@eagleoutice/flowr 2.13.16 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/README.md +36 -25
  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 +16 -7
  10. package/benchmark/calibration.js +44 -17
  11. package/benchmark/slicer.d.ts +3 -2
  12. package/benchmark/slicer.js +9 -5
  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/benchmark-app.js +4 -1
  17. package/cli/benchmark-helper-app.d.ts +1 -0
  18. package/cli/benchmark-helper-app.js +2 -2
  19. package/cli/common/options.d.ts +5 -31
  20. package/cli/common/options.js +2 -8
  21. package/cli/common/scripts-info.d.ts +5 -38
  22. package/cli/common/scripts-info.js +0 -8
  23. package/cli/repl/core.js +1 -1
  24. package/cli/repl/execute.d.ts +2 -2
  25. package/cli/repl/execute.js +2 -2
  26. package/cli/repl/parser/slice-query-parser.js +1 -1
  27. package/cli/repl/print-version.js +2 -2
  28. package/config.d.ts +16 -0
  29. package/config.js +83 -5
  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/apply-kill.js +1 -1
  38. package/dataflow/environments/built-in-props.d.ts +13 -2
  39. package/dataflow/environments/built-in-props.js +23 -1
  40. package/dataflow/environments/built-in.d.ts +7 -1
  41. package/dataflow/environments/built-in.js +42 -3
  42. package/dataflow/environments/default-builtin-config.d.ts +518 -11
  43. package/dataflow/environments/default-builtin-config.js +218 -23
  44. package/dataflow/environments/environment.d.ts +10 -2
  45. package/dataflow/environments/environment.js +25 -7
  46. package/dataflow/environments/identifier.d.ts +8 -2
  47. package/dataflow/environments/identifier.js +6 -1
  48. package/dataflow/environments/query-fn-props.d.ts +6 -0
  49. package/dataflow/environments/query-fn-props.js +22 -2
  50. package/dataflow/environments/reference-to-maybe.js +5 -5
  51. package/dataflow/environments/resolve-by-name.d.ts +3 -0
  52. package/dataflow/environments/resolve-by-name.js +44 -7
  53. package/dataflow/environments/resolve-helper.d.ts +6 -0
  54. package/dataflow/environments/resolve-helper.js +6 -0
  55. package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
  56. package/dataflow/eval/resolve/alias-tracking.js +21 -14
  57. package/dataflow/eval/resolve/node-value.d.ts +6 -0
  58. package/dataflow/eval/resolve/node-value.js +15 -9
  59. package/dataflow/eval/resolve/resolve-argument.js +2 -2
  60. package/dataflow/eval/resolve/resolve-numbers.js +2 -2
  61. package/dataflow/eval/resolve/resolve-operators.js +5 -4
  62. package/dataflow/eval/resolve/resolve-strings.js +3 -3
  63. package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
  64. package/dataflow/eval/resolve/resolve-working-directory.js +3 -3
  65. package/dataflow/eval/resolve/resolve.d.ts +5 -5
  66. package/dataflow/eval/resolve/resolve.js +10 -11
  67. package/dataflow/eval/values/general.d.ts +4 -1
  68. package/dataflow/eval/values/general.js +1 -1
  69. package/dataflow/extractor.js +2 -1
  70. package/dataflow/fn/exceptions-of-function.d.ts +3 -1
  71. package/dataflow/fn/exceptions-of-function.js +87 -39
  72. package/dataflow/fn/higher-order-function.js +5 -4
  73. package/dataflow/fn/strict-function.d.ts +40 -0
  74. package/dataflow/fn/strict-function.js +337 -0
  75. package/dataflow/graph/call-graph.js +14 -14
  76. package/dataflow/graph/df-helper.d.ts +24 -1
  77. package/dataflow/graph/df-helper.js +29 -7
  78. package/dataflow/graph/diff-dataflow-graph.js +6 -6
  79. package/dataflow/graph/edge.d.ts +27 -0
  80. package/dataflow/graph/edge.js +33 -0
  81. package/dataflow/graph/graph-helper.d.ts +3 -4
  82. package/dataflow/graph/graph-helper.js +4 -5
  83. package/dataflow/graph/graph.d.ts +39 -3
  84. package/dataflow/graph/graph.js +75 -7
  85. package/dataflow/graph/vertex.d.ts +42 -6
  86. package/dataflow/graph/vertex.js +42 -6
  87. package/dataflow/info.d.ts +26 -0
  88. package/dataflow/info.js +28 -1
  89. package/dataflow/internal/linker.d.ts +1 -0
  90. package/dataflow/internal/linker.js +11 -9
  91. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  92. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  93. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
  94. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
  95. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
  96. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
  97. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
  98. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
  99. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
  100. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  101. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
  102. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  103. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
  104. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
  106. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
  107. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -0
  108. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +29 -3
  109. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  110. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
  111. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
  112. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
  113. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +44 -20
  114. package/dataflow/internal/process/functions/call/common.d.ts +9 -1
  115. package/dataflow/internal/process/functions/call/common.js +17 -6
  116. package/dataflow/internal/process/functions/call/deferred.js +2 -1
  117. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
  118. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
  119. package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
  120. package/dataflow/internal/process/functions/call/nse.d.ts +33 -5
  121. package/dataflow/internal/process/functions/call/nse.js +113 -6
  122. package/dataflow/internal/process/functions/call/quoted.d.ts +5 -0
  123. package/dataflow/internal/process/functions/call/quoted.js +21 -9
  124. package/dataflow/origin/dfg-get-origin.d.ts +1 -0
  125. package/dataflow/origin/dfg-get-origin.js +9 -6
  126. package/documentation/data/faq/faqs.js +88 -88
  127. package/documentation/data/faq/recommended-configs.js +1 -1
  128. package/documentation/data/faq/wiki-faq-store.js +1 -1
  129. package/documentation/doc-capabilities.js +1 -1
  130. package/documentation/doc-readme.js +1 -1
  131. package/documentation/doc-util/doc-auto-gen.js +6 -2
  132. package/documentation/doc-util/doc-functions.js +1 -1
  133. package/documentation/wiki-cfg.js +2 -2
  134. package/documentation/wiki-core.js +1 -1
  135. package/documentation/wiki-create-linting-rules.js +45 -45
  136. package/documentation/wiki-dataflow-graph.js +18 -18
  137. package/documentation/wiki-linter.js +1 -0
  138. package/documentation/wiki-linting-and-testing.js +93 -5
  139. package/documentation/wiki-mk/doc-maker.js +1 -1
  140. package/documentation/wiki-overview.js +12 -1
  141. package/documentation/wiki-query.js +53 -0
  142. package/documentation/wiki-signature-database.js +3 -0
  143. package/linter/linter-output.js +1 -1
  144. package/linter/linter-rules.d.ts +24 -0
  145. package/linter/linter-rules.js +3 -1
  146. package/linter/rules/file-path-validity.js +1 -1
  147. package/linter/rules/function-finder-util.js +1 -1
  148. package/linter/rules/naming-convention.js +1 -1
  149. package/linter/rules/network-functions.d.ts +1 -1
  150. package/linter/rules/no-leaked-credentials.js +2 -1
  151. package/linter/rules/stop-with-call-arg.js +4 -4
  152. package/linter/rules/unclosed-connection.d.ts +44 -0
  153. package/linter/rules/unclosed-connection.js +200 -0
  154. package/linter/rules/undefined-symbol-util.d.ts +1 -1
  155. package/linter/rules/undefined-symbol-util.js +5 -4
  156. package/linter/rules/undefined-symbol.js +3 -3
  157. package/linter/rules/unused-definition.js +2 -1
  158. package/package.json +38 -51
  159. package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
  160. package/project/context/flowr-analyzer-environment-context.js +25 -0
  161. package/project/dependency-version-space.d.ts +3 -3
  162. package/project/dependency-version-space.js +3 -4
  163. package/project/flowr-analyzer.js +1 -1
  164. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
  165. package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
  166. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
  167. package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
  168. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
  169. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
  170. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +1 -1
  171. package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -4
  172. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +36 -7
  175. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
  176. package/project/sigdb/build.js +16 -16
  177. package/project/sigdb/codec.d.ts +1 -1
  178. package/project/sigdb/codec.js +13 -13
  179. package/project/sigdb/decompress.d.ts +1 -1
  180. package/project/sigdb/decompress.js +33 -33
  181. package/project/sigdb/index-format.js +2 -2
  182. package/project/sigdb/manifest.d.ts +3 -1
  183. package/project/sigdb/manifest.js +68 -27
  184. package/project/sigdb/memory-source.d.ts +64 -0
  185. package/project/sigdb/memory-source.js +133 -0
  186. package/project/sigdb/reader.js +14 -14
  187. package/project/sigdb/schema.d.ts +2 -2
  188. package/project/sigdb/schema.js +2 -2
  189. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  190. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
  191. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  192. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  193. package/queries/catalog/dependencies-query/link-devices.js +3 -9
  194. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
  195. package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
  196. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -1
  197. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
  198. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
  199. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
  200. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
  201. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
  202. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  203. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  204. package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
  205. package/queries/catalog/signature-query/signature-query-executor.js +3 -2
  206. package/queries/catalog/slice-query-options.d.ts +1 -1
  207. package/queries/catalog/slice-query-options.js +1 -1
  208. package/queries/query-function-filter.d.ts +8 -2
  209. package/queries/query-function-filter.js +11 -1
  210. package/queries/query.d.ts +11 -1
  211. package/queries/query.js +2 -0
  212. package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
  213. package/r-bridge/lang-4.x/ast/model/model.js +4 -4
  214. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
  215. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  216. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  217. package/r-bridge/retriever.d.ts +2 -1
  218. package/r-bridge/retriever.js +3 -2
  219. package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
  220. package/r-bridge/roxygen2/documentation-provider.js +1 -0
  221. package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
  222. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  223. package/search/flowr-search-filters.d.ts +1 -1
  224. package/search/flowr-search-filters.js +2 -14
  225. package/search/search-executor/search-enrichers.js +4 -4
  226. package/search/search-executor/search-generators.js +1 -1
  227. package/slicing/criterion/parse.d.ts +2 -2
  228. package/slicing/criterion/parse.js +5 -5
  229. package/slicing/static/fingerprint.js +1 -1
  230. package/slicing/static/slice-call.d.ts +1 -1
  231. package/slicing/static/slice-call.js +2 -2
  232. package/slicing/static/static-slicer.js +4 -3
  233. package/util/assert.js +1 -1
  234. package/util/log.d.ts +4 -1
  235. package/util/log.js +15 -2
  236. package/util/logic.js +2 -2
  237. package/util/mermaid/cfg.js +1 -1
  238. package/util/mermaid/dfg.js +6 -6
  239. package/util/mermaid/mermaid.js +3 -1
  240. package/util/objects.d.ts +12 -0
  241. package/util/objects.js +48 -0
  242. package/util/quads.js +19 -6
  243. package/util/schema.js +2 -2
  244. package/util/simple-df/dfg-ascii.js +14 -3
  245. package/util/text/ansi.d.ts +2 -0
  246. package/util/text/ansi.js +8 -0
  247. package/util/text/name-rank.d.ts +29 -0
  248. package/util/text/name-rank.js +39 -0
  249. package/util/text/url-encoding.d.ts +15 -0
  250. package/util/text/url-encoding.js +59 -0
  251. package/util/version.js +1 -1
  252. package/cli/export-quads-app.d.ts +0 -7
  253. package/cli/export-quads-app.js +0 -44
@@ -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);
@@ -7,5 +7,6 @@ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/proce
7
7
  /**
8
8
  * Process an `rm` call, marking the removed variables as {@link KillReference|killed} so the removal is
9
9
  * carried to the enclosing scope even when it happens nested within a branch or block.
10
+ * As in R, the names to remove are not evaluated, so `rm(x)` does not read `x`.
10
11
  */
11
12
  export declare function processRm<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
@@ -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 `...` */
@@ -123,16 +123,42 @@ function removeFromCustomEnv(res, envir, targets, rootId, cds) {
123
123
  const environment = (0, define_1.define)({ ...envir.envDef, definedAt: rootId, envState: newEnvState }, false, res.environment);
124
124
  return { ...res, environment };
125
125
  }
126
+ /** The arguments `rm` swallows with its `...`: they name what to remove instead of being evaluated. */
127
+ function nonStandardArguments(args) {
128
+ const indices = new Set();
129
+ for (const [i, arg] of args.entries()) {
130
+ if (arg !== r_function_call_1.EmptyArgument && (arg.name === undefined || (0, prefix_1.findByPrefixIfUnique)(arg.name.content, RmNamedFormals) === undefined)) {
131
+ indices.add(i);
132
+ }
133
+ }
134
+ return indices;
135
+ }
126
136
  /**
127
137
  * Process an `rm` call, marking the removed variables as {@link KillReference|killed} so the removal is
128
138
  * carried to the enclosing scope even when it happens nested within a branch or block.
139
+ * As in R, the names to remove are not evaluated, so `rm(x)` does not read `x`.
129
140
  */
130
141
  function processRm(name, args, rootId, data) {
131
142
  if (args.length === 0) {
132
143
  logger_1.dataflowLogger.warn('empty rm, skipping');
133
144
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
134
145
  }
135
- const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Rm }).information;
146
+ const nse = nonStandardArguments(args);
147
+ const { information, processedArguments, fnRef } = (0, known_call_handling_1.processKnownFunctionCall)({
148
+ name, args, rootId, data,
149
+ origin: built_in_proc_name_1.BuiltInProcName.Rm,
150
+ /* an unevaluated name must not resolve against the environment */
151
+ patchData: (d, i) => nse.has(i) ? { ...d, environment: d.ctx.env.makeCleanEnv() } : d
152
+ });
153
+ (0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, [...nse]);
154
+ /* the enclosing scope would link the unevaluated names, so they must not escape this call */
155
+ const evaluated = processedArguments.filter((p, i) => p !== undefined && !nse.has(i));
156
+ const res = {
157
+ ...information,
158
+ in: [fnRef, ...evaluated.flatMap(p => p.in)],
159
+ out: evaluated.flatMap(p => p.out),
160
+ unknownReferences: evaluated.flatMap(p => p.unknownReferences)
161
+ };
136
162
  const targets = collectRmTargets(args, data);
137
163
  // `rm(x, envir=e)` removes from a tracked custom environment instead of the lexical scope
138
164
  if (data.ctx.config.solver.trackEnvironments) {
@@ -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({
@@ -194,7 +194,7 @@ function processSourceCall(name, args, rootId, data, config) {
194
194
  * Otherwise, this can be an {@link RProjectFile} representing a standalone source file
195
195
  */
196
196
  function sourceRequest(rootId, request, data, information, makeMaybe, getId, evaluatedByRoot = false) {
197
- // parse, normalize and dataflow the sourced file
197
+ // parse, normalize, and dataflow the sourced file
198
198
  let dataflow;
199
199
  let fst;
200
200
  let filePath;
@@ -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
  }
@@ -94,6 +96,20 @@ function computeCallGraphSummaries(graph, own) {
94
96
  * Only vertices created on demand (exports actually referenced) get an edge, keeping the graph small.
95
97
  */
96
98
  function linkMaterializedExportsToLoaders(graph, environment) {
99
+ /* the attached namespaces hold every export of every package, far more than the graph ever materializes, so the
100
+ * cheap direction is to ask the graph first: an export earns an edge only if it is a vertex or the target of a
101
+ * `calls` edge. Both are read off the graph once here instead of per export binding. */
102
+ const called = new Set();
103
+ for (const [id] of graph.vertices(true)) {
104
+ called.add(id);
105
+ }
106
+ for (const [, outgoing] of graph.edges()) {
107
+ for (const [target, edge] of outgoing) {
108
+ if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls)) {
109
+ called.add(target);
110
+ }
111
+ }
112
+ }
97
113
  // export node id -> its loading `library()`/`use()` call, from the final environment
98
114
  const loaders = new Map();
99
115
  for (let e = environment.current; e !== undefined && !e.builtInEnv; e = e.parent) {
@@ -102,19 +118,16 @@ function linkMaterializedExportsToLoaders(graph, environment) {
102
118
  }
103
119
  for (const defs of e.memory.values()) {
104
120
  for (const d of defs) {
105
- if (!node_id_1.NodeId.isBuiltIn(d.definedAt)) {
121
+ if (called.has(d.nodeId) && !node_id_1.NodeId.isBuiltIn(d.definedAt)) {
106
122
  loaders.set(d.nodeId, d.definedAt);
107
123
  }
108
124
  }
109
125
  }
110
126
  }
111
- // only exports actually called (a materialized vertex or the target of a `calls` edge) get a loader edge
127
+ /* the loader targets are `library()` call ids, never export ids, so the edges added here never make a further
128
+ * export qualify -- the lazy checks this replaces could not have observed one either */
112
129
  for (const [id, loadedAt] of loaders) {
113
- const called = graph.hasVertex(id)
114
- || [...graph.ingoingEdges(id)?.values() ?? []].some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.Calls));
115
- if (called) {
116
- graph.addEdge(id, loadedAt, edge_1.EdgeType.Reads | edge_1.EdgeType.Calls);
117
- }
130
+ graph.addEdge(id, loadedAt, edge_1.EdgeType.Reads | edge_1.EdgeType.Calls);
118
131
  }
119
132
  }
120
133
  /** The packages (see {@link EnvType}) attached directly within a function body, i.e. its own `library()` calls. */
@@ -154,7 +167,17 @@ function escapedDefinitions() {
154
167
  for (const e of escapeTargetFrames(fdef)) {
155
168
  let escaped = perFrame.get(e.memory);
156
169
  if (escaped === undefined) {
157
- escaped = [...e.memory.values()].flatMap(ds => ds.filter(d => !node_id_1.NodeId.isBuiltIn(d.nodeId)).map(d => d.nodeId));
170
+ /* a package frame holds thousands of entries and keeps none of them, so this walks them in place
171
+ * rather than through a spread/flatMap/filter/map chain that allocates an array per step */
172
+ const collected = [];
173
+ for (const ds of e.memory.values()) {
174
+ for (const d of ds) {
175
+ if (!node_id_1.NodeId.isBuiltIn(d.nodeId)) {
176
+ collected.push(d.nodeId);
177
+ }
178
+ }
179
+ }
180
+ escaped = collected;
158
181
  perFrame.set(e.memory, escaped);
159
182
  }
160
183
  for (const d of escaped) {
@@ -168,7 +191,7 @@ function escapedDefinitions() {
168
191
  function propagateTransitiveDefinitions(graph, environment, ctx) {
169
192
  const summary = computeCallGraphSummaries(graph, escapedDefinitions());
170
193
  for (const [id, vertex] of graph.vertices(true)) {
171
- if (vertex.tag !== vertex_1.VertexType.FunctionCall) {
194
+ if (!vertex_1.FunctionCallVertex.is(vertex)) {
172
195
  continue;
173
196
  }
174
197
  for (const target of calledDefinitions(graph, id)) {
@@ -191,7 +214,7 @@ function propagateTransitivePackages(graph, environment, ctx) {
191
214
  const summary = computeCallGraphSummaries(graph, attachedPackages);
192
215
  const reachable = new Map(); // package -> its loading `library()` call
193
216
  for (const [id, vertex] of graph.vertices(true)) {
194
- if (vertex.tag !== vertex_1.VertexType.FunctionCall || !graph.isRoot(id)) {
217
+ if (!vertex_1.FunctionCallVertex.is(vertex) || !graph.isRoot(id)) {
195
218
  continue;
196
219
  }
197
220
  for (const target of calledDefinitions(graph, id)) {
@@ -221,7 +244,7 @@ function escapedDefinitionMap(graph) {
221
244
  const map = new Map();
222
245
  const seen = new Set();
223
246
  for (const [, vertex] of graph.vertices(true)) {
224
- if (vertex.tag !== vertex_1.VertexType.FunctionDefinition) {
247
+ if (!vertex_1.FunctionDefinitionVertex.is(vertex)) {
225
248
  continue;
226
249
  }
227
250
  for (const e of escapeTargetFrames(vertex)) {
@@ -251,7 +274,7 @@ function propagateTransitiveEscapedDefinitions(graph, environment) {
251
274
  const names = new Set();
252
275
  let grew = false;
253
276
  for (const [id, vertex] of graph.vertices(true)) {
254
- if (vertex.tag !== vertex_1.VertexType.FunctionCall || !graph.isRoot(id)) {
277
+ if (!vertex_1.FunctionCallVertex.is(vertex) || !graph.isRoot(id)) {
255
278
  continue;
256
279
  }
257
280
  for (const target of calledDefinitions(graph, id)) {
@@ -261,7 +284,7 @@ function propagateTransitiveEscapedDefinitions(graph, environment) {
261
284
  continue;
262
285
  }
263
286
  names.add(def.name);
264
- if ((0, resolve_by_name_1.resolveByName)(def.name, environment, def.type)?.some(d => d.nodeId === nodeId)) {
287
+ if (resolve_helper_1.Resolve.byNameAndType(def.name, environment, def.type)?.some(d => d.nodeId === nodeId)) {
265
288
  continue;
266
289
  }
267
290
  environment = (0, define_1.define)(def, false, environment);
@@ -277,7 +300,7 @@ function reResolveOpenReferences(graph, environment, references, escapedNames) {
277
300
  if (ref.name === undefined || !escapedNames.has(String(ref.name))) {
278
301
  continue;
279
302
  }
280
- for (const { nodeId } of (0, resolve_by_name_1.resolveByName)(ref.name, environment, ref.type) ?? []) {
303
+ for (const { nodeId } of resolve_helper_1.Resolve.byNameAndType(ref.name, environment, ref.type) ?? []) {
281
304
  if (!node_id_1.NodeId.isBuiltIn(nodeId) && nodeId !== ref.nodeId) {
282
305
  graph.addEdge(ref.nodeId, nodeId, edge_1.EdgeType.Reads);
283
306
  }
@@ -287,6 +310,7 @@ function reResolveOpenReferences(graph, environment, references, escapedNames) {
287
310
  /**
288
311
  * Propagates every function's escaped side effects (attached packages and `<<-` definitions) to its transitive callers.
289
312
  * @returns the enriched top-level environment and whether it grew (so the extractor can re-link and re-run to a fixpoint).
313
+ * @useInstead {@link Dataflow.sideEffects.propagateTransitive}
290
314
  */
291
315
  function propagateTransitiveSideEffects(graph, environment, ctx) {
292
316
  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);
@@ -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);
@@ -79,7 +80,7 @@ exports.Deferred = {
79
80
  */
80
81
  forcedAt(graph, binding, cfg) {
81
82
  const reads = [];
82
- for (const [reader, edge] of graph.ingoingEdges(binding) ?? []) {
83
+ for (const [reader, edge] of graph.ingoingEdges(binding) ?? graph_1.NoEdges) {
83
84
  if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads)) {
84
85
  reads.push(reader);
85
86
  }
@@ -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({