@eagleoutice/flowr 2.13.15 → 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 (225) hide show
  1. package/README.md +31 -37
  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/abstract-interpretation/unsupported-functions.d.ts +1 -0
  10. package/abstract-interpretation/unsupported-functions.js +1 -0
  11. package/benchmark/calibration.d.ts +12 -5
  12. package/benchmark/calibration.js +42 -14
  13. package/benchmark/slicer.d.ts +1 -1
  14. package/benchmark/slicer.js +5 -4
  15. package/benchmark/stats/size-of.js +1 -1
  16. package/benchmark/summarizer/first-phase/process.d.ts +2 -0
  17. package/benchmark/summarizer/first-phase/process.js +2 -0
  18. package/cli/common/options.d.ts +0 -31
  19. package/cli/common/options.js +1 -8
  20. package/cli/common/scripts-info.d.ts +0 -38
  21. package/cli/common/scripts-info.js +0 -8
  22. package/cli/repl/commands/repl-query.js +37 -2
  23. package/cli/repl/core.js +6 -3
  24. package/cli/repl/parser/slice-query-parser.js +1 -1
  25. package/cli/repl/print-version.js +2 -2
  26. package/config.d.ts +16 -0
  27. package/config.js +79 -0
  28. package/control-flow/control-flow-graph.d.ts +2 -0
  29. package/control-flow/control-flow-graph.js +2 -0
  30. package/control-flow/extract-cfg.js +1 -1
  31. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  32. package/control-flow/semantic-cfg-guided-visitor.js +1 -1
  33. package/control-flow/useless-loop.js +1 -1
  34. package/core/print/slice-diff-ansi.js +1 -1
  35. package/core/steps/pipeline/create-pipeline.js +1 -1
  36. package/dataflow/cluster.js +2 -2
  37. package/dataflow/environments/built-in-props.d.ts +8 -1
  38. package/dataflow/environments/built-in-props.js +18 -0
  39. package/dataflow/environments/built-in.d.ts +7 -1
  40. package/dataflow/environments/built-in.js +42 -3
  41. package/dataflow/environments/default-builtin-config.d.ts +442 -10
  42. package/dataflow/environments/default-builtin-config.js +188 -18
  43. package/dataflow/environments/environment.d.ts +1 -1
  44. package/dataflow/environments/identifier.d.ts +7 -2
  45. package/dataflow/environments/identifier.js +6 -1
  46. package/dataflow/environments/query-fn-props.js +2 -2
  47. package/dataflow/environments/reference-to-maybe.js +5 -5
  48. package/dataflow/environments/resolve-by-name.d.ts +3 -0
  49. package/dataflow/environments/resolve-by-name.js +30 -5
  50. package/dataflow/environments/resolve-helper.d.ts +6 -0
  51. package/dataflow/environments/resolve-helper.js +6 -0
  52. package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
  53. package/dataflow/eval/resolve/alias-tracking.js +21 -14
  54. package/dataflow/eval/resolve/node-value.d.ts +6 -0
  55. package/dataflow/eval/resolve/node-value.js +15 -9
  56. package/dataflow/eval/resolve/resolve-argument.js +2 -2
  57. package/dataflow/eval/resolve/resolve-numbers.js +2 -2
  58. package/dataflow/eval/resolve/resolve-operators.js +4 -3
  59. package/dataflow/eval/resolve/resolve-strings.js +3 -3
  60. package/dataflow/eval/resolve/resolve-working-directory.js +2 -1
  61. package/dataflow/eval/resolve/resolve.d.ts +5 -5
  62. package/dataflow/eval/resolve/resolve.js +10 -11
  63. package/dataflow/eval/values/general.d.ts +4 -1
  64. package/dataflow/eval/values/general.js +4 -1
  65. package/dataflow/extractor.js +2 -1
  66. package/dataflow/fn/exceptions-of-function.js +5 -4
  67. package/dataflow/fn/higher-order-function.d.ts +1 -1
  68. package/dataflow/fn/higher-order-function.js +22 -2
  69. package/dataflow/graph/call-graph.d.ts +1 -1
  70. package/dataflow/graph/call-graph.js +15 -15
  71. package/dataflow/graph/df-helper.d.ts +17 -2
  72. package/dataflow/graph/df-helper.js +11 -5
  73. package/dataflow/graph/diff-dataflow-graph.js +6 -6
  74. package/dataflow/graph/edge.d.ts +27 -0
  75. package/dataflow/graph/edge.js +33 -0
  76. package/dataflow/graph/graph-helper.d.ts +4 -4
  77. package/dataflow/graph/graph-helper.js +5 -5
  78. package/dataflow/graph/graph.d.ts +11 -1
  79. package/dataflow/graph/graph.js +16 -5
  80. package/dataflow/graph/vertex.d.ts +47 -6
  81. package/dataflow/graph/vertex.js +47 -6
  82. package/dataflow/internal/linker.d.ts +1 -0
  83. package/dataflow/internal/linker.js +11 -9
  84. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  85. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  86. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
  87. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
  88. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
  89. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
  90. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
  91. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
  92. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
  93. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  94. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
  95. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  96. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
  97. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
  98. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
  99. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
  100. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
  101. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  102. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  103. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +8 -2
  104. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
  106. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
  107. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -12
  108. package/dataflow/internal/process/functions/call/common.d.ts +9 -1
  109. package/dataflow/internal/process/functions/call/common.js +17 -6
  110. package/dataflow/internal/process/functions/call/deferred.d.ts +7 -0
  111. package/dataflow/internal/process/functions/call/deferred.js +24 -1
  112. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
  113. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
  114. package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
  115. package/dataflow/internal/process/functions/call/nse.d.ts +34 -5
  116. package/dataflow/internal/process/functions/call/nse.js +114 -6
  117. package/dataflow/internal/process/functions/call/quoted.d.ts +6 -0
  118. package/dataflow/internal/process/functions/call/quoted.js +26 -11
  119. package/dataflow/origin/dfg-get-origin.d.ts +1 -0
  120. package/dataflow/origin/dfg-get-origin.js +9 -6
  121. package/documentation/data/faq/faqs.js +88 -88
  122. package/documentation/data/faq/recommended-configs.js +1 -1
  123. package/documentation/data/faq/wiki-faq-store.js +1 -1
  124. package/documentation/doc-capabilities.js +1 -1
  125. package/documentation/doc-readme.js +1 -1
  126. package/documentation/doc-util/doc-auto-gen.js +6 -2
  127. package/documentation/doc-util/doc-functions.js +1 -1
  128. package/documentation/wiki-cfg.js +2 -2
  129. package/documentation/wiki-create-linting-rules.js +45 -45
  130. package/documentation/wiki-dataflow-graph.js +25 -18
  131. package/documentation/wiki-linting-and-testing.js +93 -5
  132. package/documentation/wiki-mk/doc-maker.js +1 -1
  133. package/documentation/wiki-overview.js +12 -1
  134. package/documentation/wiki-signature-database.js +3 -0
  135. package/linter/linter-format.d.ts +1 -0
  136. package/linter/linter-format.js +1 -0
  137. package/linter/rules/file-path-validity.js +1 -1
  138. package/linter/rules/function-finder-util.js +1 -1
  139. package/linter/rules/naming-convention.js +1 -1
  140. package/linter/rules/no-leaked-credentials.js +2 -1
  141. package/linter/rules/stop-with-call-arg.js +4 -4
  142. package/linter/rules/undefined-symbol-util.d.ts +1 -1
  143. package/linter/rules/undefined-symbol-util.js +5 -4
  144. package/linter/rules/undefined-symbol.js +3 -3
  145. package/linter/rules/unused-definition.js +2 -1
  146. package/package.json +35 -45
  147. package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
  148. package/project/context/flowr-analyzer-environment-context.js +25 -0
  149. package/project/dependency-version-space.js +1 -2
  150. package/project/flowr-analyzer.js +1 -1
  151. package/project/plugins/file-plugins/files/flowr-rda-file.js +3 -3
  152. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
  153. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +3 -1
  154. package/project/sigdb/build.js +16 -16
  155. package/project/sigdb/codec.d.ts +1 -1
  156. package/project/sigdb/codec.js +13 -13
  157. package/project/sigdb/decompress.d.ts +1 -1
  158. package/project/sigdb/decompress.js +33 -33
  159. package/project/sigdb/index-format.js +2 -2
  160. package/project/sigdb/manifest.js +21 -21
  161. package/project/sigdb/memory-source.d.ts +64 -0
  162. package/project/sigdb/memory-source.js +133 -0
  163. package/project/sigdb/reader.js +13 -13
  164. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  165. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  166. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
  167. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  168. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  169. package/queries/catalog/dependencies-query/link-devices.js +2 -2
  170. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
  171. package/queries/catalog/does-call-query/does-call-query-format.js +2 -1
  172. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -1
  173. package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
  174. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -1
  175. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
  176. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
  177. package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
  178. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  179. package/queries/catalog/provenance-query/provenance-query-format.js +1 -1
  180. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  181. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  182. package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
  183. package/queries/catalog/signature-query/signature-query-executor.js +3 -2
  184. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  185. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  186. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
  187. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  188. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  189. package/r-bridge/retriever.d.ts +2 -1
  190. package/r-bridge/retriever.js +3 -2
  191. package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
  192. package/r-bridge/roxygen2/documentation-provider.js +1 -0
  193. package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
  194. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  195. package/search/flowr-search-filters.d.ts +1 -1
  196. package/search/flowr-search-filters.js +2 -2
  197. package/search/search-executor/search-enrichers.js +4 -4
  198. package/search/search-executor/search-generators.js +1 -1
  199. package/slicing/criterion/parse.d.ts +1 -0
  200. package/slicing/criterion/parse.js +4 -3
  201. package/slicing/static/slice-call.d.ts +1 -1
  202. package/slicing/static/slice-call.js +2 -2
  203. package/slicing/static/static-slicer.js +4 -3
  204. package/util/assert.js +1 -1
  205. package/util/log.d.ts +4 -1
  206. package/util/log.js +15 -2
  207. package/util/logic.js +2 -2
  208. package/util/mermaid/cfg.js +1 -1
  209. package/util/mermaid/dfg.js +6 -6
  210. package/util/mermaid/mermaid.js +3 -1
  211. package/util/quads.js +19 -6
  212. package/util/r-version.d.ts +2 -0
  213. package/util/r-version.js +2 -0
  214. package/util/record.d.ts +1 -0
  215. package/util/record.js +1 -0
  216. package/util/schema.js +2 -2
  217. package/util/text/ansi.d.ts +2 -0
  218. package/util/text/ansi.js +8 -0
  219. package/util/text/name-rank.d.ts +29 -0
  220. package/util/text/name-rank.js +39 -0
  221. package/util/text/url-encoding.d.ts +15 -0
  222. package/util/text/url-encoding.js +59 -0
  223. package/util/version.js +1 -1
  224. package/cli/export-quads-app.d.ts +0 -7
  225. package/cli/export-quads-app.js +0 -44
@@ -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)) {
@@ -6,12 +6,12 @@ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model
6
6
  const linker_1 = require("../../../../linker");
7
7
  const common_1 = require("../common");
8
8
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
9
- const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
10
9
  const node_value_1 = require("../../../../../eval/resolve/node-value");
11
10
  const general_1 = require("../../../../../eval/values/general");
12
11
  const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
13
12
  const range_1 = require("../../../../../../util/range");
14
13
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
14
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
15
15
  /**
16
16
  * Process a hook such as `on.exit`
17
17
  */
@@ -64,10 +64,10 @@ function processRegisterHook(name, args, rootId, data, config) {
64
64
  const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: transformed, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.RegisterHook });
65
65
  const resolveArgs = node_value_1.NodeValue.infoOf(data, { graph: res.information.graph, environment: res.information.environment });
66
66
  const shouldAdd = addIds.size === 0 ? config.args.add?.default :
67
- Array.from(addIds).flatMap(id => (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(id, resolveArgs))?.elements ?? [])
67
+ Array.from(addIds).flatMap(id => (0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(id, resolveArgs))?.elements ?? [])
68
68
  .some(v => v.type === 'logical' && v.value !== false);
69
69
  const shouldBeAfter = afterIds.size === 0 ? config.args.after?.default :
70
- Array.from(afterIds).flatMap(id => (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(id, resolveArgs))?.elements ?? [])
70
+ Array.from(afterIds).flatMap(id => (0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(id, resolveArgs))?.elements ?? [])
71
71
  .some(v => v.type === 'logical' && v.value !== false);
72
72
  const info = res.information;
73
73
  const hooks = Array.from(wrappedFunctions, id => ({
@@ -8,7 +8,6 @@ const common_1 = require("../common");
8
8
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
9
9
  const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
10
10
  const logger_1 = require("../../../../../logger");
11
- const vertex_1 = require("../../../../../graph/vertex");
12
11
  const edge_1 = require("../../../../../graph/edge");
13
12
  const unpack_argument_1 = require("../argument/unpack-argument");
14
13
  const built_in_access_1 = require("./built-in-access");
@@ -22,6 +21,7 @@ const r_access_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/
22
21
  const graph_1 = require("../../../../../graph/graph");
23
22
  const range_1 = require("../../../../../../util/range");
24
23
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
24
+ const vertex_1 = require("../../../../../graph/vertex");
25
25
  /**
26
26
  * Process a replacement function call like `<-`, `[[<-`, `$<-`, etc.
27
27
  * These are automatically created when doing assignments like `x[y] <- value` or in general `fun(x) <- value` will call `fun<- (x, value)`.
@@ -57,11 +57,11 @@ args, rootId, data, config) {
57
57
  canBeReplacement: true
58
58
  });
59
59
  const createdVert = res.graph.getVertex(rootId);
60
- if (createdVert?.tag === vertex_1.VertexType.FunctionCall) {
60
+ if (vertex_1.FunctionCallVertex.is(createdVert)) {
61
61
  createdVert.origin = [built_in_proc_name_1.BuiltInProcName.Replacement];
62
62
  }
63
63
  const targetVert = res.graph.getVertex((0, unpack_argument_1.unpackArg)(args[0])?.info.id);
64
- if (targetVert?.tag === vertex_1.VertexType.VariableDefinition) {
64
+ if (vertex_1.VariableDefinitionVertex.is(targetVert)) {
65
65
  targetVert.par = true;
66
66
  }
67
67
  const convertedArgs = config.readIndices ? args.slice(1, -1) : (0, built_in_access_1.symbolArgumentsToStrings)(args.slice(1, -1), 0);
@@ -10,10 +10,10 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
10
10
  const prefix_1 = require("../../../../../../util/prefix");
11
11
  const node_value_1 = require("../../../../../eval/resolve/node-value");
12
12
  const r_value_1 = require("../../../../../eval/values/r-value");
13
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
14
13
  const apply_kill_1 = require("../../../../../environments/apply-kill");
15
14
  const define_1 = require("../../../../../environments/define");
16
15
  const built_in_envir_utils_1 = require("./built-in-envir-utils");
16
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
17
17
  /** whether `value` is a call to the *built-in* `ls`/`objects` that lists (and thus clears) the whole scope */
18
18
  function isBuiltInLsCall(value, data) {
19
19
  if (value.type !== type_1.RType.FunctionCall || !value.named) {
@@ -32,7 +32,7 @@ function isBuiltInLsCall(value, data) {
32
32
  if (ns === 'base') {
33
33
  return true;
34
34
  }
35
- const resolved = (0, resolve_by_name_1.resolveByName)(fn, data.environment, identifier_1.ReferenceType.Function);
35
+ const resolved = resolve_helper_1.Resolve.byNameAndType(fn, data.environment, identifier_1.ReferenceType.Function);
36
36
  return resolved === undefined || resolved.every(d => (0, identifier_1.isReferenceType)(d.type, identifier_1.ReferenceType.BuiltInFunction));
37
37
  }
38
38
  /** formal parameters of `rm` that may be given by name; every other positional argument belongs to `...` */
@@ -68,7 +68,7 @@ function processS7NewGeneric(name, args, rootId, data, config) {
68
68
  info.graph.addEdge(rootId, funArg, edge_1.EdgeType.Returns);
69
69
  info.entryPoint = funArg;
70
70
  const fArg = info.graph.getVertex(funArg);
71
- if (fArg?.tag === vertex_1.VertexType.FunctionDefinition) {
71
+ if (vertex_1.FunctionDefinitionVertex.is(fArg)) {
72
72
  fArg.mode ??= ['s4', 's7'];
73
73
  }
74
74
  return info;
@@ -86,7 +86,7 @@ function processMakeConstructor(name, args, rootId, data, config) {
86
86
  info.graph.addEdge(rootId, funId, edge_1.EdgeType.Returns);
87
87
  info.entryPoint = funId;
88
88
  const fArg = info.graph.getVertex(funId);
89
- if (fArg?.tag === vertex_1.VertexType.FunctionDefinition && config?.mode) {
89
+ if (vertex_1.FunctionDefinitionVertex.is(fArg) && config?.mode) {
90
90
  fArg.mode ??= config.mode.slice(); // copy: mode is mutated in place later, config.mode is shared
91
91
  }
92
92
  if (config?.wrapIndex !== undefined) {
@@ -121,7 +121,7 @@ function linkWrappedFunction(info, args, wrapIndex, wrapName, data) {
121
121
  return;
122
122
  }
123
123
  const vertex = info.graph.getVertex(resolved.functionId);
124
- if (vertex?.tag !== vertex_1.VertexType.Use) {
124
+ if (!vertex_1.UseVertex.is(vertex)) {
125
125
  return;
126
126
  }
127
127
  info.graph.updateToFunctionCall({
@@ -45,7 +45,7 @@ export declare function processSourceCall<OtherInfo>(name: RSymbol<OtherInfo & P
45
45
  * Processes a source request with the given dataflow processor information and existing dataflow information
46
46
  * Otherwise, this can be an {@link RProjectFile} representing a standalone source file
47
47
  */
48
- export declare function sourceRequest<OtherInfo>(rootId: NodeId, request: RParseRequest | RProjectFile<OtherInfo & ParentInformation>, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, information: DataflowInformation, makeMaybe: boolean, getId?: IdGenerator<NoInfo>): DataflowInformation;
48
+ export declare function sourceRequest<OtherInfo>(rootId: NodeId, request: RParseRequest | RProjectFile<OtherInfo & ParentInformation>, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, information: DataflowInformation, makeMaybe: boolean, getId?: IdGenerator<NoInfo>, evaluatedByRoot?: boolean): DataflowInformation;
49
49
  /**
50
50
  * Processes a standalone source file (i.e., not from a source function call)
51
51
  */
@@ -193,7 +193,7 @@ function processSourceCall(name, args, rootId, data, config) {
193
193
  * Processes a source request with the given dataflow processor information and existing dataflow information
194
194
  * Otherwise, this can be an {@link RProjectFile} representing a standalone source file
195
195
  */
196
- function sourceRequest(rootId, request, data, information, makeMaybe, getId) {
196
+ function sourceRequest(rootId, request, data, information, makeMaybe, getId, evaluatedByRoot = false) {
197
197
  // parse, normalize and dataflow the sourced file
198
198
  let dataflow;
199
199
  let fst;
@@ -261,7 +261,13 @@ function sourceRequest(rootId, request, data, information, makeMaybe, getId) {
261
261
  }
262
262
  // take the entry point as well as all the written references, and give them a control dependency to the source call to show that they are conditional
263
263
  if (!String(rootId).startsWith('file-')) {
264
- if (makeMaybe) {
264
+ if (evaluatedByRoot) {
265
+ /* the call evaluates the code and builds its result from it, so the value flows into the call */
266
+ for (const exit of dataflow.exitPoints) {
267
+ dataflow.graph.addEdge(rootId, exit.nodeId, edge_1.EdgeType.Reads);
268
+ }
269
+ }
270
+ else if (makeMaybe) {
265
271
  if (dataflow.graph.hasVertex(dataflow.entryPoint)) {
266
272
  dataflow.graph.addControlDependency(dataflow.entryPoint, rootId, true);
267
273
  }
@@ -94,7 +94,7 @@ function processStringTemplate(name, args, rootId, data, config) {
94
94
  const template = arg.value;
95
95
  for (const code of interpolationsOf(template.content.str, open, close, config.markup)) {
96
96
  const generator = (0, decorate_1.sourcedDeterministicCountingIdGenerator)(`${name.lexeme}::${template.info.id}`, template.location);
97
- const result = (0, built_in_source_1.sourceRequest)(rootId, (0, retriever_1.requestFromInput)(code), data, information, false, generator);
97
+ const result = (0, built_in_source_1.sourceRequest)(rootId, (0, retriever_1.requestFromInput)(code), data, information, false, generator, true);
98
98
  /* the template stands where the call does, so what it leaves open resolves against the bindings here */
99
99
  (0, linker_1.linkInputs)([...result.in, ...result.unknownReferences], data.environment, [], result.graph, false);
100
100
  results.push(result);
@@ -121,7 +121,7 @@ function promoteCallToFunction(call, arg, info, data) {
121
121
  if (anonymous) {
122
122
  info.graph.addEdge(arg, functionId, edge_1.EdgeType.Calls | edge_1.EdgeType.Reads);
123
123
  const dfVert = info.graph.getVertex(call);
124
- if (dfVert && dfVert.tag === vertex_1.VertexType.FunctionDefinition) {
124
+ if (dfVert && vertex_1.FunctionDefinitionVertex.is(dfVert)) {
125
125
  linker_1.ClosureRefs.resolveOpenIngoing(info.graph, call, dfVert, data.environment);
126
126
  }
127
127
  // we did the linking
@@ -145,7 +145,7 @@ function getExitPoints(vertex, graph) {
145
145
  if (!vertex) {
146
146
  return undefined;
147
147
  }
148
- if (vertex.tag === vertex_1.VertexType.FunctionDefinition) {
148
+ if (vertex_1.FunctionDefinitionVertex.is(vertex)) {
149
149
  return vertex.exitPoints;
150
150
  }
151
151
  // we assumed named argument
@@ -155,7 +155,7 @@ function getExitPoints(vertex, graph) {
155
155
  }
156
156
  if (n.type === type_1.RType.Argument && n.value?.type === type_1.RType.FunctionDefinition) {
157
157
  const fdefV = graph.getVertex(n.value.info.id);
158
- if (fdefV?.tag === vertex_1.VertexType.FunctionDefinition) {
158
+ if (vertex_1.FunctionDefinitionVertex.is(fdefV)) {
159
159
  return fdefV.exitPoints;
160
160
  }
161
161
  }
@@ -1,5 +1,5 @@
1
1
  import type { DataflowGraph } from '../../../../../graph/graph';
2
- import { type DataflowGraphVertexFunctionDefinition } from '../../../../../graph/vertex';
2
+ import type { DataflowGraphVertexFunctionDefinition } from '../../../../../graph/vertex';
3
3
  import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
4
  import { type REnvironmentInformation } from '../../../../../environments/environment';
5
5
  import type { FlowrAnalyzerContext } from '../../../../../../project/context/flowr-analyzer-context';
@@ -9,6 +9,7 @@ import type { IdentifierReference } from '../../../../../environments/identifier
9
9
  * @param graph - the fully linked dataflow graph
10
10
  * @param own - the effects a single function definition produces itself (its contribution to the summary)
11
11
  * @returns a map from each function-definition vertex to its transitive-effect summary
12
+ * @useInstead {@link Dataflow.sideEffects.callGraphSummaries}
12
13
  */
13
14
  export declare function computeCallGraphSummaries<T>(this: void, graph: DataflowGraph, own: (id: NodeId, fdef: DataflowGraphVertexFunctionDefinition) => Iterable<T>): Map<NodeId, Set<T>>;
14
15
  /**
@@ -22,6 +23,7 @@ export declare function reResolveOpenReferences(this: void, graph: DataflowGraph
22
23
  /**
23
24
  * Propagates every function's escaped side effects (attached packages and `<<-` definitions) to its transitive callers.
24
25
  * @returns the enriched top-level environment and whether it grew (so the extractor can re-link and re-run to a fixpoint).
26
+ * @useInstead {@link Dataflow.sideEffects.propagateTransitive}
25
27
  */
26
28
  export declare function propagateTransitiveSideEffects(this: void, graph: DataflowGraph, environment: REnvironmentInformation, ctx: FlowrAnalyzerContext): {
27
29
  environment: REnvironmentInformation;
@@ -4,20 +4,21 @@ exports.computeCallGraphSummaries = computeCallGraphSummaries;
4
4
  exports.linkMaterializedExportsToLoaders = linkMaterializedExportsToLoaders;
5
5
  exports.reResolveOpenReferences = reResolveOpenReferences;
6
6
  exports.propagateTransitiveSideEffects = propagateTransitiveSideEffects;
7
- const vertex_1 = require("../../../../../graph/vertex");
8
7
  const edge_1 = require("../../../../../graph/edge");
9
8
  const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
10
9
  const environment_1 = require("../../../../../environments/environment");
11
10
  const built_in_library_1 = require("./built-in-library");
12
11
  const define_1 = require("../../../../../environments/define");
13
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
12
+ const vertex_1 = require("../../../../../graph/vertex");
13
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
14
+ const graph_1 = require("../../../../../graph/graph");
14
15
  /**
15
16
  * The function-definition vertices a `call` resolves to (via {@link EdgeType.Calls}).
16
17
  */
17
18
  function calledDefinitions(graph, call) {
18
19
  const targets = [];
19
- for (const [target, edge] of graph.outgoingEdges(call) ?? []) {
20
- if ((edge.types & edge_1.EdgeType.Calls) !== 0 && graph.getVertex(target)?.tag === vertex_1.VertexType.FunctionDefinition) {
20
+ for (const [target, edge] of graph.outgoingEdges(call) ?? graph_1.NoEdges) {
21
+ if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls) && vertex_1.FunctionDefinitionVertex.is(graph.getVertex(target))) {
21
22
  targets.push(target);
22
23
  }
23
24
  }
@@ -28,18 +29,19 @@ function calledDefinitions(graph, call) {
28
29
  * @param graph - the fully linked dataflow graph
29
30
  * @param own - the effects a single function definition produces itself (its contribution to the summary)
30
31
  * @returns a map from each function-definition vertex to its transitive-effect summary
32
+ * @useInstead {@link Dataflow.sideEffects.callGraphSummaries}
31
33
  */
32
34
  function computeCallGraphSummaries(graph, own) {
33
35
  const summary = new Map();
34
36
  const callees = new Map();
35
37
  for (const [id, vertex] of graph.vertices(true)) {
36
- if (vertex.tag !== vertex_1.VertexType.FunctionDefinition) {
38
+ if (!vertex_1.FunctionDefinitionVertex.is(vertex)) {
37
39
  continue;
38
40
  }
39
41
  summary.set(id, new Set(own(id, vertex)));
40
42
  const targets = [];
41
43
  for (const node of vertex.subflow.graph) {
42
- if (graph.getVertex(node)?.tag === vertex_1.VertexType.FunctionCall) {
44
+ if (vertex_1.FunctionCallVertex.is(graph.getVertex(node))) {
43
45
  targets.push(...calledDefinitions(graph, node));
44
46
  }
45
47
  }
@@ -168,7 +170,7 @@ function escapedDefinitions() {
168
170
  function propagateTransitiveDefinitions(graph, environment, ctx) {
169
171
  const summary = computeCallGraphSummaries(graph, escapedDefinitions());
170
172
  for (const [id, vertex] of graph.vertices(true)) {
171
- if (vertex.tag !== vertex_1.VertexType.FunctionCall) {
173
+ if (!vertex_1.FunctionCallVertex.is(vertex)) {
172
174
  continue;
173
175
  }
174
176
  for (const target of calledDefinitions(graph, id)) {
@@ -191,7 +193,7 @@ function propagateTransitivePackages(graph, environment, ctx) {
191
193
  const summary = computeCallGraphSummaries(graph, attachedPackages);
192
194
  const reachable = new Map(); // package -> its loading `library()` call
193
195
  for (const [id, vertex] of graph.vertices(true)) {
194
- if (vertex.tag !== vertex_1.VertexType.FunctionCall || !graph.isRoot(id)) {
196
+ if (!vertex_1.FunctionCallVertex.is(vertex) || !graph.isRoot(id)) {
195
197
  continue;
196
198
  }
197
199
  for (const target of calledDefinitions(graph, id)) {
@@ -221,7 +223,7 @@ function escapedDefinitionMap(graph) {
221
223
  const map = new Map();
222
224
  const seen = new Set();
223
225
  for (const [, vertex] of graph.vertices(true)) {
224
- if (vertex.tag !== vertex_1.VertexType.FunctionDefinition) {
226
+ if (!vertex_1.FunctionDefinitionVertex.is(vertex)) {
225
227
  continue;
226
228
  }
227
229
  for (const e of escapeTargetFrames(vertex)) {
@@ -251,7 +253,7 @@ function propagateTransitiveEscapedDefinitions(graph, environment) {
251
253
  const names = new Set();
252
254
  let grew = false;
253
255
  for (const [id, vertex] of graph.vertices(true)) {
254
- if (vertex.tag !== vertex_1.VertexType.FunctionCall || !graph.isRoot(id)) {
256
+ if (!vertex_1.FunctionCallVertex.is(vertex) || !graph.isRoot(id)) {
255
257
  continue;
256
258
  }
257
259
  for (const target of calledDefinitions(graph, id)) {
@@ -261,7 +263,7 @@ function propagateTransitiveEscapedDefinitions(graph, environment) {
261
263
  continue;
262
264
  }
263
265
  names.add(def.name);
264
- if ((0, resolve_by_name_1.resolveByName)(def.name, environment, def.type)?.some(d => d.nodeId === nodeId)) {
266
+ if (resolve_helper_1.Resolve.byNameAndType(def.name, environment, def.type)?.some(d => d.nodeId === nodeId)) {
265
267
  continue;
266
268
  }
267
269
  environment = (0, define_1.define)(def, false, environment);
@@ -277,7 +279,7 @@ function reResolveOpenReferences(graph, environment, references, escapedNames) {
277
279
  if (ref.name === undefined || !escapedNames.has(String(ref.name))) {
278
280
  continue;
279
281
  }
280
- for (const { nodeId } of (0, resolve_by_name_1.resolveByName)(ref.name, environment, ref.type) ?? []) {
282
+ for (const { nodeId } of resolve_helper_1.Resolve.byNameAndType(ref.name, environment, ref.type) ?? []) {
281
283
  if (!node_id_1.NodeId.isBuiltIn(nodeId) && nodeId !== ref.nodeId) {
282
284
  graph.addEdge(ref.nodeId, nodeId, edge_1.EdgeType.Reads);
283
285
  }
@@ -287,6 +289,7 @@ function reResolveOpenReferences(graph, environment, references, escapedNames) {
287
289
  /**
288
290
  * Propagates every function's escaped side effects (attached packages and `<<-` definitions) to its transitive callers.
289
291
  * @returns the enriched top-level environment and whether it grew (so the extractor can re-link and re-run to a fixpoint).
292
+ * @useInstead {@link Dataflow.sideEffects.propagateTransitive}
290
293
  */
291
294
  function propagateTransitiveSideEffects(graph, environment, ctx) {
292
295
  propagateTransitiveDefinitions(graph, environment, ctx);
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Argument processing shared by the call processors.
3
+ * Importing the `Resolve` helper here pulls the evaluator in before the built-in configuration is
4
+ * initialized, so this file keeps the direct import.
5
+ * @lintIgnore use-instead
6
+ */
1
7
  import { type DataflowInformation } from '../../../../info';
2
8
  import { type DataflowProcessorInformation } from '../../../../processor';
3
9
  import type { RNode } from '../../../../../r-bridge/lang-4.x/ast/model/model';
@@ -22,6 +28,8 @@ export interface ProcessAllArgumentInput<OtherInfo> extends ForceArguments {
22
28
  readonly patchData?: (data: DataflowProcessorInformation<OtherInfo & ParentInformation>, i: number) => DataflowProcessorInformation<OtherInfo & ParentInformation>;
23
29
  /** which arguments are to be marked as {@link EdgeType#NonStandardEvaluation|non-standard-evaluation}? */
24
30
  readonly markAsNSE?: readonly number[];
31
+ /** symbols that name data rather than code, so they must not resolve to a function of the same name */
32
+ readonly nonFunction?: ReadonlySet<NodeId>;
25
33
  }
26
34
  export interface ProcessAllArgumentResult {
27
35
  readonly finalEnv: REnvironmentInformation;
@@ -44,7 +52,7 @@ export declare function convertFnArgument<OtherInfo>(this: void, arg: typeof Emp
44
52
  /**
45
53
  * Processes all arguments for a function call, updating the given final graph and environment.
46
54
  */
47
- export declare function processAllArguments<OtherInfo>({ functionName, args, data, finalGraph, functionRootId, forceArgs, patchData }: ProcessAllArgumentInput<OtherInfo>): ProcessAllArgumentResult;
55
+ export declare function processAllArguments<OtherInfo>({ functionName, args, data, finalGraph, functionRootId, forceArgs, patchData, nonFunction }: ProcessAllArgumentInput<OtherInfo>): ProcessAllArgumentResult;
48
56
  export interface PatchFunctionCallInput<OtherInfo> {
49
57
  readonly nextGraph: DataflowGraph;
50
58
  readonly rootId: NodeId;
@@ -4,6 +4,12 @@ exports.convertFnArguments = convertFnArguments;
4
4
  exports.convertFnArgument = convertFnArgument;
5
5
  exports.processAllArguments = processAllArguments;
6
6
  exports.patchFunctionCall = patchFunctionCall;
7
+ /**
8
+ * Argument processing shared by the call processors.
9
+ * Importing the `Resolve` helper here pulls the evaluator in before the built-in configuration is
10
+ * initialized, so this file keeps the direct import.
11
+ * @lintIgnore use-instead
12
+ */
7
13
  const info_1 = require("../../../../info");
8
14
  const processor_1 = require("../../../../processor");
9
15
  const model_1 = require("../../../../../r-bridge/lang-4.x/ast/model/model");
@@ -16,18 +22,19 @@ const process_argument_1 = require("../process-argument");
16
22
  const vertex_1 = require("../../../../graph/vertex");
17
23
  const edge_1 = require("../../../../graph/edge");
18
24
  const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
25
+ const vertex_2 = require("../../../../graph/vertex");
19
26
  function forceVertexArgumentValueReferences(rootId, value, graph, env) {
20
27
  const valueVertex = graph.getVertex(value.entryPoint);
21
28
  if (!valueVertex) {
22
29
  return;
23
30
  }
24
31
  // link read if it is function definition directly and reference the exit point
25
- if (valueVertex.tag === vertex_1.VertexType.FunctionDefinition) {
32
+ if (vertex_2.FunctionDefinitionVertex.is(valueVertex)) {
26
33
  for (const exit of valueVertex.exitPoints) {
27
34
  graph.addEdge(rootId, exit.nodeId, edge_1.EdgeType.Reads);
28
35
  }
29
36
  }
30
- else if (valueVertex.tag !== vertex_1.VertexType.Value) {
37
+ else if (!vertex_2.ValueVertex.is(valueVertex)) {
31
38
  for (const exit of value.exitPoints) {
32
39
  graph.addEdge(rootId, exit.nodeId, edge_1.EdgeType.Reads);
33
40
  }
@@ -80,7 +87,7 @@ function convertFnArgument(arg) {
80
87
  /**
81
88
  * Processes all arguments for a function call, updating the given final graph and environment.
82
89
  */
83
- function processAllArguments({ functionName, args, data, finalGraph, functionRootId, forceArgs = [], patchData }) {
90
+ function processAllArguments({ functionName, args, data, finalGraph, functionRootId, forceArgs = [], patchData, nonFunction }) {
84
91
  let finalEnv = functionName.environment;
85
92
  // arg env contains the environments with other args defined
86
93
  let argEnv = functionName.environment;
@@ -112,10 +119,14 @@ function processAllArguments({ functionName, args, data, finalGraph, functionRoo
112
119
  finalGraph.mergeWith(processed.graph);
113
120
  // resolve reads within argument, we resolve before adding the `processed.environment` to avoid cyclic dependencies
114
121
  for (const l of [processed.in, processed.unknownReferences]) {
115
- for (const ingoing of l) {
122
+ for (const original of l) {
116
123
  // check if it is called directly
117
- const inId = ingoing.nodeId;
118
- const refType = finalGraph.getVertex(inId)?.tag === vertex_1.VertexType.FunctionCall ? identifier_1.ReferenceType.Function : identifier_1.ReferenceType.Unknown;
124
+ const inId = original.nodeId;
125
+ /* a data argument holds a value, so a function of that name is not what it reads; the narrowed
126
+ type stays on the reference as it bubbles through the enclosing calls */
127
+ const ingoing = nonFunction?.has(inId) ? { ...original, type: identifier_1.ReferenceType.NonFunction } : original;
128
+ const refType = vertex_2.FunctionCallVertex.is(finalGraph.getVertex(inId)) ? identifier_1.ReferenceType.Function
129
+ : ingoing.type === identifier_1.ReferenceType.NonFunction ? identifier_1.ReferenceType.NonFunction : identifier_1.ReferenceType.Unknown;
119
130
  const tryToResolve = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, data.environment, refType) : undefined;
120
131
  if (tryToResolve === undefined) {
121
132
  remainingReadInArgs.push(ingoing);
@@ -24,6 +24,7 @@ interface NameIndex {
24
24
  * really depending on it, can be missed.
25
25
  */
26
26
  export declare const Deferred: {
27
+ readonly name: "Deferred";
27
28
  /** Where each name is bound and read, built once and shared by every deferred expression in the graph. */
28
29
  readonly indexOf: <Info>(this: void, graph: DataflowGraph, idMap: AstIdMap<Info & ParentInformation>) => NameIndex;
29
30
  /**
@@ -31,6 +32,12 @@ export declare const Deferred: {
31
32
  * since an earlier read would already have forced it and cached the value.
32
33
  */
33
34
  readonly forcedAt: (this: void, graph: DataflowGraph, binding: NodeId, cfg: ControlFlowGraph) => readonly NodeId[];
35
+ /**
36
+ * Links the writes an expression performs to the uses that may observe them, for a call evaluating the
37
+ * expression at a point control flow can pin down (`eval`). The reads are settled by the evaluating call
38
+ * itself, against the environment in effect there, so only this direction is left open.
39
+ */
40
+ readonly publish: <Info>(this: void, graph: DataflowGraph, expr: NodeId, index: NameIndex, idMap: AstIdMap<Info & ParentInformation>, at: NodeId, cfg?: ControlFlowGraph) => void;
34
41
  /**
35
42
  * Links the expression rooted at `expr` to the bindings it may meet when it is evaluated. Given the reads
36
43
  * that may force it, control flow rules out what no force can reach; without them every binding stays a
@@ -11,6 +11,7 @@ const edge_1 = require("../../../../graph/edge");
11
11
  const vertex_1 = require("../../../../graph/vertex");
12
12
  const happens_before_1 = require("../../../../../control-flow/happens-before");
13
13
  const logic_1 = require("../../../../../util/logic");
14
+ const graph_1 = require("../../../../graph/graph");
14
15
  /** Drops the read of `target` from `use`, for a binding another write has replaced. */
15
16
  function dropRead(graph, use, target) {
16
17
  graph.removeEdgeType(use, target, edge_1.EdgeType.Reads);
@@ -58,6 +59,7 @@ function namesWithin(expr, graph, idMap) {
58
59
  * really depending on it, can be missed.
59
60
  */
60
61
  exports.Deferred = {
62
+ name: 'Deferred',
61
63
  /** Where each name is bound and read, built once and shared by every deferred expression in the graph. */
62
64
  indexOf(graph, idMap) {
63
65
  const definitions = new Map();
@@ -78,13 +80,34 @@ exports.Deferred = {
78
80
  */
79
81
  forcedAt(graph, binding, cfg) {
80
82
  const reads = [];
81
- for (const [reader, edge] of graph.ingoingEdges(binding) ?? []) {
83
+ for (const [reader, edge] of graph.ingoingEdges(binding) ?? graph_1.NoEdges) {
82
84
  if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads)) {
83
85
  reads.push(reader);
84
86
  }
85
87
  }
86
88
  return reads.filter(r => !reads.some(other => other !== r && (0, happens_before_1.happensBefore)(cfg, other, r) === logic_1.Ternary.Always));
87
89
  },
90
+ /**
91
+ * Links the writes an expression performs to the uses that may observe them, for a call evaluating the
92
+ * expression at a point control flow can pin down (`eval`). The reads are settled by the evaluating call
93
+ * itself, against the environment in effect there, so only this direction is left open.
94
+ */
95
+ publish(graph, expr, index, idMap, at, cfg) {
96
+ const within = namesWithin(expr, graph, idMap);
97
+ const own = new Set(within.map(([id]) => id));
98
+ for (const [node, name, writes] of within) {
99
+ if (!writes) {
100
+ continue;
101
+ }
102
+ for (const use of index.uses.get(name) ?? []) {
103
+ /* only a use the evaluation may reach can see what it wrote */
104
+ if (own.has(use) || (cfg !== undefined && (0, happens_before_1.happensBefore)(cfg, at, use) === logic_1.Ternary.Never)) {
105
+ continue;
106
+ }
107
+ graph.addEdge(use, node, edge_1.EdgeType.Reads);
108
+ }
109
+ }
110
+ },
88
111
  /**
89
112
  * Links the expression rooted at `expr` to the bindings it may meet when it is evaluated. Given the reads
90
113
  * that may force it, control flow rules out what no force can reach; without them every binding stays a
@@ -29,6 +29,8 @@ export interface ProcessKnownFunctionCallInput<OtherInfo> extends ForceArguments
29
29
  readonly hasUnknownSideEffect?: boolean;
30
30
  /** The origin to use for the function being called. */
31
31
  readonly origin: FunctionOriginInformation | 'default';
32
+ /** see {@link ProcessAllArgumentInput#nonFunction} */
33
+ readonly nonFunction?: ReadonlySet<NodeId>;
32
34
  }
33
35
  /** The result of processing a known function call. */
34
36
  export interface ProcessKnownFunctionCallResult {
@@ -84,4 +86,4 @@ export declare function markArgumentsAsNonStandardEvaluation(graph: DataflowGrap
84
86
  * The main processor for function calls for which we know the target but need not
85
87
  * add any specific handling.
86
88
  */
87
- export declare function processKnownFunctionCall<OtherInfo>({ name, args, rootId, data, reverseOrder, markAsNSE, forceArgs, patchData, hasUnknownSideEffect, origin }: ProcessKnownFunctionCallInput<OtherInfo>): ProcessKnownFunctionCallResult;
89
+ export declare function processKnownFunctionCall<OtherInfo>({ name, args, rootId, data, reverseOrder, markAsNSE, forceArgs, patchData, hasUnknownSideEffect, origin, nonFunction }: ProcessKnownFunctionCallInput<OtherInfo>): ProcessKnownFunctionCallResult;
@@ -78,7 +78,10 @@ function markArgument(graph, rootId, arg, kind, evaluated) {
78
78
  if (evaluated?.has(vtx)) {
79
79
  continue;
80
80
  }
81
- if (kind === NseKind.Quoted || nse_1.Nse.suppliedByMask(arg.graph, vtx, info)) {
81
+ /* every name in a mask is a candidate column, even one the caller binds: R asks the data first.
82
+ {@link Nse.dropResolvedMask} takes the mark off the bound ones again, and keeps them as the
83
+ names that mean both */
84
+ if (kind === NseKind.Quoted || nse_1.Nse.maskCandidate(info)) {
82
85
  graph.addEdge(rootId, vtx, edge_1.EdgeType.NonStandardEvaluation);
83
86
  }
84
87
  }
@@ -87,12 +90,12 @@ function markArgument(graph, rootId, arg, kind, evaluated) {
87
90
  * The main processor for function calls for which we know the target but need not
88
91
  * add any specific handling.
89
92
  */
90
- function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = false, markAsNSE = undefined, forceArgs, patchData = d => d, hasUnknownSideEffect, origin }) {
93
+ function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = false, markAsNSE = undefined, forceArgs, patchData = d => d, hasUnknownSideEffect, origin, nonFunction }) {
91
94
  const functionName = (0, processor_1.processDataflowFor)(name, data);
92
95
  const finalGraph = new graph_1.DataflowGraph(data.completeAst.idMap);
93
96
  const functionCallName = name.content;
94
97
  const processArgs = reverseOrder ? args.toReversed() : args;
95
- const { finalEnv, callArgs, remainingReadInArgs, processedArguments } = (0, common_1.processAllArguments)({ functionName, args: processArgs, data, finalGraph, functionRootId: rootId, patchData, forceArgs });
98
+ const { finalEnv, callArgs, remainingReadInArgs, processedArguments } = (0, common_1.processAllArguments)({ functionName, args: processArgs, data, finalGraph, functionRootId: rootId, patchData, forceArgs, nonFunction });
96
99
  markArgumentsAsNonStandardEvaluation(finalGraph, rootId, processedArguments, markAsNSE, { kind: NseKind.Reevaluated });
97
100
  const onlyBuiltin = data.builtInNoEnv === rootId;
98
101
  finalGraph.addVertex({