@eagleoutice/flowr 2.2.11 → 2.2.13

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 (301) hide show
  1. package/README.md +82 -20
  2. package/benchmark/slicer.d.ts +49 -22
  3. package/benchmark/slicer.js +89 -29
  4. package/benchmark/stats/print.js +16 -10
  5. package/benchmark/stats/size-of.js +18 -1
  6. package/benchmark/stats/stats.d.ts +3 -0
  7. package/benchmark/summarizer/first-phase/input.js +1 -1
  8. package/benchmark/summarizer/first-phase/process.js +3 -3
  9. package/benchmark/summarizer/second-phase/process.js +9 -3
  10. package/benchmark/summarizer/summarizer.js +1 -1
  11. package/cli/benchmark-app.d.ts +5 -0
  12. package/cli/benchmark-app.js +49 -6
  13. package/cli/benchmark-helper-app.d.ts +4 -0
  14. package/cli/benchmark-helper-app.js +20 -4
  15. package/cli/common/options.js +15 -6
  16. package/cli/common/script.js +1 -1
  17. package/cli/flowr.js +1 -1
  18. package/cli/repl/commands/repl-cfg.d.ts +2 -0
  19. package/cli/repl/commands/repl-cfg.js +38 -24
  20. package/cli/repl/commands/repl-commands.js +6 -2
  21. package/cli/repl/commands/repl-dataflow.d.ts +2 -0
  22. package/cli/repl/commands/repl-dataflow.js +37 -3
  23. package/cli/repl/commands/repl-execute.js +1 -1
  24. package/cli/repl/commands/repl-main.d.ts +1 -1
  25. package/cli/repl/commands/repl-main.js +1 -1
  26. package/cli/repl/commands/repl-normalize.js +1 -1
  27. package/cli/repl/commands/repl-query.js +2 -2
  28. package/cli/repl/core.js +1 -1
  29. package/cli/repl/prompt.js +1 -1
  30. package/cli/repl/server/connection.js +4 -4
  31. package/cli/repl/server/messages/message-analysis.d.ts +1 -1
  32. package/cli/script-core/statistics-core.js +1 -1
  33. package/cli/script-core/statistics-helper-core.js +4 -4
  34. package/config.d.ts +60 -21
  35. package/config.js +24 -4
  36. package/control-flow/basic-cfg-guided-visitor.d.ts +39 -0
  37. package/control-flow/basic-cfg-guided-visitor.js +114 -0
  38. package/control-flow/cfg-properties.d.ts +26 -0
  39. package/control-flow/cfg-properties.js +100 -0
  40. package/control-flow/cfg-simplification.d.ts +18 -0
  41. package/control-flow/cfg-simplification.js +55 -0
  42. package/control-flow/cfg-to-basic-blocks.d.ts +5 -0
  43. package/control-flow/cfg-to-basic-blocks.js +81 -0
  44. package/control-flow/control-flow-graph.d.ts +247 -0
  45. package/control-flow/control-flow-graph.js +290 -0
  46. package/control-flow/dfg-cfg-guided-visitor.d.ts +32 -0
  47. package/control-flow/dfg-cfg-guided-visitor.js +71 -0
  48. package/control-flow/diff-cfg.d.ts +11 -0
  49. package/control-flow/diff-cfg.js +161 -0
  50. package/control-flow/extract-cfg.d.ts +30 -0
  51. package/control-flow/extract-cfg.js +475 -0
  52. package/control-flow/happens-before.d.ts +7 -0
  53. package/{util/cfg → control-flow}/happens-before.js +3 -3
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +452 -0
  55. package/control-flow/semantic-cfg-guided-visitor.js +492 -0
  56. package/control-flow/simple-visitor.d.ts +25 -0
  57. package/control-flow/simple-visitor.js +80 -0
  58. package/control-flow/syntax-cfg-guided-visitor.d.ts +128 -0
  59. package/control-flow/syntax-cfg-guided-visitor.js +166 -0
  60. package/core/print/print.d.ts +1 -1
  61. package/core/print/slice-diff-ansi.js +1 -1
  62. package/core/steps/pipeline/create-pipeline.js +1 -1
  63. package/dataflow/environments/built-in-config.d.ts +5 -2
  64. package/dataflow/environments/built-in-config.js +17 -8
  65. package/dataflow/environments/built-in.d.ts +16 -5
  66. package/dataflow/environments/built-in.js +55 -6
  67. package/dataflow/environments/clone.d.ts +5 -0
  68. package/dataflow/environments/clone.js +5 -0
  69. package/dataflow/environments/default-builtin-config.d.ts +2 -0
  70. package/dataflow/environments/default-builtin-config.js +164 -13
  71. package/dataflow/environments/define.d.ts +5 -1
  72. package/dataflow/environments/define.js +36 -10
  73. package/dataflow/environments/overwrite.js +4 -0
  74. package/dataflow/environments/remove.d.ts +6 -0
  75. package/dataflow/environments/remove.js +24 -0
  76. package/dataflow/environments/resolve-by-name.js +16 -5
  77. package/dataflow/extractor.js +2 -2
  78. package/dataflow/graph/dataflowgraph-builder.d.ts +79 -7
  79. package/dataflow/graph/dataflowgraph-builder.js +106 -8
  80. package/dataflow/graph/diff-dataflow-graph.d.ts +16 -0
  81. package/dataflow/graph/{diff.js → diff-dataflow-graph.js} +30 -56
  82. package/dataflow/graph/graph.d.ts +17 -4
  83. package/dataflow/graph/graph.js +51 -12
  84. package/dataflow/graph/vertex.d.ts +59 -4
  85. package/dataflow/graph/vertex.js +32 -0
  86. package/dataflow/internal/linker.d.ts +3 -2
  87. package/dataflow/internal/linker.js +36 -25
  88. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
  89. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -1
  90. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
  91. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +67 -54
  92. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -4
  93. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +108 -21
  94. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +54 -17
  95. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +10 -0
  96. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +140 -0
  97. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -4
  98. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -2
  99. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +15 -4
  100. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -3
  101. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
  102. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -3
  103. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +51 -17
  104. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -7
  106. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
  107. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +4 -0
  108. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +100 -31
  109. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +7 -0
  110. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +41 -0
  111. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +35 -8
  112. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
  113. package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +15 -0
  114. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +75 -0
  115. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
  116. package/dataflow/internal/process/functions/call/common.d.ts +5 -2
  117. package/dataflow/internal/process/functions/call/common.js +9 -5
  118. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -2
  119. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
  120. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -0
  121. package/dataflow/internal/process/functions/call/named-call-handling.js +10 -6
  122. package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
  123. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
  124. package/dataflow/internal/process/process-named-call.d.ts +4 -1
  125. package/dataflow/internal/process/process-named-call.js +8 -5
  126. package/dataflow/origin/dfg-get-origin.d.ts +82 -0
  127. package/dataflow/origin/dfg-get-origin.js +116 -0
  128. package/documentation/doc-util/doc-cfg.d.ts +20 -4
  129. package/documentation/doc-util/doc-cfg.js +41 -7
  130. package/documentation/doc-util/doc-cli-option.js +4 -2
  131. package/documentation/doc-util/doc-code.js +10 -2
  132. package/documentation/doc-util/doc-dfg.js +3 -3
  133. package/documentation/doc-util/doc-escape.d.ts +7 -0
  134. package/documentation/doc-util/doc-escape.js +19 -0
  135. package/documentation/doc-util/doc-files.d.ts +1 -0
  136. package/documentation/doc-util/doc-files.js +2 -1
  137. package/documentation/doc-util/doc-normalized-ast.js +3 -3
  138. package/documentation/doc-util/doc-query.js +2 -2
  139. package/documentation/doc-util/doc-repl.js +1 -1
  140. package/documentation/doc-util/doc-search.js +1 -1
  141. package/documentation/doc-util/doc-server-message.js +2 -2
  142. package/documentation/doc-util/doc-structure.d.ts +1 -0
  143. package/documentation/doc-util/doc-structure.js +5 -0
  144. package/documentation/doc-util/doc-types.d.ts +7 -1
  145. package/documentation/doc-util/doc-types.js +13 -2
  146. package/documentation/print-capabilities-markdown.js +28 -2
  147. package/documentation/print-cfg-wiki.d.ts +1 -0
  148. package/documentation/print-cfg-wiki.js +572 -0
  149. package/documentation/print-core-wiki.js +2 -2
  150. package/documentation/print-dataflow-graph-wiki.js +180 -25
  151. package/documentation/print-engines-wiki.js +1 -1
  152. package/documentation/print-faq-wiki.d.ts +1 -0
  153. package/documentation/print-faq-wiki.js +75 -0
  154. package/documentation/print-interface-wiki.js +2 -1
  155. package/documentation/print-linting-and-testing-wiki.js +52 -36
  156. package/documentation/print-normalized-ast-wiki.js +1 -1
  157. package/documentation/print-onboarding-wiki.d.ts +1 -0
  158. package/documentation/print-onboarding-wiki.js +42 -0
  159. package/documentation/print-query-wiki.js +23 -3
  160. package/documentation/print-readme.js +10 -3
  161. package/package.json +10 -6
  162. package/queries/catalog/call-context-query/call-context-query-executor.js +5 -5
  163. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  164. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  165. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -2
  166. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +24 -21
  167. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  168. package/queries/catalog/cluster-query/cluster-query-format.js +1 -1
  169. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  170. package/queries/catalog/config-query/config-query-format.js +2 -2
  171. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  172. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
  173. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  174. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
  175. package/queries/catalog/dependencies-query/dependencies-query-executor.js +17 -7
  176. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -26
  177. package/queries/catalog/dependencies-query/dependencies-query-format.js +4 -147
  178. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +24 -0
  179. package/queries/catalog/dependencies-query/function-info/function-info.js +10 -0
  180. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +2 -0
  181. package/queries/catalog/dependencies-query/function-info/library-functions.js +18 -0
  182. package/queries/catalog/dependencies-query/function-info/read-functions.d.ts +2 -0
  183. package/queries/catalog/dependencies-query/function-info/read-functions.js +101 -0
  184. package/queries/catalog/dependencies-query/function-info/source-functions.d.ts +2 -0
  185. package/queries/catalog/dependencies-query/function-info/source-functions.js +11 -0
  186. package/queries/catalog/dependencies-query/function-info/write-functions.d.ts +2 -0
  187. package/queries/catalog/dependencies-query/function-info/write-functions.js +87 -0
  188. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  189. package/queries/catalog/happens-before-query/happens-before-query-executor.js +4 -4
  190. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  191. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
  192. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  193. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  194. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
  195. package/queries/catalog/lineage-query/lineage-query-format.js +2 -2
  196. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  197. package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
  198. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  199. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -2
  200. package/queries/catalog/origin-query/origin-query-executor.d.ts +5 -0
  201. package/queries/catalog/origin-query/origin-query-executor.js +33 -0
  202. package/queries/catalog/origin-query/origin-query-format.d.ts +71 -0
  203. package/queries/catalog/origin-query/origin-query-format.js +27 -0
  204. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  205. package/queries/catalog/project-query/project-query-format.js +2 -2
  206. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  207. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -2
  208. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  209. package/queries/catalog/search-query/search-query-format.js +2 -2
  210. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  211. package/queries/catalog/static-slice-query/static-slice-query-format.js +2 -2
  212. package/queries/query-print.d.ts +1 -1
  213. package/queries/query-print.js +4 -4
  214. package/queries/query.d.ts +61 -2
  215. package/queries/query.js +3 -1
  216. package/r-bridge/data/data.d.ts +2 -2
  217. package/r-bridge/data/data.js +2 -2
  218. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -2
  219. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +5 -0
  220. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -2
  221. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +5 -0
  222. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
  223. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
  224. package/r-bridge/lang-4.x/ast/model/processing/fold.js +3 -1
  225. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
  226. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
  227. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
  228. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  229. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  230. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
  231. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +1 -1
  232. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
  233. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
  234. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
  235. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
  236. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +26 -8
  237. package/r-bridge/retriever.js +1 -1
  238. package/search/search-executor/search-generators.d.ts +1 -1
  239. package/search/search-executor/search-transformer.d.ts +1 -1
  240. package/slicing/criterion/collect-all.js +1 -1
  241. package/slicing/static/slice-call.js +13 -3
  242. package/statistics/features/supported/assignments/post-process.js +1 -1
  243. package/statistics/features/supported/defined-functions/post-process.js +2 -2
  244. package/statistics/features/supported/used-functions/post-process.js +1 -1
  245. package/statistics/features/supported/used-packages/post-process.js +2 -2
  246. package/statistics/features/supported/values/post-process.js +2 -2
  247. package/statistics/output/print-stats.js +2 -2
  248. package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
  249. package/statistics/summarizer/post-process/clusterer.js +1 -1
  250. package/statistics/summarizer/post-process/histogram.js +3 -3
  251. package/statistics/summarizer/post-process/post-process-output.js +3 -3
  252. package/statistics/summarizer/second-phase/process.js +2 -2
  253. package/statistics/summarizer/summarizer.js +2 -2
  254. package/util/assert.js +36 -1
  255. package/util/cfg/cfg.d.ts +0 -80
  256. package/util/cfg/cfg.js +0 -549
  257. package/util/{arrays.d.ts → collections/arrays.d.ts} +24 -1
  258. package/util/{arrays.js → collections/arrays.js} +44 -3
  259. package/util/collections/set.js +17 -0
  260. package/util/{list-access.d.ts → containers.d.ts} +24 -4
  261. package/util/{list-access.js → containers.js} +42 -12
  262. package/util/diff-graph.d.ts +47 -0
  263. package/util/diff-graph.js +61 -0
  264. package/util/diff.d.ts +6 -6
  265. package/util/diff.js +1 -1
  266. package/util/mermaid/ast.js +12 -1
  267. package/util/mermaid/cfg.d.ts +9 -2
  268. package/util/mermaid/cfg.js +65 -13
  269. package/util/mermaid/dfg.d.ts +2 -1
  270. package/util/mermaid/dfg.js +26 -10
  271. package/util/mermaid/mermaid.d.ts +2 -0
  272. package/util/mermaid/mermaid.js +6 -0
  273. package/util/parallel.d.ts +2 -1
  274. package/util/parallel.js +11 -2
  275. package/util/prefix.d.ts +13 -0
  276. package/util/prefix.js +34 -0
  277. package/util/quads.js +1 -1
  278. package/util/schema.d.ts +1 -1
  279. package/util/schema.js +1 -1
  280. package/util/summarizer.js +1 -1
  281. package/util/{text.js → text/text.js} +1 -1
  282. package/util/{time.js → text/time.js} +1 -1
  283. package/util/version.js +1 -1
  284. package/dataflow/graph/diff.d.ts +0 -36
  285. package/util/cfg/happens-before.d.ts +0 -7
  286. package/util/cfg/visitor.d.ts +0 -9
  287. package/util/cfg/visitor.js +0 -30
  288. package/util/set.js +0 -31
  289. /package/util/{bimap.d.ts → collections/bimap.d.ts} +0 -0
  290. /package/util/{bimap.js → collections/bimap.js} +0 -0
  291. /package/util/{defaultmap.d.ts → collections/defaultmap.d.ts} +0 -0
  292. /package/util/{defaultmap.js → collections/defaultmap.js} +0 -0
  293. /package/util/{set.d.ts → collections/set.d.ts} +0 -0
  294. /package/util/{ansi.d.ts → text/ansi.d.ts} +0 -0
  295. /package/util/{ansi.js → text/ansi.js} +0 -0
  296. /package/util/{args.d.ts → text/args.d.ts} +0 -0
  297. /package/util/{args.js → text/args.js} +0 -0
  298. /package/util/{strings.d.ts → text/strings.d.ts} +0 -0
  299. /package/util/{strings.js → text/strings.js} +0 -0
  300. /package/util/{text.d.ts → text/text.d.ts} +0 -0
  301. /package/util/{time.d.ts → text/time.d.ts} +0 -0
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processAccess = processAccess;
4
+ exports.symbolArgumentsToStrings = symbolArgumentsToStrings;
4
5
  const known_call_handling_1 = require("../known-call-handling");
5
6
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
6
7
  const logger_1 = require("../../../../../logger");
@@ -11,11 +12,11 @@ const built_in_1 = require("../../../../../environments/built-in");
11
12
  const built_in_assignment_1 = require("./built-in-assignment");
12
13
  const identifier_1 = require("../../../../../environments/identifier");
13
14
  const vertex_1 = require("../../../../../graph/vertex");
14
- const list_access_1 = require("../../../../../../util/list-access");
15
+ const containers_1 = require("../../../../../../util/containers");
15
16
  const config_1 = require("../../../../../../config");
16
17
  function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
17
18
  outInfo.definitionRootNodes.push(rootId);
18
- return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data }).information;
19
+ return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'table:assign' }).information;
19
20
  }
20
21
  /**
21
22
  * Processes different types of access operations.
@@ -31,13 +32,13 @@ function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
31
32
  function processAccess(name, args, rootId, data, config) {
32
33
  if (args.length < 2) {
33
34
  logger_1.dataflowLogger.warn(`Access ${name.content} has less than 2 arguments, skipping`);
34
- return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs }).information;
35
+ return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'default' }).information;
35
36
  }
36
37
  const head = args[0];
37
38
  let fnCall;
38
39
  if (head === r_function_call_1.EmptyArgument) {
39
40
  // in this case we may be within a pipe
40
- fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs });
41
+ fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'builtin:access' });
41
42
  }
42
43
  else if (!config.treatIndicesAsString) {
43
44
  /* within an access operation which treats its fields, we redefine the table assignment ':=' as a trigger if this is to be treated as a definition */
@@ -96,15 +97,17 @@ function processAccess(name, args, rootId, data, config) {
96
97
  function processNumberBasedAccess(data, name, args, rootId, config, head) {
97
98
  const existing = data.environment.current.memory.get(':=');
98
99
  const outInfo = { definitionRootNodes: [] };
100
+ const tableAssignId = (0, built_in_1.builtInId)(':=-table');
99
101
  data.environment.current.memory.set(':=', [{
100
102
  type: identifier_1.ReferenceType.BuiltInFunction,
101
- definedAt: built_in_1.BuiltIn,
103
+ definedAt: tableAssignId,
102
104
  controlDependencies: undefined,
103
105
  processor: (name, args, rootId, data) => tableAssignmentProcessor(name, args, rootId, data, outInfo),
106
+ config: {},
104
107
  name: ':=',
105
- nodeId: built_in_1.BuiltIn,
108
+ nodeId: tableAssignId
106
109
  }]);
107
- const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs });
110
+ const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'builtin:access' });
108
111
  /* recover the environment */
109
112
  if (existing !== undefined) {
110
113
  data.environment.current.memory.set(':=', existing);
@@ -112,21 +115,15 @@ function processNumberBasedAccess(data, name, args, rootId, config, head) {
112
115
  if (head.value && outInfo.definitionRootNodes.length > 0) {
113
116
  (0, built_in_assignment_1.markAsAssignment)(fnCall.information, { type: identifier_1.ReferenceType.Variable, name: head.value.lexeme ?? '', nodeId: head.value.info.id, definedAt: rootId, controlDependencies: [] }, outInfo.definitionRootNodes, rootId);
114
117
  }
118
+ if ((0, config_1.getConfig)().solver.pointerTracking) {
119
+ referenceAccessedIndices(args, data, fnCall, rootId, true);
120
+ }
115
121
  return fnCall;
116
122
  }
117
- /**
118
- * Processes different types of string-based access operations.
119
- *
120
- * Example:
121
- * ```r
122
- * a$foo
123
- * a@foo
124
- * ```
125
- */
126
- function processStringBasedAccess(args, data, name, rootId, config) {
123
+ function symbolArgumentsToStrings(args, firstIndexInclusive = 1, lastIndexInclusive = args.length - 1) {
127
124
  const newArgs = [...args];
128
125
  // if the argument is a symbol, we convert it to a string for this perspective
129
- for (let i = 1; i < newArgs.length; i++) {
126
+ for (let i = firstIndexInclusive; i <= lastIndexInclusive; i++) {
130
127
  const arg = newArgs[i];
131
128
  if (arg !== r_function_call_1.EmptyArgument && arg.value?.type === type_1.RType.Symbol) {
132
129
  newArgs[i] = {
@@ -144,55 +141,71 @@ function processStringBasedAccess(args, data, name, rootId, config) {
144
141
  };
145
142
  }
146
143
  }
147
- const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: newArgs, rootId, data, forceArgs: config.forceArgs });
144
+ return newArgs;
145
+ }
146
+ /**
147
+ * Processes different types of string-based access operations.
148
+ *
149
+ * Example:
150
+ * ```r
151
+ * a$foo
152
+ * a@foo
153
+ * ```
154
+ */
155
+ function processStringBasedAccess(args, data, name, rootId, config) {
156
+ const newArgs = symbolArgumentsToStrings(args);
157
+ const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: newArgs, rootId, data, forceArgs: config.forceArgs,
158
+ origin: 'builtin:access'
159
+ });
160
+ if ((0, config_1.getConfig)().solver.pointerTracking) {
161
+ referenceAccessedIndices(newArgs, data, fnCall, rootId, false);
162
+ }
163
+ return fnCall;
164
+ }
165
+ function referenceAccessedIndices(newArgs, data, fnCall, rootId, isIndexBasedAccess) {
148
166
  // Resolve access on the way up the fold
149
- const nonEmptyArgs = newArgs.filter(arg => arg !== r_function_call_1.EmptyArgument);
150
- const accessedArg = nonEmptyArgs.find(arg => arg.info.role === "accessed" /* RoleInParent.Accessed */);
151
- const accessArg = nonEmptyArgs.find(arg => arg.info.role === "index-access" /* RoleInParent.IndexAccess */);
167
+ const { accessedArg, accessArg } = (0, containers_1.getAccessOperands)(newArgs);
152
168
  if (accessedArg === undefined || accessArg === undefined) {
153
- return fnCall;
169
+ return;
154
170
  }
155
- if ((0, config_1.getConfig)().solver.pointerTracking) {
156
- let accessedIndicesCollection;
157
- // If the accessedArg is a symbol, it's either a simple access or the base case of a nested access
158
- if (accessedArg.value?.type === type_1.RType.Symbol) {
159
- accessedIndicesCollection = (0, list_access_1.resolveSingleIndex)(accessedArg, accessArg, data.environment);
171
+ let accessedIndicesCollection;
172
+ // If the accessedArg is a symbol, it's either a simple access or the base case of a nested access
173
+ if (accessedArg.value?.type === type_1.RType.Symbol) {
174
+ accessedIndicesCollection = (0, containers_1.resolveSingleIndex)(accessedArg, accessArg, data.environment, isIndexBasedAccess);
175
+ }
176
+ else {
177
+ // Higher access call
178
+ const underlyingAccessId = accessedArg.value?.info.id ?? -1;
179
+ const vertex = fnCall.information.graph.getVertex(underlyingAccessId);
180
+ const subIndices = vertex?.indicesCollection
181
+ ?.flatMap(indices => indices.indices)
182
+ ?.flatMap(index => index?.subIndices ?? []);
183
+ if (subIndices) {
184
+ accessedIndicesCollection = (0, containers_1.filterIndices)(subIndices, accessArg, isIndexBasedAccess);
160
185
  }
161
- else {
162
- // Higher access call
163
- const underlyingAccessId = accessedArg.value?.info.id ?? -1;
164
- const vertex = fnCall.information.graph.getVertex(underlyingAccessId);
165
- const subIndices = vertex?.indicesCollection
166
- ?.flatMap(indices => indices.indices)
167
- ?.flatMap(index => index?.subIndices ?? []);
168
- if (subIndices) {
169
- accessedIndicesCollection = (0, list_access_1.filterIndices)(subIndices, accessArg);
170
- }
186
+ }
187
+ // Add indices to vertex afterward
188
+ if (accessedIndicesCollection) {
189
+ const vertex = fnCall.information.graph.getVertex(rootId);
190
+ if (vertex) {
191
+ vertex.indicesCollection = accessedIndicesCollection;
171
192
  }
172
- // Add indices to vertex afterward
173
- if (accessedIndicesCollection) {
174
- const vertex = fnCall.information.graph.getVertex(rootId);
175
- if (vertex) {
176
- vertex.indicesCollection = accessedIndicesCollection;
177
- }
178
- // When access has no access as parent, it's the top most
179
- const rootNode = data.completeAst.idMap.get(rootId);
180
- const parentNode = data.completeAst.idMap.get(rootNode?.info.parent ?? -1);
181
- if (parentNode?.type !== type_1.RType.Access) {
182
- // Only reference indices in top most access
183
- referenceIndices(accessedIndicesCollection, fnCall, name.info.id);
184
- }
193
+ // When access has no access as parent, it's the top most
194
+ const rootNode = data.completeAst.idMap.get(rootId);
195
+ const parentNode = data.completeAst.idMap.get(rootNode?.info.parent ?? -1);
196
+ if (parentNode?.type !== type_1.RType.Access) {
197
+ // Only reference indices in top most access
198
+ referenceIndices(accessedIndicesCollection, fnCall, rootId);
185
199
  }
186
200
  }
187
- return fnCall;
188
201
  }
189
202
  /**
190
203
  * Creates edges of type {@link EdgeType.Reads} to the accessed Indices and their sub-indices starting from
191
204
  * the node with {@link parentNodeId}.
192
205
  *
193
206
  * @param accessedIndicesCollection - All indices that were accessed by the access operation
194
- * @param fnCall - The {@link ProcessKnownFunctionCallResult} of the access operation
195
- * @param parentNodeId - {@link NodeId} of the parent from which the edge starts
207
+ * @param fnCall - The {@link ProcessKnownFunctionCallResult} of the access operation
208
+ * @param parentNodeId - {@link NodeId} of the parent from which the edge starts
196
209
  */
197
210
  function referenceIndices(accessedIndicesCollection, fnCall, parentNodeId) {
198
211
  const accessedIndices = accessedIndicesCollection?.flatMap(indices => indices.indices);
@@ -10,9 +10,11 @@ export interface BuiltInApplyConfiguration extends MergeableRecord {
10
10
  readonly indexOfFunction?: number;
11
11
  /** does the argument have a name that it can be given by as well? */
12
12
  readonly nameOfFunctionArgument?: string;
13
- /**
14
- * Should we unquote the function if it is given as a string?
15
- */
13
+ /** Should we unquote the function if it is given as a string? */
16
14
  readonly unquoteFunction?: boolean;
15
+ /** Should the function be resolved in the global environment? */
16
+ readonly resolveInEnvironment: 'global' | 'local';
17
+ /** Should the value of the function be resolved? */
18
+ readonly resolveValue?: boolean;
17
19
  }
18
- export declare function processApply<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { indexOfFunction, nameOfFunctionArgument, unquoteFunction }: BuiltInApplyConfiguration): DataflowInformation;
20
+ export declare function processApply<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: BuiltInApplyConfiguration): DataflowInformation;
@@ -8,13 +8,19 @@ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
8
8
  const vertex_1 = require("../../../../../graph/vertex");
9
9
  const edge_1 = require("../../../../../graph/edge");
10
10
  const identifier_1 = require("../../../../../environments/identifier");
11
- function processApply(name, args, rootId, data, { indexOfFunction = 1, nameOfFunctionArgument, unquoteFunction }) {
11
+ const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
12
+ const unnamed_call_handling_1 = require("../unnamed-call-handling");
13
+ const log_1 = require("../../../../../../util/log");
14
+ function processApply(name, args, rootId, data, config) {
15
+ const { indexOfFunction = 1, nameOfFunctionArgument, unquoteFunction, resolveInEnvironment, resolveValue } = config;
12
16
  /* as the length is one-based and the argument filter mapping is zero-based, we do not have to subtract 1 */
13
17
  const forceArgsMask = new Array(indexOfFunction).fill(false);
14
18
  forceArgsMask.push(true);
15
- const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
16
- name, args, rootId, data, forceArgs: forceArgsMask
19
+ const resFn = (0, known_call_handling_1.processKnownFunctionCall)({
20
+ name, args, rootId, data, forceArgs: forceArgsMask, origin: 'builtin:apply'
17
21
  });
22
+ let information = resFn.information;
23
+ const processedArguments = resFn.processedArguments;
18
24
  let index = indexOfFunction;
19
25
  /* search, if one of the arguments actually contains the argument name if given in the config */
20
26
  if (nameOfFunctionArgument !== undefined) {
@@ -29,30 +35,48 @@ function processApply(name, args, rootId, data, { indexOfFunction = 1, nameOfFun
29
35
  return information;
30
36
  }
31
37
  const arg = args[index];
32
- if (arg === r_function_call_1.EmptyArgument || !arg.value || (!unquoteFunction && arg.value.type !== type_1.RType.Symbol)) {
38
+ if (arg === r_function_call_1.EmptyArgument || !arg.value || (!unquoteFunction && arg.value.type !== type_1.RType.Symbol && arg.value.type !== type_1.RType.FunctionDefinition)) {
33
39
  logger_1.dataflowLogger.warn(`Expected symbol as argument at index ${index}, but got ${JSON.stringify(arg)} instead.`);
34
40
  return information;
35
41
  }
36
- let functionId;
37
- let functionName;
42
+ let functionId = undefined;
43
+ let functionName = undefined;
44
+ let anonymous = false;
38
45
  const val = arg.value;
39
46
  if (unquoteFunction && val.type === type_1.RType.String) {
40
47
  functionId = val.info.id;
41
48
  functionName = val.content.str;
49
+ information = {
50
+ ...information,
51
+ in: [...information.in, { type: identifier_1.ReferenceType.Function, name: functionName, controlDependencies: data.controlDependencies, nodeId: functionId }]
52
+ };
42
53
  }
43
54
  else if (val.type === type_1.RType.Symbol) {
44
55
  functionId = val.info.id;
45
- functionName = val.content;
56
+ if (resolveValue) {
57
+ const resolved = (0, resolve_by_name_1.resolveValueOfVariable)(val.content, data.environment);
58
+ if (resolved?.length === 1 && typeof resolved[0] === 'string') {
59
+ functionName = resolved[0];
60
+ }
61
+ }
62
+ else {
63
+ functionName = val.content;
64
+ }
46
65
  }
47
- else {
66
+ else if (val.type === type_1.RType.FunctionDefinition) {
67
+ anonymous = true;
68
+ functionId = val.info.id;
69
+ functionName = `${unnamed_call_handling_1.UnnamedFunctionCallPrefix}${functionId}`;
70
+ }
71
+ if (functionName === undefined || functionId === undefined) {
48
72
  logger_1.dataflowLogger.warn(`Expected symbol or string as function argument at index ${index}, but got ${JSON.stringify(val)} instead.`);
49
73
  return information;
50
74
  }
51
75
  const allOtherArguments = processedArguments.filter((_, i) => i !== index).map((arg, i) => {
52
76
  const counterpart = args[i];
53
- if (arg && counterpart !== r_function_call_1.EmptyArgument && counterpart.name) {
77
+ if (arg && counterpart !== r_function_call_1.EmptyArgument) {
54
78
  return {
55
- name: counterpart.name.content,
79
+ name: counterpart.name?.content,
56
80
  controlDependencies: data.controlDependencies,
57
81
  type: identifier_1.ReferenceType.Argument,
58
82
  nodeId: arg.entryPoint
@@ -62,21 +86,84 @@ function processApply(name, args, rootId, data, { indexOfFunction = 1, nameOfFun
62
86
  return r_function_call_1.EmptyArgument;
63
87
  }
64
88
  });
65
- /* identify it as a full-blown function call :) */
66
- information.graph.updateToFunctionCall({
67
- tag: vertex_1.VertexType.FunctionCall,
68
- id: functionId,
69
- name: functionName,
70
- args: allOtherArguments,
71
- environment: data.environment,
72
- onlyBuiltin: false,
73
- cds: data.controlDependencies
74
- });
89
+ if (anonymous) {
90
+ const rootFnId = functionId;
91
+ functionId = 'anon-' + rootFnId;
92
+ information.graph.addVertex({
93
+ tag: vertex_1.VertexType.FunctionCall,
94
+ id: functionId,
95
+ environment: data.environment,
96
+ name: functionName,
97
+ /* can never be a direct built-in-call */
98
+ onlyBuiltin: false,
99
+ cds: data.controlDependencies,
100
+ args: allOtherArguments, // same reference
101
+ origin: ['function']
102
+ });
103
+ information.graph.addEdge(rootId, rootFnId, edge_1.EdgeType.Calls | edge_1.EdgeType.Reads);
104
+ information.graph.addEdge(rootId, functionId, edge_1.EdgeType.Calls | edge_1.EdgeType.Argument);
105
+ information = {
106
+ ...information,
107
+ in: [
108
+ ...information.in,
109
+ { type: identifier_1.ReferenceType.Function, name: functionName, controlDependencies: data.controlDependencies, nodeId: functionId }
110
+ ]
111
+ };
112
+ const dfVert = information.graph.getVertex(rootId);
113
+ if (dfVert && dfVert.tag === vertex_1.VertexType.FunctionDefinition) {
114
+ // resolve all ingoings against the environment
115
+ const ingoingRefs = dfVert.subflow.in;
116
+ const remainingIn = [];
117
+ for (const ingoing of ingoingRefs) {
118
+ const resolved = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, data.environment, ingoing.type) : undefined;
119
+ if (resolved === undefined) {
120
+ remainingIn.push(ingoing);
121
+ continue;
122
+ }
123
+ (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Found ${resolved.length} references to open ref ${ingoing.nodeId} in closure of function definition ${rootId}`);
124
+ let allBuiltIn = true;
125
+ for (const ref of resolved) {
126
+ information.graph.addEdge(ingoing, ref, edge_1.EdgeType.Reads);
127
+ information.graph.addEdge(rootId, ref, edge_1.EdgeType.Reads); // because the def. is the anonymous call
128
+ if (!(0, identifier_1.isReferenceType)(ref.type, identifier_1.ReferenceType.BuiltInConstant | identifier_1.ReferenceType.BuiltInFunction)) {
129
+ allBuiltIn = false;
130
+ }
131
+ }
132
+ if (allBuiltIn) {
133
+ remainingIn.push(ingoing);
134
+ }
135
+ }
136
+ dfVert.subflow.in = remainingIn;
137
+ }
138
+ }
139
+ else {
140
+ /* identify it as a full-blown function call :) */
141
+ information.graph.updateToFunctionCall({
142
+ tag: vertex_1.VertexType.FunctionCall,
143
+ id: functionId,
144
+ name: functionName,
145
+ args: allOtherArguments,
146
+ environment: resolveInEnvironment === 'global' ? undefined : data.environment,
147
+ onlyBuiltin: resolveInEnvironment === 'global',
148
+ cds: data.controlDependencies,
149
+ origin: ['function']
150
+ });
151
+ }
75
152
  for (const arg of processedArguments) {
76
153
  if (arg) {
77
154
  information.graph.addEdge(functionId, arg.entryPoint, edge_1.EdgeType.Argument);
78
155
  }
79
156
  }
80
- return information;
157
+ if (resolveInEnvironment === 'global') {
158
+ // remove from open ingoing references
159
+ return {
160
+ ...information,
161
+ in: information.in.filter(ref => ref.nodeId !== functionId),
162
+ unknownReferences: information.unknownReferences.filter(ref => ref.nodeId !== functionId)
163
+ };
164
+ }
165
+ else {
166
+ return information;
167
+ }
81
168
  }
82
169
  //# sourceMappingURL=built-in-apply.js.map
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processAssignment = processAssignment;
4
4
  exports.markAsAssignment = markAsAssignment;
5
5
  const known_call_handling_1 = require("../known-call-handling");
6
- const assert_1 = require("../../../../../../util/assert");
7
6
  const log_1 = require("../../../../../../util/log");
8
7
  const unpack_argument_1 = require("../argument/unpack-argument");
9
8
  const process_named_call_1 = require("../../../process-named-call");
@@ -17,8 +16,10 @@ const vertex_1 = require("../../../../../graph/vertex");
17
16
  const define_1 = require("../../../../../environments/define");
18
17
  const edge_1 = require("../../../../../graph/edge");
19
18
  const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
20
- const list_access_1 = require("../../../../../../util/list-access");
19
+ const containers_1 = require("../../../../../../util/containers");
21
20
  const config_1 = require("../../../../../../config");
21
+ const named_call_handling_1 = require("../named-call-handling");
22
+ const built_in_1 = require("../../../../../environments/built-in");
22
23
  function toReplacementSymbol(target, prefix, superAssignment) {
23
24
  return {
24
25
  type: type_1.RType.Symbol,
@@ -45,6 +46,27 @@ function findRootAccess(node) {
45
46
  return undefined;
46
47
  }
47
48
  }
49
+ function tryReplacementPassingIndices(rootId, functionName, data, name, args, indices) {
50
+ const resolved = (0, resolve_by_name_1.resolveByName)(functionName.content, data.environment, identifier_1.ReferenceType.Function) ?? [];
51
+ // yield for unsupported pass along!
52
+ if (resolved.length !== 1 || resolved[0].type !== identifier_1.ReferenceType.BuiltInFunction) {
53
+ return (0, process_named_call_1.processAsNamedCall)(functionName, data, name, args);
54
+ }
55
+ const info = built_in_1.BuiltInProcessorMapper['builtin:replacement']({
56
+ type: type_1.RType.Symbol,
57
+ info: functionName.info,
58
+ content: name,
59
+ lexeme: functionName.lexeme,
60
+ location: functionName.location,
61
+ namespace: undefined
62
+ }, (0, make_argument_1.wrapArgumentsUnnamed)(args, data.completeAst.idMap), functionName.info.id, data, {
63
+ ...(resolved[0].config ?? {}),
64
+ activeIndices: indices,
65
+ assignRootId: rootId
66
+ });
67
+ (0, named_call_handling_1.markAsOnlyBuiltIn)(info.graph, functionName.info.id);
68
+ return info;
69
+ }
48
70
  /**
49
71
  * Processes an assignment, i.e., `<target> <- <source>`.
50
72
  * Handling it as a function call \`&lt;-\` `(<target>, <source>)`.
@@ -55,13 +77,17 @@ function processAssignment(name,
55
77
  args, rootId, data, config) {
56
78
  if (!config.mayHaveMoreArgs && args.length !== 2) {
57
79
  logger_1.dataflowLogger.warn(`Assignment ${name.content} has something else than 2 arguments, skipping`);
58
- return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs }).information;
80
+ return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'default' }).information;
59
81
  }
60
82
  const effectiveArgs = getEffectiveOrder(config, args);
61
- const { target, source } = extractSourceAndTarget(effectiveArgs, name);
83
+ const { target, source } = extractSourceAndTarget(effectiveArgs);
84
+ if (target === undefined || source === undefined) {
85
+ logger_1.dataflowLogger.warn(`Assignment ${name.content} has an undefined target or source, skipping`);
86
+ return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'default' }).information;
87
+ }
62
88
  const { type, named } = target;
63
89
  if (!config.targetVariable && type === type_1.RType.Symbol) {
64
- const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, reverseOrder: !config.swapSourceAndTarget, forceArgs: config.forceArgs });
90
+ const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, reverseOrder: !config.swapSourceAndTarget, forceArgs: config.forceArgs, origin: 'builtin:assignment' });
65
91
  return processAssignmentToSymbol({
66
92
  ...config,
67
93
  nameOfAssignmentFunction: name.content,
@@ -75,14 +101,14 @@ args, rootId, data, config) {
75
101
  }
76
102
  else if (config.canBeReplacement && type === type_1.RType.FunctionCall && named) {
77
103
  /* as replacement functions take precedence over the lhs fn-call (i.e., `names(x) <- ...` is independent from the definition of `names`), we do not have to process the call */
78
- logger_1.dataflowLogger.debug(`Assignment ${name.content} has a function call as target => replacement function ${target.lexeme}`);
104
+ logger_1.dataflowLogger.debug(`Assignment ${name.content} has a function call as target ==> replacement function ${target.lexeme}`);
79
105
  const replacement = toReplacementSymbol(target, target.functionName.content, config.superAssignment ?? false);
80
- return (0, process_named_call_1.processAsNamedCall)(replacement, data, replacement.content, [...target.arguments, source]);
106
+ return tryReplacementPassingIndices(rootId, replacement, data, replacement.content, [...target.arguments, source], config.indicesCollection);
81
107
  }
82
108
  else if (config.canBeReplacement && type === type_1.RType.Access) {
83
- logger_1.dataflowLogger.debug(`Assignment ${name.content} has an access as target => replacement function ${target.lexeme}`);
109
+ logger_1.dataflowLogger.debug(`Assignment ${name.content} has an access-type node as target ==> replacement function ${target.lexeme}`);
84
110
  const replacement = toReplacementSymbol(target, target.operator, config.superAssignment ?? false);
85
- return (0, process_named_call_1.processAsNamedCall)(replacement, data, replacement.content, [(0, make_argument_1.toUnnamedArgument)(target.accessed, data.completeAst.idMap), ...target.access, source]);
111
+ return tryReplacementPassingIndices(rootId, replacement, data, replacement.content, [(0, make_argument_1.toUnnamedArgument)(target.accessed, data.completeAst.idMap), ...target.access, source], config.indicesCollection);
86
112
  }
87
113
  else if (type === type_1.RType.Access) {
88
114
  const rootArg = findRootAccess(target);
@@ -93,7 +119,8 @@ args, rootId, data, config) {
93
119
  rootId,
94
120
  data,
95
121
  reverseOrder: !config.swapSourceAndTarget,
96
- forceArgs: config.forceArgs
122
+ forceArgs: config.forceArgs,
123
+ origin: 'builtin:assignment'
97
124
  });
98
125
  return processAssignmentToSymbol({
99
126
  ...config,
@@ -111,15 +138,16 @@ args, rootId, data, config) {
111
138
  return processAssignmentToString(target, args, name, rootId, data, config, source);
112
139
  }
113
140
  logger_1.dataflowLogger.warn(`Assignment ${name.content} has an unknown target type ${target.type} => unknown impact`);
114
- const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: effectiveArgs, rootId, data, forceArgs: config.forceArgs }).information;
141
+ const info = (0, known_call_handling_1.processKnownFunctionCall)({
142
+ name, args: effectiveArgs, rootId, data, forceArgs: config.forceArgs,
143
+ origin: 'builtin:assignment'
144
+ }).information;
115
145
  info.graph.markIdForUnknownSideEffects(rootId);
116
146
  return info;
117
147
  }
118
- function extractSourceAndTarget(args, name) {
148
+ function extractSourceAndTarget(args) {
119
149
  const source = (0, unpack_argument_1.unpackArgument)(args[1], false);
120
150
  const target = (0, unpack_argument_1.unpackArgument)(args[0], false);
121
- (0, assert_1.guard)(source !== undefined, () => `Assignment ${name.content} has no source, impossible!`);
122
- (0, assert_1.guard)(target !== undefined, () => `Assignment ${name.content} has no target, impossible!`);
123
151
  return { source, target };
124
152
  }
125
153
  /**
@@ -154,7 +182,8 @@ function processAssignmentToString(target, args, name, rootId, data, config, sou
154
182
  rootId,
155
183
  data,
156
184
  reverseOrder: !config.swapSourceAndTarget,
157
- forceArgs: config.forceArgs
185
+ forceArgs: config.forceArgs,
186
+ origin: 'builtin:assignment'
158
187
  });
159
188
  return processAssignmentToSymbol({
160
189
  ...config,
@@ -191,16 +220,24 @@ function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignme
191
220
  if ((0, config_1.getConfig)().solver.pointerTracking) {
192
221
  let indicesCollection = undefined;
193
222
  if (sourceIds.length === 1) {
194
- // support for tracking indices
223
+ // support for tracking indices.
195
224
  // Indices were defined for the vertex e.g. a <- list(c = 1) or a$b <- list(c = 1)
196
225
  indicesCollection = information.graph.getVertex(sourceIds[0])?.indicesCollection;
226
+ // support assignment of container e.g. container1 <- container2
227
+ // defined indices are passed
228
+ if (!indicesCollection) {
229
+ const node = information.graph.idMap?.get(sourceIds[0]);
230
+ if (node && node.type === type_1.RType.Symbol) {
231
+ indicesCollection = (0, containers_1.resolveIndicesByName)(node.lexeme, information.environment);
232
+ }
233
+ }
197
234
  }
198
235
  // Indices defined by replacement operation e.g. $<-
199
236
  if (config?.indicesCollection !== undefined) {
200
237
  // If there were indices stored in the vertex, then a container was defined
201
238
  // and assigned to the index of another container e.g. a$b <- list(c = 1)
202
239
  if (indicesCollection) {
203
- indicesCollection = (0, list_access_1.addSubIndicesToLeafIndices)(config.indicesCollection, indicesCollection);
240
+ indicesCollection = (0, containers_1.addSubIndicesToLeafIndices)(config.indicesCollection, indicesCollection);
204
241
  }
205
242
  else {
206
243
  // No indices were defined for the vertex e.g. a$b <- 2
@@ -0,0 +1,10 @@
1
+ import { type DataflowProcessorInformation } from '../../../../../processor';
2
+ import type { DataflowInformation } from '../../../../../info';
3
+ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
4
+ import type { RFunctionArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
+ import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
+ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ export declare function processEvalCall<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: {
8
+ /** should this produce an explicit source function call in the graph? */
9
+ includeFunctionCall?: boolean;
10
+ }): DataflowInformation;