@eagleoutice/flowr 2.15.10 → 2.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/README.md +23 -26
  2. package/abstract-interpretation/data-frame/arguments.js +11 -7
  3. package/cli/flowr-main-options.d.ts +15 -0
  4. package/cli/flowr-main-options.js +18 -0
  5. package/cli/flowr.d.ts +18 -0
  6. package/cli/flowr.js +13 -2
  7. package/cli/repl/commands/repl-clipboard.js +2 -1
  8. package/cli/repl/commands/repl-commands.js +2 -0
  9. package/cli/repl/commands/repl-main.d.ts +5 -0
  10. package/cli/repl/commands/repl-signature.js +2 -0
  11. package/cli/repl/core.d.ts +7 -1
  12. package/cli/repl/core.js +17 -8
  13. package/cli/repl/execute.js +2 -0
  14. package/cli/repl/server/connection.js +2 -1
  15. package/cli/repl/server/net.d.ts +10 -0
  16. package/cli/repl/server/net.js +34 -1
  17. package/cli/slicer-app.js +2 -1
  18. package/config.d.ts +12 -2
  19. package/config.js +91 -14
  20. package/control-flow/happens-before.d.ts +5 -0
  21. package/control-flow/happens-before.js +48 -34
  22. package/control-flow/useless-loop.d.ts +1 -1
  23. package/control-flow/useless-loop.js +29 -42
  24. package/dataflow/environments/built-in-props.d.ts +9 -0
  25. package/dataflow/environments/built-in-props.js +25 -19
  26. package/dataflow/environments/built-in.d.ts +2 -2
  27. package/dataflow/environments/built-in.js +41 -77
  28. package/dataflow/environments/default-builtin-config.d.ts +181 -29
  29. package/dataflow/environments/default-builtin-config.js +38 -24
  30. package/dataflow/environments/environment.d.ts +6 -4
  31. package/dataflow/environments/environment.js +54 -121
  32. package/dataflow/environments/identifier.d.ts +4 -2
  33. package/dataflow/environments/identifier.js +23 -69
  34. package/dataflow/environments/reference-to-maybe.d.ts +9 -0
  35. package/dataflow/environments/reference-to-maybe.js +23 -51
  36. package/dataflow/environments/resolve-by-name.js +37 -76
  37. package/dataflow/eval/resolve/resolve-argument.d.ts +3 -1
  38. package/dataflow/eval/resolve/resolve-argument.js +61 -64
  39. package/dataflow/eval/resolve/resolve-working-directory.d.ts +8 -2
  40. package/dataflow/eval/resolve/resolve-working-directory.js +12 -20
  41. package/dataflow/eval/resolve/resolve.d.ts +4 -0
  42. package/dataflow/eval/resolve/resolve.js +23 -14
  43. package/dataflow/extractor.js +185 -59
  44. package/dataflow/fn/class-declaration.d.ts +8 -2
  45. package/dataflow/fn/class-declaration.js +96 -97
  46. package/dataflow/fn/exceptions-of-function.js +68 -37
  47. package/dataflow/fn/frame-reflection.d.ts +12 -4
  48. package/dataflow/fn/frame-reflection.js +64 -42
  49. package/dataflow/fn/function-props.js +15 -33
  50. package/dataflow/fn/function-semantics.d.ts +11 -3
  51. package/dataflow/fn/function-semantics.js +6 -0
  52. package/dataflow/fn/higher-order-function.js +13 -17
  53. package/dataflow/fn/strict-function.d.ts +13 -0
  54. package/dataflow/fn/strict-function.js +285 -122
  55. package/dataflow/graph/call-graph.d.ts +7 -6
  56. package/dataflow/graph/call-graph.js +35 -46
  57. package/dataflow/graph/graph.d.ts +6 -1
  58. package/dataflow/graph/graph.js +57 -66
  59. package/dataflow/info.d.ts +8 -1
  60. package/dataflow/info.js +24 -30
  61. package/dataflow/internal/control-flow.d.ts +42 -4
  62. package/dataflow/internal/control-flow.js +76 -39
  63. package/dataflow/internal/linker.d.ts +15 -9
  64. package/dataflow/internal/linker.js +253 -241
  65. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +80 -14
  66. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +441 -79
  67. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +3 -1
  68. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +51 -48
  69. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -2
  70. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +119 -185
  71. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +7 -9
  72. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
  73. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +122 -147
  74. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +55 -25
  75. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +290 -252
  76. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +30 -32
  78. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +68 -67
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +72 -126
  80. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -3
  81. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +10 -10
  82. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +4 -4
  83. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -35
  84. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +8 -3
  85. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +1 -1
  86. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +12 -28
  87. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +1 -1
  88. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +40 -118
  89. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -3
  90. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +16 -24
  91. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -0
  92. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +93 -102
  93. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -3
  94. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +173 -114
  95. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -3
  96. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +22 -27
  97. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
  98. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +34 -9
  99. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +1 -1
  100. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +120 -93
  101. package/dataflow/internal/process/functions/call/common.d.ts +1 -3
  102. package/dataflow/internal/process/functions/call/common.js +36 -76
  103. package/dataflow/internal/process/functions/call/deferred.d.ts +6 -2
  104. package/dataflow/internal/process/functions/call/deferred.js +60 -58
  105. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -2
  106. package/dataflow/internal/process/functions/call/known-call-handling.js +65 -68
  107. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +3 -5
  108. package/dataflow/internal/process/functions/call/named-call-handling.js +44 -21
  109. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
  110. package/dataflow/internal/process/functions/call/quoted.js +162 -172
  111. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +17 -38
  112. package/dataflow/internal/process/functions/process-parameter.js +25 -32
  113. package/dataflow/internal/process/process-symbol.js +3 -6
  114. package/dataflow/internal/program-order.d.ts +26 -0
  115. package/dataflow/internal/program-order.js +49 -0
  116. package/documentation/doc-capabilities.js +4 -1
  117. package/documentation/wiki-interface.js +4 -0
  118. package/documentation/wiki-setup.js +23 -0
  119. package/engines.js +11 -3
  120. package/linter/linter-executor.js +19 -1
  121. package/linter/linter-rules.d.ts +17 -8
  122. package/linter/rules/absolute-path.js +63 -87
  123. package/linter/rules/file-path-validity.d.ts +4 -2
  124. package/linter/rules/file-path-validity.js +117 -80
  125. package/linter/rules/namespace-access.js +21 -33
  126. package/linter/rules/naming-convention.d.ts +1 -1
  127. package/linter/rules/naming-convention.js +60 -48
  128. package/linter/rules/network-functions.js +11 -7
  129. package/linter/rules/no-leaked-credentials.js +15 -18
  130. package/linter/rules/problematic-inputs.d.ts +2 -1
  131. package/linter/rules/problematic-inputs.js +39 -59
  132. package/linter/rules/roxygen-arguments.d.ts +9 -4
  133. package/linter/rules/roxygen-arguments.js +29 -48
  134. package/linter/rules/seeded-randomness.d.ts +7 -4
  135. package/linter/rules/seeded-randomness.js +130 -89
  136. package/linter/rules/stop-with-call-arg.d.ts +4 -2
  137. package/linter/rules/stop-with-call-arg.js +25 -22
  138. package/linter/rules/unclosed-connection.js +31 -24
  139. package/linter/rules/undefined-symbol.d.ts +4 -6
  140. package/linter/rules/undefined-symbol.js +58 -75
  141. package/linter/rules/unescaped-arguments.js +18 -44
  142. package/linter/rules/unused-definition.d.ts +6 -0
  143. package/linter/rules/unused-definition.js +105 -145
  144. package/linter/rules/unused-import.d.ts +3 -0
  145. package/linter/rules/unused-import.js +25 -43
  146. package/package.json +5 -2
  147. package/project/flowr-analyzer.js +6 -2
  148. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -2
  149. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +8 -12
  150. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +14 -5
  151. package/project/plugins/file-plugins/files/flowr-rda-file.js +35 -24
  152. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +7 -5
  153. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +34 -56
  154. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +18 -42
  155. package/project/sigdb/decompress.js +3 -1
  156. package/project/sigdb/sigdb-download.js +9 -6
  157. package/queries/base-query-format.js +1 -2
  158. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  159. package/queries/catalog/config-query/config-query-executor.js +9 -2
  160. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  161. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
  162. package/queries/catalog/dataflow-query/dataflow-query-format.js +4 -7
  163. package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -114
  164. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +5 -9
  165. package/queries/catalog/dependencies-query/function-info/library-functions.js +6 -0
  166. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  167. package/queries/catalog/dependencies-query/function-info/write-functions.js +7 -3
  168. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +4 -4
  169. package/queries/catalog/input-sources-query/simple-input-classifier.js +192 -301
  170. package/r-bridge/lang-4.x/ast/model/model.d.ts +3 -1
  171. package/r-bridge/lang-4.x/ast/model/model.js +19 -43
  172. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  173. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
  174. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -12
  175. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  176. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  177. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  178. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  179. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  180. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  181. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  182. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  183. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  184. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  185. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  186. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  187. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  188. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  189. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  190. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  191. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  192. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  193. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  194. package/r-bridge/roxygen2/roxygen-parse.js +28 -42
  195. package/r-bridge/shell-executor.js +2 -0
  196. package/r-bridge/shell.js +8 -0
  197. package/search/search-executor/search-enrichers.js +25 -37
  198. package/slicing/static/slice-call.d.ts +4 -3
  199. package/slicing/static/slice-call.js +56 -88
  200. package/slicing/static/static-slicer.js +120 -79
  201. package/slicing/static/visiting-queue.d.ts +4 -6
  202. package/slicing/static/visiting-queue.js +9 -13
  203. package/util/files.d.ts +6 -0
  204. package/util/files.js +12 -0
  205. package/util/parallel.js +2 -0
  206. package/util/proc.js +2 -1
  207. package/util/r-base-packages.d.ts +2 -0
  208. package/util/r-base-packages.js +23 -13
  209. package/util/secure-mode.d.ts +42 -0
  210. package/util/secure-mode.js +70 -0
  211. package/util/text/playground-link.d.ts +12 -3
  212. package/util/text/playground-link.js +18 -27
  213. package/util/version.js +4 -10
@@ -1,11 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Quoted = void 0;
4
+ /**
5
+ * `FunctionSemantics.call` is the entry point these members are reached through, and it is built on this file, so the backing
6
+ * functions are called directly here; going through `FunctionSemantics` would make `src/dataflow/fn/function-semantics.ts` import its own
7
+ * importers.
8
+ * @lintIgnore use-instead
9
+ */
10
+ const model_1 = require("../../../../../r-bridge/lang-4.x/ast/model/model");
4
11
  const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
5
12
  const match_args_1 = require("../../../../graph/match-args");
6
13
  const node_id_1 = require("../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
7
14
  const identifier_1 = require("../../../../environments/identifier");
8
15
  const resolve_helper_1 = require("../../../../environments/resolve-helper");
16
+ const program_order_1 = require("../../../program-order");
9
17
  const r_symbol_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
10
18
  const built_in_proc_name_1 = require("../../../../environments/built-in-proc-name");
11
19
  const edge_1 = require("../../../../graph/edge");
@@ -16,19 +24,16 @@ const linker_1 = require("../../../linker");
16
24
  const nse_1 = require("./nse");
17
25
  const deferred_1 = require("./deferred");
18
26
  const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
19
- const retriever_1 = require("../../../../../r-bridge/retriever");
20
27
  const happens_before_1 = require("../../../../../control-flow/happens-before");
21
28
  const query_fn_props_1 = require("../../../../environments/query-fn-props");
22
29
  const built_in_props_1 = require("../../../../environments/built-in-props");
23
- /** Calls capturing a language object. */
24
- const CapturingProcessors = [built_in_proc_name_1.BuiltInProcName.Quote];
30
+ const frame_reflection_1 = require("../../../../fn/frame-reflection");
31
+ const defaultmap_1 = require("../../../../../util/collections/defaultmap");
25
32
  /** Calls whose result is a language object although they read their arguments like any other call. */
26
33
  const CapturingCalls = new Set(['expression']);
27
34
  /** Calls capturing an expression as a promise, forced at some later read of the variable they bind. */
28
35
  const DelayingCalls = new Set(['delayedAssign']);
29
36
  const DelayedAssignFormals = ['x', 'value', 'eval.env', 'assign.env'];
30
- /** Calls evaluating one. */
31
- const EvaluatingProcessors = [built_in_proc_name_1.BuiltInProcName.Eval];
32
37
  /** Calls evaluating their own unevaluated argument, in a frame of their own. */
33
38
  const EvaluatingElsewhereCalls = new Set(['evalq']);
34
39
  /**
@@ -36,9 +41,6 @@ const EvaluatingElsewhereCalls = new Set(['evalq']);
36
41
  * counts because a call handing back one of them, a container included, must not hide the capture inside.
37
42
  */
38
43
  const ValueFlow = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall | edge_1.EdgeType.Returns | edge_1.EdgeType.Argument;
39
- function hasOrigin(vertex, of) {
40
- return Array.isArray(vertex.origin) && vertex.origin.some(o => of.includes(o));
41
- }
42
44
  /**
43
45
  * A language object reads nothing where it is written and everything where it reaches `eval`, with the bindings
44
46
  * in effect there. Working on the finished graph makes assignments, branches, loops, and calls one traversal.
@@ -55,13 +57,8 @@ exports.Quoted = {
55
57
  if (!vertex_1.DfgVertex.isFunctionCall(vertex)) {
56
58
  return [];
57
59
  }
58
- else if (hasOrigin(vertex, CapturingProcessors)) {
59
- return capturedArgumentsOf(graph, id, true);
60
- }
61
- else if (CapturingCalls.has(identifier_1.Identifier.getName(vertex.name))) {
62
- return capturedArgumentsOf(graph, id, false);
63
- }
64
- return [];
60
+ const marked = vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Quote);
61
+ return marked || CapturingCalls.has(identifier_1.Identifier.getName(vertex.name)) ? capturedArgumentsOf(graph, id, marked) : [];
65
62
  },
66
63
  /** Every expression the value at `id` may hold, with the call that captured it. Several is normal. */
67
64
  sourcesOf(graph, id) {
@@ -75,6 +72,18 @@ exports.Quoted = {
75
72
  } });
76
73
  return found;
77
74
  },
75
+ /** What `id` within captured code needs to run at all: the capturing call and every call evaluating it (`eval`, `body(f) <- quote(...)`). */
76
+ evaluationDependencies(graph, id) {
77
+ const idMap = graph.idMap;
78
+ for (let parent = idMap?.get(id)?.info.parent; parent !== undefined; parent = idMap?.get(parent)?.info.parent) {
79
+ const captured = exports.Quoted.capturedBy(graph, parent);
80
+ if (captured.length > 0) {
81
+ const evaluating = captured.flatMap(expr => (0, frame_reflection_1.edgeSources)(graph, expr, edge_1.EdgeType.Returns | edge_1.EdgeType.Reads | edge_1.EdgeType.Calls));
82
+ return [parent, ...evaluating.filter(from => from !== parent)];
83
+ }
84
+ }
85
+ return [];
86
+ },
78
87
  /** Links every name in `expr` against `environment` and hands back what stays unresolved. */
79
88
  evaluateIn: linker_1.linkExpressionIn,
80
89
  /**
@@ -85,85 +94,84 @@ exports.Quoted = {
85
94
  finalize(graph, environment, idMap, controlFlow) {
86
95
  /* lets the forces of a parameter be reused without counting its reads again while nothing touched them (see `forcesOf`) */
87
96
  graph.trackIncomingReads(true);
88
- let names = undefined;
89
- let bindings = undefined;
97
+ let names;
98
+ const namesOnce = () => names ??= deferred_1.Deferred.indexOf(graph, idMap);
99
+ let bindings;
90
100
  let cfg = null;
91
101
  const cfgOnce = () => (cfg === null ? (cfg = controlFlow()) : cfg);
92
102
  const masking = [];
93
- let sideEffects = undefined;
94
- const sideEffectsOnce = () => sideEffects ??= callsWithSideEffects(graph);
95
- let installers = undefined;
103
+ const evaluated = [];
104
+ let sideEffects;
105
+ let installers;
106
+ const installersOnce = () => installers ??= languageInstallersOf(graph, environment);
96
107
  /* every call of a function forces its parameters at the same sites, so this pass works them out once */
97
108
  const forcing = new Map();
98
109
  /* evaluations within one function and forces of one parameter share their sites, and with them what reaches them */
99
- const reaches = new Map();
110
+ const reaches = new defaultmap_1.DefaultMap(() => ({}));
111
+ const reachOf = (sites) => reaches.get(sites.join('\0'));
100
112
  let enclosing;
101
- const reachOf = (sites) => {
102
- const key = sites.join('\0');
103
- let reach = reaches.get(key);
104
- if (reach === undefined) {
105
- reach = {};
106
- reaches.set(key, reach);
107
- }
108
- return reach;
109
- };
110
- const installersOnce = () => installers ??= languageInstallersOf(graph, environment);
111
113
  for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
112
114
  const masks = nse_1.Nse.dropResolvedMask(graph, id, vertex.name);
113
115
  if (masks !== undefined) {
114
116
  masking.push(masks);
115
117
  }
116
118
  for (const installed of installedLanguageOf(graph, id, installersOnce)) {
117
- names ??= deferred_1.Deferred.indexOf(graph, idMap);
118
- deferred_1.Deferred.link(graph, installed, names, idMap);
119
+ deferred_1.Deferred.link(graph, installed, namesOnce(), idMap);
119
120
  graph.addEdge(id, installed, edge_1.EdgeType.Returns);
120
121
  }
121
122
  if (DelayingCalls.has(identifier_1.Identifier.getName(vertex.name))) {
122
123
  const promise = capturedArgumentsOf(graph, id, true)[0];
123
- const binding = promise === undefined ? undefined : boundBy(graph, id);
124
- if (promise !== undefined) {
125
- names ??= deferred_1.Deferred.indexOf(graph, idMap);
126
- const flow = binding === undefined ? undefined : cfgOnce();
127
- const sites = flow === undefined || binding === undefined ? undefined : deferred_1.Deferred.forcedAt(graph, binding, flow);
128
- /* the promise runs in `eval.env`, so whatever that environment holds may be what it reads */
129
- const call = idMap.get(id);
130
- const evalEnv = r_function_call_1.RFunctionCall.is(call) ? match_args_1.MatchArgs.toNames(call.arguments, DelayedAssignFormals).get('eval.env')?.value : undefined;
131
- const tracked = trackedEnvOf(vertex, evalEnv);
132
- /* a tracked `eval.env` that binds every name the promise reads leaves no other binding in play, its writes still reach later reads */
133
- const bound = tracked !== undefined && exports.Quoted.evaluateIn(graph, promise, tracked, idMap).length === 0;
134
- deferred_1.Deferred.link(graph, promise, bound ? { definitions: new Map(), uses: names.uses } : names, idMap, flow !== undefined && sites?.length && binding !== undefined ? { cfg: flow, sites, binding } : undefined);
135
- if (binding !== undefined) {
136
- linkForcesToPromise(graph, binding, promise);
137
- }
138
- if (evalEnv !== undefined) {
139
- graph.addEdge(promise, evalEnv.info.id, edge_1.EdgeType.Reads);
140
- }
124
+ if (promise === undefined) {
125
+ continue;
126
+ }
127
+ const promised = namesOnce();
128
+ const binding = boundBy(graph, id);
129
+ const flow = binding === undefined ? undefined : cfgOnce();
130
+ const sites = flow === undefined || binding === undefined ? undefined : deferred_1.Deferred.forcedAt(graph, binding, flow, true);
131
+ /* the promise runs in `eval.env`, so whatever that environment holds may be what it reads */
132
+ const call = idMap.get(id);
133
+ const evalEnv = r_function_call_1.RFunctionCall.is(call) ? match_args_1.MatchArgs.toNames(call.arguments, DelayedAssignFormals).get('eval.env')?.value : undefined;
134
+ const tracked = trackedEnvOf(vertex, evalEnv);
135
+ /* a tracked `eval.env` that binds every name the promise reads leaves no other binding in play, its writes still reach later reads */
136
+ const bound = tracked !== undefined && exports.Quoted.evaluateIn(graph, promise, tracked, idMap).length === 0;
137
+ const candidates = bound ? { definitions: new Map(), uses: promised.uses } : promised;
138
+ const forces = flow !== undefined && sites?.length && binding !== undefined ? { cfg: flow, sites, binding } : undefined;
139
+ deferred_1.Deferred.link(graph, promise, candidates, idMap, forces);
140
+ if (binding !== undefined) {
141
+ linkForcesToPromise(graph, binding, promise);
142
+ }
143
+ if (evalEnv !== undefined) {
144
+ graph.addEdge(promise, evalEnv.info.id, edge_1.EdgeType.Reads);
141
145
  }
142
146
  }
143
- else if (hasOrigin(vertex, EvaluatingProcessors) || EvaluatingElsewhereCalls.has(identifier_1.Identifier.getName(vertex.name))) {
144
- names ??= deferred_1.Deferred.indexOf(graph, idMap);
145
- bindings ??= bindingsOf(graph, idMap);
146
- resolveEvaluation(graph, vertex, idMap, names, bindings, cfgOnce(), reachOf, enclosing ??= enclosingDefinitions(graph));
147
+ else if (vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Eval) || EvaluatingElsewhereCalls.has(identifier_1.Identifier.getName(vertex.name))) {
148
+ bindings ??= (0, deferred_1.verticesByName)(graph, vertex_1.VertexType.VariableDefinition, idMap);
149
+ resolveEvaluation(graph, vertex, idMap, namesOnce(), bindings, cfgOnce(), reachOf, enclosing ??= enclosingDefinitions(graph), evaluated);
147
150
  }
148
151
  else {
149
- for (const escaped of escapingArguments(graph, id)) {
150
- names ??= deferred_1.Deferred.indexOf(graph, idMap);
151
- deferred_1.Deferred.link(graph, escaped, names, idMap);
152
+ for (const [escaped, closure] of escapingArguments(graph, id)) {
153
+ deferred_1.Deferred.link(graph, escaped, namesOnce(), idMap);
154
+ readAtForcingCalls(graph, id, escaped, closure, idMap);
152
155
  }
153
- if (sideEffectsOnce().has(id)) {
154
- const flow = cfgOnce();
155
- if (flow !== undefined) {
156
- for (const [argument, parameter] of forcedParameters(graph, id)) {
157
- names ??= deferred_1.Deferred.indexOf(graph, idMap);
158
- const forces = forcesOf(graph, parameter, flow, forcing, reachOf);
159
- if (forces !== undefined) {
160
- deferred_1.Deferred.link(graph, argument, names, idMap, forces);
161
- }
156
+ sideEffects ??= callsWithSideEffects(graph);
157
+ const flow = sideEffects.has(id) ? cfgOnce() : undefined;
158
+ if (flow === undefined) {
159
+ continue;
160
+ }
161
+ for (const parameter of df_helper_1.Dataflow.calleesOf(graph, id).flatMap(df_helper_1.Dataflow.parametersOf)) {
162
+ for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
163
+ const index = namesOnce();
164
+ const forces = forcesOf(graph, parameter, flow, forcing, reachOf);
165
+ if (forces !== undefined) {
166
+ deferred_1.Deferred.link(graph, argument, index, idMap, forces);
162
167
  }
163
168
  }
164
169
  }
165
170
  }
166
171
  }
172
+ for (const at of evaluated) {
173
+ nse_1.Nse.unmark(graph, at);
174
+ }
167
175
  graph.trackIncomingReads(false);
168
176
  /* only once every mark has settled: the read a column gets makes it look bound from here on */
169
177
  nse_1.Nse.linkMasksToData(graph, masking);
@@ -177,12 +185,7 @@ function forcesOf(graph, parameter, cfg, forcing, reachOf) {
177
185
  return known.forces;
178
186
  }
179
187
  /* counting is only needed once something touched the reads, and the same count still means the same forces */
180
- let reads = 0;
181
- for (const [, edge] of graph.edgesTo(parameter)) {
182
- if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads)) {
183
- reads++;
184
- }
185
- }
188
+ const reads = (0, frame_reflection_1.edgeSources)(graph, parameter, edge_1.EdgeType.Reads).length;
186
189
  if (known?.reads === reads) {
187
190
  forcing.set(parameter, { ...known, version });
188
191
  return known.forces;
@@ -194,17 +197,12 @@ function forcesOf(graph, parameter, cfg, forcing, reachOf) {
194
197
  }
195
198
  /** The name a delaying call binds, which is the definition its reads have to go through. */
196
199
  function boundBy(graph, id) {
197
- for (const [target, edge] of graph.edgesTo(id)) {
198
- if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy) && vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target))) {
199
- return target;
200
- }
201
- }
202
- return undefined;
200
+ return (0, frame_reflection_1.edgeSources)(graph, id, edge_1.EdgeType.DefinedBy).find(target => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)));
203
201
  }
204
202
  /** Every read of the delayed name takes the promised expression's value, so all of them get the link, not just whichever forces it first. */
205
203
  function linkForcesToPromise(graph, binding, promise) {
206
- for (const [reader, edge] of graph.edgesTo(binding)) {
207
- if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) && reader !== promise) {
204
+ for (const reader of (0, frame_reflection_1.edgeSources)(graph, binding, edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall)) {
205
+ if (reader !== promise) {
208
206
  graph.addEdge(reader, promise, edge_1.EdgeType.Reads);
209
207
  }
210
208
  }
@@ -216,16 +214,13 @@ function trackedEnvOf(call, evalEnv) {
216
214
  return env?.current.globalEnv || env?.current.builtInEnv ? undefined : env;
217
215
  }
218
216
  function* installedLanguageOf(graph, id, installers) {
219
- for (const [definition, edge] of graph.edgesFrom(id)) {
220
- if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) || !vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(definition))) {
217
+ for (const definition of (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.Reads)) {
218
+ if (!vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(definition))) {
221
219
  continue;
222
220
  }
223
221
  let installs = false;
224
222
  const captured = [];
225
- for (const [by, e] of graph.edgesFrom(definition)) {
226
- if (!edge_1.DfEdge.includesType(e, edge_1.EdgeType.DefinedBy)) {
227
- continue;
228
- }
223
+ for (const by of (0, frame_reflection_1.edgeTargets)(graph, definition, edge_1.EdgeType.DefinedBy)) {
229
224
  const captures = capturedArgumentsOf(graph, by, true);
230
225
  if (captures.length > 0) {
231
226
  captured.push(...captures);
@@ -254,51 +249,31 @@ function languageInstallersOf(graph, environment) {
254
249
  * and still hands back the language object they form, all of them.
255
250
  */
256
251
  function capturedArgumentsOf(graph, id, marked) {
257
- const captured = [];
258
- for (const [target, edge] of graph.edgesFrom(id)) {
259
- if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Argument) && (!marked || edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation))) {
260
- captured.push(target);
261
- }
262
- }
263
- return captured;
264
- }
265
- /** Every name a definition binds, the string-named ones an `assign` creates included. */
266
- function bindingsOf(graph, idMap) {
267
- const bindings = new Map();
268
- for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
269
- const name = node_id_1.NodeId.recoverName(id, idMap);
270
- if (name === undefined) {
271
- continue;
272
- }
273
- const key = identifier_1.Identifier.getName((0, retriever_1.removeRQuotes)(name));
274
- const known = bindings.get(key);
275
- if (known !== undefined) {
276
- known.push(id);
277
- }
278
- else {
279
- bindings.set(key, [id]);
280
- }
281
- }
282
- return bindings;
252
+ return [...graph.edgesFrom(id)]
253
+ .filter(([, edge]) => edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Argument) && (!marked || edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation)))
254
+ .map(([target]) => target);
283
255
  }
284
256
  /**
285
257
  * Where the evaluation happens: the call itself, or, for one inside a closure, every call of that closure (those
286
258
  * are the points whose bindings the evaluation sees). `undefined` if a nesting closure is never seen called.
287
259
  */
288
260
  function evaluationSites(graph, id, enclosing) {
289
- const sites = [];
290
- const definitions = enclosing.get(id) ?? [];
291
- for (const definition of definitions) {
292
- for (const [caller, edge] of graph.edgesTo(definition)) {
293
- if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls)) {
294
- sites.push(caller);
261
+ if ((enclosing.get(id) ?? []).length === 0) {
262
+ return [id];
263
+ }
264
+ const sites = new Set();
265
+ const todo = [id];
266
+ for (let at = todo.pop(); at !== undefined; at = todo.pop()) {
267
+ for (const definition of enclosing.get(at) ?? []) {
268
+ for (const caller of (0, frame_reflection_1.edgeSources)(graph, definition, edge_1.EdgeType.Calls)) {
269
+ if (!sites.has(caller)) {
270
+ sites.add(caller);
271
+ todo.push(caller);
272
+ }
295
273
  }
296
274
  }
297
275
  }
298
- if (definitions.length === 0) {
299
- return [id];
300
- }
301
- return sites.length > 0 ? sites : undefined;
276
+ return sites.size > 0 ? [...sites] : undefined;
302
277
  }
303
278
  /** the function definitions each vertex sits in, built once per pass instead of searching them for every evaluation */
304
279
  function enclosingDefinitions(graph) {
@@ -341,40 +316,25 @@ function linkAgainstAnyBinding(graph, open, bindings, sites, cfg, reach) {
341
316
  }
342
317
  }
343
318
  function callsWithSideEffects(graph) {
344
- const calls = new Set();
345
- for (const [id] of graph.vertices(true)) {
346
- for (const [target, edge] of graph.edgesFrom(id)) {
347
- if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.SideEffectOnCall)) {
348
- calls.add(target);
349
- }
350
- }
351
- }
352
- return calls;
353
- }
354
- function* forcedParameters(graph, id) {
355
- for (const callee of df_helper_1.Dataflow.calleesOf(graph, id)) {
356
- for (const parameter of df_helper_1.Dataflow.parametersOf(callee)) {
357
- for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
358
- yield [argument, parameter];
359
- }
360
- }
361
- }
319
+ return new Set(graph.vertices(true).flatMap(([from]) => (0, frame_reflection_1.edgeTargets)(graph, from, edge_1.EdgeType.SideEffectOnCall)));
362
320
  }
363
321
  /** Links a capture handed to an evaluating call, in that call's scope. */
364
- function resolveEvaluation(graph, call, idMap, names, bindings, cfg, reachOf, enclosing) {
322
+ function resolveEvaluation(graph, call, idMap, names, bindings, cfg, reachOf, enclosing, evaluated) {
365
323
  const id = call.id;
366
324
  const own = EvaluatingElsewhereCalls.has(identifier_1.Identifier.getName(call.name));
367
325
  const sources = own ? capturedArgumentsOf(graph, id, true).map(expr => ({ expr, at: id })) : sourcesHandedTo(graph, call, idMap);
368
326
  const environment = call.environment;
369
- /* a frame of its own says nothing about the bindings here, so every one of them stays possible */
370
- const elsewhere = own || environment === undefined || evaluatesElsewhere(idMap.get(id));
327
+ const node = idMap.get(id);
328
+ /* a frame of its own (`eval(expr, envir)` runs in the one it is given) says nothing about the bindings here,
329
+ so every one of them stays possible */
330
+ const elsewhere = own || environment === undefined || (r_function_call_1.RFunctionCall.isNamed(node) && node.arguments.length > 1);
371
331
  const sites = sources.length > 0 ? evaluationSites(graph, id, enclosing) : undefined;
372
332
  const reach = sites === undefined ? {} : reachOf(sites);
373
333
  for (const { expr, at } of sources) {
374
334
  if (elsewhere) {
375
335
  const forces = cfg === undefined || sites === undefined ? undefined : { cfg, sites, binding: id, reach };
376
336
  deferred_1.Deferred.link(graph, expr, { definitions: bindings, uses: names.uses }, idMap, forces);
377
- deferred_1.Deferred.publish(graph, expr, names, idMap, id, undefined);
337
+ deferred_1.Deferred.publish(graph, expr, names, idMap, id, sites ?? []);
378
338
  }
379
339
  else {
380
340
  const open = (0, linker_1.linkExpressionIn)(graph, expr, environment, idMap);
@@ -382,24 +342,24 @@ function resolveEvaluation(graph, call, idMap, names, bindings, cfg, reachOf, en
382
342
  const enclosing = open.length > 0 ? graph.getVertex(at)?.environment : undefined;
383
343
  const unbound = enclosing === undefined ? open : (0, linker_1.linkInputs)(open, enclosing, [], graph, false);
384
344
  linkAgainstAnyBinding(graph, unbound, bindings, sites, cfg, reach);
385
- deferred_1.Deferred.publish(graph, expr, names, idMap, id, cfg);
345
+ deferred_1.Deferred.publish(graph, expr, names, idMap, id, sites ?? [], cfg);
386
346
  }
387
347
  graph.addEdge(id, expr, edge_1.EdgeType.Returns);
388
348
  /* the captured code only runs because this call evaluates it */
389
349
  graph.addEdge(expr, id, edge_1.EdgeType.Reads);
390
350
  if (!elsewhere) {
391
351
  /* the capture said "not evaluated here", and being handed to `eval` settles that it is */
392
- nse_1.Nse.unmark(graph, at);
352
+ evaluated.push(at);
393
353
  }
394
354
  }
395
355
  if (sources.length > 0 && !elsewhere) {
396
356
  forgetUnknownSideEffect(graph, id);
397
357
  }
398
358
  if (sources.length > 0 && environment !== undefined && !sources.some(({ expr }) => mayConfigure(graph, expr, environment))) {
399
- forgetStateWrites(graph, id);
359
+ forgetStateWrites(graph, id, new Set(sources.filter(({ at }) => model_1.RNode.findEnclosing(at, idMap, n => n.info.id === id) === undefined).map(({ expr }) => expr)));
400
360
  }
401
361
  }
402
- /** Whether evaluating `expr` may change the options or graphics state: a call states {@link CallProp.Configures} or is opaque. */
362
+ /** Whether evaluating `expr` may change the options, graphics, or RNG state: a call states {@link CallProp.Configures} or {@link SemanticCallTag.Random}, or is opaque. */
403
363
  function mayConfigure(graph, expr, environment) {
404
364
  const seen = new Set();
405
365
  const todo = [expr];
@@ -412,7 +372,7 @@ function mayConfigure(graph, expr, environment) {
412
372
  const vertex = graph.getVertex(id);
413
373
  if (vertex_1.DfgVertex.isFunctionCall(vertex)) {
414
374
  const builtIn = Array.isArray(vertex.origin) && vertex.origin.every(o => String(o).startsWith('builtin:') && o !== built_in_proc_name_1.BuiltInProcName.Function && o !== built_in_proc_name_1.BuiltInProcName.Eval);
415
- if (!builtIn || built_in_props_1.CallProps.hasAny((0, query_fn_props_1.callFnProps)(id, { graph, environment }), built_in_props_1.CallProp.Configures)) {
375
+ if (!builtIn || built_in_props_1.CallProps.hasAny((0, query_fn_props_1.callFnProps)(id, { graph, environment }), [built_in_props_1.CallProp.Configures, built_in_props_1.SemanticCallTag.Random])) {
416
376
  return true;
417
377
  }
418
378
  }
@@ -424,10 +384,13 @@ function mayConfigure(graph, expr, environment) {
424
384
  }
425
385
  return false;
426
386
  }
427
- /** An evaluation is assumed to write the options and graphics state until we know what it evaluates (see `evaluatesCapturedCode`); a captured call then no longer needs the evaluation either, `eval(quote(x <- 1))` slices to `x <- 1`. */
428
- function forgetStateWrites(graph, id) {
387
+ /**
388
+ * An evaluation is assumed to write the options and graphics state until we know what it evaluates (see `evaluatesCapturedCode`);
389
+ * a captured call then no longer needs the evaluation either, `eval(quote(x <- 1))` slices to `x <- 1`.
390
+ */
391
+ function forgetStateWrites(graph, id, evaluatedElsewhere) {
429
392
  for (const [from, edge] of graph.edgesTo(id)) {
430
- if (edge_1.DfEdge.isOnlyType(edge, edge_1.EdgeType.Reads) && vertex_1.DfgVertex.isFunctionCall(graph.getVertex(from))) {
393
+ if (edge_1.DfEdge.isOnlyType(edge, edge_1.EdgeType.Reads) && vertex_1.DfgVertex.isFunctionCall(graph.getVertex(from)) && !evaluatedElsewhere.has(from)) {
431
394
  graph.removeEdgeType(from, id, edge_1.EdgeType.Reads);
432
395
  }
433
396
  }
@@ -435,8 +398,10 @@ function forgetStateWrites(graph, id) {
435
398
  /** The captures the first argument of an evaluating call may carry. */
436
399
  function sourcesHandedTo(graph, call, idMap) {
437
400
  const argument = call.args.find(a => !graph_1.FunctionArgument.isEmpty(a));
438
- const reference = argument === undefined ? undefined : unwrapArgument(graph_1.FunctionArgument.getReference(argument), idMap);
439
- return reference === undefined ? [] : exports.Quoted.sourcesOf(graph, reference);
401
+ const reference = argument === undefined ? undefined : graph_1.FunctionArgument.getReference(argument);
402
+ const node = reference === undefined ? undefined : idMap.get(reference);
403
+ const value = r_argument_1.RArgument.is(node) ? node.value?.info.id : reference;
404
+ return value === undefined ? [] : exports.Quoted.sourcesOf(graph, value);
440
405
  }
441
406
  /**
442
407
  * The arguments of `id` whose promise outlives the call: the callee hands back a closure and never reads the
@@ -451,29 +416,54 @@ function* escapingArguments(graph, id) {
451
416
  continue;
452
417
  }
453
418
  for (const parameter of df_helper_1.Dataflow.parametersOf(callee)) {
454
- let escapes = true;
455
- for (const [reader, edge] of graph.edgesTo(parameter)) {
456
- if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) && !closure.subflow.graph.has(reader)) {
457
- escapes = false;
458
- break;
459
- }
460
- }
461
- if (!escapes) {
419
+ if ((0, frame_reflection_1.edgeSources)(graph, parameter, edge_1.EdgeType.Reads).some(reader => !closure.subflow.graph.has(reader))) {
462
420
  continue;
463
421
  }
464
- yield* df_helper_1.Dataflow.argumentsBoundTo(graph, parameter);
422
+ for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
423
+ yield [argument, closure.id];
424
+ }
465
425
  }
466
426
  }
467
427
  }
468
428
  }
469
- /** The value an argument reference points at. */
470
- function unwrapArgument(reference, idMap) {
471
- const node = reference === undefined ? undefined : idMap.get(reference);
472
- return r_argument_1.RArgument.is(node) ? node.value?.info.id : reference;
473
- }
474
- /** `eval(expr, envir)` runs in the frame it is given, so the bindings here say nothing. */
475
- function evaluatesElsewhere(call) {
476
- return r_function_call_1.RFunctionCall.isNamed(call) && call.arguments.length > 1;
429
+ /** A promise only `closure` forces sees what is bound where it is called, so if each of its calls runs once, a definition none of them sees does not reach it. */
430
+ function readAtForcingCalls(graph, factoryCall, argument, closure, idMap) {
431
+ const environments = [];
432
+ for (const [binding, edge] of graph.edgesTo(factoryCall)) {
433
+ const via = graph.getVertex(binding);
434
+ if (!edge_1.DfEdge.includesType(edge, ~edge_1.ControlFlowEdgeTypes) || vertex_1.DfgVertex.hasOrigin(via, built_in_proc_name_1.BuiltInProcName.Assignment)) {
435
+ continue;
436
+ }
437
+ else if (!vertex_1.DfgVertex.isVariableDefinition(via) || !edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy)) {
438
+ return;
439
+ }
440
+ for (const reader of (0, frame_reflection_1.edgeSources)(graph, binding, edge_1.EdgeType.Reads)) {
441
+ const call = graph.getVertex(reader);
442
+ if (!vertex_1.DfgVertex.isFunctionCall(call) || !(0, frame_reflection_1.hasEdgeOfType)(graph, reader, closure, edge_1.EdgeType.Calls)
443
+ || call.environment === undefined || program_order_1.ProgramOrder.runsOnceAt(reader, graph) === undefined) {
444
+ return;
445
+ }
446
+ environments.push(call.environment);
447
+ }
448
+ }
449
+ if (environments.length === 0 || program_order_1.ProgramOrder.runsOnceAt(factoryCall, graph) === undefined) {
450
+ return;
451
+ }
452
+ model_1.RNode.visitAst(idMap.get(argument), node => {
453
+ /* what a function within the argument reads is read when that function runs, not when the promise is forced */
454
+ if (graph.hasVertex(node.info.id) && !graph.isRoot(node.info.id)) {
455
+ return true;
456
+ }
457
+ if (r_symbol_1.RSymbol.is(node)) {
458
+ const visible = new Set(environments.flatMap(env => resolve_helper_1.Resolve.byName(node.content, env) ?? []).map(d => d.nodeId));
459
+ for (const target of (0, frame_reflection_1.edgeTargets)(graph, node.info.id, edge_1.EdgeType.Reads)) {
460
+ if (vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)) && !visible.has(target)) {
461
+ graph.removeEdgeType(node.info.id, target, edge_1.EdgeType.Reads);
462
+ }
463
+ }
464
+ }
465
+ return false;
466
+ });
477
467
  }
478
468
  /** Drops the marker the call carries while we cannot say what it evaluates. */
479
469
  function forgetUnknownSideEffect(graph, id) {