@eagleoutice/flowr 2.16.2 → 2.16.3

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 (445) hide show
  1. package/README.md +10 -10
  2. package/abstract-interpretation/data-frame/arguments.js +4 -3
  3. package/abstract-interpretation/data-frame/dataframe-semantics.js +1 -2
  4. package/abstract-interpretation/data-frame/semantics.d.ts +2 -2
  5. package/abstract-interpretation/data-frame/semantics.js +2 -6
  6. package/benchmark/slicer.js +1 -3
  7. package/benchmark/summarizer/first-phase/input.js +1 -12
  8. package/benchmark/summarizer/second-phase/process.d.ts +7 -0
  9. package/benchmark/summarizer/second-phase/process.js +15 -12
  10. package/cli/repl/commands/repl-cfg.js +18 -49
  11. package/cli/repl/commands/repl-clipboard.d.ts +2 -0
  12. package/cli/repl/commands/repl-clipboard.js +5 -0
  13. package/cli/repl/commands/repl-commands.js +2 -2
  14. package/cli/repl/commands/repl-dataflow.js +21 -55
  15. package/cli/repl/commands/repl-normalize.js +15 -28
  16. package/cli/repl/commands/repl-parse.js +2 -2
  17. package/cli/repl/commands/repl-query.js +10 -10
  18. package/cli/repl/commands/repl-signature.js +4 -4
  19. package/cli/repl/server/connection.d.ts +1 -0
  20. package/cli/repl/server/connection.js +8 -30
  21. package/cli/repl/server/messages/message-analysis.js +1 -1
  22. package/config.d.ts +6 -0
  23. package/config.js +7 -4
  24. package/control-flow/cfg-dead-code.js +5 -14
  25. package/control-flow/cfg-to-basic-blocks.js +1 -6
  26. package/control-flow/control-flow-graph.d.ts +2 -16
  27. package/control-flow/control-flow-graph.js +8 -66
  28. package/control-flow/diff-cfg.js +10 -23
  29. package/control-flow/semantic-cfg-guided-visitor.js +5 -11
  30. package/control-flow/simple-visitor.js +2 -2
  31. package/core/steps/pipeline/default-pipelines.d.ts +138 -138
  32. package/data/r-base-packages.generated.js +0 -1
  33. package/data/r-base-primitives.generated.js +0 -1
  34. package/data/r-s3-generics.generated.d.ts +5 -0
  35. package/data/r-s3-generics.generated.js +103 -0
  36. package/dataflow/cluster.js +2 -1
  37. package/dataflow/environments/append.d.ts +1 -0
  38. package/dataflow/environments/built-in-props.d.ts +10 -0
  39. package/dataflow/environments/built-in-props.js +25 -1
  40. package/dataflow/environments/built-in.js +15 -9
  41. package/dataflow/environments/clone.d.ts +1 -0
  42. package/dataflow/environments/clone.js +1 -0
  43. package/dataflow/environments/default-builtin-config.d.ts +188 -14
  44. package/dataflow/environments/default-builtin-config.js +125 -65
  45. package/dataflow/environments/define.d.ts +1 -0
  46. package/dataflow/environments/define.js +1 -0
  47. package/dataflow/environments/environment.d.ts +27 -0
  48. package/dataflow/environments/environment.js +37 -16
  49. package/dataflow/environments/frame-memory.d.ts +9 -1
  50. package/dataflow/environments/frame-memory.js +12 -1
  51. package/dataflow/environments/identifier.d.ts +0 -2
  52. package/dataflow/environments/identifier.js +5 -7
  53. package/dataflow/environments/overwrite.js +1 -0
  54. package/dataflow/environments/query-fn-props.js +2 -3
  55. package/dataflow/environments/scoping.d.ts +3 -0
  56. package/dataflow/environments/scoping.js +3 -0
  57. package/dataflow/eval/resolve/alias-tracking.js +3 -3
  58. package/dataflow/eval/resolve/resolve-argument.d.ts +7 -3
  59. package/dataflow/eval/resolve/resolve-argument.js +16 -11
  60. package/dataflow/eval/resolve/resolve-numbers.js +5 -2
  61. package/dataflow/eval/resolve/resolve-strings.d.ts +1 -1
  62. package/dataflow/eval/resolve/resolve-working-directory.js +2 -2
  63. package/dataflow/eval/resolve/resolve.js +1 -2
  64. package/dataflow/eval/values/intervals/interval-constants.js +1 -6
  65. package/dataflow/eval/values/r-value.js +1 -6
  66. package/dataflow/extractor.js +17 -17
  67. package/dataflow/fn/argument-roles.js +15 -15
  68. package/dataflow/fn/class-declaration.js +7 -7
  69. package/dataflow/fn/frame-reflection.d.ts +1 -23
  70. package/dataflow/fn/frame-reflection.js +8 -95
  71. package/dataflow/fn/function-props.d.ts +0 -3
  72. package/dataflow/fn/function-props.js +9 -11
  73. package/dataflow/fn/function-semantics.d.ts +1 -0
  74. package/dataflow/fn/strict-function.js +15 -14
  75. package/dataflow/graph/call-graph.d.ts +8 -0
  76. package/dataflow/graph/call-graph.js +40 -25
  77. package/dataflow/graph/dataflowgraph-builder.d.ts +0 -60
  78. package/dataflow/graph/dataflowgraph-builder.js +15 -135
  79. package/dataflow/graph/df-helper.d.ts +56 -4
  80. package/dataflow/graph/df-helper.js +116 -1
  81. package/dataflow/graph/diff-dataflow-graph.js +13 -15
  82. package/dataflow/graph/graph-helper.d.ts +20 -0
  83. package/dataflow/graph/graph-helper.js +18 -0
  84. package/dataflow/graph/graph.js +3 -8
  85. package/dataflow/graph/match-args.d.ts +1 -1
  86. package/dataflow/graph/match-args.js +3 -3
  87. package/dataflow/internal/linker.d.ts +4 -10
  88. package/dataflow/internal/linker.js +21 -29
  89. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -8
  90. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +5 -2
  91. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +39 -22
  92. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -21
  93. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -7
  94. package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +6 -11
  95. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
  96. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -13
  97. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +27 -13
  98. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -8
  99. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +33 -35
  100. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -5
  101. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +6 -7
  102. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +12 -5
  103. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +3 -4
  104. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +7 -8
  105. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -6
  106. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +3 -4
  107. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -3
  108. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -7
  109. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +6 -5
  110. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -2
  111. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -6
  112. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +4 -4
  113. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +7 -7
  114. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +1 -2
  115. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -3
  116. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  117. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +5 -7
  118. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +4 -5
  120. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +8 -9
  121. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
  122. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +3 -3
  123. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +36 -38
  124. package/dataflow/internal/process/functions/call/common.d.ts +3 -1
  125. package/dataflow/internal/process/functions/call/common.js +6 -7
  126. package/dataflow/internal/process/functions/call/deferred.js +8 -8
  127. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +11 -4
  128. package/dataflow/internal/process/functions/call/known-call-handling.js +11 -7
  129. package/dataflow/internal/process/functions/call/named-call-handling.js +4 -3
  130. package/dataflow/internal/process/functions/call/nse.js +4 -4
  131. package/dataflow/internal/process/functions/call/quoted.js +16 -14
  132. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
  133. package/dataflow/internal/process/functions/process-parameter.js +2 -2
  134. package/dataflow/internal/process/process-named-call.js +1 -1
  135. package/dataflow/origin/dfg-get-origin.js +2 -2
  136. package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -0
  137. package/dataflow/origin/dfg-get-symbol-refs.js +3 -8
  138. package/documentation/data/faq/wiki-faq-store.js +2 -2
  139. package/documentation/doc-capabilities.js +2 -1
  140. package/documentation/doc-util/doc-functions.js +2 -2
  141. package/documentation/doc-util/doc-repl.js +4 -4
  142. package/documentation/doc-util/doc-types.js +2 -2
  143. package/documentation/wiki-absint.js +2 -1
  144. package/documentation/wiki-cfg.js +2 -1
  145. package/documentation/wiki-create-linting-rules.js +1 -1
  146. package/documentation/wiki-dataflow-graph.js +6 -6
  147. package/documentation/wiki-interface.js +3 -2
  148. package/documentation/wiki-linter.js +54 -4
  149. package/documentation/wiki-mk/doc-maker.js +1 -2
  150. package/documentation/wiki-query.js +25 -0
  151. package/documentation/wiki-search.js +2 -1
  152. package/documentation/wiki-signature-database.js +0 -2
  153. package/linter/linter-executor.js +4 -0
  154. package/linter/linter-rules.d.ts +518 -1
  155. package/linter/linter-rules.js +39 -1
  156. package/linter/linter-tags.d.ts +6 -0
  157. package/linter/linter-tags.js +6 -0
  158. package/linter/rules/absolute-path.js +4 -3
  159. package/linter/rules/cmd-check/bogus-return.d.ts +29 -0
  160. package/linter/rules/cmd-check/bogus-return.js +63 -0
  161. package/linter/rules/cmd-check/call-arguments.d.ts +63 -0
  162. package/linter/rules/cmd-check/call-arguments.js +211 -0
  163. package/linter/rules/cmd-check/class-string-comparison.d.ts +48 -0
  164. package/linter/rules/cmd-check/class-string-comparison.js +135 -0
  165. package/linter/rules/cmd-check/cmd-check-util.d.ts +67 -0
  166. package/linter/rules/cmd-check/cmd-check-util.js +169 -0
  167. package/linter/rules/cmd-check/compiled-code.d.ts +86 -0
  168. package/linter/rules/cmd-check/compiled-code.js +350 -0
  169. package/linter/rules/cmd-check/conformance.d.ts +47 -0
  170. package/linter/rules/cmd-check/conformance.js +166 -0
  171. package/linter/rules/cmd-check/dependency-declaration.d.ts +95 -0
  172. package/linter/rules/cmd-check/dependency-declaration.js +299 -0
  173. package/linter/rules/cmd-check/description-metadata.d.ts +63 -0
  174. package/linter/rules/cmd-check/description-metadata.js +393 -0
  175. package/linter/rules/cmd-check/documentation-mismatch.d.ts +54 -0
  176. package/linter/rules/cmd-check/documentation-mismatch.js +407 -0
  177. package/linter/rules/cmd-check/file-checks.d.ts +29 -0
  178. package/linter/rules/cmd-check/file-checks.js +34 -0
  179. package/linter/rules/cmd-check/foreign-function-calls.d.ts +54 -0
  180. package/linter/rules/cmd-check/foreign-function-calls.js +115 -0
  181. package/linter/rules/cmd-check/global-environment-modification.d.ts +61 -0
  182. package/linter/rules/cmd-check/global-environment-modification.js +237 -0
  183. package/linter/rules/cmd-check/namespace-tampering.d.ts +52 -0
  184. package/linter/rules/cmd-check/namespace-tampering.js +162 -0
  185. package/linter/rules/cmd-check/non-ascii-code.d.ts +51 -0
  186. package/linter/rules/cmd-check/non-ascii-code.js +112 -0
  187. package/linter/rules/cmd-check/package-code.d.ts +30 -0
  188. package/linter/rules/cmd-check/package-code.js +141 -0
  189. package/linter/rules/cmd-check/package-data.d.ts +49 -0
  190. package/linter/rules/cmd-check/package-data.js +181 -0
  191. package/linter/rules/cmd-check/package-files.d.ts +41 -0
  192. package/linter/rules/cmd-check/package-files.js +157 -0
  193. package/linter/rules/cmd-check/package-hooks.d.ts +57 -0
  194. package/linter/rules/cmd-check/package-hooks.js +165 -0
  195. package/linter/rules/cmd-check/package-metafiles.d.ts +49 -0
  196. package/linter/rules/cmd-check/package-metafiles.js +292 -0
  197. package/linter/rules/cmd-check/package-runtime.d.ts +67 -0
  198. package/linter/rules/cmd-check/package-runtime.js +284 -0
  199. package/linter/rules/cmd-check/package-structure.d.ts +85 -0
  200. package/linter/rules/cmd-check/package-structure.js +320 -0
  201. package/linter/rules/cmd-check/rd-files.d.ts +67 -0
  202. package/linter/rules/cmd-check/rd-files.js +621 -0
  203. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +72 -0
  204. package/linter/rules/cmd-check/s-three-method-consistency.js +206 -0
  205. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +45 -0
  206. package/linter/rules/cmd-check/true-false-abbreviation.js +121 -0
  207. package/linter/rules/deprecated-functions.js +4 -4
  208. package/linter/rules/naming-convention.d.ts +1 -1
  209. package/linter/rules/naming-convention.js +13 -14
  210. package/linter/rules/no-leaked-credentials.js +4 -4
  211. package/linter/rules/problematic-inputs.js +2 -1
  212. package/linter/rules/seeded-randomness.js +5 -5
  213. package/linter/rules/software-has-license.d.ts +1 -1
  214. package/linter/rules/software-has-license.js +1 -1
  215. package/linter/rules/unclosed-connection.js +3 -3
  216. package/linter/rules/undefined-symbol-util.js +16 -32
  217. package/linter/rules/undefined-symbol.d.ts +2 -0
  218. package/linter/rules/undefined-symbol.js +33 -3
  219. package/linter/rules/unescaped-arguments.js +10 -9
  220. package/linter/rules/unused-definition.js +13 -19
  221. package/package.json +1 -1
  222. package/project/cache/flowr-analyzer-cache.js +1 -1
  223. package/project/context/flowr-analyzer-context.js +1 -1
  224. package/project/context/flowr-analyzer-environment-context.d.ts +1 -1
  225. package/project/context/flowr-analyzer-files-context.d.ts +6 -0
  226. package/project/context/flowr-analyzer-files-context.js +3 -0
  227. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +0 -2
  228. package/project/context/flowr-analyzer-incremental-analysis-context.js +0 -4
  229. package/project/context/flowr-file.d.ts +4 -0
  230. package/project/context/flowr-file.js +4 -0
  231. package/project/flowr-analyzer-builder.js +1 -1
  232. package/project/plugins/file-plugins/files/flowr-description-file.js +2 -2
  233. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -0
  234. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +4 -0
  235. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +2 -0
  236. package/project/plugins/file-plugins/files/flowr-manifest-files.js +11 -14
  237. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +3 -0
  238. package/project/plugins/file-plugins/files/flowr-namespace-file.js +25 -15
  239. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +44 -0
  240. package/project/plugins/file-plugins/files/flowr-rd-file.js +130 -61
  241. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -1
  242. package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -16
  243. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -0
  244. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +4 -0
  245. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +2 -0
  246. package/project/plugins/file-plugins/files/flowr-sweave-file.js +4 -0
  247. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +0 -1
  248. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -5
  249. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +2 -0
  250. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -0
  251. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +3 -7
  252. package/project/sigdb/build.js +16 -30
  253. package/project/sigdb/dict.d.ts +4 -6
  254. package/project/sigdb/dict.js +125 -31
  255. package/project/sigdb/reader.js +2 -18
  256. package/project/sigdb/sigdb-download.js +14 -23
  257. package/queries/base-query-format.d.ts +2 -0
  258. package/queries/base-query-format.js +10 -2
  259. package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
  260. package/queries/catalog/absint-query/absint-query-format.js +5 -7
  261. package/queries/catalog/call-context-query/call-context-query-executor.js +24 -32
  262. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  263. package/queries/catalog/call-context-query/call-context-query-format.js +1 -3
  264. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -4
  265. package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -4
  266. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -3
  267. package/queries/catalog/config-query/config-query-format.js +3 -3
  268. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -3
  269. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -3
  270. package/queries/catalog/dependencies-query/data-flow.d.ts +43 -0
  271. package/queries/catalog/dependencies-query/data-flow.js +173 -0
  272. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +18 -0
  273. package/queries/catalog/dependencies-query/dependencies-query-executor.js +108 -12
  274. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +17 -1
  275. package/queries/catalog/dependencies-query/dependencies-query-format.js +14 -11
  276. package/queries/catalog/dependencies-query/function-info/derived-functions.js +2 -1
  277. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
  278. package/queries/catalog/dependencies-query/function-info/library-functions.js +13 -13
  279. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  280. package/queries/catalog/dependencies-query/function-info/remote-functions.js +3 -3
  281. package/queries/catalog/dependencies-query/function-info/source-functions.js +2 -2
  282. package/queries/catalog/dependencies-query/function-info/test-functions.js +8 -8
  283. package/queries/catalog/dependencies-query/function-info/transform-functions.d.ts +8 -0
  284. package/queries/catalog/dependencies-query/function-info/transform-functions.js +17 -0
  285. package/queries/catalog/dependencies-query/function-info/write-functions.js +4 -0
  286. package/queries/catalog/dependencies-query/implicit-echo.d.ts +5 -3
  287. package/queries/catalog/dependencies-query/implicit-echo.js +33 -34
  288. package/queries/catalog/dependencies-query/link-devices.d.ts +3 -2
  289. package/queries/catalog/dependencies-query/link-devices.js +9 -6
  290. package/queries/catalog/dependencies-query/plot-description.d.ts +10 -0
  291. package/queries/catalog/dependencies-query/plot-description.js +119 -0
  292. package/queries/catalog/dependencies-query/plot-objects.d.ts +13 -0
  293. package/queries/catalog/dependencies-query/plot-objects.js +61 -0
  294. package/queries/catalog/dice-query/dice-query-format.d.ts +2 -2
  295. package/queries/catalog/dice-query/dice-query-format.js +3 -40
  296. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
  297. package/queries/catalog/does-call-query/does-call-query-format.js +2 -2
  298. package/queries/catalog/function-info-query/function-info-query-format.js +2 -2
  299. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +2 -1
  300. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
  301. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
  302. package/queries/catalog/id-map-query/id-map-query-format.js +1 -3
  303. package/queries/catalog/input-sources-query/input-sources-query-executor.js +2 -2
  304. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -3
  305. package/queries/catalog/input-sources-query/simple-input-classifier.js +28 -29
  306. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +4 -7
  307. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +1 -1
  308. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +3 -2
  309. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
  310. package/queries/catalog/linter-query/linter-query-executor.js +10 -3
  311. package/queries/catalog/linter-query/linter-query-format.d.ts +4 -1
  312. package/queries/catalog/linter-query/linter-query-format.js +32 -21
  313. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  314. package/queries/catalog/location-map-query/location-map-query-format.js +1 -3
  315. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -3
  316. package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
  317. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  318. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  319. package/queries/catalog/origin-query/origin-query-format.js +4 -5
  320. package/queries/catalog/project-query/project-query-format.js +2 -2
  321. package/queries/catalog/provenance-query/provenance-query-format.js +2 -3
  322. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  323. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -4
  324. package/queries/catalog/search-query/search-query-format.js +1 -3
  325. package/queries/catalog/signature-query/signature-query-executor.js +3 -3
  326. package/queries/catalog/signature-query/signature-query-format.js +2 -2
  327. package/queries/catalog/slice-query-options.d.ts +16 -0
  328. package/queries/catalog/slice-query-options.js +28 -0
  329. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
  330. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -42
  331. package/queries/query-print.d.ts +4 -0
  332. package/queries/query-print.js +17 -1
  333. package/queries/query.d.ts +3 -3
  334. package/queries/query.js +3 -4
  335. package/r-bridge/lang-4.x/ast/model/model.d.ts +27 -3
  336. package/r-bridge/lang-4.x/ast/model/model.js +28 -1
  337. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +20 -1
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +25 -1
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
  350. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
  352. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
  353. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +18 -2
  354. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +15 -6
  355. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
  356. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
  357. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
  358. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
  359. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
  360. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
  361. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
  362. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
  363. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
  364. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
  365. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
  366. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +1 -0
  367. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
  368. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
  369. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
  370. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
  371. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
  372. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
  373. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +17 -0
  374. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +20 -0
  375. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
  376. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
  377. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
  378. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
  379. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
  380. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
  381. package/r-bridge/lang-4.x/ast/model/operators.js +0 -2
  382. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -6
  383. package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -6
  384. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -3
  385. package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
  386. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -5
  387. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -2
  388. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -20
  389. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -5
  390. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -5
  391. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -5
  392. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -9
  393. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -5
  394. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -10
  395. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -11
  396. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -11
  397. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -5
  398. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -5
  399. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -5
  400. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +6 -1
  401. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +7 -0
  402. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +0 -10
  403. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +30 -82
  404. package/r-bridge/retriever.d.ts +0 -4
  405. package/r-bridge/retriever.js +0 -13
  406. package/r-bridge/roxygen2/documentation-provider.js +3 -7
  407. package/r-bridge/shell.js +3 -8
  408. package/reconstruct/auto-select/magic-comments.js +8 -7
  409. package/reconstruct/inline/source-inline-map.d.ts +3 -0
  410. package/reconstruct/inline/source-inline-map.js +8 -7
  411. package/reconstruct/reconstruct.d.ts +1 -1
  412. package/reconstruct/reconstruct.js +33 -109
  413. package/search/flowr-search-printer.js +4 -15
  414. package/search/search-executor/search-generators.js +1 -1
  415. package/slicing/criterion/filters/all-variables.js +1 -2
  416. package/slicing/static/fingerprint.js +11 -2
  417. package/slicing/static/slice-call.d.ts +2 -8
  418. package/slicing/static/slice-call.js +8 -18
  419. package/slicing/static/static-slicer.js +81 -6
  420. package/util/collections/arrays.js +1 -1
  421. package/util/collections/set.js +1 -1
  422. package/util/diff-graph.d.ts +4 -0
  423. package/util/diff-graph.js +12 -0
  424. package/util/files.js +2 -6
  425. package/util/json.js +1 -15
  426. package/util/mermaid/cfg.js +10 -17
  427. package/util/mermaid/dfg.js +6 -8
  428. package/util/objects.d.ts +1 -1
  429. package/util/quads.js +4 -13
  430. package/util/r-author.js +5 -5
  431. package/util/range.d.ts +9 -0
  432. package/util/range.js +11 -0
  433. package/util/schema.js +3 -3
  434. package/util/simple-df/dfg-view.js +2 -1
  435. package/util/text/ansi.js +1 -2
  436. package/util/text/playground-link.js +2 -1
  437. package/util/text/r-highlight.js +2 -1
  438. package/util/text/strings.d.ts +2 -0
  439. package/util/text/strings.js +5 -0
  440. package/util/text/time.js +1 -2
  441. package/util/version.js +4 -3
  442. package/dataflow/fn/recursive-function.d.ts +0 -6
  443. package/dataflow/fn/recursive-function.js +0 -32
  444. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +0 -16
  445. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +0 -27
@@ -8,7 +8,7 @@ const edge_1 = require("../../../../../graph/edge");
8
8
  const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
9
9
  const environment_1 = require("../../../../../environments/environment");
10
10
  const built_in_library_1 = require("./built-in-library");
11
- const define_1 = require("../../../../../environments/define");
11
+ const frame_memory_1 = require("../../../../../environments/frame-memory");
12
12
  const vertex_1 = require("../../../../../graph/vertex");
13
13
  const program_order_1 = require("../../../../program-order");
14
14
  const resolve_helper_1 = require("../../../../../environments/resolve-helper");
@@ -16,7 +16,7 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
16
16
  const identifier_1 = require("../../../../../environments/identifier");
17
17
  const built_in_ambient_state_1 = require("./built-in-ambient-state");
18
18
  const defaultmap_1 = require("../../../../../../util/collections/defaultmap");
19
- const frame_reflection_1 = require("../../../../../fn/frame-reflection");
19
+ const df_helper_1 = require("../../../../../graph/df-helper");
20
20
  /**
21
21
  * Computes, for every function-definition vertex `F`, `summary(F) = own(F)` unioned with `summary(G)` over every transitive callee `G`.
22
22
  * @param graph - the fully linked dataflow graph
@@ -27,14 +27,12 @@ const frame_reflection_1 = require("../../../../../fn/frame-reflection");
27
27
  function computeCallGraphSummaries(graph, own) {
28
28
  const summary = new Map();
29
29
  const callees = new Map();
30
- for (const [id, vertex] of graph.vertices(true)) {
31
- if (vertex_1.DfgVertex.isFunctionDefinition(vertex)) {
32
- summary.set(id, new Set(own(id, vertex)));
33
- callees.set(id, (0, frame_reflection_1.callsIn)(vertex, graph).flatMap(([node]) => (0, frame_reflection_1.calledDefinitions)(graph, node)).toArray());
34
- }
30
+ for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)) {
31
+ summary.set(id, new Set(own(id, vertex)));
32
+ callees.set(id, df_helper_1.Dataflow.callsIn(vertex, graph).flatMap(([node]) => df_helper_1.Dataflow.calleeIdsOf(graph, node)).toArray());
35
33
  }
36
34
  /* pull each callee's summary, its callers are revisited whenever a function grew */
37
- (0, frame_reflection_1.propagateToFixpoint)(summary.keys(), callees, id => {
35
+ df_helper_1.Dataflow.propagateToFixpoint(summary.keys(), callees, id => {
38
36
  const effects = summary.get(id);
39
37
  const before = effects.size;
40
38
  for (const callee of callees.get(id) ?? []) {
@@ -65,7 +63,7 @@ function linkMaterializedExportsToLoaders(graph, environment) {
65
63
  }
66
64
  /* export node id -> its loading `library()`/`use()` call, from the final environment */
67
65
  const loaders = new Map();
68
- for (let e = environment.current; e !== undefined && !e.builtInEnv; e = e.parent) {
66
+ for (const e of environment_1.REnvironment.frames(environment.current)) {
69
67
  if (e.t !== environment_1.EnvType.Namespace) {
70
68
  continue;
71
69
  }
@@ -84,9 +82,9 @@ function linkMaterializedExportsToLoaders(graph, environment) {
84
82
  }
85
83
  }
86
84
  /** The packages (see {@link EnvType}) attached directly within a function body, i.e. its own `library()` calls. */
87
- function attachedPackages(_id, fdef) {
85
+ function ownLibraryCalls(_id, fdef) {
88
86
  const packages = [];
89
- for (let e = fdef.subflow.environment.current; e !== undefined && !e.builtInEnv; e = e.parent) {
87
+ for (const e of environment_1.REnvironment.frames(fdef.subflow.environment.current)) {
90
88
  if (e.t === environment_1.EnvType.Namespace && e.n !== undefined) {
91
89
  /* an export binding carries the loading `library()` call in `definedAt` */
92
90
  let definedAt = node_id_1.NodeId.toBuiltIn(e.n);
@@ -103,10 +101,8 @@ function attachedPackages(_id, fdef) {
103
101
  return packages;
104
102
  }
105
103
  /** The scopes outside a function's own frame, i.e. those a definition of its body can have escaped into. */
106
- function* escapeTargetFrames(fdef) {
107
- for (let e = fdef.subflow.environment.current.parent; e !== undefined && !e.builtInEnv; e = e.parent) {
108
- yield e;
109
- }
104
+ function escapeTargetFrames(fdef) {
105
+ return environment_1.REnvironment.frames(fdef.subflow.environment.current.parent);
110
106
  }
111
107
  /**
112
108
  * The non-built-in definitions a function body lets escape to an outer scope (e.g. a `<<-` super-assignment),
@@ -119,7 +115,12 @@ function escapedDefinitions(hidden) {
119
115
  const defs = hidden.keys().filter(call => fdef.subflow.graph.has(call)).toArray();
120
116
  for (const e of escapeTargetFrames(fdef)) {
121
117
  let escaped = perFrame.get(e.memory);
122
- if (escaped === undefined) {
118
+ if (escaped === undefined && e.memory instanceof frame_memory_1.Frame && e.memory.lazy() !== undefined) {
119
+ /* an attached package binds nothing but its exports, which are built-ins */
120
+ escaped = [];
121
+ perFrame.set(e.memory, escaped);
122
+ }
123
+ else if (escaped === undefined) {
123
124
  /* a package frame holds thousands of entries and keeps none of them, so this walks them in place
124
125
  * rather than through a spread/flatMap/filter/map chain that allocates an array per step */
125
126
  const collected = [];
@@ -134,7 +135,10 @@ function escapedDefinitions(hidden) {
134
135
  perFrame.set(e.memory, escaped);
135
136
  }
136
137
  for (const d of escaped) {
137
- defs.push(d);
138
+ /* a package the caller attached is visible in the body, but only one the body attaches escapes it */
139
+ if (e.t === undefined || fdef.subflow.graph.has(d)) {
140
+ defs.push(d);
141
+ }
138
142
  }
139
143
  }
140
144
  return defs;
@@ -142,11 +146,8 @@ function escapedDefinitions(hidden) {
142
146
  }
143
147
  /** Emits {@link EdgeType.SideEffectOnCall} edges for definitions that escape a function transitively. */
144
148
  function propagateTransitiveDefinitions(graph, environment, ctx, summary) {
145
- for (const [id, vertex] of graph.vertices(true)) {
146
- if (!vertex_1.DfgVertex.isFunctionCall(vertex)) {
147
- continue;
148
- }
149
- for (const target of (0, frame_reflection_1.calledDefinitions)(graph, id)) {
149
+ for (const [id] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
150
+ for (const target of df_helper_1.Dataflow.calleeIdsOf(graph, id)) {
150
151
  for (const def of summary.get(target) ?? []) {
151
152
  /* an escaping package export is only in the environment; materialize its vertex on demand */
152
153
  if (node_id_1.NodeId.isBuiltIn(def)) {
@@ -163,13 +164,13 @@ function propagateTransitiveDefinitions(graph, environment, ctx, summary) {
163
164
  * @returns the enriched environment and whether it grew (so the caller can re-link and re-run to a fixpoint).
164
165
  */
165
166
  function propagateTransitivePackages(graph, environment, ctx) {
166
- const summary = computeCallGraphSummaries(graph, attachedPackages);
167
+ const summary = computeCallGraphSummaries(graph, ownLibraryCalls);
167
168
  const reachable = new Map(); // package -> its loading `library()` call
168
- for (const [id, vertex] of graph.vertices(true)) {
169
- if (!vertex_1.DfgVertex.isFunctionCall(vertex) || !graph.isRoot(id)) {
169
+ for (const [id] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
170
+ if (!graph.isRoot(id)) {
170
171
  continue;
171
172
  }
172
- for (const target of (0, frame_reflection_1.calledDefinitions)(graph, id)) {
173
+ for (const target of df_helper_1.Dataflow.calleeIdsOf(graph, id)) {
173
174
  for (const { pack, definedAt } of summary.get(target) ?? []) {
174
175
  if (!reachable.has(pack)) {
175
176
  reachable.set(pack, definedAt);
@@ -203,7 +204,7 @@ function hiddenBuiltInWrites(graph, environment) {
203
204
  continue;
204
205
  }
205
206
  const own = vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Function) ? undefined : vertex.name;
206
- for (const target of (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.Calls)) {
207
+ for (const target of df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Calls)) {
207
208
  if (node_id_1.NodeId.isBuiltIn(target) && (own === undefined || node_id_1.NodeId.toBuiltIn(identifier_1.Identifier.getName(own)) !== target)) {
208
209
  const targets = resolve_helper_1.Resolve.byNameAndType(node_id_1.NodeId.fromBuiltIn(target), { current: builtIns, level: 0 }, identifier_1.ReferenceType.Function) ?? [];
209
210
  const defs = targets.flatMap(d => (0, built_in_ambient_state_1.writesOfHiddenBuiltIn)(d, id));
@@ -230,7 +231,7 @@ function linkHiddenReads(graph, reads) {
230
231
  if (vertex.environment === undefined) {
231
232
  continue;
232
233
  }
233
- for (const target of (0, frame_reflection_1.calledDefinitions)(graph, id)) {
234
+ for (const target of df_helper_1.Dataflow.calleeIdsOf(graph, id)) {
234
235
  for (const call of summary.get(target) ?? []) {
235
236
  for (const name of reads.get(call) ?? []) {
236
237
  for (const def of resolve_helper_1.Resolve.byName(name, vertex.environment) ?? []) {
@@ -251,10 +252,7 @@ function escapedDefinitionMap(graph, hidden) {
251
252
  const map = new Map(hidden.entries().map(([id, defs]) => [id, [...defs]]));
252
253
  const definitionsOf = new defaultmap_1.DefaultMap(() => [], map);
253
254
  const seen = new Set();
254
- for (const [, vertex] of graph.vertices(true)) {
255
- if (!vertex_1.DfgVertex.isFunctionDefinition(vertex)) {
256
- continue;
257
- }
255
+ for (const [, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)) {
258
256
  const global = escapeTargetFrames(vertex).filter(e => e.t === undefined).reduce((_, e) => e, undefined);
259
257
  /* a frame shared with an already-visited definition contributes the same entries */
260
258
  if (global !== undefined && !seen.has(global.memory)) {
@@ -279,13 +277,13 @@ function propagateTransitiveEscapedDefinitions(graph, environment, defined, hidd
279
277
  const defs = escapedDefinitionMap(graph, hidden);
280
278
  const names = new Set();
281
279
  let byName;
282
- const definitionsNamed = (name) => (byName ??= (0, frame_reflection_1.definitionsByName)(graph)).get(name);
280
+ const definitionsNamed = (name) => (byName ??= df_helper_1.Dataflow.definitionsByName(graph)).get(name);
283
281
  let grew = false;
284
- for (const [id, vertex] of graph.vertices(true)) {
285
- if (!vertex_1.DfgVertex.isFunctionCall(vertex) || !graph.isRoot(id)) {
282
+ for (const [id] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
283
+ if (!graph.isRoot(id)) {
286
284
  continue;
287
285
  }
288
- for (const target of (0, frame_reflection_1.calledDefinitions)(graph, id)) {
286
+ for (const target of df_helper_1.Dataflow.calleeIdsOf(graph, id)) {
289
287
  for (const def of (summary.get(target) ?? []).values().flatMap(nodeId => defs.get(nodeId) ?? [])) {
290
288
  const nodeId = def.nodeId;
291
289
  names.add(def.name);
@@ -300,7 +298,7 @@ function propagateTransitiveEscapedDefinitions(graph, environment, defined, hidd
300
298
  if (resolve_helper_1.Resolve.byNameAndType(def.name, environment, def.type)?.some(d => d.nodeId === nodeId)) {
301
299
  continue;
302
300
  }
303
- environment = (0, define_1.define)(def, false, environment);
301
+ environment = environment_1.REnvironment.define(def, false, environment);
304
302
  linkReadsAfter(graph, id, def, open, definitionsNamed);
305
303
  grew = true;
306
304
  }
@@ -315,7 +313,7 @@ function propagateTransitiveEscapedDefinitions(graph, environment, defined, hidd
315
313
  function linkReadsAfter(graph, call, def, open, definitionsNamed) {
316
314
  const before = graph.getVertex(call)?.environment;
317
315
  const visible = before === undefined ? definitionsNamed(def.name) : resolve_helper_1.Resolve.byName(def.name, before)?.map(d => d.nodeId) ?? [];
318
- const replaced = new Set([...visible, ...(0, frame_reflection_1.edgeSources)(graph, call, edge_1.EdgeType.SideEffectOnCall)]);
316
+ const replaced = new Set([...visible, ...df_helper_1.Dataflow.sourcesOf(graph, call, edge_1.EdgeType.SideEffectOnCall)]);
319
317
  const readers = new Set(open.filter(r => r.name === def.name).map(r => r.nodeId));
320
318
  for (const [id] of graph.vertices(true)) {
321
319
  /* an argument reads the value of a call, not a name the call may define (an ambient state is defined at its call) */
@@ -30,6 +30,8 @@ export interface ProcessAllArgumentInput<OtherInfo> {
30
30
  readonly nonFunction?: ReadonlySet<NodeId>;
31
31
  /** the arguments from this index on are alternatives of which at most one runs (the arms of `switch`) */
32
32
  readonly alternativesFrom?: number;
33
+ /** keep the graph of each processed argument its own, for a caller marking what lies within an argument */
34
+ readonly keepGraphs?: boolean;
33
35
  }
34
36
  export interface ProcessAllArgumentResult {
35
37
  readonly finalEnv: REnvironmentInformation;
@@ -56,7 +58,7 @@ export declare function convertFnArgument<OtherInfo>(this: void, arg: typeof Emp
56
58
  */
57
59
  export declare function isPipedArgument<OtherInfo>(arg: unknown, functionRootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): boolean;
58
60
  /** Processes all arguments for a function call, updating the given final graph and environment. */
59
- export declare function processAllArguments<OtherInfo>({ functionName, args, data, finalGraph, functionRootId, forced, patchData, nonFunction, alternativesFrom }: ProcessAllArgumentInput<OtherInfo>): ProcessAllArgumentResult;
61
+ export declare function processAllArguments<OtherInfo>({ functionName, args, data, finalGraph, functionRootId, forced, patchData, nonFunction, alternativesFrom, keepGraphs }: ProcessAllArgumentInput<OtherInfo>): ProcessAllArgumentResult;
60
62
  export interface PatchFunctionCallInput<OtherInfo> {
61
63
  readonly nextGraph: DataflowGraph;
62
64
  readonly rootId: NodeId;
@@ -17,14 +17,13 @@ const model_1 = require("../../../../../r-bridge/lang-4.x/ast/model/model");
17
17
  const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
18
18
  const identifier_1 = require("../../../../environments/identifier");
19
19
  const built_in_ambient_state_1 = require("./built-in/built-in-ambient-state");
20
- const overwrite_1 = require("../../../../environments/overwrite");
21
20
  const resolve_by_name_1 = require("../../../../environments/resolve-by-name");
22
21
  const process_argument_1 = require("../process-argument");
23
22
  const vertex_1 = require("../../../../graph/vertex");
24
23
  const edge_1 = require("../../../../graph/edge");
25
24
  const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
26
25
  const vertex_2 = require("../../../../graph/vertex");
27
- const append_1 = require("../../../../environments/append");
26
+ const environment_1 = require("../../../../environments/environment");
28
27
  function forceVertexArgumentValueReferences(rootId, value, graph, env) {
29
28
  const valueVertex = graph.getVertex(value.entryPoint);
30
29
  if (!valueVertex) {
@@ -80,7 +79,7 @@ function isPipedArgument(arg, functionRootId, data) {
80
79
  return data.pipedArgument?.rootId === functionRootId && data.pipedArgument.argument === arg;
81
80
  }
82
81
  /** Processes all arguments for a function call, updating the given final graph and environment. */
83
- function processAllArguments({ functionName, args, data, finalGraph, functionRootId, forced = [], patchData, nonFunction, alternativesFrom }) {
82
+ function processAllArguments({ functionName, args, data, finalGraph, functionRootId, forced = [], patchData, nonFunction, alternativesFrom, keepGraphs }) {
84
83
  let finalEnv = functionName.environment;
85
84
  const callArgs = [];
86
85
  const processedArguments = [];
@@ -113,12 +112,12 @@ function processAllArguments({ functionName, args, data, finalGraph, functionRoo
113
112
  forceVertexArgumentValueReferences(functionRootId, processed, processed.graph, data.environment);
114
113
  }
115
114
  processedArguments.push(processed);
116
- finalEnv = (0, overwrite_1.overwriteEnvironment)(finalEnv, processed.environment);
115
+ finalEnv = environment_1.REnvironment.overwrite(finalEnv, processed.environment);
117
116
  if (beforeAlternatives !== undefined) {
118
- afterAlternatives = (0, append_1.appendEnvironment)(afterAlternatives ?? beforeAlternatives, finalEnv);
117
+ afterAlternatives = environment_1.REnvironment.append(afterAlternatives ?? beforeAlternatives, finalEnv);
119
118
  }
120
- /* nothing reads the argument's own graph past this point, only its entry point and references */
121
- finalGraph.mergeWith(processed.graph, true, precomputed === undefined);
119
+ /* unless asked to keep it, nothing reads the argument's own graph past this point, only its entry point and references */
120
+ finalGraph.mergeWith(processed.graph, true, precomputed === undefined && !keepGraphs);
122
121
  /* resolve reads within argument, we resolve before adding the `processed.environment` to avoid cyclic dependencies */
123
122
  for (const original of [...processed.in, ...processed.unknownReferences]) {
124
123
  const inId = original.nodeId;
@@ -2,23 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Deferred = void 0;
4
4
  exports.verticesByName = verticesByName;
5
+ const r_string_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
5
6
  const model_1 = require("../../../../../r-bridge/lang-4.x/ast/model/model");
6
7
  const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
7
8
  const node_id_1 = require("../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
8
9
  const identifier_1 = require("../../../../environments/identifier");
9
- const retriever_1 = require("../../../../../r-bridge/retriever");
10
10
  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 r_symbol_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
14
14
  const linker_1 = require("../../../linker");
15
- const frame_reflection_1 = require("../../../../fn/frame-reflection");
16
15
  const r_function_definition_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
17
16
  const built_in_proc_name_1 = require("../../../../environments/built-in-proc-name");
17
+ const df_helper_1 = require("../../../../graph/df-helper");
18
18
  /** The vertices of `type` by their unquoted name. */
19
19
  function verticesByName(graph, type, idMap) {
20
20
  const named = graph.vertexIdsOfType(type).filter(id => node_id_1.NodeId.recoverName(id, idMap) !== undefined);
21
- return Map.groupBy(named, id => (0, retriever_1.removeRQuotes)(node_id_1.NodeId.recoverName(id, idMap)));
21
+ return Map.groupBy(named, id => r_string_1.RString.unquote(node_id_1.NodeId.recoverName(id, idMap)));
22
22
  }
23
23
  /** The names a deferred expression touches, each with the node touching it and whether it is written. */
24
24
  function namesWithin(expr, graph, idMap) {
@@ -34,10 +34,10 @@ function namesWithin(expr, graph, idMap) {
34
34
  /* a call reads the function it names, so `evalq(f())` needs the definition of `f` */
35
35
  if (vertex_1.DfgVertex.isFunctionCall(graph.getVertex(inner.info.id))) {
36
36
  names.push([inner.info.id, identifier_1.Identifier.getName(inner.functionName.content), false]);
37
- for (const def of (0, frame_reflection_1.edgeSources)(graph, inner.info.id, edge_1.EdgeType.SideEffectOnCall)) {
37
+ for (const def of df_helper_1.Dataflow.sourcesOf(graph, inner.info.id, edge_1.EdgeType.SideEffectOnCall)) {
38
38
  const name = node_id_1.NodeId.recoverName(def, idMap);
39
39
  if (name !== undefined) {
40
- names.push([def, (0, retriever_1.removeRQuotes)(name), true]);
40
+ names.push([def, r_string_1.RString.unquote(name), true]);
41
41
  }
42
42
  }
43
43
  }
@@ -77,11 +77,11 @@ exports.Deferred = {
77
77
  * With `viaClosures`, a closure reading a `delayedAssign` binding forces it when called.
78
78
  */
79
79
  forcedAt(graph, binding, cfg, viaClosures = false) {
80
- const reads = (0, frame_reflection_1.edgeSources)(graph, binding, edge_1.EdgeType.Reads);
80
+ const reads = df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.Reads);
81
81
  const readSet = new Set(reads);
82
82
  /* a closure reading it and the call of that closure may skip the read, so they never rule out a later force */
83
83
  const calls = viaClosures
84
- ? (0, frame_reflection_1.edgeSources)(graph, binding, edge_1.EdgeType.DefinesOnCall | edge_1.EdgeType.DefinedByOnCall).filter(r => !readSet.has(r))
84
+ ? df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.DefinesOnCall | edge_1.EdgeType.DefinedByOnCall).filter(r => !readSet.has(r))
85
85
  : [];
86
86
  if (reads.length < 2) {
87
87
  return reads.concat(calls);
@@ -148,7 +148,7 @@ exports.Deferred = {
148
148
  return always;
149
149
  };
150
150
  /* `delayedAssign` names its variable with a string literal, so the recovered name still carries quotes */
151
- const bindingName = forces === undefined ? undefined : (0, retriever_1.removeRQuotes)(node_id_1.NodeId.recoverName(forces.binding, idMap) ?? '');
151
+ const bindingName = forces === undefined ? undefined : r_string_1.RString.unquote(node_id_1.NodeId.recoverName(forces.binding, idMap) ?? '');
152
152
  for (const [node, name, writes] of within) {
153
153
  if (writes) {
154
154
  /* a write of the bound name replaces the binding, so a read it definitely reaches sees only it */
@@ -25,6 +25,8 @@ export interface ProcessKnownFunctionCallInput<OtherInfo> {
25
25
  readonly reverseOrder?: boolean;
26
26
  /** which arguments are {@link NseKind.Reevaluated|reevaluated}, like a loop body */
27
27
  readonly markAsNSE?: readonly number[];
28
+ /** see {@link ProcessAllArgumentInput#keepGraphs}, needed to mark what lies within an argument afterward */
29
+ readonly keepArgumentGraphs?: boolean;
28
30
  /** allows passing a data processor in-between each argument */
29
31
  readonly patchData?: (data: DataflowProcessorInformation<OtherInfo & ParentInformation>, arg: number) => DataflowProcessorInformation<OtherInfo & ParentInformation>;
30
32
  /** Does the call have a side effect that we do not know a lot about which may have further consequences? */
@@ -87,17 +89,22 @@ export interface NseMarkOptions {
87
89
  readonly kind?: NseKind;
88
90
  /** ids an unquote escape splices back in, see {@link FunctionSemantics.call.nse.unquoted} */
89
91
  readonly evaluated?: ReadonlySet<NodeId>;
92
+ /** the position of the argument filling the first parameter, see {@link nseArgumentPositions} */
93
+ readonly first?: number;
90
94
  }
91
- /** The positions of the arguments `which` names among `count` arguments. */
92
- export declare function nseArgumentPositions(which: NseArguments | readonly number[] | undefined, count: number): readonly number[];
95
+ /**
96
+ * The positions of the arguments `which` names among `count` arguments, where `first` is the position of the
97
+ * argument filling the first parameter (`-1` if none does), as a named one may come later (`mutate(z = 1, .data = d)`).
98
+ */
99
+ export declare function nseArgumentPositions(which: NseArguments | readonly number[] | undefined, count: number, first?: number): readonly number[];
93
100
  /**
94
101
  * Marks the selected arguments as {@link EdgeType.NonStandardEvaluation}: a {@link NseKind.Quoted|quoted} one
95
102
  * entirely, a {@link NseKind.DataMasked|data-masked} one only where {@link FunctionSemantics.call.nse.suppliedByMask} holds, and a
96
103
  * {@link NseKind.Reevaluated|reevaluated} one as a whole but not within.
97
104
  */
98
- export declare function markArgumentsAsNonStandardEvaluation(graph: DataflowGraph, rootId: NodeId, processedArguments: readonly (DataflowInformation | undefined)[], which: NseArguments | readonly number[] | undefined, { kind, evaluated }?: NseMarkOptions): void;
105
+ export declare function markArgumentsAsNonStandardEvaluation(graph: DataflowGraph, rootId: NodeId, processedArguments: readonly (DataflowInformation | undefined)[], which: NseArguments | readonly number[] | undefined, { kind, evaluated, first }?: NseMarkOptions): void;
99
106
  /**
100
107
  * The main processor for function calls for which we know the target but need not
101
108
  * add any specific handling.
102
109
  */
103
- export declare function processKnownFunctionCall<OtherInfo>({ name, args, rootId, data, reverseOrder, markAsNSE, sig, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom }: ProcessKnownFunctionCallInput<OtherInfo>): ProcessKnownFunctionCallResult;
110
+ export declare function processKnownFunctionCall<OtherInfo>({ name, args, rootId, data, reverseOrder, markAsNSE, sig, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom, keepArgumentGraphs }: ProcessKnownFunctionCallInput<OtherInfo>): ProcessKnownFunctionCallResult;
@@ -47,24 +47,27 @@ var NseKind;
47
47
  /** evaluated, just not exactly once (a loop body), so only the argument itself is marked */
48
48
  NseKind["Reevaluated"] = "reevaluated";
49
49
  })(NseKind || (exports.NseKind = NseKind = {}));
50
- /** The positions of the arguments `which` names among `count` arguments. */
51
- function nseArgumentPositions(which, count) {
50
+ /**
51
+ * The positions of the arguments `which` names among `count` arguments, where `first` is the position of the
52
+ * argument filling the first parameter (`-1` if none does), as a named one may come later (`mutate(z = 1, .data = d)`).
53
+ */
54
+ function nseArgumentPositions(which, count, first = 0) {
52
55
  if (typeof which !== 'string') {
53
56
  return which ?? [];
54
57
  }
55
58
  const all = Array.from({ length: count }, (_, i) => i);
56
59
  if (which === NseArguments.First) {
57
- return all.slice(0, 1);
60
+ return first >= 0 && first < count ? [first] : [];
58
61
  }
59
- return which === NseArguments.AllButFirst ? all.slice(1) : all;
62
+ return which === NseArguments.AllButFirst ? all.filter(i => i !== first) : all;
60
63
  }
61
64
  /**
62
65
  * Marks the selected arguments as {@link EdgeType.NonStandardEvaluation}: a {@link NseKind.Quoted|quoted} one
63
66
  * entirely, a {@link NseKind.DataMasked|data-masked} one only where {@link FunctionSemantics.call.nse.suppliedByMask} holds, and a
64
67
  * {@link NseKind.Reevaluated|reevaluated} one as a whole but not within.
65
68
  */
66
- function markArgumentsAsNonStandardEvaluation(graph, rootId, processedArguments, which, { kind = NseKind.Quoted, evaluated } = {}) {
67
- for (const i of nseArgumentPositions(which, processedArguments.length)) {
69
+ function markArgumentsAsNonStandardEvaluation(graph, rootId, processedArguments, which, { kind = NseKind.Quoted, evaluated, first } = {}) {
70
+ for (const i of nseArgumentPositions(which, processedArguments.length, first)) {
68
71
  if (i < processedArguments.length) {
69
72
  markArgument(graph, rootId, processedArguments[i], kind, evaluated);
70
73
  }
@@ -99,7 +102,7 @@ function markArgument(graph, rootId, arg, kind, evaluated) {
99
102
  * The main processor for function calls for which we know the target but need not
100
103
  * add any specific handling.
101
104
  */
102
- function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = false, markAsNSE = undefined, sig, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom }) {
105
+ function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = false, markAsNSE = undefined, sig, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom, keepArgumentGraphs }) {
103
106
  const functionName = (0, processor_1.processDataflowFor)(name, data);
104
107
  const finalGraph = new graph_1.DataflowGraph(data.completeAst.idMap);
105
108
  const functionCallName = name.content;
@@ -111,6 +114,7 @@ function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = fal
111
114
  data: origin === 'default' ? control_flow_1.ControlFlow.withinPromise(data, rootId) : data,
112
115
  finalGraph,
113
116
  functionRootId: rootId,
117
+ keepGraphs: keepArgumentGraphs,
114
118
  patchData,
115
119
  forced,
116
120
  nonFunction,
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.markAsOnlyBuiltIn = markAsOnlyBuiltIn;
4
4
  exports.processNamedCall = processNamedCall;
5
+ const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
5
6
  const built_in_ambient_state_1 = require("./built-in/built-in-ambient-state");
6
7
  const function_semantics_1 = require("../../../../fn/function-semantics");
7
8
  const info_1 = require("../../../../info");
8
9
  const known_call_handling_1 = require("./known-call-handling");
9
- const append_1 = require("../../../../environments/append");
10
10
  const r_parameter_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-parameter");
11
11
  const r_string_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
12
12
  const r_expression_list_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
@@ -26,6 +26,7 @@ const resolve_helper_1 = require("../../../../environments/resolve-helper");
26
26
  const assert_1 = require("../../../../../util/assert");
27
27
  const built_in_props_1 = require("../../../../environments/built-in-props");
28
28
  const query_fn_props_1 = require("../../../../environments/query-fn-props");
29
+ const environment_1 = require("../../../../environments/environment");
29
30
  function mergeInformation(info, newInfo) {
30
31
  if (info === undefined) {
31
32
  return newInfo;
@@ -35,7 +36,7 @@ function mergeInformation(info, newInfo) {
35
36
  in: info.in.concat(newInfo.in),
36
37
  out: info.out.concat(newInfo.out),
37
38
  graph: info.graph.mergeWith(newInfo.graph),
38
- environment: (0, append_1.appendEnvironment)(info.environment, newInfo.environment),
39
+ environment: environment_1.REnvironment.append(info.environment, newInfo.environment),
39
40
  entryPoint: newInfo.entryPoint,
40
41
  cfgEntry: newInfo.cfgEntry,
41
42
  cfgExit: newInfo.cfgExit,
@@ -79,7 +80,7 @@ function markAsOnlyBuiltIn(graph, rootId, keepEnvironment = false) {
79
80
  const HandedFunction = identifier_1.ReferenceType.Function | identifier_1.ReferenceType.Parameter | identifier_1.ReferenceType.Argument;
80
81
  /** Whether `arg` hands over a function that may draw: a symbol bound to data (`d <- read.csv(f)`, `NA`) does not, nor does a built-in stating it does not (`mean`) */
81
82
  function handsOverFunction(arg, data) {
82
- const value = arg === r_function_call_1.EmptyArgument ? undefined : arg.value;
83
+ const value = r_argument_1.RArgument.valueOf(arg);
83
84
  if (!r_symbol_1.RSymbol.is(value)) {
84
85
  return r_function_definition_1.RFunctionDefinition.is(value);
85
86
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Nse = exports.Unquote = void 0;
4
+ const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
4
5
  const model_1 = require("../../../../../r-bridge/lang-4.x/ast/model/model");
5
6
  const r_unary_op_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-unary-op");
6
7
  const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
@@ -9,7 +10,6 @@ const identifier_1 = require("../../../../environments/identifier");
9
10
  const data_masking_functions_1 = require("../../../../environments/data-masking-functions");
10
11
  const vertex_1 = require("../../../../graph/vertex");
11
12
  const edge_1 = require("../../../../graph/edge");
12
- const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
13
13
  /** The escape a quoting function offers, a property of the function: `quote(!!x)` negates, `expr(!!x)` splices. */
14
14
  var Unquote;
15
15
  (function (Unquote) {
@@ -23,11 +23,11 @@ var Unquote;
23
23
  /** `!!x` parses as `!(!x)`, so peel the run of `!` to reach the operand. */
24
24
  function unquotedOperandOf(node, style) {
25
25
  if (style === Unquote.Bquote) {
26
- if (!r_function_call_1.RFunctionCall.isNamed(node) || identifier_1.Identifier.getName(node.functionName.content) !== '.' || node.arguments.length !== 1) {
26
+ if (!r_function_call_1.RFunctionCall.isNamed(node, '.') || node.arguments.length !== 1) {
27
27
  return undefined;
28
28
  }
29
29
  const arg = node.arguments[0];
30
- return r_argument_1.RArgument.isEmpty(arg) ? undefined : arg.value;
30
+ return r_argument_1.RArgument.valueOf(arg);
31
31
  }
32
32
  if (!isNegation(node) || !isNegation(node.operand)) {
33
33
  return undefined;
@@ -137,7 +137,7 @@ exports.Nse = {
137
137
  },
138
138
  /** Whether `id` is a name the data mask supplies, i.e. a use the caller does not bind itself. */
139
139
  suppliedByMask(graph, id, vertex = graph.getVertex(id)) {
140
- return vertex_1.DfgVertex.isUse(vertex) && !graph.outgoingEdges(id)?.values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.Reads));
140
+ return vertex_1.DfgVertex.isUse(vertex) && !graph.edgesFrom(id).values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.Reads));
141
141
  },
142
142
  /**
143
143
  * Whether `id` is a name a data mask supplied, which the mark the masking call carries is what records.
@@ -27,7 +27,6 @@ const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r
27
27
  const happens_before_1 = require("../../../../../control-flow/happens-before");
28
28
  const query_fn_props_1 = require("../../../../environments/query-fn-props");
29
29
  const built_in_props_1 = require("../../../../environments/built-in-props");
30
- const frame_reflection_1 = require("../../../../fn/frame-reflection");
31
30
  const defaultmap_1 = require("../../../../../util/collections/defaultmap");
32
31
  /** Calls whose result is a language object although they read their arguments like any other call. */
33
32
  const CapturingCalls = new Set(['expression']);
@@ -78,7 +77,7 @@ exports.Quoted = {
78
77
  for (let parent = idMap?.get(id)?.info.parent; parent !== undefined; parent = idMap?.get(parent)?.info.parent) {
79
78
  const captured = exports.Quoted.capturedBy(graph, parent);
80
79
  if (captured.length > 0) {
81
- const evaluating = captured.flatMap(expr => (0, frame_reflection_1.edgeSources)(graph, expr, edge_1.EdgeType.Returns | edge_1.EdgeType.Reads | edge_1.EdgeType.Calls));
80
+ const evaluating = captured.flatMap(expr => df_helper_1.Dataflow.sourcesOf(graph, expr, edge_1.EdgeType.Returns | edge_1.EdgeType.Reads | edge_1.EdgeType.Calls));
82
81
  return [parent, ...evaluating.filter(from => from !== parent)];
83
82
  }
84
83
  }
@@ -110,6 +109,8 @@ exports.Quoted = {
110
109
  const reaches = new defaultmap_1.DefaultMap(() => ({}));
111
110
  const reachOf = (sites) => reaches.get(sites.join('\0'));
112
111
  let enclosing;
112
+ /* every call of a function lists the arguments of all its calls, so each is linked once per forces it meets */
113
+ const linkedWith = new Map();
113
114
  for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
114
115
  const masks = nse_1.Nse.dropResolvedMask(graph, id, vertex.name);
115
116
  if (masks !== undefined) {
@@ -162,7 +163,8 @@ exports.Quoted = {
162
163
  for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
163
164
  const index = namesOnce();
164
165
  const forces = forcesOf(graph, parameter, flow, forcing, reachOf);
165
- if (forces !== undefined) {
166
+ if (forces !== undefined && linkedWith.get(argument) !== forces) {
167
+ linkedWith.set(argument, forces);
166
168
  deferred_1.Deferred.link(graph, argument, index, idMap, forces);
167
169
  }
168
170
  }
@@ -185,7 +187,7 @@ function forcesOf(graph, parameter, cfg, forcing, reachOf) {
185
187
  return known.forces;
186
188
  }
187
189
  /* counting is only needed once something touched the reads, and the same count still means the same forces */
188
- const reads = (0, frame_reflection_1.edgeSources)(graph, parameter, edge_1.EdgeType.Reads).length;
190
+ const reads = df_helper_1.Dataflow.sourcesOf(graph, parameter, edge_1.EdgeType.Reads).length;
189
191
  if (known?.reads === reads) {
190
192
  forcing.set(parameter, { ...known, version });
191
193
  return known.forces;
@@ -197,11 +199,11 @@ function forcesOf(graph, parameter, cfg, forcing, reachOf) {
197
199
  }
198
200
  /** The name a delaying call binds, which is the definition its reads have to go through. */
199
201
  function boundBy(graph, id) {
200
- return (0, frame_reflection_1.edgeSources)(graph, id, edge_1.EdgeType.DefinedBy).find(target => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)));
202
+ return df_helper_1.Dataflow.sourcesOf(graph, id, edge_1.EdgeType.DefinedBy).find(target => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)));
201
203
  }
202
204
  /** Every read of the delayed name takes the promised expression's value, so all of them get the link, not just whichever forces it first. */
203
205
  function linkForcesToPromise(graph, binding, promise) {
204
- for (const reader of (0, frame_reflection_1.edgeSources)(graph, binding, edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall)) {
206
+ for (const reader of df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall)) {
205
207
  if (reader !== promise) {
206
208
  graph.addEdge(reader, promise, edge_1.EdgeType.Reads);
207
209
  }
@@ -214,13 +216,13 @@ function trackedEnvOf(call, evalEnv) {
214
216
  return env?.current.globalEnv || env?.current.builtInEnv ? undefined : env;
215
217
  }
216
218
  function* installedLanguageOf(graph, id, installers) {
217
- for (const definition of (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.Reads)) {
219
+ for (const definition of df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads)) {
218
220
  if (!vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(definition))) {
219
221
  continue;
220
222
  }
221
223
  let installs = false;
222
224
  const captured = [];
223
- for (const by of (0, frame_reflection_1.edgeTargets)(graph, definition, edge_1.EdgeType.DefinedBy)) {
225
+ for (const by of df_helper_1.Dataflow.targetsOf(graph, definition, edge_1.EdgeType.DefinedBy)) {
224
226
  const captures = capturedArgumentsOf(graph, by, true);
225
227
  if (captures.length > 0) {
226
228
  captured.push(...captures);
@@ -265,7 +267,7 @@ function evaluationSites(graph, id, enclosing) {
265
267
  const todo = [id];
266
268
  for (let at = todo.pop(); at !== undefined; at = todo.pop()) {
267
269
  for (const definition of enclosing.get(at) ?? []) {
268
- for (const caller of (0, frame_reflection_1.edgeSources)(graph, definition, edge_1.EdgeType.Calls)) {
270
+ for (const caller of df_helper_1.Dataflow.sourcesOf(graph, definition, edge_1.EdgeType.Calls)) {
269
271
  if (!sites.has(caller)) {
270
272
  sites.add(caller);
271
273
  todo.push(caller);
@@ -316,7 +318,7 @@ function linkAgainstAnyBinding(graph, open, bindings, sites, cfg, reach) {
316
318
  }
317
319
  }
318
320
  function callsWithSideEffects(graph) {
319
- return new Set(graph.vertices(true).flatMap(([from]) => (0, frame_reflection_1.edgeTargets)(graph, from, edge_1.EdgeType.SideEffectOnCall)));
321
+ return new Set(graph.vertices(true).flatMap(([from]) => df_helper_1.Dataflow.targetsOf(graph, from, edge_1.EdgeType.SideEffectOnCall)));
320
322
  }
321
323
  /** Links a capture handed to an evaluating call, in that call's scope. */
322
324
  function resolveEvaluation(graph, call, idMap, names, bindings, cfg, reachOf, enclosing, evaluated) {
@@ -416,7 +418,7 @@ function* escapingArguments(graph, id) {
416
418
  continue;
417
419
  }
418
420
  for (const parameter of df_helper_1.Dataflow.parametersOf(callee)) {
419
- if ((0, frame_reflection_1.edgeSources)(graph, parameter, edge_1.EdgeType.Reads).some(reader => !closure.subflow.graph.has(reader))) {
421
+ if (df_helper_1.Dataflow.sourcesOf(graph, parameter, edge_1.EdgeType.Reads).some(reader => !closure.subflow.graph.has(reader))) {
420
422
  continue;
421
423
  }
422
424
  for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
@@ -437,9 +439,9 @@ function readAtForcingCalls(graph, factoryCall, argument, closure, idMap) {
437
439
  else if (!vertex_1.DfgVertex.isVariableDefinition(via) || !edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy)) {
438
440
  return;
439
441
  }
440
- for (const reader of (0, frame_reflection_1.edgeSources)(graph, binding, edge_1.EdgeType.Reads)) {
442
+ for (const reader of df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.Reads)) {
441
443
  const call = graph.getVertex(reader);
442
- if (!vertex_1.DfgVertex.isFunctionCall(call) || !(0, frame_reflection_1.hasEdgeOfType)(graph, reader, closure, edge_1.EdgeType.Calls)
444
+ if (!vertex_1.DfgVertex.isFunctionCall(call) || !df_helper_1.Dataflow.hasEdge(graph, reader, closure, edge_1.EdgeType.Calls)
443
445
  || call.environment === undefined || program_order_1.ProgramOrder.runsOnceAt(reader, graph) === undefined) {
444
446
  return;
445
447
  }
@@ -456,7 +458,7 @@ function readAtForcingCalls(graph, factoryCall, argument, closure, idMap) {
456
458
  }
457
459
  if (r_symbol_1.RSymbol.is(node)) {
458
460
  const visible = new Set(environments.flatMap(env => resolve_helper_1.Resolve.byName(node.content, env) ?? []).map(d => d.nodeId));
459
- for (const target of (0, frame_reflection_1.edgeTargets)(graph, node.info.id, edge_1.EdgeType.Reads)) {
461
+ for (const target of df_helper_1.Dataflow.targetsOf(graph, node.info.id, edge_1.EdgeType.Reads)) {
460
462
  if (vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)) && !visible.has(target)) {
461
463
  graph.removeEdgeType(node.info.id, target, edge_1.EdgeType.Reads);
462
464
  }
@@ -16,7 +16,7 @@ const built_in_proc_name_1 = require("../../../../environments/built-in-proc-nam
16
16
  const node_id_1 = require("../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
17
17
  const r_access_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
18
18
  const r_function_definition_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
19
- const frame_reflection_1 = require("../../../../fn/frame-reflection");
19
+ const df_helper_1 = require("../../../../graph/df-helper");
20
20
  exports.UnnamedFunctionCallPrefix = 'unnamed-fc-';
21
21
  /**
22
22
  * Whether a `$`/`[[` access callee resolved a field to a stored function: a resolved dispatch (`dispatch$foo()`)
@@ -25,7 +25,7 @@ exports.UnnamedFunctionCallPrefix = 'unnamed-fc-';
25
25
  */
26
26
  function accessResolvesToField(graph, accessId, accessedId) {
27
27
  const base = node_id_1.NodeId.normalize(accessedId);
28
- return (0, frame_reflection_1.edgeTargets)(graph, accessId, edge_1.EdgeType.Returns).some(target => node_id_1.NodeId.normalize(target) !== base);
28
+ return df_helper_1.Dataflow.targetsOf(graph, accessId, edge_1.EdgeType.Returns).some(target => node_id_1.NodeId.normalize(target) !== base);
29
29
  }
30
30
  /**
31
31
  * Processes an unnamed function call.