@eagleoutice/flowr 2.16.1 → 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 (459) 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 +15 -2
  39. package/dataflow/environments/built-in-props.js +31 -4
  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 +385 -25
  44. package/dataflow/environments/default-builtin-config.js +186 -106
  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 +1 -2
  52. package/dataflow/environments/identifier.js +5 -7
  53. package/dataflow/environments/overwrite.js +1 -0
  54. package/dataflow/environments/query-fn-props.d.ts +3 -0
  55. package/dataflow/environments/query-fn-props.js +7 -0
  56. package/dataflow/environments/resolve-by-name.js +11 -4
  57. package/dataflow/environments/scoping.d.ts +3 -0
  58. package/dataflow/environments/scoping.js +3 -0
  59. package/dataflow/eval/resolve/alias-tracking.js +3 -3
  60. package/dataflow/eval/resolve/resolve-argument.d.ts +7 -3
  61. package/dataflow/eval/resolve/resolve-argument.js +21 -12
  62. package/dataflow/eval/resolve/resolve-numbers.js +5 -2
  63. package/dataflow/eval/resolve/resolve-strings.d.ts +1 -1
  64. package/dataflow/eval/resolve/resolve-working-directory.js +2 -2
  65. package/dataflow/eval/resolve/resolve.js +1 -2
  66. package/dataflow/eval/values/intervals/interval-constants.js +1 -6
  67. package/dataflow/eval/values/r-value.js +1 -6
  68. package/dataflow/extractor.js +17 -17
  69. package/dataflow/fn/argument-roles.js +15 -15
  70. package/dataflow/fn/class-declaration.js +7 -7
  71. package/dataflow/fn/frame-reflection.d.ts +1 -23
  72. package/dataflow/fn/frame-reflection.js +8 -95
  73. package/dataflow/fn/function-props.d.ts +0 -3
  74. package/dataflow/fn/function-props.js +9 -11
  75. package/dataflow/fn/function-semantics.d.ts +1 -0
  76. package/dataflow/fn/strict-function.js +15 -14
  77. package/dataflow/graph/call-graph.d.ts +8 -0
  78. package/dataflow/graph/call-graph.js +40 -25
  79. package/dataflow/graph/dataflowgraph-builder.d.ts +0 -60
  80. package/dataflow/graph/dataflowgraph-builder.js +15 -135
  81. package/dataflow/graph/df-helper.d.ts +56 -4
  82. package/dataflow/graph/df-helper.js +116 -1
  83. package/dataflow/graph/diff-dataflow-graph.js +13 -15
  84. package/dataflow/graph/graph-helper.d.ts +20 -0
  85. package/dataflow/graph/graph-helper.js +18 -0
  86. package/dataflow/graph/graph.js +15 -8
  87. package/dataflow/graph/match-args.d.ts +1 -1
  88. package/dataflow/graph/match-args.js +3 -3
  89. package/dataflow/internal/linker.d.ts +4 -10
  90. package/dataflow/internal/linker.js +21 -29
  91. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -8
  92. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +5 -2
  93. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +39 -22
  94. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -21
  95. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -7
  96. package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +6 -11
  97. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
  98. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -13
  99. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +27 -13
  100. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -8
  101. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +33 -35
  102. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -5
  103. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +6 -7
  104. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +12 -5
  105. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +3 -4
  106. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +7 -8
  107. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -6
  108. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +3 -4
  109. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -3
  110. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +14 -7
  111. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +6 -5
  112. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -2
  113. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -6
  114. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +4 -4
  115. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +7 -7
  116. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +1 -2
  117. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -3
  118. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +5 -7
  120. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
  121. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +4 -5
  122. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +8 -9
  123. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
  124. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +3 -3
  125. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +36 -38
  126. package/dataflow/internal/process/functions/call/common.d.ts +3 -1
  127. package/dataflow/internal/process/functions/call/common.js +6 -7
  128. package/dataflow/internal/process/functions/call/deferred.js +8 -8
  129. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +11 -4
  130. package/dataflow/internal/process/functions/call/known-call-handling.js +11 -7
  131. package/dataflow/internal/process/functions/call/named-call-handling.js +64 -11
  132. package/dataflow/internal/process/functions/call/nse.js +4 -4
  133. package/dataflow/internal/process/functions/call/quoted.js +16 -14
  134. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
  135. package/dataflow/internal/process/functions/process-parameter.js +2 -2
  136. package/dataflow/internal/process/process-named-call.js +1 -1
  137. package/dataflow/origin/dfg-get-origin.js +2 -2
  138. package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -0
  139. package/dataflow/origin/dfg-get-symbol-refs.js +3 -8
  140. package/documentation/data/faq/wiki-faq-store.js +2 -2
  141. package/documentation/doc-capabilities.js +2 -1
  142. package/documentation/doc-util/doc-functions.js +2 -2
  143. package/documentation/doc-util/doc-repl.js +4 -4
  144. package/documentation/doc-util/doc-types.js +2 -2
  145. package/documentation/wiki-absint.js +2 -1
  146. package/documentation/wiki-cfg.js +2 -1
  147. package/documentation/wiki-create-linting-rules.js +1 -1
  148. package/documentation/wiki-dataflow-graph.js +6 -6
  149. package/documentation/wiki-interface.js +3 -2
  150. package/documentation/wiki-linter.js +54 -4
  151. package/documentation/wiki-mk/doc-maker.js +1 -2
  152. package/documentation/wiki-query.js +25 -0
  153. package/documentation/wiki-search.js +2 -1
  154. package/documentation/wiki-signature-database.js +0 -2
  155. package/linter/linter-executor.js +4 -0
  156. package/linter/linter-rules.d.ts +526 -4
  157. package/linter/linter-rules.js +39 -1
  158. package/linter/linter-tags.d.ts +6 -0
  159. package/linter/linter-tags.js +6 -0
  160. package/linter/rules/absolute-path.js +4 -3
  161. package/linter/rules/cmd-check/bogus-return.d.ts +29 -0
  162. package/linter/rules/cmd-check/bogus-return.js +63 -0
  163. package/linter/rules/cmd-check/call-arguments.d.ts +63 -0
  164. package/linter/rules/cmd-check/call-arguments.js +211 -0
  165. package/linter/rules/cmd-check/class-string-comparison.d.ts +48 -0
  166. package/linter/rules/cmd-check/class-string-comparison.js +135 -0
  167. package/linter/rules/cmd-check/cmd-check-util.d.ts +67 -0
  168. package/linter/rules/cmd-check/cmd-check-util.js +169 -0
  169. package/linter/rules/cmd-check/compiled-code.d.ts +86 -0
  170. package/linter/rules/cmd-check/compiled-code.js +350 -0
  171. package/linter/rules/cmd-check/conformance.d.ts +47 -0
  172. package/linter/rules/cmd-check/conformance.js +166 -0
  173. package/linter/rules/cmd-check/dependency-declaration.d.ts +95 -0
  174. package/linter/rules/cmd-check/dependency-declaration.js +299 -0
  175. package/linter/rules/cmd-check/description-metadata.d.ts +63 -0
  176. package/linter/rules/cmd-check/description-metadata.js +393 -0
  177. package/linter/rules/cmd-check/documentation-mismatch.d.ts +54 -0
  178. package/linter/rules/cmd-check/documentation-mismatch.js +407 -0
  179. package/linter/rules/cmd-check/file-checks.d.ts +29 -0
  180. package/linter/rules/cmd-check/file-checks.js +34 -0
  181. package/linter/rules/cmd-check/foreign-function-calls.d.ts +54 -0
  182. package/linter/rules/cmd-check/foreign-function-calls.js +115 -0
  183. package/linter/rules/cmd-check/global-environment-modification.d.ts +61 -0
  184. package/linter/rules/cmd-check/global-environment-modification.js +237 -0
  185. package/linter/rules/cmd-check/namespace-tampering.d.ts +52 -0
  186. package/linter/rules/cmd-check/namespace-tampering.js +162 -0
  187. package/linter/rules/cmd-check/non-ascii-code.d.ts +51 -0
  188. package/linter/rules/cmd-check/non-ascii-code.js +112 -0
  189. package/linter/rules/cmd-check/package-code.d.ts +30 -0
  190. package/linter/rules/cmd-check/package-code.js +141 -0
  191. package/linter/rules/cmd-check/package-data.d.ts +49 -0
  192. package/linter/rules/cmd-check/package-data.js +181 -0
  193. package/linter/rules/cmd-check/package-files.d.ts +41 -0
  194. package/linter/rules/cmd-check/package-files.js +157 -0
  195. package/linter/rules/cmd-check/package-hooks.d.ts +57 -0
  196. package/linter/rules/cmd-check/package-hooks.js +165 -0
  197. package/linter/rules/cmd-check/package-metafiles.d.ts +49 -0
  198. package/linter/rules/cmd-check/package-metafiles.js +292 -0
  199. package/linter/rules/cmd-check/package-runtime.d.ts +67 -0
  200. package/linter/rules/cmd-check/package-runtime.js +284 -0
  201. package/linter/rules/cmd-check/package-structure.d.ts +85 -0
  202. package/linter/rules/cmd-check/package-structure.js +320 -0
  203. package/linter/rules/cmd-check/rd-files.d.ts +67 -0
  204. package/linter/rules/cmd-check/rd-files.js +621 -0
  205. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +72 -0
  206. package/linter/rules/cmd-check/s-three-method-consistency.js +206 -0
  207. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +45 -0
  208. package/linter/rules/cmd-check/true-false-abbreviation.js +121 -0
  209. package/linter/rules/deprecated-functions.js +4 -4
  210. package/linter/rules/function-finder-util.d.ts +1 -1
  211. package/linter/rules/function-finder-util.js +1 -3
  212. package/linter/rules/naming-convention.d.ts +1 -1
  213. package/linter/rules/naming-convention.js +13 -14
  214. package/linter/rules/network-functions.d.ts +4 -3
  215. package/linter/rules/network-functions.js +14 -12
  216. package/linter/rules/no-leaked-credentials.d.ts +8 -3
  217. package/linter/rules/no-leaked-credentials.js +134 -36
  218. package/linter/rules/problematic-inputs.d.ts +1 -1
  219. package/linter/rules/problematic-inputs.js +21 -14
  220. package/linter/rules/seeded-randomness.js +5 -5
  221. package/linter/rules/software-has-license.d.ts +1 -1
  222. package/linter/rules/software-has-license.js +1 -1
  223. package/linter/rules/unclosed-connection.js +3 -3
  224. package/linter/rules/undefined-symbol-util.js +16 -32
  225. package/linter/rules/undefined-symbol.d.ts +2 -0
  226. package/linter/rules/undefined-symbol.js +33 -3
  227. package/linter/rules/unescaped-arguments.d.ts +13 -2
  228. package/linter/rules/unescaped-arguments.js +104 -15
  229. package/linter/rules/unused-definition.js +13 -19
  230. package/package.json +1 -1
  231. package/project/cache/flowr-analyzer-cache.js +1 -1
  232. package/project/context/flowr-analyzer-context.js +1 -1
  233. package/project/context/flowr-analyzer-environment-context.d.ts +1 -1
  234. package/project/context/flowr-analyzer-files-context.d.ts +6 -0
  235. package/project/context/flowr-analyzer-files-context.js +3 -0
  236. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +0 -2
  237. package/project/context/flowr-analyzer-incremental-analysis-context.js +0 -4
  238. package/project/context/flowr-file.d.ts +4 -0
  239. package/project/context/flowr-file.js +4 -0
  240. package/project/flowr-analyzer-builder.js +1 -1
  241. package/project/plugins/file-plugins/files/flowr-description-file.js +2 -2
  242. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -0
  243. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +4 -0
  244. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +2 -0
  245. package/project/plugins/file-plugins/files/flowr-manifest-files.js +11 -14
  246. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +3 -0
  247. package/project/plugins/file-plugins/files/flowr-namespace-file.js +25 -15
  248. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +44 -0
  249. package/project/plugins/file-plugins/files/flowr-rd-file.js +130 -61
  250. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -1
  251. package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -16
  252. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -0
  253. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +4 -0
  254. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +2 -0
  255. package/project/plugins/file-plugins/files/flowr-sweave-file.js +4 -0
  256. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +0 -1
  257. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -5
  258. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +2 -0
  259. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -0
  260. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +3 -7
  261. package/project/sigdb/build.js +16 -30
  262. package/project/sigdb/dict.d.ts +4 -6
  263. package/project/sigdb/dict.js +125 -31
  264. package/project/sigdb/reader.js +2 -18
  265. package/project/sigdb/sigdb-download.js +14 -23
  266. package/queries/base-query-format.d.ts +2 -0
  267. package/queries/base-query-format.js +10 -2
  268. package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
  269. package/queries/catalog/absint-query/absint-query-format.js +5 -7
  270. package/queries/catalog/call-context-query/call-context-query-executor.js +26 -33
  271. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  272. package/queries/catalog/call-context-query/call-context-query-format.js +1 -3
  273. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -4
  274. package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -4
  275. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -3
  276. package/queries/catalog/config-query/config-query-format.js +3 -3
  277. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -3
  278. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -3
  279. package/queries/catalog/dependencies-query/data-flow.d.ts +43 -0
  280. package/queries/catalog/dependencies-query/data-flow.js +173 -0
  281. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +18 -0
  282. package/queries/catalog/dependencies-query/dependencies-query-executor.js +108 -12
  283. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +17 -1
  284. package/queries/catalog/dependencies-query/dependencies-query-format.js +14 -11
  285. package/queries/catalog/dependencies-query/function-info/derived-functions.js +2 -1
  286. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
  287. package/queries/catalog/dependencies-query/function-info/library-functions.js +13 -13
  288. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  289. package/queries/catalog/dependencies-query/function-info/remote-functions.js +3 -3
  290. package/queries/catalog/dependencies-query/function-info/source-functions.js +2 -2
  291. package/queries/catalog/dependencies-query/function-info/test-functions.js +8 -8
  292. package/queries/catalog/dependencies-query/function-info/transform-functions.d.ts +8 -0
  293. package/queries/catalog/dependencies-query/function-info/transform-functions.js +17 -0
  294. package/queries/catalog/dependencies-query/function-info/write-functions.js +4 -0
  295. package/queries/catalog/dependencies-query/implicit-echo.d.ts +5 -3
  296. package/queries/catalog/dependencies-query/implicit-echo.js +33 -34
  297. package/queries/catalog/dependencies-query/link-devices.d.ts +3 -2
  298. package/queries/catalog/dependencies-query/link-devices.js +9 -6
  299. package/queries/catalog/dependencies-query/plot-description.d.ts +10 -0
  300. package/queries/catalog/dependencies-query/plot-description.js +119 -0
  301. package/queries/catalog/dependencies-query/plot-objects.d.ts +13 -0
  302. package/queries/catalog/dependencies-query/plot-objects.js +61 -0
  303. package/queries/catalog/dice-query/dice-query-format.d.ts +2 -2
  304. package/queries/catalog/dice-query/dice-query-format.js +3 -40
  305. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
  306. package/queries/catalog/does-call-query/does-call-query-format.js +2 -2
  307. package/queries/catalog/function-info-query/function-info-query-format.js +2 -2
  308. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +2 -1
  309. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
  310. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
  311. package/queries/catalog/id-map-query/id-map-query-format.js +1 -3
  312. package/queries/catalog/input-sources-query/input-source-functions.d.ts +6 -4
  313. package/queries/catalog/input-sources-query/input-source-functions.js +11 -6
  314. package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -3
  315. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +1 -1
  316. package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -5
  317. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +12 -4
  318. package/queries/catalog/input-sources-query/simple-input-classifier.js +237 -40
  319. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +4 -7
  320. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +1 -1
  321. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +3 -2
  322. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
  323. package/queries/catalog/linter-query/linter-query-executor.js +10 -3
  324. package/queries/catalog/linter-query/linter-query-format.d.ts +4 -1
  325. package/queries/catalog/linter-query/linter-query-format.js +32 -21
  326. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  327. package/queries/catalog/location-map-query/location-map-query-format.js +1 -3
  328. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -3
  329. package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
  330. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  331. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  332. package/queries/catalog/origin-query/origin-query-format.js +4 -5
  333. package/queries/catalog/project-query/project-query-format.js +2 -2
  334. package/queries/catalog/provenance-query/provenance-query-format.js +2 -3
  335. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  336. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -4
  337. package/queries/catalog/search-query/search-query-format.js +1 -3
  338. package/queries/catalog/signature-query/signature-query-executor.js +3 -3
  339. package/queries/catalog/signature-query/signature-query-format.js +2 -2
  340. package/queries/catalog/slice-query-options.d.ts +16 -0
  341. package/queries/catalog/slice-query-options.js +28 -0
  342. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
  343. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -42
  344. package/queries/query-print.d.ts +4 -0
  345. package/queries/query-print.js +17 -1
  346. package/queries/query.d.ts +3 -3
  347. package/queries/query.js +3 -4
  348. package/r-bridge/lang-4.x/ast/model/model.d.ts +27 -3
  349. package/r-bridge/lang-4.x/ast/model/model.js +28 -1
  350. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  352. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
  353. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
  354. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +20 -1
  355. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +25 -1
  356. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
  357. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
  358. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
  359. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
  360. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
  361. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
  362. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
  363. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
  364. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
  365. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
  366. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +18 -2
  367. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +15 -6
  368. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
  369. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
  370. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
  371. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
  372. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
  373. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
  374. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
  375. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
  376. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
  377. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
  378. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
  379. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +1 -0
  380. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
  381. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
  382. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
  383. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
  384. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
  385. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
  386. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +17 -0
  387. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +20 -0
  388. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
  389. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
  390. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
  391. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
  392. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
  393. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
  394. package/r-bridge/lang-4.x/ast/model/operators.js +0 -2
  395. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -6
  396. package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -6
  397. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -3
  398. package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
  399. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -5
  400. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -2
  401. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -20
  402. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -5
  403. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -5
  404. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -5
  405. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -9
  406. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -5
  407. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -10
  408. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -11
  409. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -11
  410. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -5
  411. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -5
  412. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -5
  413. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +6 -1
  414. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +7 -0
  415. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +0 -10
  416. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +30 -82
  417. package/r-bridge/retriever.d.ts +0 -4
  418. package/r-bridge/retriever.js +0 -13
  419. package/r-bridge/roxygen2/documentation-provider.js +3 -7
  420. package/r-bridge/shell.js +3 -8
  421. package/reconstruct/auto-select/magic-comments.js +8 -7
  422. package/reconstruct/inline/source-inline-map.d.ts +3 -0
  423. package/reconstruct/inline/source-inline-map.js +8 -7
  424. package/reconstruct/reconstruct.d.ts +1 -1
  425. package/reconstruct/reconstruct.js +33 -109
  426. package/search/flowr-search-printer.js +4 -15
  427. package/search/search-executor/search-enrichers.js +5 -3
  428. package/search/search-executor/search-generators.js +1 -1
  429. package/slicing/criterion/filters/all-variables.js +1 -2
  430. package/slicing/static/fingerprint.js +11 -2
  431. package/slicing/static/slice-call.d.ts +2 -8
  432. package/slicing/static/slice-call.js +8 -18
  433. package/slicing/static/static-slicer.js +81 -6
  434. package/util/collections/arrays.js +1 -1
  435. package/util/collections/set.js +1 -1
  436. package/util/diff-graph.d.ts +4 -0
  437. package/util/diff-graph.js +12 -0
  438. package/util/files.js +2 -6
  439. package/util/json.js +1 -15
  440. package/util/mermaid/cfg.js +10 -17
  441. package/util/mermaid/dfg.js +6 -8
  442. package/util/objects.d.ts +1 -1
  443. package/util/quads.js +4 -13
  444. package/util/r-author.js +5 -5
  445. package/util/range.d.ts +9 -0
  446. package/util/range.js +11 -0
  447. package/util/schema.js +3 -3
  448. package/util/simple-df/dfg-view.js +2 -1
  449. package/util/text/ansi.js +1 -2
  450. package/util/text/playground-link.js +2 -1
  451. package/util/text/r-highlight.js +2 -1
  452. package/util/text/strings.d.ts +2 -0
  453. package/util/text/strings.js +5 -0
  454. package/util/text/time.js +1 -2
  455. package/util/version.js +4 -3
  456. package/dataflow/fn/recursive-function.d.ts +0 -6
  457. package/dataflow/fn/recursive-function.js +0 -32
  458. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +0 -16
  459. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +0 -27
@@ -15,12 +15,7 @@ function intervalFrom(start, end = start, startInclusive = true, endInclusive =
15
15
  return intervalFromValues(typeof start === 'number' ? (0, scalar_constants_1.getScalarFromInteger)(start) : (0, scalar_constants_1.liftScalar)(start), typeof end === 'number' ? (0, scalar_constants_1.getScalarFromInteger)(end) : (0, scalar_constants_1.liftScalar)(end), startInclusive, endInclusive);
16
16
  }
17
17
  function shiftNum(v) {
18
- if ((0, r_value_1.isBottom)(v) || (0, r_value_1.isTop)(v)) {
19
- return (0, scalar_constants_1.liftScalar)(v);
20
- }
21
- else {
22
- return v;
23
- }
18
+ return (0, r_value_1.isBottom)(v) || (0, r_value_1.isTop)(v) ? (0, scalar_constants_1.liftScalar)(v) : v;
24
19
  }
25
20
  /**
26
21
  * The same as {@link intervalFrom}, but from bounds that are already lifted values.
@@ -56,12 +56,7 @@ function stringifyRNumberSuffix(value) {
56
56
  function renderString(value) {
57
57
  const quote = value.quotes;
58
58
  const raw = value.flag === 'raw';
59
- if (raw) {
60
- return `r${quote}(${value.str})${quote}`;
61
- }
62
- else {
63
- return `${quote}${JSON.stringify(value.str).slice(1, -1)}${quote}`;
64
- }
59
+ return raw ? `r${quote}(${value.str})${quote}` : `${quote}${JSON.stringify(value.str).slice(1, -1)}${quote}`;
65
60
  }
66
61
  /**
67
62
  * A value as a human-readable string, dispatching on its type and answering for `Top` and `Bottom` as well.
@@ -25,6 +25,7 @@ const built_in_function_definition_1 = require("./internal/process/functions/cal
25
25
  const transitive_side_effects_1 = require("./internal/process/functions/call/built-in/transitive-side-effects");
26
26
  const built_in_try_catch_1 = require("./internal/process/functions/call/built-in/built-in-try-catch");
27
27
  const linker_1 = require("./internal/linker");
28
+ const environment_1 = require("./environments/environment");
28
29
  const flowr_file_1 = require("../project/context/flowr-file");
29
30
  const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
30
31
  const vertex_1 = require("./graph/vertex");
@@ -48,7 +49,6 @@ const query_fn_props_1 = require("./environments/query-fn-props");
48
49
  const resolve_helper_1 = require("./environments/resolve-helper");
49
50
  const happens_before_1 = require("../control-flow/happens-before");
50
51
  const assert_1 = require("../util/assert");
51
- const frame_reflection_1 = require("./fn/frame-reflection");
52
52
  /**
53
53
  * The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
54
54
  * Maps every {@link RType} in the normalized AST to a processor.
@@ -102,7 +102,7 @@ function linkEnvironmentArgumentsWrittenByCallee(graph, environment) {
102
102
  if (!holdsEnvironment(graph, argument, environment)) {
103
103
  continue;
104
104
  }
105
- for (const call of (0, frame_reflection_1.edgeSources)(graph, argument, edge_1.EdgeType.Argument).filter(c => vertex_1.DfgVertex.isFunctionCall(graph.getVertex(c)))) {
105
+ for (const call of df_helper_1.Dataflow.sourcesOf(graph, argument, edge_1.EdgeType.Argument).filter(c => vertex_1.DfgVertex.isFunctionCall(graph.getVertex(c)))) {
106
106
  (0, unknown_side_effect_1.handleUnknownSideEffect)(graph, environment, call);
107
107
  for (const write of writes) {
108
108
  graph.addEdge(call, write, edge_1.EdgeType.Reads);
@@ -113,7 +113,7 @@ function linkEnvironmentArgumentsWrittenByCallee(graph, environment) {
113
113
  }
114
114
  }
115
115
  function tracksAnyEnvironment(environment) {
116
- for (let e = environment.current; e !== undefined && !e.builtInEnv; e = e.parent) {
116
+ for (const e of environment_1.REnvironment.frames(environment.current)) {
117
117
  if (e.memory.values().some(defs => defs.some(identifier_1.hasEnvState))) {
118
118
  return true;
119
119
  }
@@ -125,8 +125,8 @@ function writesOfParameters(graph, definition, parameters, written, environment)
125
125
  for (const node of definition.subflow.graph) {
126
126
  const vertex = graph.getVertex(node);
127
127
  if (vertex_1.DfgVertex.isVariableDefinition(vertex) && vertex.par) {
128
- const replacements = (0, frame_reflection_1.edgeTargets)(graph, node, edge_1.EdgeType.DefinedBy).filter(t => vertex_1.DfgVertex.hasOrigin(graph.getVertex(t), built_in_proc_name_1.BuiltInProcName.Replacement));
129
- for (const parameter of (0, frame_reflection_1.edgeTargets)(graph, node, edge_1.EdgeType.Reads).filter(t => parameters.has(t))) {
128
+ const replacements = df_helper_1.Dataflow.targetsOf(graph, node, edge_1.EdgeType.DefinedBy).filter(t => vertex_1.DfgVertex.hasOrigin(graph.getVertex(t), built_in_proc_name_1.BuiltInProcName.Replacement));
129
+ for (const parameter of df_helper_1.Dataflow.targetsOf(graph, node, edge_1.EdgeType.Reads).filter(t => parameters.has(t))) {
130
130
  written.get(parameter).push(...replacements);
131
131
  }
132
132
  }
@@ -148,7 +148,7 @@ function holdsEnvironment(graph, argument, environment) {
148
148
  function openReadsOfCalledFunctions(graph) {
149
149
  const reads = new Map();
150
150
  for (const [id, definition] of graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)) {
151
- if ((0, frame_reflection_1.edgeSources)(graph, id, edge_1.EdgeType.Calls).length > 0) {
151
+ if (df_helper_1.Dataflow.sourcesOf(graph, id, edge_1.EdgeType.Calls).length > 0) {
152
152
  for (const read of definition.subflow.in) {
153
153
  if (read.name !== undefined && !built_in_ambient_state_1.AmbientStateName.is(read.name) && !identifier_1.Identifier.getName(read.name).startsWith(unnamed_call_handling_1.UnnamedFunctionCallPrefix)) {
154
154
  reads.set(read.nodeId, read);
@@ -164,7 +164,7 @@ function callActiveBindings(graph) {
164
164
  const active = new Set();
165
165
  const bindings = new Map();
166
166
  for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
167
- const called = (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.Calls);
167
+ const called = df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Calls);
168
168
  if (called.length > 0) {
169
169
  active.add(id);
170
170
  const fns = called.filter(t => vertex_1.DfgVertex.isFunctionDefinition(graph.getVertex(t)));
@@ -176,10 +176,10 @@ function callActiveBindings(graph) {
176
176
  if (active.size === 0) {
177
177
  return;
178
178
  }
179
- for (const [, ids] of bindings.size === 0 ? [] : (0, frame_reflection_1.definitionsByName)(graph).entries()) {
179
+ for (const [, ids] of bindings.size === 0 ? [] : df_helper_1.Dataflow.definitionsByName(graph).entries()) {
180
180
  const fns = ids.flatMap(id => bindings.get(id) ?? []);
181
181
  for (const id of fns.length === 0 ? [] : ids.filter(id => !bindings.has(id))) {
182
- for (const assignment of (0, frame_reflection_1.edgeSources)(graph, id, edge_1.EdgeType.Returns).filter(a => vertex_1.DfgVertex.isFunctionCall(graph.getVertex(a)))) {
182
+ for (const assignment of df_helper_1.Dataflow.sourcesOf(graph, id, edge_1.EdgeType.Returns).filter(a => vertex_1.DfgVertex.isFunctionCall(graph.getVertex(a)))) {
183
183
  active.add(id);
184
184
  for (const fn of fns) {
185
185
  graph.addEdge(assignment, fn, edge_1.EdgeType.Calls);
@@ -190,7 +190,7 @@ function callActiveBindings(graph) {
190
190
  }
191
191
  for (const id of graph.vertexIdsOfType(vertex_1.VertexType.Use)) {
192
192
  const node = graph.idMap?.get(id);
193
- if (r_symbol_1.RSymbol.is(node) && (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.Reads).some(def => active.has(def))) {
193
+ if (r_symbol_1.RSymbol.is(node) && df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads).some(def => active.has(def))) {
194
194
  graph.updateToFunctionCall({ tag: vertex_1.VertexType.FunctionCall, id, name: node.content, args: [], environment: undefined, onlyBuiltin: false, cds: graph.getVertex(id)?.cds, origin: [built_in_proc_name_1.BuiltInProcName.Function] });
195
195
  }
196
196
  }
@@ -198,9 +198,9 @@ function callActiveBindings(graph) {
198
198
  /** A call of what a closure returned that we could not link (`h2 <- h()` with `h` returning `sys.function()`) may run anything. */
199
199
  function markCallsOfUnknownValues(graph, environment) {
200
200
  const fromClosure = (def) => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(def))
201
- && (0, frame_reflection_1.edgeTargets)(graph, def, edge_1.EdgeType.DefinedBy).some(c => (0, frame_reflection_1.calledDefinitions)(graph, c).length > 0);
201
+ && df_helper_1.Dataflow.targetsOf(graph, def, edge_1.EdgeType.DefinedBy).some(c => df_helper_1.Dataflow.calleeIdsOf(graph, c).length > 0);
202
202
  for (const [id, call] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
203
- if (!call.onlyBuiltin && (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.Calls).length === 0 && (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.Reads).some(fromClosure)) {
203
+ if (!call.onlyBuiltin && df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Calls).length === 0 && df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads).some(fromClosure)) {
204
204
  (0, unknown_side_effect_1.handleUnknownSideEffect)(graph, environment, id);
205
205
  }
206
206
  }
@@ -212,7 +212,7 @@ function readFramesThroughEnvironment(graph) {
212
212
  return;
213
213
  }
214
214
  const environmentCall = node_id_1.NodeId.toBuiltIn('environment');
215
- const callsEnvironment = (id) => (0, frame_reflection_1.hasEdgeOfType)(graph, id, environmentCall, edge_1.EdgeType.Calls);
215
+ const callsEnvironment = (id) => df_helper_1.Dataflow.hasEdge(graph, id, environmentCall, edge_1.EdgeType.Calls);
216
216
  /* `environment(fn)` hands out the frame `fn` was created in */
217
217
  const ofClosures = new defaultmap_1.DefaultMap(() => []);
218
218
  for (const [id, call] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
@@ -311,7 +311,7 @@ function linkResourceReadersToWriters(graph, environment, ctx) {
311
311
  const where = { graph, idMap: graph.idMap, resolve: ctx.config.solver.variables, ctx, environment };
312
312
  const pathOf = (0, defaultmap_1.memoize)((id) => resolve_helper_1.Resolve.toSingleString(id, where));
313
313
  const sameResource = (a, b) => {
314
- if (a === b || reachedBy(b).values().some(t => reachedBy(a).has(t))) {
314
+ if (a === b || !reachedBy(b).isDisjointFrom(reachedBy(a))) {
315
315
  return true;
316
316
  }
317
317
  const path = pathOf(a);
@@ -328,7 +328,7 @@ function linkResourceReadersToWriters(graph, environment, ctx) {
328
328
  if (before.has(writer.id)) {
329
329
  graph.addEdge(reader.id, writer.id, edge_1.EdgeType.Reads);
330
330
  /* whatever is linked to a diverting writer (`print` after `sink(file)`) writes to the resource as well */
331
- for (const id of (0, frame_reflection_1.edgeSources)(graph, writer.id, edge_1.EdgeType.Reads)) {
331
+ for (const id of df_helper_1.Dataflow.sourcesOf(graph, writer.id, edge_1.EdgeType.Reads)) {
332
332
  graph.addEdge(reader.id, id, edge_1.EdgeType.Reads);
333
333
  }
334
334
  }
@@ -342,9 +342,9 @@ function linkReadsOfDivertedOutput(graph, environment) {
342
342
  }
343
343
  const printsOf = (0, defaultmap_1.memoize)((id) => function_semantics_1.FunctionSemantics.call.props.hasAll((0, query_fn_props_1.callFnProps)(id, { graph, environment }), [built_in_props_1.SemanticCallTag.Prints]));
344
344
  const printingCall = (writer) => vertex_1.DfgVertex.isFunctionCall(graph.getVertex(writer)) && printsOf(writer);
345
- const writersOf = (0, defaultmap_1.memoize)((target) => (0, frame_reflection_1.edgeSources)(graph, target, edge_1.EdgeType.Reads).filter(printingCall));
345
+ const writersOf = (0, defaultmap_1.memoize)((target) => df_helper_1.Dataflow.sourcesOf(graph, target, edge_1.EdgeType.Reads).filter(printingCall));
346
346
  for (const [id] of graph.verticesOfType(vertex_1.VertexType.Use)) {
347
- for (const target of (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.Reads)) {
347
+ for (const target of df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads)) {
348
348
  const diverting = graph.getVertex(target);
349
349
  if (!vertex_1.DfgVertex.isFunctionCall(diverting) || diverting.args.length === 0) {
350
350
  continue;
@@ -24,7 +24,7 @@ exports.DefaultDepth = 6;
24
24
  * @useInstead {@link FunctionSemantics.argumentRoles}
25
25
  */
26
26
  function argumentRolesOfFunctions(ids, graph, options = {}) {
27
- const state = makeState(graph, options);
27
+ const state = roleStateOf(graph, options);
28
28
  const all = {};
29
29
  for (const id of ids) {
30
30
  const roles = rolesOf(id, state);
@@ -34,7 +34,7 @@ function argumentRolesOfFunctions(ids, graph, options = {}) {
34
34
  }
35
35
  return all;
36
36
  }
37
- function makeState(graph, { ctx, maxDepth = exports.DefaultDepth }) {
37
+ function roleStateOf(graph, { ctx, maxDepth = exports.DefaultDepth }) {
38
38
  return { graph, info: (0, query_fn_props_1.builtInLookup)(ctx), maxDepth, args: new Map() };
39
39
  }
40
40
  function rolesOf(id, state) {
@@ -95,7 +95,7 @@ function intersect(sets) {
95
95
  function sameValueAs(node, state) {
96
96
  const graph = state.graph;
97
97
  const vertex = graph.getVertex(node);
98
- const returns = takesApart(vertex) ? [] : (0, frame_reflection_1.edgeTargets)(graph, node, edge_1.EdgeType.Returns);
98
+ const returns = takesApart(vertex) ? [] : df_helper_1.Dataflow.targetsOf(graph, node, edge_1.EdgeType.Returns);
99
99
  if (vertex_1.DfgVertex.isFunctionCall(vertex)) {
100
100
  const alias = argumentsWith(vertex, state, built_in_props_1.ArgProp.Alias);
101
101
  if (missesItsElse(vertex, state)) {
@@ -113,13 +113,13 @@ function sameValueAs(node, state) {
113
113
  }
114
114
  else if (vertex_1.DfgVertex.isVariableDefinition(vertex)) {
115
115
  /* what the name was given, a call included: what that yields in turn is for the next step to say */
116
- return [[], (0, frame_reflection_1.edgeTargets)(graph, node, edge_1.EdgeType.DefinedBy)];
116
+ return [[], df_helper_1.Dataflow.targetsOf(graph, node, edge_1.EdgeType.DefinedBy)];
117
117
  }
118
118
  return [[], []];
119
119
  }
120
120
  /** Whether the call is an `if` that may skip its branch: no `else` was written and the condition is no `TRUE`. */
121
121
  function missesItsElse(vertex, state) {
122
- if (!vertex.origin.includes(built_in_proc_name_1.BuiltInProcName.IfThenElse) || graph_1.FunctionArgument.isNotEmpty(vertex.args[2])) {
122
+ if (!vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.IfThenElse) || graph_1.FunctionArgument.isNotEmpty(vertex.args[2])) {
123
123
  return false;
124
124
  }
125
125
  const condition = vertex.args[0];
@@ -128,24 +128,24 @@ function missesItsElse(vertex, state) {
128
128
  /** Whether the call hands back a part of what it was given (`x$a`, `x[1]`, `pkg::name`) rather than the thing. */
129
129
  function takesApart(vertex) {
130
130
  return vertex_1.DfgVertex.isFunctionCall(vertex)
131
- && (vertex.origin.includes(built_in_proc_name_1.BuiltInProcName.Access) || vertex.origin.includes(built_in_proc_name_1.BuiltInProcName.NamespaceAccess));
131
+ && (vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Access) || vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.NamespaceAccess));
132
132
  }
133
133
  /** The roles the calls inside a definition give to what they are handed, as one mask per node reached. */
134
134
  function statedRoles(definition, state) {
135
135
  const byName = formalsByName(definition, state);
136
136
  const roles = new Map();
137
137
  const add = (node, props) => {
138
- for (const formal of resolvesTo(node, byName, state)) {
138
+ for (const formal of aliasTargets(node, byName, state)) {
139
139
  roles.set(formal, (roles.get(formal) ?? 0) | props);
140
140
  }
141
141
  };
142
- for (const [node, vertex] of (0, frame_reflection_1.callsIn)(definition, state.graph)) {
142
+ for (const [node, vertex] of df_helper_1.Dataflow.callsIn(definition, state.graph)) {
143
143
  /* a formal the body calls is what it is used as, whether or not any built-in says so */
144
144
  for (const callee of calledNames(node, vertex, state)) {
145
145
  add(callee, built_in_props_1.ArgProp.Callee);
146
146
  }
147
147
  const notStated = (0, info_1.happensInEveryBranch)(vertex.cds) ? NotStatedByACall : NotStatedByACall | built_in_props_1.ArgProp.Forced;
148
- for (const [props, argument] of argumentProps(vertex, state)) {
148
+ for (const [props, argument] of rolesOfCall(vertex, state)) {
149
149
  const stated = props & ~notStated;
150
150
  if (stated !== 0) {
151
151
  add(argument, stated);
@@ -168,14 +168,14 @@ function calledNames(id, vertex, state) {
168
168
  const called = identifier_1.Identifier.getName(vertex.name);
169
169
  return [...state.graph.edgesFrom(id)]
170
170
  .filter(([target, edge]) => edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) && !handed.has(target) && !node_id_1.NodeId.isBuiltIn(target)
171
- && state.graph.idMap?.get(target)?.lexeme === called)
171
+ && node_id_1.NodeId.recoverName(target, state.graph.idMap) === called)
172
172
  .map(([target]) => target);
173
173
  }
174
174
  /**
175
175
  * Which definitions an argument stands for: what a name refers to, not what a value is (collects *may*, not
176
176
  * identity). An argument a call never evaluates has no origin to follow (`quote(x)`), so its written name answers.
177
177
  */
178
- function resolvesTo(node, byName, state) {
178
+ function aliasTargets(node, byName, state) {
179
179
  const found = new Set([node]);
180
180
  const queue = [[node, 0]];
181
181
  for (let at = 0; at < queue.length; at++) {
@@ -202,7 +202,7 @@ function resolvesTo(node, byName, state) {
202
202
  function formalsByName(definition, state) {
203
203
  const byName = new Map();
204
204
  for (const formal of Object.keys(definition.params)) {
205
- const name = state.graph.idMap?.get(node_id_1.NodeId.normalize(formal))?.lexeme;
205
+ const name = node_id_1.NodeId.recoverName(node_id_1.NodeId.normalize(formal), state.graph.idMap);
206
206
  if (name !== undefined) {
207
207
  byName.set(name, node_id_1.NodeId.normalize(formal));
208
208
  }
@@ -211,10 +211,10 @@ function formalsByName(definition, state) {
211
211
  }
212
212
  /** The arguments of a call carrying any of `props`, as the nodes they are. */
213
213
  function argumentsWith(vertex, state, props) {
214
- return argumentProps(vertex, state).filter(([had]) => (had & props) !== 0).map(([, argument]) => argument);
214
+ return rolesOfCall(vertex, state).filter(([had]) => (had & props) !== 0).map(([, argument]) => argument);
215
215
  }
216
216
  /** What the call states about each of its arguments, paired with the node the argument is (`...` bound by R's own matching). */
217
- function argumentProps(vertex, state) {
217
+ function rolesOfCall(vertex, state) {
218
218
  const known = state.args.get(vertex.id);
219
219
  if (known !== undefined) {
220
220
  return known;
@@ -223,7 +223,7 @@ function argumentProps(vertex, state) {
223
223
  state.args.set(vertex.id, found);
224
224
  return found;
225
225
  }
226
- /** @see {@link argumentProps}, which answers from what this worked out once per call. */
226
+ /** @see {@link rolesOfCall}, which answers from what this worked out once per call. */
227
227
  function matchArgumentProps(vertex, state) {
228
228
  const sig = state.info(vertex.name)?.sig;
229
229
  if (sig === undefined) {
@@ -24,7 +24,7 @@ const built_in_proc_name_1 = require("../environments/built-in-proc-name");
24
24
  const node_value_1 = require("../eval/resolve/node-value");
25
25
  const string_constants_1 = require("../eval/values/string/string-constants");
26
26
  const r_value_1 = require("../eval/values/r-value");
27
- const frame_reflection_1 = require("./frame-reflection");
27
+ const df_helper_1 = require("../graph/df-helper");
28
28
  /** the class name R uses to mark a class as non-instantiable */
29
29
  const VirtualClass = 'VIRTUAL';
30
30
  /** The argument `ref` names, by name when the call gives one and by position among the unnamed ones otherwise. */
@@ -32,7 +32,7 @@ function argForImpl(args, ref) {
32
32
  if (ref === undefined) {
33
33
  return undefined;
34
34
  }
35
- const named = ref.name === undefined ? undefined : args.find(a => !r_argument_1.RArgument.isEmpty(a) && a.name?.content === ref.name);
35
+ const named = ref.name === undefined ? undefined : r_argument_1.RArgument.findNamed(args, ref.name);
36
36
  if (named !== undefined) {
37
37
  return r_argument_1.RArgument.valueOf(named);
38
38
  }
@@ -179,11 +179,11 @@ function generatorVariables(graph, classes) {
179
179
  const classOfId = new Map(classes.values().map(d => [d.id, d.name]));
180
180
  const generators = new Map();
181
181
  for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
182
- const lexeme = graph.idMap?.get(id)?.lexeme;
182
+ const lexeme = node_id_1.NodeId.recoverName(id, graph.idMap);
183
183
  if (lexeme === undefined) {
184
184
  continue;
185
185
  }
186
- for (const target of (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.DefinedBy)) {
186
+ for (const target of df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.DefinedBy)) {
187
187
  const cls = classOfId.get(target);
188
188
  if (cls !== undefined) {
189
189
  generators.set(lexeme, cls);
@@ -236,7 +236,7 @@ function toSigClassesImpl(classes, ownerOf) {
236
236
  /** The class vector S3 dispatch sees for the value at `id`: a `structure(..., class = )` or a constant, `undefined` if not statically known. */
237
237
  function s3ClassOfValue(id, info) {
238
238
  const node = info.idMap.get(id);
239
- if (r_function_call_1.RFunctionCall.is(node) && (0, frame_reflection_1.hasEdgeOfType)(info.graph, id, node_id_1.NodeId.toBuiltIn('structure'), edge_1.EdgeType.Calls)) {
239
+ if (r_function_call_1.RFunctionCall.is(node) && df_helper_1.Dataflow.hasEdge(info.graph, id, node_id_1.NodeId.toBuiltIn('structure'), edge_1.EdgeType.Calls)) {
240
240
  const cls = node_value_1.NodeValue.soleOf(argForImpl(node.arguments, { name: 'class' }), info);
241
241
  const strings = cls?.type === 'string' ? (0, string_constants_1.collectStrings)([cls]) : cls?.type === 'vector' && (0, r_value_1.isValue)(cls.elements) ? (0, string_constants_1.collectStrings)(cls.elements) : undefined;
242
242
  return strings?.length ? strings : undefined;
@@ -256,7 +256,7 @@ function s3ClassOfValue(id, info) {
256
256
  /** The value a plain assignment binds to the definition `def`, `undefined` for any other kind of definition (`class(x) <- `, `assign`, a parameter, ...). */
257
257
  function assignedValueOf(def, graph) {
258
258
  const vertex = graph.getVertex(def);
259
- const byAssignment = (0, frame_reflection_1.edgeTargets)(graph, def, edge_1.EdgeType.DefinedBy).some(t => vertex_1.DfgVertex.hasOrigin(graph.getVertex(t), built_in_proc_name_1.BuiltInProcName.Assignment));
259
+ const byAssignment = df_helper_1.Dataflow.targetsOf(graph, def, edge_1.EdgeType.DefinedBy).some(t => vertex_1.DfgVertex.hasOrigin(graph.getVertex(t), built_in_proc_name_1.BuiltInProcName.Assignment));
260
260
  return vertex_1.DfgVertex.isVariableDefinition(vertex) && byAssignment && vertex.source?.length === 1 ? vertex.source[0] : undefined;
261
261
  }
262
262
  /** The class vectors S3 dispatch may see for the argument at `id`, one per reaching definition, `undefined` unless all are known. */
@@ -264,7 +264,7 @@ function s3DispatchClassesOf(id, info) {
264
264
  const { graph } = info;
265
265
  const value = r_argument_1.RArgument.valueOf(info.idMap.get(id))?.info.id;
266
266
  const isRead = value !== undefined && vertex_1.DfgVertex.isUse(graph.getVertex(value));
267
- const values = isRead ? (0, frame_reflection_1.edgeTargets)(graph, value, edge_1.EdgeType.Reads).map(def => assignedValueOf(def, graph)) : [value];
267
+ const values = isRead ? df_helper_1.Dataflow.targetsOf(graph, value, edge_1.EdgeType.Reads).map(def => assignedValueOf(def, graph)) : [value];
268
268
  const classes = values.map(v => v === undefined ? undefined : s3ClassOfValue(v, info));
269
269
  return classes.length > 0 && classes.every(assert_1.isNotUndefined) ? classes : undefined;
270
270
  }
@@ -1,31 +1,9 @@
1
1
  import type { DataflowGraph } from '../graph/graph';
2
- import { EdgeType } from '../graph/edge';
3
- import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexFunctionDefinition } from '../graph/vertex';
2
+ import type { DataflowGraphVertexFunctionDefinition } from '../graph/vertex';
4
3
  import type { ArgProps, BuiltInFnInfo } from '../environments/built-in-props';
5
4
  import type { Identifier } from '../environments/identifier';
6
- import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
- import { DefaultMap } from '../../util/collections/defaultmap';
8
5
  /** What flowR states about the built-in a call names, see {@link BuiltInFnInfo}. */
9
6
  export type BuiltInLookup = (name: Identifier) => BuiltInFnInfo | undefined;
10
- /** The nodes at the far end of `node`'s outgoing edges of any of `types`, shared by every walk here and in the sibling analyses that follow specific edge kinds. */
11
- export declare function edgeTargets(this: void, graph: DataflowGraph, node: NodeId, types: EdgeType): NodeId[];
12
- /** The function-definition vertices a `call` resolves to (via {@link EdgeType.Calls}). */
13
- export declare function calledDefinitions(this: void, graph: DataflowGraph, call: NodeId): NodeId[];
14
- /** The nodes at the near end of `node`'s incoming edges of any of `types`, see {@link edgeTargets}. */
15
- export declare function edgeSources(this: void, graph: DataflowGraph, node: NodeId, types: EdgeType): NodeId[];
16
- /** Every variable definition by its unquoted name, in a single pass. */
17
- export declare function definitionsByName(this: void, graph: DataflowGraph): DefaultMap<string, NodeId[]>;
18
- /** Whether an edge from `from` to `to` carries any of `types`. */
19
- export declare function hasEdgeOfType(this: void, graph: DataflowGraph, from: NodeId, to: NodeId, types: EdgeType): boolean;
20
- /** The calls a definition's body reaches, id and vertex paired; shared by every walk here and in the sibling analyses that visit them all. */
21
- export declare function callsIn(definition: DataflowGraphVertexFunctionDefinition, graph: DataflowGraph): Generator<[NodeId, DataflowGraphVertexFunctionCall]>;
22
- /**
23
- * Recomputes `recompute(id)` for every node reachable from `seed` along the reverse of `successors`, so a
24
- * change at a node is carried on to whatever points at it, until nothing grows anymore. `recompute` updates
25
- * its node's value itself and reports whether it grew; shared by {@link propagateOverCalls} and by
26
- * {@link carriersOf} below, which grows a set rather than a bitfield.
27
- */
28
- export declare function propagateToFixpoint(seed: Iterable<NodeId>, successors: ReadonlyMap<NodeId, readonly NodeId[]>, recompute: (id: NodeId) => boolean): void;
29
7
  /** What to ask for beyond the definition itself, see {@link reflectiveRolesOf}. */
30
8
  export interface FrameReflectionOptions {
31
9
  /** what flowR states about a built-in, answered once per name */
@@ -1,12 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.edgeTargets = edgeTargets;
4
- exports.calledDefinitions = calledDefinitions;
5
- exports.edgeSources = edgeSources;
6
- exports.definitionsByName = definitionsByName;
7
- exports.hasEdgeOfType = hasEdgeOfType;
8
- exports.callsIn = callsIn;
9
- exports.propagateToFixpoint = propagateToFixpoint;
10
3
  exports.reflectiveRolesOf = reflectiveRolesOf;
11
4
  const graph_1 = require("../graph/graph");
12
5
  const built_in_proc_name_1 = require("../environments/built-in-proc-name");
@@ -14,86 +7,6 @@ const edge_1 = require("../graph/edge");
14
7
  const df_helper_1 = require("../graph/df-helper");
15
8
  const vertex_1 = require("../graph/vertex");
16
9
  const built_in_props_1 = require("../environments/built-in-props");
17
- const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
18
- const retriever_1 = require("../../r-bridge/retriever");
19
- const defaultmap_1 = require("../../util/collections/defaultmap");
20
- /** The nodes at the far end of `node`'s outgoing edges of any of `types`, shared by every walk here and in the sibling analyses that follow specific edge kinds. */
21
- function edgeTargets(graph, node, types) {
22
- const found = [];
23
- for (const [target, edge] of graph.edgesFrom(node)) {
24
- if (edge_1.DfEdge.includesType(edge, types)) {
25
- found.push(target);
26
- }
27
- }
28
- return found;
29
- }
30
- /** The function-definition vertices a `call` resolves to (via {@link EdgeType.Calls}). */
31
- function calledDefinitions(graph, call) {
32
- return edgeTargets(graph, call, edge_1.EdgeType.Calls).filter(t => vertex_1.DfgVertex.isFunctionDefinition(graph.getVertex(t)));
33
- }
34
- /** The nodes at the near end of `node`'s incoming edges of any of `types`, see {@link edgeTargets}. */
35
- function edgeSources(graph, node, types) {
36
- const found = [];
37
- for (const [source, edge] of graph.edgesTo(node)) {
38
- if (edge_1.DfEdge.includesType(edge, types)) {
39
- found.push(source);
40
- }
41
- }
42
- return found;
43
- }
44
- /** Every variable definition by its unquoted name, in a single pass. */
45
- function definitionsByName(graph) {
46
- const byName = new defaultmap_1.DefaultMap(() => []);
47
- for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
48
- const name = node_id_1.NodeId.recoverName(id, graph.idMap);
49
- if (name !== undefined) {
50
- byName.get((0, retriever_1.removeRQuotes)(name)).push(id);
51
- }
52
- }
53
- return byName;
54
- }
55
- /** Whether an edge from `from` to `to` carries any of `types`. */
56
- function hasEdgeOfType(graph, from, to, types) {
57
- return edge_1.DfEdge.includesType(graph.outgoingEdges(from)?.get(to) ?? { types: 0 }, types);
58
- }
59
- /** The calls a definition's body reaches, id and vertex paired; shared by every walk here and in the sibling analyses that visit them all. */
60
- function* callsIn(definition, graph) {
61
- for (const node of definition.subflow.graph) {
62
- const vertex = graph.getVertex(node);
63
- if (vertex_1.DfgVertex.isFunctionCall(vertex)) {
64
- yield [node, vertex];
65
- }
66
- }
67
- }
68
- /**
69
- * Recomputes `recompute(id)` for every node reachable from `seed` along the reverse of `successors`, so a
70
- * change at a node is carried on to whatever points at it, until nothing grows anymore. `recompute` updates
71
- * its node's value itself and reports whether it grew; shared by {@link propagateOverCalls} and by
72
- * {@link carriersOf} below, which grows a set rather than a bitfield.
73
- */
74
- function propagateToFixpoint(seed, successors, recompute) {
75
- const callers = new defaultmap_1.DefaultMap(() => []);
76
- for (const [id, next] of successors) {
77
- for (const to of next) {
78
- callers.get(to).push(id);
79
- }
80
- }
81
- const pending = [...seed];
82
- const queued = new Set(pending);
83
- while (pending.length > 0) {
84
- const id = pending.pop();
85
- queued.delete(id);
86
- if (!recompute(id)) {
87
- continue;
88
- }
89
- for (const caller of callers.get(id)) {
90
- if (!queued.has(caller)) {
91
- queued.add(caller);
92
- pending.push(caller);
93
- }
94
- }
95
- }
96
- }
97
10
  /**
98
11
  * What `definition`'s body reaches about its own formals through the frame or call it sits in, as the
99
12
  * {@link BuiltInFnInfo#frame} bits of the reflective calls it makes (`0` for none). `get("x", envir = e)` and
@@ -102,7 +15,7 @@ function propagateToFixpoint(seed, successors, recompute) {
102
15
  */
103
16
  function reflectiveRolesOf(definition, graph, { known }) {
104
17
  let roles = 0;
105
- for (const [node, vertex] of callsIn(definition, graph)) {
18
+ for (const [node, vertex] of df_helper_1.Dataflow.callsIn(definition, graph)) {
106
19
  const info = known(vertex.name);
107
20
  const frame = info?.frame ?? 0;
108
21
  if (frame === 0 || (roles & frame) === frame || handedAnotherFrame(vertex, info)) {
@@ -123,8 +36,8 @@ function resolvedThroughout(frame, definition, graph) {
123
36
  const formals = new Set(df_helper_1.Dataflow.parametersOf(definition));
124
37
  const carrying = carriersOf(frame, definition, graph);
125
38
  let consumers = 0;
126
- for (const [node, vertex] of callsIn(definition, graph)) {
127
- const args = argumentsOf(vertex);
39
+ for (const [node, vertex] of df_helper_1.Dataflow.callsIn(definition, graph)) {
40
+ const args = argumentIdsOf(vertex);
128
41
  if (carrying.has(node) || !args.some(id => carrying.has(id))) {
129
42
  continue;
130
43
  }
@@ -138,7 +51,7 @@ function resolvedThroughout(frame, definition, graph) {
138
51
  /** Whether the consuming `call` itself, or one of its arguments naming what it looks up by a fixed name, reads a formal. */
139
52
  function resolvedToAFormal(call, args, formals, graph) {
140
53
  const fixed = args.filter(id => isFixedName(id, graph));
141
- return [call, ...fixed].some(id => edgeTargets(graph, id, edge_1.EdgeType.Reads).some(to => formals.has(to)));
54
+ return [call, ...fixed].some(id => df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads).some(to => formals.has(to)));
142
55
  }
143
56
  function isFixedName(node, graph) {
144
57
  const vertex = graph.getVertex(node);
@@ -153,9 +66,9 @@ function carriersOf(frame, definition, graph) {
153
66
  for (const node of definition.subflow.graph) {
154
67
  const vertex = graph.getVertex(node);
155
68
  /* a call reading the frame is what uses it, so it is a consumer rather than another name for it, and carries nothing on */
156
- successors.set(node, vertex_1.DfgVertex.isFunctionCall(vertex) && !passesOn(vertex) ? [] : edgeTargets(graph, node, CarryingEdges));
69
+ successors.set(node, vertex_1.DfgVertex.isFunctionCall(vertex) && !passesOn(vertex) ? [] : df_helper_1.Dataflow.targetsOf(graph, node, CarryingEdges));
157
70
  }
158
- propagateToFixpoint(successors.keys(), successors, id => {
71
+ df_helper_1.Dataflow.propagateToFixpoint(successors.keys(), successors, id => {
159
72
  if (carrying.has(id) || !(successors.get(id) ?? []).some(to => carrying.has(to))) {
160
73
  return false;
161
74
  }
@@ -166,10 +79,10 @@ function carriersOf(frame, definition, graph) {
166
79
  }
167
80
  /** Whether the call hands what it was given straight on: storing a frame under a name is no use of it. */
168
81
  function passesOn(vertex) {
169
- return vertex.origin.includes(built_in_proc_name_1.BuiltInProcName.Assignment) || vertex.origin.includes(built_in_proc_name_1.BuiltInProcName.ExpressionList);
82
+ return vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Assignment) || vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.ExpressionList);
170
83
  }
171
84
  /** The nodes a call was handed, whatever way the arguments were written. */
172
- function argumentsOf(vertex) {
85
+ function argumentIdsOf(vertex) {
173
86
  return vertex.args.filter(graph_1.FunctionArgument.isNotEmpty)
174
87
  .flatMap(a => graph_1.FunctionArgument.isNamed(a) && a.valueId !== undefined ? [a.nodeId, a.valueId] : [a.nodeId]);
175
88
  }
@@ -7,9 +7,6 @@ import type { DataflowGraph } from '../graph/graph';
7
7
  import type { StatedProps } from '../environments/built-in-props';
8
8
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
9
9
  import { type ArgumentRolesOptions, type FunctionArgumentRoles } from './argument-roles';
10
- import { propagateToFixpoint } from './frame-reflection';
11
- /** @see {@link propagateToFixpoint}, re-exported from where it lives so nothing importing it from here needs to change. */
12
- export { propagateToFixpoint };
13
10
  /** What flowR infers about a set of definitions, see {@link inferFunctions}. */
14
11
  export interface InferredFunctions {
15
12
  /** per definition, what its body states about the function itself */
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propagateToFixpoint = void 0;
4
3
  exports.inferFunctions = inferFunctions;
5
4
  const function_semantics_1 = require("./function-semantics");
6
5
  const edge_1 = require("../graph/edge");
@@ -11,9 +10,8 @@ const identifier_1 = require("../environments/identifier");
11
10
  const info_1 = require("../info");
12
11
  const strict_function_1 = require("./strict-function");
13
12
  const argument_roles_1 = require("./argument-roles");
14
- const frame_reflection_1 = require("./frame-reflection");
15
- Object.defineProperty(exports, "propagateToFixpoint", { enumerable: true, get: function () { return frame_reflection_1.propagateToFixpoint; } });
16
13
  const logic_1 = require("../../util/logic");
14
+ const df_helper_1 = require("../graph/df-helper");
17
15
  /**
18
16
  * What each of the `definitions` does, stated the way a built-in states it: {@link CallProp} bits for the
19
17
  * function ({@link PropagatedProps} bits its callees carry over included) and {@link ArgProp} bits per formal,
@@ -25,7 +23,7 @@ function inferFunctions(definitions, graph, options = {}) {
25
23
  const strict = (0, strict_function_1.strictnessOfEach)(definitions, graph, { ctx });
26
24
  return {
27
25
  props: only === 'arguments' ? {} : callProps(definitions, { graph, info: (0, query_fn_props_1.builtInLookup)(ctx) }, strict),
28
- roles: only === 'function' ? {} : argumentProps(definitions, graph, strict, options)
26
+ roles: only === 'function' ? {} : rolesOfDefinitions(definitions, graph, strict, options)
29
27
  };
30
28
  }
31
29
  /** The {@link CallProp} mask of each definition, `Strict` included and what its callees carry mixed in. */
@@ -45,7 +43,7 @@ function callProps(definitions, state, strict) {
45
43
  callees.set(id, own.callees);
46
44
  toVisit.push(...own.callees);
47
45
  }
48
- (0, frame_reflection_1.propagateToFixpoint)(callees.keys(), callees, id => {
46
+ df_helper_1.Dataflow.propagateToFixpoint(callees.keys(), callees, id => {
49
47
  const before = props.get(id);
50
48
  let grown = before ?? {};
51
49
  for (const callee of callees.get(id) ?? []) {
@@ -61,7 +59,7 @@ function callProps(definitions, state, strict) {
61
59
  return Object.fromEntries(definitions.filter(id => hasAny(props.get(id))).map(id => [id, props.get(id)]));
62
60
  }
63
61
  /** The {@link ArgProp} mask of each formal, `Forced`/`Lazy` included. */
64
- function argumentProps(definitions, graph, strict, options) {
62
+ function rolesOfDefinitions(definitions, graph, strict, options) {
65
63
  const all = { ...(0, argument_roles_1.argumentRolesOfFunctions)(definitions, graph, options) };
66
64
  for (const [id, { parameters }] of Object.entries(strict)) {
67
65
  const roles = { ...all[id] };
@@ -85,7 +83,7 @@ function propsOf(id, state) {
85
83
  }
86
84
  let stated = {};
87
85
  const callees = [];
88
- for (const [node, vertex] of (0, frame_reflection_1.callsIn)(definition, state.graph)) {
86
+ for (const [node, vertex] of df_helper_1.Dataflow.callsIn(definition, state.graph)) {
89
87
  const info = state.info(vertex.name);
90
88
  const carried = filter(info, built_in_props_1.PropagatedProps);
91
89
  stated = join(stated, {
@@ -95,9 +93,9 @@ function propsOf(id, state) {
95
93
  if (built_in_props_1.DispatchCallees.has(identifier_1.Identifier.getName(vertex.name))) {
96
94
  stated = join(stated, { props: built_in_props_1.CallProp.Generic });
97
95
  }
98
- callees.push(...(0, frame_reflection_1.calledDefinitions)(state.graph, node));
96
+ callees.push(...df_helper_1.Dataflow.calleeIdsOf(state.graph, node));
99
97
  }
100
- if (returnsInvisibly(definition, state)) {
98
+ if (exitsInvisibly(definition, state)) {
101
99
  stated = join(stated, { props: built_in_props_1.CallProp.Invisible });
102
100
  }
103
101
  return { stated, callees };
@@ -117,7 +115,7 @@ function bindsOutside(vertex, info) {
117
115
  return info?.sig !== undefined && built_in_props_1.FnSig.posWith(built_in_props_1.FnSig.layout(info.sig), vertex.args.length, built_in_props_1.ArgProp.Written).length > 0;
118
116
  }
119
117
  /** Whether every unconditional exit ends in a call returning invisibly; a bare value result (`function() 1`) never does. */
120
- function returnsInvisibly(definition, state) {
118
+ function exitsInvisibly(definition, state) {
121
119
  const unconditional = definition.exitPoints.filter(e => (0, info_1.happensInEveryBranch)(e.cds)).map(e => e.nodeId);
122
120
  return unconditional.length > 0 && unconditional.every(node => yieldsInvisibly(node, state));
123
121
  }
@@ -132,7 +130,7 @@ function yieldsInvisibly(node, state, depth = 0) {
132
130
  return false;
133
131
  }
134
132
  /* a block hands back its last expression and `return(x)` what it was given, so what they yield decides */
135
- const returns = (0, frame_reflection_1.edgeTargets)(state.graph, node, edge_1.EdgeType.Returns);
133
+ const returns = df_helper_1.Dataflow.targetsOf(state.graph, node, edge_1.EdgeType.Returns);
136
134
  return returns.length > 0 && returns.every(target => yieldsInvisibly(target, state, depth + 1));
137
135
  }
138
136
  //# sourceMappingURL=function-props.js.map
@@ -68,6 +68,7 @@ export declare const FunctionSemantics: {
68
68
  readonly signature: {
69
69
  readonly layout: (this: void, sig: FnSig) => import("../environments/built-in-props").SigLayout;
70
70
  readonly propAt: (this: void, { props, rest }: import("../environments/built-in-props").SigLayout, index: number) => ArgProps;
71
+ readonly slots: (this: void, { names, rest }: import("../environments/built-in-props").SigLayout, argNames: readonly (string | undefined)[]) => number[];
71
72
  readonly posWith: (this: void, layout: import("../environments/built-in-props").SigLayout, count: number, prop: ArgProps) => number[];
72
73
  readonly forced: (this: void, sig: FnSig | undefined, count: number) => readonly boolean[] | undefined;
73
74
  readonly forcing: (this: void, sig: FnSig | undefined, count: number) => readonly import("../../util/logic").Ternary[] | undefined;