@eagleoutice/flowr 2.13.16 → 2.14.0

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 (196) hide show
  1. package/README.md +31 -31
  2. package/abstract-interpretation/absint-visitor.js +1 -1
  3. package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
  4. package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
  5. package/abstract-interpretation/data-frame/mappers/function-mapper.js +18 -17
  6. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +6 -6
  7. package/abstract-interpretation/data-frame/resolve-args.d.ts +9 -4
  8. package/abstract-interpretation/data-frame/resolve-args.js +10 -5
  9. package/benchmark/calibration.d.ts +12 -5
  10. package/benchmark/calibration.js +42 -14
  11. package/benchmark/slicer.d.ts +1 -1
  12. package/benchmark/slicer.js +5 -4
  13. package/benchmark/stats/size-of.js +1 -1
  14. package/benchmark/summarizer/first-phase/process.d.ts +2 -0
  15. package/benchmark/summarizer/first-phase/process.js +2 -0
  16. package/cli/common/options.d.ts +0 -31
  17. package/cli/common/options.js +1 -8
  18. package/cli/common/scripts-info.d.ts +0 -38
  19. package/cli/common/scripts-info.js +0 -8
  20. package/cli/repl/core.js +1 -1
  21. package/cli/repl/parser/slice-query-parser.js +1 -1
  22. package/cli/repl/print-version.js +2 -2
  23. package/config.d.ts +16 -0
  24. package/config.js +79 -0
  25. package/control-flow/extract-cfg.js +1 -1
  26. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  27. package/control-flow/semantic-cfg-guided-visitor.js +1 -1
  28. package/control-flow/useless-loop.js +1 -1
  29. package/core/print/slice-diff-ansi.js +1 -1
  30. package/core/steps/pipeline/create-pipeline.js +1 -1
  31. package/dataflow/cluster.js +2 -2
  32. package/dataflow/environments/built-in-props.d.ts +8 -1
  33. package/dataflow/environments/built-in-props.js +18 -0
  34. package/dataflow/environments/built-in.d.ts +7 -1
  35. package/dataflow/environments/built-in.js +42 -3
  36. package/dataflow/environments/default-builtin-config.d.ts +442 -10
  37. package/dataflow/environments/default-builtin-config.js +188 -18
  38. package/dataflow/environments/environment.d.ts +1 -1
  39. package/dataflow/environments/identifier.d.ts +7 -2
  40. package/dataflow/environments/identifier.js +6 -1
  41. package/dataflow/environments/query-fn-props.js +2 -2
  42. package/dataflow/environments/reference-to-maybe.js +5 -5
  43. package/dataflow/environments/resolve-by-name.d.ts +3 -0
  44. package/dataflow/environments/resolve-by-name.js +30 -5
  45. package/dataflow/environments/resolve-helper.d.ts +6 -0
  46. package/dataflow/environments/resolve-helper.js +6 -0
  47. package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
  48. package/dataflow/eval/resolve/alias-tracking.js +21 -14
  49. package/dataflow/eval/resolve/node-value.d.ts +6 -0
  50. package/dataflow/eval/resolve/node-value.js +15 -9
  51. package/dataflow/eval/resolve/resolve-argument.js +2 -2
  52. package/dataflow/eval/resolve/resolve-numbers.js +2 -2
  53. package/dataflow/eval/resolve/resolve-operators.js +4 -3
  54. package/dataflow/eval/resolve/resolve-strings.js +3 -3
  55. package/dataflow/eval/resolve/resolve-working-directory.js +2 -1
  56. package/dataflow/eval/resolve/resolve.d.ts +5 -5
  57. package/dataflow/eval/resolve/resolve.js +10 -11
  58. package/dataflow/eval/values/general.d.ts +4 -1
  59. package/dataflow/eval/values/general.js +1 -1
  60. package/dataflow/extractor.js +2 -1
  61. package/dataflow/fn/exceptions-of-function.js +5 -4
  62. package/dataflow/fn/higher-order-function.js +5 -4
  63. package/dataflow/graph/call-graph.js +14 -14
  64. package/dataflow/graph/df-helper.d.ts +15 -0
  65. package/dataflow/graph/df-helper.js +10 -4
  66. package/dataflow/graph/diff-dataflow-graph.js +6 -6
  67. package/dataflow/graph/edge.d.ts +27 -0
  68. package/dataflow/graph/edge.js +33 -0
  69. package/dataflow/graph/graph-helper.d.ts +3 -4
  70. package/dataflow/graph/graph-helper.js +4 -5
  71. package/dataflow/graph/graph.d.ts +11 -1
  72. package/dataflow/graph/graph.js +16 -5
  73. package/dataflow/graph/vertex.d.ts +42 -6
  74. package/dataflow/graph/vertex.js +42 -6
  75. package/dataflow/internal/linker.d.ts +1 -0
  76. package/dataflow/internal/linker.js +11 -9
  77. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  78. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  79. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
  80. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
  81. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
  82. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
  83. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
  85. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
  86. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  87. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
  88. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  89. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
  90. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
  91. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
  92. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
  93. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
  94. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  95. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
  96. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
  97. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -12
  98. package/dataflow/internal/process/functions/call/common.d.ts +9 -1
  99. package/dataflow/internal/process/functions/call/common.js +17 -6
  100. package/dataflow/internal/process/functions/call/deferred.js +2 -1
  101. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
  102. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
  103. package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
  104. package/dataflow/internal/process/functions/call/nse.d.ts +33 -5
  105. package/dataflow/internal/process/functions/call/nse.js +113 -6
  106. package/dataflow/internal/process/functions/call/quoted.d.ts +5 -0
  107. package/dataflow/internal/process/functions/call/quoted.js +21 -9
  108. package/dataflow/origin/dfg-get-origin.d.ts +1 -0
  109. package/dataflow/origin/dfg-get-origin.js +9 -6
  110. package/documentation/data/faq/faqs.js +88 -88
  111. package/documentation/data/faq/recommended-configs.js +1 -1
  112. package/documentation/data/faq/wiki-faq-store.js +1 -1
  113. package/documentation/doc-capabilities.js +1 -1
  114. package/documentation/doc-readme.js +1 -1
  115. package/documentation/doc-util/doc-auto-gen.js +6 -2
  116. package/documentation/doc-util/doc-functions.js +1 -1
  117. package/documentation/wiki-cfg.js +2 -2
  118. package/documentation/wiki-create-linting-rules.js +45 -45
  119. package/documentation/wiki-dataflow-graph.js +17 -18
  120. package/documentation/wiki-linting-and-testing.js +93 -5
  121. package/documentation/wiki-mk/doc-maker.js +1 -1
  122. package/documentation/wiki-overview.js +12 -1
  123. package/documentation/wiki-signature-database.js +3 -0
  124. package/linter/rules/file-path-validity.js +1 -1
  125. package/linter/rules/function-finder-util.js +1 -1
  126. package/linter/rules/naming-convention.js +1 -1
  127. package/linter/rules/no-leaked-credentials.js +2 -1
  128. package/linter/rules/stop-with-call-arg.js +4 -4
  129. package/linter/rules/undefined-symbol-util.d.ts +1 -1
  130. package/linter/rules/undefined-symbol-util.js +5 -4
  131. package/linter/rules/undefined-symbol.js +3 -3
  132. package/linter/rules/unused-definition.js +2 -1
  133. package/package.json +35 -45
  134. package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
  135. package/project/context/flowr-analyzer-environment-context.js +25 -0
  136. package/project/dependency-version-space.js +1 -2
  137. package/project/flowr-analyzer.js +1 -1
  138. package/project/plugins/file-plugins/files/flowr-rda-file.js +3 -3
  139. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
  140. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +3 -1
  141. package/project/sigdb/build.js +16 -16
  142. package/project/sigdb/codec.d.ts +1 -1
  143. package/project/sigdb/codec.js +13 -13
  144. package/project/sigdb/decompress.d.ts +1 -1
  145. package/project/sigdb/decompress.js +33 -33
  146. package/project/sigdb/index-format.js +2 -2
  147. package/project/sigdb/manifest.js +21 -21
  148. package/project/sigdb/memory-source.d.ts +64 -0
  149. package/project/sigdb/memory-source.js +133 -0
  150. package/project/sigdb/reader.js +13 -13
  151. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  152. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
  153. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  154. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  155. package/queries/catalog/dependencies-query/link-devices.js +2 -2
  156. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
  157. package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
  158. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  159. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  160. package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
  161. package/queries/catalog/signature-query/signature-query-executor.js +3 -2
  162. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
  163. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  164. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  165. package/r-bridge/retriever.d.ts +2 -1
  166. package/r-bridge/retriever.js +3 -2
  167. package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
  168. package/r-bridge/roxygen2/documentation-provider.js +1 -0
  169. package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
  170. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  171. package/search/flowr-search-filters.d.ts +1 -1
  172. package/search/flowr-search-filters.js +2 -2
  173. package/search/search-executor/search-enrichers.js +4 -4
  174. package/search/search-executor/search-generators.js +1 -1
  175. package/slicing/criterion/parse.js +3 -3
  176. package/slicing/static/slice-call.d.ts +1 -1
  177. package/slicing/static/slice-call.js +2 -2
  178. package/slicing/static/static-slicer.js +4 -3
  179. package/util/assert.js +1 -1
  180. package/util/log.d.ts +4 -1
  181. package/util/log.js +15 -2
  182. package/util/logic.js +2 -2
  183. package/util/mermaid/cfg.js +1 -1
  184. package/util/mermaid/dfg.js +6 -6
  185. package/util/mermaid/mermaid.js +3 -1
  186. package/util/quads.js +19 -6
  187. package/util/schema.js +2 -2
  188. package/util/text/ansi.d.ts +2 -0
  189. package/util/text/ansi.js +8 -0
  190. package/util/text/name-rank.d.ts +29 -0
  191. package/util/text/name-rank.js +39 -0
  192. package/util/text/url-encoding.d.ts +15 -0
  193. package/util/text/url-encoding.js +59 -0
  194. package/util/version.js +1 -1
  195. package/cli/export-quads-app.d.ts +0 -7
  196. package/cli/export-quads-app.js +0 -44
@@ -57,9 +57,13 @@ export declare function getAliases(sourceIds: readonly NodeId[], dataflow: Dataf
57
57
  * @param resolve - Variable resolve mode
58
58
  * @param ctx - Context used for clean environment
59
59
  * @param blocked - If set, the ids that should not be considered during resolution (=>top)
60
+ * @useInstead {@link Resolve.toValue}
60
61
  */
61
62
  export declare function resolveIdToValue(id: NodeId | RNodeWithParent | undefined, { environment, graph, idMap, full, ctx, resolve, blocked }: ResolveInfo): ResolveResult;
62
63
  /** Resolves an id to a single constant string value, or `undefined` if it is not a unique string constant. */
64
+ /**
65
+ * @useInstead {@link Resolve.toSingleString}
66
+ */
63
67
  export declare function resolveIdToSingleString(id: NodeId | RNodeWithParent | undefined, info: ResolveInfo): string | undefined;
64
68
  /**
65
69
  * Please use {@link resolveIdToValue}
@@ -91,5 +95,6 @@ export declare function trackAliasesInGraph(id: NodeId, graph: DataflowGraph, ct
91
95
  * @param name - Identifier to resolve
92
96
  * @param environment - Environment to use
93
97
  * @returns Value of Constant or Top
98
+ * @useInstead {@link Resolve.toConstants}
94
99
  */
95
100
  export declare function resolveToConstants(name: Identifier | undefined, environment: REnvironmentInformation): ResolveResult;
@@ -12,7 +12,6 @@ const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
12
12
  const visiting_queue_1 = require("../../../slicing/static/visiting-queue");
13
13
  const assert_1 = require("../../../util/assert");
14
14
  const identifier_1 = require("../../environments/identifier");
15
- const resolve_by_name_1 = require("../../environments/resolve-by-name");
16
15
  const edge_1 = require("../../graph/edge");
17
16
  const r_for_loop_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-for-loop");
18
17
  const unknown_replacement_1 = require("../../graph/unknown-replacement");
@@ -23,6 +22,9 @@ const r_value_1 = require("../values/r-value");
23
22
  const set_constants_1 = require("../values/sets/set-constants");
24
23
  const resolve_1 = require("./resolve");
25
24
  const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
25
+ const resolve_helper_1 = require("../../environments/resolve-helper");
26
+ const node_value_1 = require("./node-value");
27
+ const graph_1 = require("../../graph/graph");
26
28
  const AliasHandler = {
27
29
  [vertex_1.VertexType.Value]: (sourceId) => [sourceId],
28
30
  [vertex_1.VertexType.Use]: getUseAlias,
@@ -33,11 +35,11 @@ const AliasHandler = {
33
35
  function getFunctionCallAlias(sourceId, dataflow, environment) {
34
36
  const vertex = dataflow.getVertex(sourceId);
35
37
  /* the lexeme of an infix call like `a %% b` is the whole expression, so we prefer the effective name of the vertex */
36
- const identifier = vertex?.tag === vertex_1.VertexType.FunctionCall ? vertex.name : (0, node_id_1.recoverName)(sourceId, dataflow.idMap);
38
+ const identifier = vertex_1.FunctionCallVertex.is(vertex) ? vertex.name : (0, node_id_1.recoverName)(sourceId, dataflow.idMap);
37
39
  if (identifier === undefined) {
38
40
  return undefined;
39
41
  }
40
- const defs = (0, resolve_by_name_1.resolveByName)(identifier, environment, identifier_1.ReferenceType.Function);
42
+ const defs = resolve_helper_1.Resolve.byNameAndType(identifier, environment, identifier_1.ReferenceType.Function);
41
43
  if (defs?.length !== 1) {
42
44
  return undefined;
43
45
  }
@@ -50,7 +52,7 @@ function getUseAlias(sourceId, dataflow, environment) {
50
52
  if (identifier === undefined) {
51
53
  return undefined;
52
54
  }
53
- const defs = (0, resolve_by_name_1.resolveByNameAnyType)(identifier, environment);
55
+ const defs = resolve_helper_1.Resolve.byName(identifier, environment);
54
56
  if (defs === undefined) {
55
57
  return undefined;
56
58
  }
@@ -92,7 +94,7 @@ function getAliases(sourceIds, dataflow, environment) {
92
94
  if (info === undefined) {
93
95
  return undefined;
94
96
  }
95
- else if (info.tag === vertex_1.VertexType.FunctionDefinition) {
97
+ else if (vertex_1.FunctionDefinitionVertex.is(info)) {
96
98
  definitions.add(sourceId);
97
99
  continue;
98
100
  }
@@ -123,6 +125,7 @@ function getAliases(sourceIds, dataflow, environment) {
123
125
  * @param resolve - Variable resolve mode
124
126
  * @param ctx - Context used for clean environment
125
127
  * @param blocked - If set, the ids that should not be considered during resolution (=>top)
128
+ * @useInstead {@link Resolve.toValue}
126
129
  */
127
130
  function resolveIdToValue(id, { environment, graph, idMap, full = true, ctx, resolve = ctx.config.solver.variables, blocked }) {
128
131
  blocked ??= new Set();
@@ -167,8 +170,11 @@ function resolveIdToValue(id, { environment, graph, idMap, full = true, ctx, res
167
170
  }
168
171
  }
169
172
  /** Resolves an id to a single constant string value, or `undefined` if it is not a unique string constant. */
173
+ /**
174
+ * @useInstead {@link Resolve.toSingleString}
175
+ */
170
176
  function resolveIdToSingleString(id, info) {
171
- const element = (0, general_1.soleValue)((0, general_1.valueSetGuard)(resolveIdToValue(id, info)), 'string');
177
+ const element = node_value_1.NodeValue.sole((0, general_1.valueSetGuard)(resolveIdToValue(id, info)), 'string');
172
178
  return element !== undefined && (0, r_value_1.isValue)(element.value) ? element.value.str : undefined;
173
179
  }
174
180
  /** the values one element of a sequence may take: a vector contributes its elements, a set what its members do */
@@ -195,7 +201,7 @@ function trackAliasInEnvironments(identifier, environment, { blocked, idMap, res
195
201
  if (identifier === undefined) {
196
202
  return r_value_1.Top;
197
203
  }
198
- const defs = (0, resolve_by_name_1.resolveByNameAnyType)(identifier, environment);
204
+ const defs = resolve_helper_1.Resolve.byName(identifier, environment);
199
205
  if (defs === undefined) {
200
206
  return r_value_1.Top;
201
207
  }
@@ -292,7 +298,7 @@ function isParameterDefault(node, idMap) {
292
298
  */
293
299
  function iteratedSequence(id, graph, idMap) {
294
300
  let sequence;
295
- for (const [target, edge] of graph.outgoingEdges(id) ?? []) {
301
+ for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
296
302
  if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads)) {
297
303
  continue;
298
304
  }
@@ -371,19 +377,19 @@ function trackAliasesInGraph(id, graph, ctx, idMap, blocked) {
371
377
  continue;
372
378
  }
373
379
  const isFn = t === vertex_1.VertexType.FunctionCall;
374
- const outgoingEdges = graph.outgoingEdges(id) ?? [];
380
+ const outgoingEdges = graph.outgoingEdges(id) ?? graph_1.NoEdges;
375
381
  let foundRetuns = false;
376
382
  // travel all read and defined-by edges
377
- for (const [targetId, { types }] of outgoingEdges) {
383
+ for (const [targetId, edge] of outgoingEdges) {
378
384
  if (isFn) {
379
- if (types === edge_1.EdgeType.Returns || types === edge_1.EdgeType.DefinedByOnCall || types === edge_1.EdgeType.DefinedBy) {
385
+ if (edge_1.DfEdge.isOnlyType(edge, edge_1.EdgeType.Returns) || edge_1.DfEdge.isOnlyType(edge, edge_1.EdgeType.DefinedByOnCall) || edge_1.DfEdge.isOnlyType(edge, edge_1.EdgeType.DefinedBy)) {
380
386
  queue.add(targetId, baseEnvironment, cleanFingerprint, false);
381
387
  }
382
- foundRetuns ||= edge_1.DfEdge.includesType({ types }, edge_1.EdgeType.Returns);
388
+ foundRetuns ||= edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Returns);
383
389
  continue;
384
390
  }
385
391
  // currently, they have to be exact!
386
- if (types === edge_1.EdgeType.Reads || types === edge_1.EdgeType.DefinedBy || types === edge_1.EdgeType.DefinedByOnCall) {
392
+ if (edge_1.DfEdge.isOnlyType(edge, edge_1.EdgeType.Reads) || edge_1.DfEdge.isOnlyType(edge, edge_1.EdgeType.DefinedBy) || edge_1.DfEdge.isOnlyType(edge, edge_1.EdgeType.DefinedByOnCall)) {
387
393
  queue.add(targetId, baseEnvironment, cleanFingerprint, false);
388
394
  }
389
395
  }
@@ -427,12 +433,13 @@ function trackAliasesInGraph(id, graph, ctx, idMap, blocked) {
427
433
  * @param name - Identifier to resolve
428
434
  * @param environment - Environment to use
429
435
  * @returns Value of Constant or Top
436
+ * @useInstead {@link Resolve.toConstants}
430
437
  */
431
438
  function resolveToConstants(name, environment) {
432
439
  if (name === undefined) {
433
440
  return r_value_1.Top;
434
441
  }
435
- const definitions = (0, resolve_by_name_1.resolveByName)(name, environment, identifier_1.ReferenceType.Constant);
442
+ const definitions = resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.Constant);
436
443
  if (definitions === undefined) {
437
444
  return r_value_1.Top;
438
445
  }
@@ -17,6 +17,12 @@ declare function infoOf<OtherInfo>(this: void, data: DataflowProcessorInformatio
17
17
  * This is constant propagation over the dataflow graph, not abstract interpretation: it follows definitions to
18
18
  * constants and gives up wherever a value is not statically pinned down, with no fixpoint and no widening.
19
19
  * Anything needing an abstract state lives in `src/abstract-interpretation/`.
20
+ * @example
21
+ * ```ts
22
+ * NodeValue.of(id, data); // during processing
23
+ * NodeValue.inGraph(id, graph, ctx); // on a finished graph
24
+ * NodeValue.sole(NodeValue.setOf(id, data)); // the single value, if there is exactly one
25
+ * ```
20
26
  */
21
27
  export declare const NodeValue: {
22
28
  readonly name: "NodeValue";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodeValue = void 0;
4
- const alias_tracking_1 = require("./alias-tracking");
4
+ const resolve_helper_1 = require("../../environments/resolve-helper");
5
5
  const general_1 = require("../values/general");
6
6
  const string_constants_1 = require("../values/string/string-constants");
7
7
  function infoOf(data, overrides) {
@@ -24,6 +24,12 @@ function graphInfoOf(graph, ctx, overrides) {
24
24
  * This is constant propagation over the dataflow graph, not abstract interpretation: it follows definitions to
25
25
  * constants and gives up wherever a value is not statically pinned down, with no fixpoint and no widening.
26
26
  * Anything needing an abstract state lives in `src/abstract-interpretation/`.
27
+ * @example
28
+ * ```ts
29
+ * NodeValue.of(id, data); // during processing
30
+ * NodeValue.inGraph(id, graph, ctx); // on a finished graph
31
+ * NodeValue.sole(NodeValue.setOf(id, data)); // the single value, if there is exactly one
32
+ * ```
27
33
  */
28
34
  exports.NodeValue = {
29
35
  name: 'NodeValue',
@@ -31,40 +37,40 @@ exports.NodeValue = {
31
37
  infoOf,
32
38
  /** The value(s) the node may hold. */
33
39
  of(id, data, overrides) {
34
- return (0, alias_tracking_1.resolveIdToValue)(id, infoOf(data, overrides));
40
+ return resolve_helper_1.Resolve.toValue(id, infoOf(data, overrides));
35
41
  },
36
42
  /** The value set the node may hold, `undefined` if it resolves to top or bottom. */
37
43
  setOf(id, data, overrides) {
38
- return (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(id, infoOf(data, overrides)));
44
+ return (0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(id, infoOf(data, overrides)));
39
45
  },
40
46
  /** The strings the node may hold, `undefined` if it does not resolve to strings. */
41
47
  stringsOf(id, data, overrides) {
42
- const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(id, infoOf(data, overrides)));
48
+ const resolved = (0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(id, infoOf(data, overrides)));
43
49
  return resolved ? (0, string_constants_1.collectStrings)(resolved.elements) : undefined;
44
50
  },
45
51
  /** The single string the node resolves to, `undefined` if it is not exactly one. */
46
52
  singleStringOf(id, data, overrides) {
47
- return (0, alias_tracking_1.resolveIdToSingleString)(id, infoOf(data, overrides));
53
+ return resolve_helper_1.Resolve.toSingleString(id, infoOf(data, overrides));
48
54
  },
49
55
  /** The one value a set holds, `undefined` unless it holds exactly one, optionally of the given kind. */
50
56
  sole: general_1.soleValue,
51
57
  /** The one value the node resolves to, `undefined` unless it is exactly one, optionally of the given kind. */
52
58
  soleOf(id, data, type, overrides) {
53
- return (0, general_1.soleValue)((0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(id, infoOf(data, overrides))), type);
59
+ return (0, general_1.soleValue)((0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(id, infoOf(data, overrides))), type);
54
60
  },
55
61
  /** The same questions, asked of a finished dataflow graph instead of a running processor. */
56
62
  inGraph: {
57
63
  /** The value set the node may hold, `undefined` if it resolves to top or bottom. */
58
64
  setOf(id, graph, ctx, overrides) {
59
- return (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(id, graphInfoOf(graph, ctx, overrides)));
65
+ return (0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(id, graphInfoOf(graph, ctx, overrides)));
60
66
  },
61
67
  /** The single string the node resolves to, `undefined` if it is not exactly one. */
62
68
  singleStringOf(id, graph, ctx, overrides) {
63
- return (0, alias_tracking_1.resolveIdToSingleString)(id, graphInfoOf(graph, ctx, overrides));
69
+ return resolve_helper_1.Resolve.toSingleString(id, graphInfoOf(graph, ctx, overrides));
64
70
  },
65
71
  /** The one value the node resolves to, `undefined` unless it is exactly one, optionally of the given kind. */
66
72
  soleOf(id, graph, ctx, type, overrides) {
67
- return (0, general_1.soleValue)((0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(id, graphInfoOf(graph, ctx, overrides))), type);
73
+ return (0, general_1.soleValue)((0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(id, graphInfoOf(graph, ctx, overrides))), type);
68
74
  }
69
75
  }
70
76
  };
@@ -8,10 +8,10 @@ const assert_1 = require("../../../util/assert");
8
8
  const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
9
9
  const dependencies_query_format_1 = require("../../../queries/catalog/dependencies-query/dependencies-query-format");
10
10
  const general_1 = require("../values/general");
11
- const alias_tracking_1 = require("./alias-tracking");
12
11
  const r_value_2 = require("../values/r-value");
13
12
  const convert_values_1 = require("../../../r-bridge/lang-4.x/convert-values");
14
13
  const string_constants_1 = require("../values/string/string-constants");
14
+ const resolve_helper_1 = require("../../environments/resolve-helper");
15
15
  /**
16
16
  * Get the values of all arguments matching the criteria.
17
17
  */
@@ -89,7 +89,7 @@ function resolveBasedOnConfig(variableResolve, graph, vertex, argument, environm
89
89
  full = false;
90
90
  }
91
91
  }
92
- const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(argument, { environment, graph, full, resolve: variableResolve, ctx }));
92
+ const resolved = (0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(argument, { environment, graph, full, resolve: variableResolve, ctx }));
93
93
  if (resolved) {
94
94
  const values = [];
95
95
  for (const value of resolved.elements) {
@@ -8,8 +8,8 @@ const r_value_1 = require("../../../util/r-value");
8
8
  const r_value_2 = require("../values/r-value");
9
9
  const interval_constants_1 = require("../values/intervals/interval-constants");
10
10
  const vector_constants_1 = require("../values/vectors/vector-constants");
11
- const alias_tracking_1 = require("./alias-tracking");
12
11
  const match_arguments_1 = require("./match-arguments");
12
+ const resolve_helper_1 = require("../../environments/resolve-helper");
13
13
  /** R breaks a tie to the even neighbor, unlike `Math.round`, which always goes up */
14
14
  function roundHalfEven(x, digits = 0) {
15
15
  const scale = 10 ** digits;
@@ -81,7 +81,7 @@ exports.NumericFns = {
81
81
  };
82
82
  /** the number an operand folds to, with a logical counting as its `0`/`1` just like R would coerce it */
83
83
  function numeric(node, args) {
84
- const value = (0, r_value_1.unliftRValue)((0, alias_tracking_1.resolveIdToValue)(node, args));
84
+ const value = (0, r_value_1.unliftRValue)(resolve_helper_1.Resolve.toValue(node, args));
85
85
  if (typeof value === 'boolean') {
86
86
  return Number(value);
87
87
  }
@@ -11,10 +11,11 @@ const r_value_1 = require("../../../util/r-value");
11
11
  const logical_constants_1 = require("../values/logical/logical-constants");
12
12
  const r_value_2 = require("../values/r-value");
13
13
  const general_1 = require("../values/general");
14
- const alias_tracking_1 = require("./alias-tracking");
14
+ const resolve_helper_1 = require("../../environments/resolve-helper");
15
+ const node_value_1 = require("./node-value");
15
16
  /** the scalar an operand folds to, with a logical counting as its `0`/`1` just like R would coerce it */
16
17
  function operand(node, args) {
17
- const value = (0, r_value_1.unliftRValue)((0, alias_tracking_1.resolveIdToValue)(node, args));
18
+ const value = (0, r_value_1.unliftRValue)(resolve_helper_1.Resolve.toValue(node, args));
18
19
  if (typeof value === 'boolean') {
19
20
  return Number(value);
20
21
  }
@@ -109,6 +110,6 @@ function resolveAsGroup(args) {
109
110
  return r_value_2.Top;
110
111
  }
111
112
  /* unwrap the set again, as the caller of a handler wraps the returned value in one */
112
- return (0, general_1.soleValue)((0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(node.children[0], args))) ?? r_value_2.Top;
113
+ return node_value_1.NodeValue.sole((0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(node.children[0], args))) ?? r_value_2.Top;
113
114
  }
114
115
  //# sourceMappingURL=resolve-operators.js.map
@@ -8,8 +8,8 @@ const identifier_1 = require("../../environments/identifier");
8
8
  const r_value_1 = require("../values/r-value");
9
9
  const string_constants_1 = require("../values/string/string-constants");
10
10
  const interval_constants_1 = require("../values/intervals/interval-constants");
11
- const alias_tracking_1 = require("./alias-tracking");
12
11
  const match_arguments_1 = require("./match-arguments");
12
+ const resolve_helper_1 = require("../../environments/resolve-helper");
13
13
  /** everything after the last separator, with trailing separators dropped first (`a/b/` is `b`, `/` is the empty string) */
14
14
  function basename(path) {
15
15
  const trimmed = path.replace(/\/+$/, '');
@@ -81,7 +81,7 @@ function foldStringCall(node, resolveArg) {
81
81
  for (const [at, slot] of matched.entries()) {
82
82
  if (Array.isArray(slot)) {
83
83
  const parts = slot.map(resolveArg);
84
- if (parts.some(p => p === undefined)) {
84
+ if (parts.includes(undefined)) {
85
85
  return undefined;
86
86
  }
87
87
  args.push(parts);
@@ -114,7 +114,7 @@ function resolveAsStringFn(args) {
114
114
  if (node.type !== type_1.RType.FunctionCall || !node.named) {
115
115
  return r_value_1.Top;
116
116
  }
117
- const folded = foldStringCall(node, arg => (0, alias_tracking_1.resolveIdToSingleString)(arg.info.id, args));
117
+ const folded = foldStringCall(node, arg => resolve_helper_1.Resolve.toSingleString(arg.info.id, args));
118
118
  if (folded === undefined) {
119
119
  return r_value_1.Top;
120
120
  }
@@ -18,6 +18,7 @@ const edge_1 = require("../../graph/edge");
18
18
  const defaultmap_1 = require("../../../util/collections/defaultmap");
19
19
  const files_1 = require("../../../util/files");
20
20
  const built_in_source_1 = require("../../internal/process/functions/call/built-in/built-in-source");
21
+ const graph_1 = require("../../graph/graph");
21
22
  /** functions recognized as changing the working directory; a registry so more (e.g. `withr::with_dir`) can be added */
22
23
  const ChangeFunctions = [
23
24
  { name: 'setwd', namespace: 'base', argIdx: 0, argName: 'dir' }
@@ -145,7 +146,7 @@ function collect(graph, ctx) {
145
146
  // a function's setwd is propagated to its call sites; only a lone unconditional setwd has a site-independent effect
146
147
  for (const [fn, setwds] of byFn.entries()) {
147
148
  const net = setwds.length === 1 && setwds[0].cds.length === 0 && !setwds[0].iterated ? setwds[0].dir : undefined;
148
- for (const [site, edge] of graph.ingoingEdges(fn) ?? []) {
149
+ for (const [site, edge] of graph.ingoingEdges(fn) ?? graph_1.NoEdges) {
149
150
  if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls)) {
150
151
  continue;
151
152
  }
@@ -1,7 +1,7 @@
1
1
  import type { BuiltInEvalHandlerArgs } from '../../environments/built-in';
2
2
  import { type Lift, Top, type Value, type ValueNumber, type ValueVector } from '../values/r-value';
3
3
  /**
4
- * Helper function used by {@link resolveIdToValue}, please use that instead, if
4
+ * Helper function used by {@link Resolve.toValue}, please use that instead, if
5
5
  * you want to resolve the value of an identifier / node
6
6
  *
7
7
  * This function converts an RNode to its Value, either directly for a constant or by handing the node
@@ -10,20 +10,20 @@ import { type Lift, Top, type Value, type ValueNumber, type ValueVector } from '
10
10
  */
11
11
  export declare function resolveNode(args: BuiltInEvalHandlerArgs): Value;
12
12
  /**
13
- * Helper function used by {@link resolveIdToValue}, please use that instead, if
13
+ * Helper function used by {@link Resolve.toValue}, please use that instead, if
14
14
  * you want to resolve the value of an identifier / node
15
15
  *
16
16
  * This function resolves a vector function call `c` to a {@link ValueVector}
17
- * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
17
+ * by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
18
18
  * @returns ValueVector or Top
19
19
  */
20
20
  export declare function resolveAsVector(args: BuiltInEvalHandlerArgs): ValueVector | typeof Top;
21
21
  /**
22
- * Helper function used by {@link resolveIdToValue}, please use that instead, if
22
+ * Helper function used by {@link Resolve.toValue}, please use that instead, if
23
23
  * you want to resolve the value of an identifier / node
24
24
  *
25
25
  * This function resolves a binary sequence operator `:` to a {@link ValueVector} of {@link ValueNumber}s
26
- * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
26
+ * by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
27
27
  * @returns ValueVector of ValueNumbers or Top
28
28
  */
29
29
  export declare function resolveAsSeq(args: BuiltInEvalHandlerArgs): ValueVector<Lift<ValueNumber[]>> | typeof Top;
@@ -11,12 +11,11 @@ const logical_constants_1 = require("../values/logical/logical-constants");
11
11
  const r_value_2 = require("../values/r-value");
12
12
  const string_constants_1 = require("../values/string/string-constants");
13
13
  const vector_constants_1 = require("../values/vectors/vector-constants");
14
- const alias_tracking_1 = require("./alias-tracking");
15
14
  const scalar_constants_1 = require("../values/scalar/scalar-constants");
16
15
  const identifier_1 = require("../../environments/identifier");
17
- const resolve_by_name_1 = require("../../environments/resolve-by-name");
18
16
  const df_helper_1 = require("../../graph/df-helper");
19
17
  const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
18
+ const resolve_helper_1 = require("../../environments/resolve-helper");
20
19
  /**
21
20
  * The {@link BuiltInEvalHandler} the given name resolves to in the current environment, just like the
22
21
  * {@link BuiltInIdentifierDefinition#processor} a call resolves to; `undefined` if the name is shadowed
@@ -24,7 +23,7 @@ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-
24
23
  */
25
24
  function evalHandlerOf(name, environment, ctx) {
26
25
  const defs = environment ?
27
- (0, resolve_by_name_1.resolveByName)(name, environment, identifier_1.ReferenceType.BuiltInFunction)
26
+ resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.BuiltInFunction)
28
27
  : ctx.env.builtInEnvironment.memory.get(identifier_1.Identifier.getName(name));
29
28
  const def = defs?.length === 1 ? defs[0] : undefined;
30
29
  return def?.type === identifier_1.ReferenceType.BuiltInFunction ? def.evalHandler : undefined;
@@ -60,7 +59,7 @@ function evalNameOf({ node, graph }) {
60
59
  return name;
61
60
  }
62
61
  /**
63
- * Helper function used by {@link resolveIdToValue}, please use that instead, if
62
+ * Helper function used by {@link Resolve.toValue}, please use that instead, if
64
63
  * you want to resolve the value of an identifier / node
65
64
  *
66
65
  * This function converts an RNode to its Value, either directly for a constant or by handing the node
@@ -87,11 +86,11 @@ function resolveNode(args) {
87
86
  return handler?.(args) ?? r_value_2.Top;
88
87
  }
89
88
  /**
90
- * Helper function used by {@link resolveIdToValue}, please use that instead, if
89
+ * Helper function used by {@link Resolve.toValue}, please use that instead, if
91
90
  * you want to resolve the value of an identifier / node
92
91
  *
93
92
  * This function resolves a vector function call `c` to a {@link ValueVector}
94
- * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
93
+ * by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
95
94
  * @returns ValueVector or Top
96
95
  */
97
96
  function resolveAsVector(args) {
@@ -99,14 +98,14 @@ function resolveAsVector(args) {
99
98
  if (node.type !== type_1.RType.FunctionCall) {
100
99
  return r_value_2.Top;
101
100
  }
102
- return (0, vector_constants_1.vectorFrom)((0, vector_constants_1.flattenVectorElements)(node.arguments.map(arg => arg !== r_function_call_1.EmptyArgument ? (0, alias_tracking_1.resolveIdToValue)(arg.value, args) : r_value_2.Top)));
101
+ return (0, vector_constants_1.vectorFrom)((0, vector_constants_1.flattenVectorElements)(node.arguments.map(arg => arg !== r_function_call_1.EmptyArgument ? resolve_helper_1.Resolve.toValue(arg.value, args) : r_value_2.Top)));
103
102
  }
104
103
  /**
105
- * Helper function used by {@link resolveIdToValue}, please use that instead, if
104
+ * Helper function used by {@link Resolve.toValue}, please use that instead, if
106
105
  * you want to resolve the value of an identifier / node
107
106
  *
108
107
  * This function resolves a binary sequence operator `:` to a {@link ValueVector} of {@link ValueNumber}s
109
- * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
108
+ * by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
110
109
  * @returns ValueVector of ValueNumbers or Top
111
110
  */
112
111
  function resolveAsSeq(args) {
@@ -114,8 +113,8 @@ function resolveAsSeq(args) {
114
113
  if (operator.type !== type_1.RType.BinaryOp) {
115
114
  return r_value_2.Top;
116
115
  }
117
- const leftValue = (0, r_value_1.unliftRValue)((0, alias_tracking_1.resolveIdToValue)(operator.lhs, args));
118
- const rightValue = (0, r_value_1.unliftRValue)((0, alias_tracking_1.resolveIdToValue)(operator.rhs, args));
116
+ const leftValue = (0, r_value_1.unliftRValue)(resolve_helper_1.Resolve.toValue(operator.lhs, args));
117
+ const rightValue = (0, r_value_1.unliftRValue)(resolve_helper_1.Resolve.toValue(operator.rhs, args));
119
118
  if ((0, r_value_1.isRNumberValue)(leftValue) && (0, r_value_1.isRNumberValue)(rightValue)) {
120
119
  return (0, vector_constants_1.vectorFrom)(createNumberSequence(leftValue, rightValue).map(scalar_constants_1.liftScalar));
121
120
  }
@@ -6,11 +6,14 @@ import { type Lift, type Value, type ValueSet, Bottom, Top } from './r-value';
6
6
  export declare function bottomTopGuard(...a: Lift<unknown>[]): typeof Top | typeof Bottom | undefined;
7
7
  /**
8
8
  * Returns a value set, if a is not bottom or top, otherwise undefined.
9
- * Useful when working with values returned by {@link resolveIdToValue}
9
+ * Useful when working with values returned by {@link Resolve.toValue}
10
10
  * @param a - value set to check
11
11
  * @returns value set if a is not top or bottom
12
12
  */
13
13
  export declare function valueSetGuard(a: Lift<ValueSet<Value[]>>): ValueSet<Value[]> | undefined;
14
+ /**
15
+ * @useInstead {@link NodeValue.sole}
16
+ */
14
17
  export declare function soleValue(this: void, set: ValueSet<Value[]> | undefined): Value | undefined;
15
18
  export declare function soleValue<T extends Value['type']>(this: void, set: ValueSet<Value[]> | undefined, type: T): Extract<Value, {
16
19
  type: T;
@@ -24,7 +24,7 @@ function bottomTopGuard(...a) {
24
24
  }
25
25
  /**
26
26
  * Returns a value set, if a is not bottom or top, otherwise undefined.
27
- * Useful when working with values returned by {@link resolveIdToValue}
27
+ * Useful when working with values returned by {@link Resolve.toValue}
28
28
  * @param a - value set to check
29
29
  * @returns value set if a is not top or bottom
30
30
  */
@@ -29,6 +29,7 @@ const quoted_1 = require("./internal/process/functions/call/quoted");
29
29
  const range_1 = require("../util/range");
30
30
  const logger_1 = require("./logger");
31
31
  const gas_1 = require("../gas");
32
+ const df_helper_1 = require("./graph/df-helper");
32
33
  /**
33
34
  * The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
34
35
  * Maps every {@link RType} in the normalized AST to a processor.
@@ -156,7 +157,7 @@ function produceDataFlowGraph(parser, completeAst, ctx) {
156
157
  (0, built_in_function_definition_1.updateNestedFunctionCalls)(df.graph, df.environment, ctx);
157
158
  const escapedNames = new Set();
158
159
  for (let round = 0; round < transitiveSideEffectRounds; round++) {
159
- const { environment, grew, escapedNames: roundNames } = (0, transitive_side_effects_1.propagateTransitiveSideEffects)(df.graph, df.environment, ctx);
160
+ const { environment, grew, escapedNames: roundNames } = df_helper_1.Dataflow.sideEffects.propagateTransitive(df.graph, df.environment, ctx);
160
161
  df.environment = environment;
161
162
  for (const n of roundNames) {
162
163
  escapedNames.add(n);
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateExceptionsOfFunction = calculateExceptionsOfFunction;
4
4
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
5
- const vertex_1 = require("../graph/vertex");
6
5
  const built_in_proc_name_1 = require("../environments/built-in-proc-name");
6
+ const vertex_1 = require("../graph/vertex");
7
+ const graph_1 = require("../graph/graph");
7
8
  const CatchHandlers = new Set([built_in_proc_name_1.BuiltInProcName.Try]);
8
9
  /**
9
10
  * Collect exception sources of a function in the call graph.
@@ -39,7 +40,7 @@ function calculateExceptionsOfFunction(id, graph, knownThrower = {}) {
39
40
  if (node_id_1.NodeId.isBuiltIn(currentId)) {
40
41
  continue;
41
42
  }
42
- if (vtx.tag === vertex_1.VertexType.FunctionDefinition) {
43
+ if (vertex_1.FunctionDefinitionVertex.is(vtx)) {
43
44
  const es = vtx.exitPoints.filter(e => e.type === 4 /* ExitPointType.Error */).map(e => ({ id: e.nodeId, cds: e.cds }));
44
45
  for (const e of es) {
45
46
  if (!mine.includes(e)) {
@@ -48,11 +49,11 @@ function calculateExceptionsOfFunction(id, graph, knownThrower = {}) {
48
49
  }
49
50
  collectedExceptions[vtx.id] = es;
50
51
  }
51
- else if (vtx.tag === vertex_1.VertexType.FunctionCall && vtx.origin !== 'unnamed' && vtx.origin.some(c => CatchHandlers.has(c))) {
52
+ else if (vertex_1.FunctionCallVertex.is(vtx) && vtx.origin !== 'unnamed' && vtx.origin.some(c => CatchHandlers.has(c))) {
52
53
  // skip the try-catch handlers as they catch all exceptions within their body
53
54
  continue;
54
55
  }
55
- const outEdges = graph.outgoingEdges(currentId) ?? [];
56
+ const outEdges = graph.outgoingEdges(currentId) ?? graph_1.NoEdges;
56
57
  for (const [out] of outEdges) {
57
58
  if (!visited.has(out)) {
58
59
  toVisit.push(out);
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isFunctionHigherOrder = isFunctionHigherOrder;
4
4
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
5
- const resolve_by_name_1 = require("../environments/resolve-by-name");
6
5
  const identifier_1 = require("../environments/identifier");
7
6
  const vertex_1 = require("../graph/vertex");
8
7
  const assert_1 = require("../../util/assert");
@@ -10,6 +9,8 @@ const edge_1 = require("../graph/edge");
10
9
  const node_value_1 = require("../eval/resolve/node-value");
11
10
  const config_1 = require("../../config");
12
11
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
12
+ const resolve_helper_1 = require("../environments/resolve-helper");
13
+ const graph_1 = require("../graph/graph");
13
14
  function isAnyReturnAFunction(def, graph) {
14
15
  const workingQueue = def.exitPoints.map(d => graph.getVertex(d.nodeId)).filter(assert_1.isNotUndefined);
15
16
  const seen = new Set();
@@ -22,7 +23,7 @@ function isAnyReturnAFunction(def, graph) {
22
23
  if (vertex_1.FunctionDefinitionVertex.is(current)) {
23
24
  return true;
24
25
  }
25
- const next = graph.outgoingEdges(current.id) ?? [];
26
+ const next = graph.outgoingEdges(current.id) ?? graph_1.NoEdges;
26
27
  for (const [t, e] of next) {
27
28
  if (edge_1.DfEdge.includesType(e, edge_1.EdgeType.Returns)) {
28
29
  const v = graph.getVertex(t);
@@ -39,11 +40,11 @@ function isAnyReturnAFunction(def, graph) {
39
40
  * hence no `function-definition` value to resolve to.
40
41
  */
41
42
  function readsBuiltInFunction(id, graph, ctx) {
42
- for (const [target, edge] of graph.outgoingEdges(id) ?? []) {
43
+ for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
43
44
  if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) || !node_id_1.NodeId.isBuiltIn(target)) {
44
45
  continue;
45
46
  }
46
- const defs = (0, resolve_by_name_1.resolveByName)(node_id_1.NodeId.fromBuiltIn(target), ctx.env.makeCleanEnv(), identifier_1.ReferenceType.Function);
47
+ const defs = resolve_helper_1.Resolve.byNameAndType(node_id_1.NodeId.fromBuiltIn(target), ctx.env.makeCleanEnv(), identifier_1.ReferenceType.Function);
47
48
  if (defs?.some(d => (0, identifier_1.isReferenceType)(d.type, identifier_1.ReferenceType.BuiltInFunction))) {
48
49
  return true;
49
50
  }