@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
@@ -25,11 +25,12 @@ const logger_1 = require("../logger");
25
25
  const edge_1 = require("../graph/edge");
26
26
  const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
27
27
  const vertex_1 = require("../graph/vertex");
28
- const resolve_by_name_1 = require("../environments/resolve-by-name");
29
28
  const arg_matching_1 = require("../../util/arg-matching");
30
29
  const info_1 = require("../info");
31
30
  const unnamed_call_handling_1 = require("./process/functions/call/unnamed-call-handling");
32
31
  const built_in_proc_name_1 = require("../environments/built-in-proc-name");
32
+ const vertex_2 = require("../graph/vertex");
33
+ const resolve_helper_1 = require("../environments/resolve-helper");
33
34
  /**
34
35
  * Find all reads within the graph that do not reference a local definition in the graph.
35
36
  */
@@ -45,7 +46,7 @@ function findNonLocalReads(graph, ignores = new Set()) {
45
46
  const outgoing = graph.outgoingEdges(nodeId);
46
47
  const origin = graph.getVertex(nodeId);
47
48
  const name = (0, node_id_1.recoverName)(nodeId, graph.idMap);
48
- const type = origin?.tag === vertex_1.VertexType.FunctionCall ? identifier_1.ReferenceType.Function : identifier_1.ReferenceType.Variable;
49
+ const type = vertex_2.FunctionCallVertex.is(origin) ? identifier_1.ReferenceType.Function : identifier_1.ReferenceType.Variable;
49
50
  const identifierRef = { nodeId, name, type };
50
51
  if (outgoing === undefined) {
51
52
  nonLocalReads.push(identifierRef);
@@ -169,7 +170,7 @@ function linkFunctionCallWithSingleTarget(graph, { subflow: fnSubflow, exitPoint
169
170
  if (info.environment !== undefined) {
170
171
  // for each open ingoing reference, try to resolve it here, and if so, add a read edge from the call to signal that it reads it
171
172
  for (const ingoing of fnSubflow.in) {
172
- const defs = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, info.environment, ingoing.type) : undefined;
173
+ const defs = ingoing.name ? resolve_helper_1.Resolve.byNameAndType(ingoing.name, info.environment, ingoing.type) : undefined;
173
174
  if (defs === undefined) {
174
175
  continue;
175
176
  }
@@ -183,7 +184,7 @@ function linkFunctionCallWithSingleTarget(graph, { subflow: fnSubflow, exitPoint
183
184
  graph.addEdge(ingoing.nodeId, v, edge_1.EdgeType.Calls);
184
185
  // add s7 to vertex
185
186
  const vInfo = graph.getVertex(v);
186
- if (vInfo && vInfo.tag === vertex_1.VertexType.FunctionDefinition) {
187
+ if (vInfo && vertex_2.FunctionDefinitionVertex.is(vInfo)) {
187
188
  vInfo.mode ??= [];
188
189
  if (!vInfo.mode.includes('s7')) {
189
190
  vInfo.mode.push('s7');
@@ -276,7 +277,7 @@ function getAllFunctionCallTargets(call, graph, environment) {
276
277
  return [];
277
278
  }
278
279
  const [info, outgoingEdges] = callVertex;
279
- if (info.tag !== vertex_1.VertexType.FunctionCall) {
280
+ if (!vertex_2.FunctionCallVertex.is(info)) {
280
281
  return [];
281
282
  }
282
283
  if (environment !== undefined || info.environment !== undefined) {
@@ -284,7 +285,7 @@ function getAllFunctionCallTargets(call, graph, environment) {
284
285
  const refType = info.origin.includes(built_in_proc_name_1.BuiltInProcName.S3Dispatch) ? identifier_1.ReferenceType.S3MethodPrefix :
285
286
  info.origin.includes(built_in_proc_name_1.BuiltInProcName.S7Dispatch) ? identifier_1.ReferenceType.S7MethodPrefix : identifier_1.ReferenceType.Function;
286
287
  if (info.name !== undefined && !identifier_1.Identifier.getName(info.name).startsWith(unnamed_call_handling_1.UnnamedFunctionCallPrefix)) {
287
- functionCallDefs = (0, resolve_by_name_1.resolveByName)(info.name, environment ?? info.environment, refType)?.map(d => d.nodeId) ?? [];
288
+ functionCallDefs = resolve_helper_1.Resolve.byNameAndType(info.name, environment ?? info.environment, refType)?.map(d => d.nodeId) ?? [];
288
289
  }
289
290
  for (const [target, outgoingEdge] of outgoingEdges.entries()) {
290
291
  if (edge_1.DfEdge.includesType(outgoingEdge, edge_1.EdgeType.Calls)) {
@@ -347,7 +348,7 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
347
348
  if (!outgoing) {
348
349
  continue;
349
350
  }
350
- const isSkipType = vertex.tag === vertex_1.VertexType.FunctionCall || (vertex.tag === vertex_1.VertexType.VariableDefinition && vertex.par);
351
+ const isSkipType = vertex_2.FunctionCallVertex.is(vertex) || (vertex_2.VariableDefinitionVertex.is(vertex) && vertex.par);
351
352
  let hasReturnEdge = false;
352
353
  let followTargets;
353
354
  for (const [target, e] of outgoing) {
@@ -381,6 +382,7 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
381
382
  /**
382
383
  * Links every name in the expression rooted at `expr` against `environment`, as if it were written there, and
383
384
  * hands back what stays unresolved. This is how an expression that was captured elsewhere is read here.
385
+ * @useInstead {@link Quoted.evaluateIn}
384
386
  */
385
387
  function linkExpressionIn(graph, expr, environment, idMap) {
386
388
  const node = idMap.get(expr);
@@ -414,7 +416,7 @@ function linkExpressionIn(graph, expr, environment, idMap) {
414
416
  */
415
417
  function linkInputs(referencesToLinkAgainstEnvironment, environmentInformation, givenInputs, graph, maybeForRemaining) {
416
418
  for (const bodyInput of referencesToLinkAgainstEnvironment) {
417
- const probableTarget = bodyInput.name ? (0, resolve_by_name_1.resolveByName)(bodyInput.name, environmentInformation, bodyInput.type) : undefined;
419
+ const probableTarget = bodyInput.name ? resolve_helper_1.Resolve.byNameAndType(bodyInput.name, environmentInformation, bodyInput.type) : undefined;
418
420
  if (probableTarget === undefined) {
419
421
  if (maybeForRemaining) {
420
422
  bodyInput.cds ??= [];
@@ -541,7 +543,7 @@ exports.ClosureRefs = {
541
543
  resolveOpenIngoing(graph, callId, definition, environment) {
542
544
  const remainingIn = [];
543
545
  for (const ingoing of definition.subflow.in) {
544
- const resolved = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, environment, ingoing.type) : undefined;
546
+ const resolved = ingoing.name ? resolve_helper_1.Resolve.byNameAndType(ingoing.name, environment, ingoing.type) : undefined;
545
547
  if (resolved === undefined) {
546
548
  remainingIn.push(ingoing);
547
549
  continue;
@@ -15,7 +15,7 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
15
15
  const unpack_argument_1 = require("../argument/unpack-argument");
16
16
  const built_in_envir_utils_1 = require("./built-in-envir-utils");
17
17
  const built_in_stack_env_1 = require("./built-in-stack-env");
18
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
18
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
19
19
  function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
20
20
  outInfo.definitionRootNodes.push(rootId);
21
21
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.TableAssignment }).information;
@@ -71,7 +71,7 @@ function processAccess(name, args, rootId, data, config) {
71
71
  const fieldNode = (0, unpack_argument_1.unpackArg)(args[1]);
72
72
  const fieldName = fieldNode?.type === type_1.RType.String ? fieldNode.content.str : (config.treatIndicesAsString ? fieldNode?.lexeme : undefined);
73
73
  const fieldDefs = fieldName
74
- ? ((0, built_in_stack_env_1.stackEnvInheritsFields)(head.value) ? (0, resolve_by_name_1.resolveByName)(fieldName, envState, identifier_1.ReferenceType.Unknown) : envState.current.memory.get(fieldName))
74
+ ? ((0, built_in_stack_env_1.stackEnvInheritsFields)(head.value) ? resolve_helper_1.Resolve.byNameAndType(fieldName, envState, identifier_1.ReferenceType.Unknown) : envState.current.memory.get(fieldName))
75
75
  : undefined;
76
76
  for (const fd of fieldDefs ?? []) {
77
77
  info.graph.addEdge(name.info.id, fd.nodeId, edge_1.EdgeType.Reads);
@@ -133,7 +133,7 @@ function processApply(name, args, rootId, data, config) {
133
133
  ]
134
134
  };
135
135
  const dfVert = information.graph.getVertex(rootId);
136
- if (dfVert && dfVert.tag === vertex_1.VertexType.FunctionDefinition) {
136
+ if (dfVert && vertex_1.FunctionDefinitionVertex.is(dfVert)) {
137
137
  linker_1.ClosureRefs.resolveOpenIngoing(information.graph, rootId, dfVert, data.environment);
138
138
  }
139
139
  }
@@ -21,7 +21,6 @@ const retriever_1 = require("../../../../../../r-bridge/retriever");
21
21
  const vertex_1 = require("../../../../../graph/vertex");
22
22
  const define_1 = require("../../../../../environments/define");
23
23
  const edge_1 = require("../../../../../graph/edge");
24
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
25
24
  const built_in_envir_utils_1 = require("./built-in-envir-utils");
26
25
  const named_call_handling_1 = require("../named-call-handling");
27
26
  const built_in_1 = require("../../../../../environments/built-in");
@@ -32,6 +31,8 @@ const built_in_new_env_1 = require("./built-in-new-env");
32
31
  const built_in_list_1 = require("./built-in-list");
33
32
  const built_in_class_generator_1 = require("./built-in-class-generator");
34
33
  const built_in_stack_env_1 = require("./built-in-stack-env");
34
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
35
+ const graph_1 = require("../../../../../graph/graph");
35
36
  function toReplacementSymbol(target, prefix, superAssignment) {
36
37
  return {
37
38
  type: type_1.RType.Symbol,
@@ -56,7 +57,7 @@ function findRootAccess(node) {
56
57
  return undefined;
57
58
  }
58
59
  function tryReplacement(rootId, functionName, data, name, args) {
59
- const resolved = (0, resolve_by_name_1.resolveByName)(functionName.content, data.environment, identifier_1.ReferenceType.Function) ?? [];
60
+ const resolved = resolve_helper_1.Resolve.byNameAndType(functionName.content, data.environment, identifier_1.ReferenceType.Function) ?? [];
60
61
  // yield for unsupported pass along!
61
62
  if (resolved.length !== 1 || resolved[0].type !== identifier_1.ReferenceType.BuiltInFunction) {
62
63
  return (0, process_named_call_1.processAsNamedCall)(functionName, data, name, args);
@@ -453,7 +454,7 @@ function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignme
453
454
  }
454
455
  information.graph.addEdge(nid, rootIdOfAssignment, edge_1.EdgeType.DefinedBy);
455
456
  // kinda dirty, but we have to remove existing read edges for the symbol, added by the child
456
- for (const [id] of [...information.graph.outgoingEdges(nodeToDefine.nodeId) ?? []]) {
457
+ for (const [id] of information.graph.outgoingEdges(nodeToDefine.nodeId) ?? graph_1.NoEdges) {
457
458
  information.graph.removeEdgeType(nodeToDefine.nodeId, id, edge_1.EdgeType.Reads);
458
459
  }
459
460
  }
@@ -486,7 +487,7 @@ function processAssignmentToSymbol(config) {
486
487
  envState = stackEnv;
487
488
  }
488
489
  else if (source.type === type_1.RType.Symbol) {
489
- const defs = (0, resolve_by_name_1.resolveByName)(source.content, data.environment, identifier_1.ReferenceType.Variable);
490
+ const defs = resolve_helper_1.Resolve.byNameAndType(source.content, data.environment, identifier_1.ReferenceType.Variable);
490
491
  envState = defs?.find((d) => d.envState !== undefined)?.envState
491
492
  ?? (0, built_in_envir_utils_1.findReturnsEnvState)(defs);
492
493
  }
@@ -502,7 +503,7 @@ function processAssignmentToSymbol(config) {
502
503
  returnsEnvState = entryVertex.returnEnvState;
503
504
  }
504
505
  else if (vertex_1.FunctionCallVertex.is(entryVertex) && entryVertex.name) {
505
- envState = (0, built_in_envir_utils_1.findReturnsEnvState)((0, resolve_by_name_1.resolveByName)(entryVertex.name, data.environment, identifier_1.ReferenceType.Function));
506
+ envState = (0, built_in_envir_utils_1.findReturnsEnvState)(resolve_helper_1.Resolve.byNameAndType(entryVertex.name, data.environment, identifier_1.ReferenceType.Function));
506
507
  }
507
508
  envState ??= (0, built_in_class_generator_1.resolveConstructorInstanceEnvState)(source, data);
508
509
  }
@@ -9,8 +9,8 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
9
9
  const built_in_list_1 = require("./built-in-list");
10
10
  const built_in_envir_utils_1 = require("./built-in-envir-utils");
11
11
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
12
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
13
12
  const identifier_1 = require("../../../../../environments/identifier");
13
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
14
14
  /** R6's `public` / Reference Class's `methods` argument carrying the class generator's methods. */
15
15
  const MethodListArguments = ['public', 'methods'];
16
16
  /** Processes an `R6Class`/`setRefClass` generator call, tagging it so the assignment layer can record its method list. */
@@ -40,6 +40,6 @@ function resolveConstructorInstanceEnvState(source, data) {
40
40
  if (fieldName !== ConstructorField) {
41
41
  return undefined;
42
42
  }
43
- return (0, built_in_envir_utils_1.findReturnsEnvState)((0, resolve_by_name_1.resolveByName)(callee.accessed.content, data.environment, identifier_1.ReferenceType.Variable));
43
+ return (0, built_in_envir_utils_1.findReturnsEnvState)(resolve_helper_1.Resolve.byNameAndType(callee.accessed.content, data.environment, identifier_1.ReferenceType.Variable));
44
44
  }
45
45
  //# sourceMappingURL=built-in-class-generator.js.map
@@ -13,21 +13,20 @@ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model
13
13
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
14
14
  const unpack_argument_1 = require("../argument/unpack-argument");
15
15
  const decode_1 = require("../../../../../../project/sigdb/decode");
16
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
17
16
  const identifier_1 = require("../../../../../environments/identifier");
18
17
  const define_1 = require("../../../../../environments/define");
19
18
  const environment_1 = require("../../../../../environments/environment");
20
19
  const prefix_1 = require("../../../../../../util/prefix");
21
20
  const built_in_stack_env_1 = require("./built-in-stack-env");
22
- const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
23
21
  const node_value_1 = require("../../../../../eval/resolve/node-value");
24
22
  const resolve_strings_1 = require("../../../../../eval/resolve/resolve-strings");
25
23
  const logger_1 = require("../../../../../logger");
24
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
26
25
  /** A tracked env is a real stack environment (not a private custom env) when its current layer is the global or the built-in/base env. */
27
26
  function isStackEnvState(envState) {
28
27
  return envState.current.globalEnv === true || envState.current.builtInEnv === true;
29
28
  }
30
- /** Maps a list of identifier definitions (from {@link resolveByName}) to an {@link EnvirResolution}, merging the envStates of multiple reaching definitions. */
29
+ /** Maps a list of identifier definitions (from {@link Resolve.byNameAndType}) to an {@link EnvirResolution}, merging the envStates of multiple reaching definitions. */
31
30
  function resolveDefsToEnvirResolution(defs, nodeId, data) {
32
31
  if (!defs || defs.length === 0) {
33
32
  return undefined;
@@ -78,7 +77,7 @@ function resolveConstantString(node, data) {
78
77
  const unshadowed = new Map();
79
78
  const fold = (n) => {
80
79
  if (!r_function_call_1.RFunctionCall.isNamed(n)) {
81
- return (0, alias_tracking_1.resolveIdToSingleString)(n.info.id, info);
80
+ return resolve_helper_1.Resolve.toSingleString(n.info.id, info);
82
81
  }
83
82
  const fnName = identifier_1.Identifier.getName(n.functionName.content);
84
83
  if (!resolve_strings_1.PasteLikeCalls.has(fnName)) {
@@ -86,7 +85,7 @@ function resolveConstantString(node, data) {
86
85
  }
87
86
  let ok = unshadowed.get(fnName);
88
87
  if (ok === undefined) {
89
- const defs = (0, resolve_by_name_1.resolveByName)(n.functionName.content, data.environment, identifier_1.ReferenceType.Function);
88
+ const defs = resolve_helper_1.Resolve.byNameAndType(n.functionName.content, data.environment, identifier_1.ReferenceType.Function);
90
89
  ok = defs === undefined || defs.every(d => (0, identifier_1.isReferenceType)(d.type, identifier_1.ReferenceType.BuiltInFunction));
91
90
  unshadowed.set(fnName, ok);
92
91
  }
@@ -113,7 +112,7 @@ function resolveArgToEnvir(arg, data) {
113
112
  if (node?.type !== type_1.RType.Symbol) {
114
113
  return undefined;
115
114
  }
116
- return resolveDefsToEnvirResolution((0, resolve_by_name_1.resolveByName)(node.content, data.environment, identifier_1.ReferenceType.Variable), node.info.id, data);
115
+ return resolveDefsToEnvirResolution(resolve_helper_1.Resolve.byNameAndType(node.content, data.environment, identifier_1.ReferenceType.Variable), node.info.id, data);
117
116
  }
118
117
  /** Builds an {@link EnvirResolution} for an environment obtained directly (not via a holder variable), e.g. `globalenv()` / `.GlobalEnv`. */
119
118
  function stackEnvirResolution(envState, nodeId, lexeme, data) {
@@ -138,7 +137,7 @@ function resolveEnvirArg(args, data, argName = 'envir') {
138
137
  }
139
138
  /** Resolves a symbol by name to an {@link EnvirResolution} when it holds a tracked environment. */
140
139
  function resolveSymbolToEnvir(symbolName, nodeId, data) {
141
- return resolveDefsToEnvirResolution((0, resolve_by_name_1.resolveByName)(symbolName, data.environment, identifier_1.ReferenceType.Variable), nodeId, data);
140
+ return resolveDefsToEnvirResolution(resolve_helper_1.Resolve.byNameAndType(symbolName, data.environment, identifier_1.ReferenceType.Variable), nodeId, data);
142
141
  }
143
142
  /** Moves definitions written into a custom environment from the caller's scope into `envDef`'s tracked `envState`, re-defining the holder variable. */
144
143
  function routeWrittenToCustomEnv(result, envDef, newDefAt, definedAt) {
@@ -10,7 +10,6 @@ const common_1 = require("../common");
10
10
  const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
11
11
  const graph_1 = require("../../../../../graph/graph");
12
12
  const identifier_1 = require("../../../../../environments/identifier");
13
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
14
13
  const edge_1 = require("../../../../../graph/edge");
15
14
  const vertex_1 = require("../../../../../graph/vertex");
16
15
  const scoping_1 = require("../../../../../environments/scoping");
@@ -21,6 +20,8 @@ const reference_to_maybe_1 = require("../../../../../environments/reference-to-m
21
20
  const apply_kill_1 = require("../../../../../environments/apply-kill");
22
21
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
23
22
  const general_1 = require("../../../../../eval/values/general");
23
+ const vertex_2 = require("../../../../../graph/vertex");
24
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
24
25
  /**
25
26
  * Whether the definitions of this list among the `targets` of a read cover every branch, alone or together.
26
27
  * Only then the read is resolved here and must not bubble up as an ingoing reference.
@@ -40,7 +41,7 @@ function coveredByListDefinitions(targets, listEnvironments) {
40
41
  }
41
42
  function linkReadNameToWriteIfPossible(read, environments, listEnvironments, remainingRead, nextGraph) {
42
43
  const readName = read.name && identifier_1.Identifier.isDotDotDotAccess(read.name) ? identifier_1.Identifier.dotdotdot() : read.name;
43
- const probableTarget = readName ? (0, resolve_by_name_1.resolveByName)(readName, environments, read.type) : undefined;
44
+ const probableTarget = readName ? resolve_helper_1.Resolve.byNameAndType(readName, environments, read.type) : undefined;
44
45
  if (probableTarget === undefined || !coveredByListDefinitions(probableTarget, listEnvironments)) {
45
46
  const readId = readName ? identifier_1.Identifier.getName(readName) : undefined;
46
47
  const has = remainingRead.get(readId);
@@ -90,17 +91,17 @@ function* transitivelyCalledDefinitions(initial, graph, resolveEnv) {
90
91
  const stack = initial.map(fn => ({ fn, direct: true }));
91
92
  while (stack.length > 0) {
92
93
  const { fn, direct } = stack.pop();
93
- if (fn.tag !== vertex_1.VertexType.FunctionDefinition || seen.has(fn.id)) {
94
+ if (!vertex_2.FunctionDefinitionVertex.is(fn) || seen.has(fn.id)) {
94
95
  continue;
95
96
  }
96
97
  seen.add(fn.id);
97
98
  yield { fn, direct };
98
99
  for (const nodeId of fn.subflow.graph) {
99
100
  const call = graph.getVertex(nodeId);
100
- if (call?.tag !== vertex_1.VertexType.FunctionCall || call.onlyBuiltin || call.name === undefined) {
101
+ if (!vertex_2.FunctionCallVertex.is(call) || call.onlyBuiltin || call.name === undefined) {
101
102
  continue;
102
103
  }
103
- const resolved = (0, resolve_by_name_1.resolveByName)(call.name, resolveEnv, identifier_1.ReferenceType.Function);
104
+ const resolved = resolve_helper_1.Resolve.byNameAndType(call.name, resolveEnv, identifier_1.ReferenceType.Function);
104
105
  if (resolved === undefined) {
105
106
  continue;
106
107
  }
@@ -142,7 +143,7 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
142
143
  for (const { functionCall, called } of calledEnvs) {
143
144
  let callDependencies = null;
144
145
  for (const { fn: calledFn, direct } of transitivelyCalledDefinitions(called, nextGraph, inputEnvironment)) {
145
- (0, assert_1.guard)(calledFn.tag === vertex_1.VertexType.FunctionDefinition, 'called function must be a function definition');
146
+ (0, assert_1.guard)(vertex_2.FunctionDefinitionVertex.is(calledFn), 'called function must be a function definition');
146
147
  // only merge the environments they have in common
147
148
  let environment = direct ? calledFn.subflow.environment : withoutPackageLayers(calledFn.subflow.environment);
148
149
  while (environment.level > inputEnvironment.level) {
@@ -23,5 +23,6 @@ export declare function retrieveActiveEnvironment(callerEnvironment: REnvironmen
23
23
  * Update the closure links of all nested function calls, this is probably to be done once at the end of the script
24
24
  * @param graph - dataflow graph to collect the function calls from and to update the closure links for
25
25
  * @param outEnvironment - active environment on resolving closures (i.e., exit of the function definition)
26
+ * @lintIgnore vertex-has-origin
26
27
  */
27
28
  export declare function updateNestedFunctionCalls(graph: DataflowGraph, outEnvironment: REnvironmentInformation, ctx: FlowrAnalyzerContext): void;
@@ -18,13 +18,13 @@ const overwrite_1 = require("../../../../../environments/overwrite");
18
18
  const vertex_1 = require("../../../../../graph/vertex");
19
19
  const built_in_new_env_1 = require("./built-in-new-env");
20
20
  const scoping_1 = require("../../../../../environments/scoping");
21
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
22
21
  const edge_1 = require("../../../../../graph/edge");
23
22
  const log_1 = require("../../../../../../util/log");
24
23
  const built_in_library_1 = require("./built-in-library");
25
24
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
26
25
  const hooks_1 = require("../../../../../hooks");
27
26
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
27
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
28
28
  /**
29
29
  * Process a function definition, i.e., `function(a, b) { ... }`
30
30
  */
@@ -141,7 +141,7 @@ function processFunctionDefinition(name, args, rootId, data) {
141
141
  // an on.exit hook's `<<-` escapes like a body `<<-`; fold its escaping writes into this function's subflow
142
142
  for (const hook of exitHooks) {
143
143
  const vert = subgraph.getVertex(hook.id);
144
- if (vert?.tag !== vertex_1.VertexType.FunctionDefinition) {
144
+ if (!vertex_1.FunctionDefinitionVertex.is(vert)) {
145
145
  continue;
146
146
  }
147
147
  let hookEnvironment = vert.subflow.environment;
@@ -183,7 +183,7 @@ function processFunctionDefinition(name, args, rootId, data) {
183
183
  let afterHookExitPoints = exitPoints?.filter(e => e.type === 1 /* ExitPointType.Return */ || e.type === 0 /* ExitPointType.Default */ || e.type === 4 /* ExitPointType.Error */) ?? [];
184
184
  for (const hook of exitHooks) {
185
185
  const vert = subgraph.getVertex(hook.id);
186
- if (vert?.tag !== vertex_1.VertexType.FunctionDefinition) {
186
+ if (!vertex_1.FunctionDefinitionVertex.is(vert)) {
187
187
  continue;
188
188
  }
189
189
  // call all hooks
@@ -197,13 +197,13 @@ function processFunctionDefinition(name, args, rootId, data) {
197
197
  if (data.ctx.config.solver.trackEnvironments) {
198
198
  for (const ep of afterHookExitPoints) {
199
199
  const epVertex = subgraph.getVertex(ep.nodeId);
200
- if (vertex_1.FunctionCallVertex.is(epVertex) && epVertex.origin.includes(built_in_proc_name_1.BuiltInProcName.NewEnv)) {
200
+ if (vertex_1.FunctionCallVertex.hasOrigin(epVertex, built_in_proc_name_1.BuiltInProcName.NewEnv)) {
201
201
  returnEnvState = (0, built_in_new_env_1.createFreshEnvState)(data, { graph: subgraph, entryPoint: ep.nodeId });
202
202
  break;
203
203
  }
204
204
  const epNode = subgraph.idMap?.get(ep.nodeId);
205
205
  if (epNode?.type === type_1.RType.Symbol) {
206
- const defs = (0, resolve_by_name_1.resolveByName)(epNode.content, outEnvironment, identifier_1.ReferenceType.Variable);
206
+ const defs = resolve_helper_1.Resolve.byNameAndType(epNode.content, outEnvironment, identifier_1.ReferenceType.Variable);
207
207
  const def = defs?.find((d) => d.envState !== undefined);
208
208
  if (def?.envState) {
209
209
  returnEnvState = def.envState;
@@ -258,7 +258,7 @@ function retrieveActiveEnvironment(callerEnvironment, baseEnvironment, ctx) {
258
258
  }
259
259
  function updateDispatches(graph, myArgs) {
260
260
  for (const [, info] of graph.vertices(false)) {
261
- if (info.tag !== vertex_1.VertexType.FunctionCall || (!info.origin.includes(built_in_proc_name_1.BuiltInProcName.S3Dispatch) && !info.origin.includes(built_in_proc_name_1.BuiltInProcName.S7Dispatch))) {
261
+ if (!vertex_1.FunctionCallVertex.is(info) || (!info.origin.includes(built_in_proc_name_1.BuiltInProcName.S3Dispatch) && !info.origin.includes(built_in_proc_name_1.BuiltInProcName.S7Dispatch))) {
262
262
  continue;
263
263
  }
264
264
  if (info.args.length === 0) {
@@ -285,7 +285,7 @@ function updateNestedFunctionClosures(graph, outEnvironment, fnId) {
285
285
  const ingoingRefs = subflow.in;
286
286
  const remainingIn = [];
287
287
  for (const ingoing of ingoingRefs) {
288
- const resolved = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, outEnvironment, ingoing.type) : undefined;
288
+ const resolved = ingoing.name ? resolve_helper_1.Resolve.byNameAndType(ingoing.name, outEnvironment, ingoing.type) : undefined;
289
289
  if (resolved === undefined) {
290
290
  remainingIn.push(ingoing);
291
291
  continue;
@@ -311,7 +311,7 @@ function updateNestedFunctionClosures(graph, outEnvironment, fnId) {
311
311
  function linkSuperAssignmentsToOuterDefinitions(parentGraph, nestedGraphNodeIds, parentEnvironment) {
312
312
  for (const nodeId of nestedGraphNodeIds) {
313
313
  const vertex = parentGraph.getVertex(nodeId);
314
- if (vertex?.tag !== vertex_1.VertexType.FunctionCall || !vertex.origin.includes(built_in_proc_name_1.BuiltInProcName.SuperAssignment)) {
314
+ if (!vertex_1.FunctionCallVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.SuperAssignment)) {
315
315
  continue;
316
316
  }
317
317
  const outgoingReturns = parentGraph.outgoingEdges(nodeId);
@@ -323,7 +323,7 @@ function linkSuperAssignmentsToOuterDefinitions(parentGraph, nestedGraphNodeIds,
323
323
  continue;
324
324
  }
325
325
  const targetVertex = parentGraph.getVertex(targetId);
326
- if (targetVertex?.tag !== vertex_1.VertexType.VariableDefinition) {
326
+ if (!vertex_1.VariableDefinitionVertex.is(targetVertex)) {
327
327
  continue;
328
328
  }
329
329
  const targetNode = parentGraph.idMap?.get(targetId);
@@ -331,7 +331,7 @@ function linkSuperAssignmentsToOuterDefinitions(parentGraph, nestedGraphNodeIds,
331
331
  continue;
332
332
  }
333
333
  const varName = targetNode.content;
334
- const resolved = (0, resolve_by_name_1.resolveByName)(varName, parentEnvironment, identifier_1.ReferenceType.Variable);
334
+ const resolved = resolve_helper_1.Resolve.byNameAndType(varName, parentEnvironment, identifier_1.ReferenceType.Variable);
335
335
  if (resolved) {
336
336
  for (const ref of resolved) {
337
337
  if (ref.nodeId !== targetId && !node_id_1.NodeId.isBuiltIn(ref.nodeId)) {
@@ -346,6 +346,7 @@ function linkSuperAssignmentsToOuterDefinitions(parentGraph, nestedGraphNodeIds,
346
346
  * Update the closure links of all nested function calls, this is probably to be done once at the end of the script
347
347
  * @param graph - dataflow graph to collect the function calls from and to update the closure links for
348
348
  * @param outEnvironment - active environment on resolving closures (i.e., exit of the function definition)
349
+ * @lintIgnore vertex-has-origin
349
350
  */
350
351
  function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
351
352
  // track *all* function definitions - including those nested within the current graph,
@@ -361,7 +362,7 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
361
362
  for (const target of targets) {
362
363
  if (node_id_1.NodeId.isBuiltIn(target)) {
363
364
  // a package export resolved lazily here (nested), so materialize it and link to its loader
364
- const loader = (0, resolve_by_name_1.resolveByName)(name, effectiveEnvironment, identifier_1.ReferenceType.Function)?.find(r => r.nodeId === target)?.definedAt;
365
+ const loader = resolve_helper_1.Resolve.byNameAndType(name, effectiveEnvironment, identifier_1.ReferenceType.Function)?.find(r => r.nodeId === target)?.definedAt;
365
366
  if (loader !== undefined && !node_id_1.NodeId.isBuiltIn(loader)) {
366
367
  (0, built_in_library_1.attachExportVertex)(graph, target, effectiveEnvironment, ctx);
367
368
  graph.addEdge(target, loader, edge_1.EdgeType.Reads | edge_1.EdgeType.Calls);
@@ -371,8 +372,8 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
371
372
  }
372
373
  const targetVertex = graph.getVertex(target);
373
374
  // support reads on symbols
374
- if (targetVertex?.tag !== vertex_1.VertexType.FunctionDefinition) {
375
- if (targetVertex?.tag === vertex_1.VertexType.Use) {
375
+ if (!vertex_1.FunctionDefinitionVertex.is(targetVertex)) {
376
+ if (vertex_1.UseVertex.is(targetVertex)) {
376
377
  graph.addEdge(id, target, edge_1.EdgeType.Reads);
377
378
  }
378
379
  continue;
@@ -389,7 +390,7 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
389
390
  // collect all next method calls to link them to the same targets!
390
391
  for (const s of targetVertex.subflow.graph) {
391
392
  const v = graph.getVertex(s);
392
- if (v?.tag === vertex_1.VertexType.FunctionCall && v.origin.includes(built_in_proc_name_1.BuiltInProcName.S3DispatchNext)) {
393
+ if (vertex_1.FunctionCallVertex.is(v) && v.origin.includes(built_in_proc_name_1.BuiltInProcName.S3DispatchNext)) {
393
394
  collectedNextMethods.add(v.id);
394
395
  }
395
396
  }
@@ -397,7 +398,7 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
397
398
  const ingoingRefs = targetVertex.subflow.in;
398
399
  const remainingIn = [];
399
400
  for (const ingoing of ingoingRefs) {
400
- const resolved = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, effectiveEnvironment, ingoing.type) : undefined;
401
+ const resolved = ingoing.name ? resolve_helper_1.Resolve.byNameAndType(ingoing.name, effectiveEnvironment, ingoing.type) : undefined;
401
402
  if (resolved === undefined) {
402
403
  remainingIn.push(ingoing);
403
404
  continue;
@@ -421,10 +422,10 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
421
422
  for (const nextMethodId of collectedNextMethods) {
422
423
  for (const target of targets) {
423
424
  const targetVertex = graph.getVertex(target);
424
- if (targetVertex?.tag === vertex_1.VertexType.Use) {
425
+ if (vertex_1.UseVertex.is(targetVertex)) {
425
426
  graph.addEdge(nextMethodId, target, edge_1.EdgeType.Reads);
426
427
  }
427
- else if (targetVertex?.tag === vertex_1.VertexType.FunctionDefinition) {
428
+ else if (vertex_1.FunctionDefinitionVertex.is(targetVertex)) {
428
429
  graph.addEdge(nextMethodId, target, edge_1.EdgeType.Calls);
429
430
  }
430
431
  }
@@ -507,7 +508,7 @@ function findPromiseLinkagesForParameters(parameters, readInParameters, paramete
507
508
  // first, we try to bind again within parameters - if we have it, fine
508
509
  const remainingRead = [];
509
510
  for (const read of readInParameters) {
510
- const resolved = read.name ? (0, resolve_by_name_1.resolveByName)(read.name, parameterEnvs, read.type) : undefined;
511
+ const resolved = read.name ? resolve_helper_1.Resolve.byNameAndType(read.name, parameterEnvs, read.type) : undefined;
511
512
  const rid = read.nodeId;
512
513
  if (resolved !== undefined) {
513
514
  for (const { nodeId } of resolved) {
@@ -161,7 +161,9 @@ function processLibrary(name, args, rootId, data, config = {}) {
161
161
  linkLibrary(dependency, info, rootId, data, spec);
162
162
  }
163
163
  else {
164
- info.graph.markIdForUnknownSideEffects(rootId);
164
+ if (!data.ctx.env.knowsPackage(p)) {
165
+ info.graph.markIdForUnknownSideEffects(rootId);
166
+ }
165
167
  if (info.environment.level >= 0) {
166
168
  info.environment = recordUnresolvedLibraryLoad(info.environment, p, rootId, spec.pos, data.cds);
167
169
  }
@@ -330,6 +332,9 @@ function recordUnresolvedLibraryLoad(envInfo, pack, rootId, pos, cds) {
330
332
  */
331
333
  function loadNodesForNamespace(env, pack) {
332
334
  const nodes = [];
335
+ if (env.current.builtInEnv) {
336
+ return nodes; // resolving straight in the built-in environment (`get(x, envir = baseenv())`): no search path above it
337
+ }
333
338
  for (let e = environment_1.REnvironment.findGlobal(env.current).parent; e.t !== undefined && !e.builtInEnv; e = e.parent) {
334
339
  if (e.n !== pack) {
335
340
  continue;
@@ -7,9 +7,9 @@ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
7
7
  const known_call_handling_1 = require("../known-call-handling");
8
8
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
9
9
  const identifier_1 = require("../../../../../environments/identifier");
10
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
11
10
  const define_1 = require("../../../../../environments/define");
12
11
  const scoping_1 = require("../../../../../environments/scoping");
12
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
13
13
  /**
14
14
  * Process a list call.
15
15
  *
@@ -34,7 +34,7 @@ function resolveListToEnvState(source, data) {
34
34
  }
35
35
  const value = arg.value;
36
36
  const isFn = value.type === type_1.RType.FunctionDefinition
37
- || (value.type === type_1.RType.Symbol && ((0, resolve_by_name_1.resolveByName)(value.content, data.environment, identifier_1.ReferenceType.Function)?.length ?? 0) > 0);
37
+ || (value.type === type_1.RType.Symbol && (resolve_helper_1.Resolve.byNameAndType(value.content, data.environment, identifier_1.ReferenceType.Function)?.length ?? 0) > 0);
38
38
  if (!isFn) {
39
39
  continue;
40
40
  }
@@ -9,10 +9,10 @@ const common_1 = require("../common");
9
9
  const unpack_argument_1 = require("../argument/unpack-argument");
10
10
  const scoping_1 = require("../../../../../environments/scoping");
11
11
  const identifier_1 = require("../../../../../environments/identifier");
12
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
13
12
  const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
14
13
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
15
14
  const built_in_envir_utils_1 = require("./built-in-envir-utils");
15
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
16
16
  /**
17
17
  * Processes a built-in 'local' function call.
18
18
  */
@@ -59,7 +59,7 @@ function processLocal(name, args, rootId, data, config) {
59
59
  });
60
60
  const resultEnvironment = envirResolution ? data.environment : (0, scoping_1.popLocalEnvironment)(dfExpr.environment);
61
61
  /* definitions of the local scope vanish with it, only what escaped it (e.g. via `<<-`) may bubble up */
62
- const escaping = envirResolution ? dfExpr.out : dfExpr.out.filter(o => o.name !== undefined && (0, resolve_by_name_1.resolveByName)(o.name, resultEnvironment, o.type)?.some(d => d.nodeId === o.nodeId));
62
+ const escaping = envirResolution ? dfExpr.out : dfExpr.out.filter(o => o.name !== undefined && resolve_helper_1.Resolve.byNameAndType(o.name, resultEnvironment, o.type)?.some(d => d.nodeId === o.nodeId));
63
63
  const ingoing = dfEnv.in.concat(dfExpr.in, dfEnv.unknownReferences, dfExpr.unknownReferences);
64
64
  ingoing.push({ nodeId: rootId, name: name.content, cds: data.cds, type: identifier_1.ReferenceType.Function });
65
65
  const baseResult = {
@@ -68,7 +68,7 @@ function processPipe(name, args, rootId, data, { pipePlaceholderName, assignLhs,
68
68
  if (rhs.type === type_1.RType.Symbol && rhsMightBeSymbol) {
69
69
  // convert a plain symbol on the RHS into a function-call vertex so we can treat it like `df %>% head`
70
70
  const maybeVertex = information.graph.getVertex(rhs.info.id);
71
- if (maybeVertex && maybeVertex.tag === vertex_1.VertexType.Use) {
71
+ if (maybeVertex && vertex_1.UseVertex.is(maybeVertex)) {
72
72
  information.graph.updateToFunctionCall({
73
73
  tag: vertex_1.VertexType.FunctionCall,
74
74
  id: rhs.info.id,
@@ -84,7 +84,7 @@ function processPipe(name, args, rootId, data, { pipePlaceholderName, assignLhs,
84
84
  }
85
85
  if (treatedAsFunctionCall || rhs.type === type_1.RType.FunctionCall) {
86
86
  const functionCallNode = information.graph.getVertex(rhs.info.id);
87
- (0, assert_1.guard)(functionCallNode?.tag === vertex_1.VertexType.FunctionCall, () => `Expected function call node with id ${rhs.info.id} to be a function call node, but got ${functionCallNode?.tag} instead.`);
87
+ (0, assert_1.guard)(vertex_1.FunctionCallVertex.is(functionCallNode), () => `Expected function call node with id ${rhs.info.id} to be a function call node, but got ${functionCallNode?.tag} instead.`);
88
88
  // make the lhs an argument node (or link it to placeholders within the rhs call):
89
89
  const argId = lhs.info.id;
90
90
  // find all symbol occurrences inside the rhs function call AST that match the placeholder name
@@ -4,8 +4,6 @@ exports.processPurrrFormula = processPurrrFormula;
4
4
  const known_call_handling_1 = require("../known-call-handling");
5
5
  const linker_1 = require("../../../../linker");
6
6
  const df_helper_1 = require("../../../../../graph/df-helper");
7
- const vertex_1 = require("../../../../../graph/vertex");
8
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
9
7
  const identifier_1 = require("../../../../../environments/identifier");
10
8
  const common_1 = require("../common");
11
9
  const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
@@ -16,10 +14,12 @@ const edge_1 = require("../../../../../graph/edge");
16
14
  const unpack_argument_1 = require("../argument/unpack-argument");
17
15
  const logger_1 = require("../../../../../logger");
18
16
  const graph_1 = require("../../../../../graph/graph");
17
+ const vertex_1 = require("../../../../../graph/vertex");
18
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
19
19
  function linkOnSymbol(rootId, filteredArgs, node, graph, data) {
20
20
  // If the formula is a symbol naming a function, try to resolve it in the call environment.
21
21
  try {
22
- const defs = (0, resolve_by_name_1.resolveByName)(node.content, data.environment, identifier_1.ReferenceType.Function) ?? [];
22
+ const defs = resolve_helper_1.Resolve.byNameAndType(node.content, data.environment, identifier_1.ReferenceType.Function) ?? [];
23
23
  graph.addEdge(rootId, node.info.id, edge_1.EdgeType.Calls);
24
24
  for (const def of defs) {
25
25
  // Mark the call as calling this target
@@ -102,7 +102,7 @@ function processPurrrFormula(name, args, rootId, data, config) {
102
102
  else {
103
103
  try {
104
104
  df_helper_1.Dataflow.visitDfg(information.graph, formulaNode.info.id, (vtx) => {
105
- if (vtx.tag === vertex_1.VertexType.FunctionCall) {
105
+ if (vertex_1.FunctionCallVertex.is(vtx)) {
106
106
  information.graph.addEdge(rootId, vtx.id, edge_1.EdgeType.Calls);
107
107
  const targets = (0, linker_1.getAllFunctionCallTargets)(vtx.id, information.graph, vtx.environment);
108
108
  for (const t of targets) {
@@ -124,7 +124,7 @@ function processPurrrFormula(name, args, rootId, data, config) {
124
124
  }
125
125
  return !vtx.origin.includes(built_in_proc_name_1.BuiltInProcName.List);
126
126
  }
127
- else if (vtx.tag === vertex_1.VertexType.Use) {
127
+ else if (vertex_1.UseVertex.is(vtx)) {
128
128
  const node = data.completeAst.idMap.get(vtx.id);
129
129
  if (node?.type === type_1.RType.Symbol) {
130
130
  linkOnSymbol(rootId, filteredCallArgs, node, information.graph, data);
@@ -92,7 +92,7 @@ function applyEnvListReplacement(information, env, expr) {
92
92
  try {
93
93
  /* traverse the env processed DFG to find list calls (prefix-aware handling) */
94
94
  df_helper_1.Dataflow.visitDfg(env.graph, env.entryPoint, (vtx) => {
95
- if (vtx.tag !== vertex_1.VertexType.FunctionCall) {
95
+ if (!vertex_1.FunctionCallVertex.is(vtx)) {
96
96
  return;
97
97
  }
98
98
  if (!vtx.origin.includes(built_in_proc_name_1.BuiltInProcName.List)) {