@eagleoutice/flowr 2.6.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (435) hide show
  1. package/README.md +36 -34
  2. package/abstract-interpretation/data-frame/absint-visitor.d.ts +1 -1
  3. package/abstract-interpretation/data-frame/absint-visitor.js +6 -6
  4. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +4 -7
  5. package/abstract-interpretation/data-frame/dataframe-domain.js +5 -11
  6. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +3 -1
  7. package/abstract-interpretation/data-frame/mappers/access-mapper.js +3 -2
  8. package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
  9. package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +3 -1
  10. package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +3 -2
  11. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +7 -7
  12. package/abstract-interpretation/data-frame/mappers/function-mapper.js +28 -24
  13. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +3 -1
  14. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +3 -2
  15. package/abstract-interpretation/data-frame/semantics.js +54 -41
  16. package/abstract-interpretation/data-frame/shape-inference.d.ts +3 -3
  17. package/abstract-interpretation/data-frame/shape-inference.js +3 -3
  18. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -0
  19. package/abstract-interpretation/domains/abstract-domain.js +3 -2
  20. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  21. package/abstract-interpretation/domains/interval-domain.d.ts +2 -2
  22. package/abstract-interpretation/domains/interval-domain.js +3 -6
  23. package/abstract-interpretation/domains/lattice.d.ts +2 -0
  24. package/abstract-interpretation/domains/lattice.js +3 -1
  25. package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -1
  26. package/abstract-interpretation/domains/positive-interval-domain.js +1 -1
  27. package/abstract-interpretation/domains/satisfiable-domain.d.ts +2 -2
  28. package/abstract-interpretation/domains/satisfiable-domain.js +2 -2
  29. package/abstract-interpretation/domains/set-range-domain.d.ts +98 -0
  30. package/abstract-interpretation/domains/set-range-domain.js +400 -0
  31. package/abstract-interpretation/domains/set-upper-bound-domain.js +2 -2
  32. package/abstract-interpretation/domains/singleton-domain.js +2 -2
  33. package/abstract-interpretation/normalized-ast-fold.d.ts +1 -1
  34. package/benchmark/slicer.d.ts +3 -1
  35. package/benchmark/slicer.js +50 -27
  36. package/benchmark/stats/print.js +8 -5
  37. package/benchmark/stats/stats.d.ts +3 -2
  38. package/benchmark/summarizer/data.d.ts +11 -8
  39. package/benchmark/summarizer/first-phase/process.js +12 -9
  40. package/benchmark/summarizer/second-phase/graph.d.ts +3 -1
  41. package/benchmark/summarizer/second-phase/graph.js +3 -1
  42. package/benchmark/summarizer/second-phase/process.js +24 -18
  43. package/cli/export-quads-app.js +1 -1
  44. package/cli/repl/commands/repl-dataflow.js +2 -1
  45. package/cli/repl/commands/repl-parse.js +16 -4
  46. package/cli/repl/commands/repl-query.js +1 -1
  47. package/cli/repl/core.js +16 -13
  48. package/cli/repl/server/connection.js +2 -1
  49. package/cli/script-core/statistics-helper-core.js +2 -1
  50. package/cli/slicer-app.js +3 -4
  51. package/cli/wiki.d.ts +4 -0
  52. package/cli/wiki.js +165 -0
  53. package/config.d.ts +4 -0
  54. package/config.js +6 -0
  55. package/control-flow/cfg-dead-code.js +14 -3
  56. package/control-flow/cfg-simplification.d.ts +5 -2
  57. package/control-flow/cfg-simplification.js +3 -0
  58. package/control-flow/extract-cfg.d.ts +9 -3
  59. package/control-flow/extract-cfg.js +44 -4
  60. package/control-flow/semantic-cfg-guided-visitor.d.ts +2 -2
  61. package/control-flow/simple-visitor.js +2 -2
  62. package/control-flow/useless-loop.d.ts +3 -3
  63. package/control-flow/useless-loop.js +16 -5
  64. package/core/pipeline-executor.d.ts +3 -6
  65. package/core/pipeline-executor.js +4 -7
  66. package/core/print/normalize-printer.d.ts +1 -1
  67. package/core/print/normalize-printer.js +2 -2
  68. package/core/steps/all/core/00-parse.d.ts +1 -1
  69. package/core/steps/all/core/00-parse.js +1 -1
  70. package/core/steps/all/core/10-normalize.d.ts +3 -9
  71. package/core/steps/all/core/10-normalize.js +1 -16
  72. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -3
  73. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -3
  74. package/core/steps/all/core/20-dataflow.d.ts +3 -4
  75. package/core/steps/all/core/20-dataflow.js +2 -2
  76. package/core/steps/all/static-slicing/00-slice.d.ts +4 -2
  77. package/core/steps/all/static-slicing/00-slice.js +3 -2
  78. package/core/steps/all/static-slicing/10-reconstruct.d.ts +8 -0
  79. package/core/steps/all/static-slicing/10-reconstruct.js +4 -1
  80. package/core/steps/pipeline/default-pipelines.d.ts +94 -95
  81. package/core/steps/pipeline/default-pipelines.js +8 -8
  82. package/dataflow/cluster.js +2 -2
  83. package/dataflow/environments/append.d.ts +5 -0
  84. package/dataflow/environments/append.js +6 -20
  85. package/dataflow/environments/built-in.d.ts +2 -1
  86. package/dataflow/environments/clone.d.ts +1 -2
  87. package/dataflow/environments/clone.js +3 -17
  88. package/dataflow/environments/define.d.ts +7 -3
  89. package/dataflow/environments/define.js +9 -56
  90. package/dataflow/environments/diff.js +3 -3
  91. package/dataflow/environments/environment.d.ts +48 -28
  92. package/dataflow/environments/environment.js +187 -62
  93. package/dataflow/environments/overwrite.d.ts +1 -5
  94. package/dataflow/environments/overwrite.js +2 -61
  95. package/dataflow/environments/reference-to-maybe.d.ts +13 -0
  96. package/dataflow/environments/reference-to-maybe.js +54 -0
  97. package/dataflow/environments/resolve-by-name.d.ts +6 -1
  98. package/dataflow/environments/resolve-by-name.js +56 -4
  99. package/dataflow/environments/scoping.d.ts +8 -4
  100. package/dataflow/environments/scoping.js +13 -9
  101. package/dataflow/eval/resolve/alias-tracking.d.ts +10 -4
  102. package/dataflow/eval/resolve/alias-tracking.js +15 -13
  103. package/dataflow/eval/resolve/resolve-argument.d.ts +2 -1
  104. package/dataflow/eval/resolve/resolve-argument.js +10 -10
  105. package/dataflow/eval/resolve/resolve.d.ts +13 -11
  106. package/dataflow/eval/resolve/resolve.js +16 -15
  107. package/dataflow/eval/values/string/string-constants.d.ts +9 -3
  108. package/dataflow/eval/values/string/string-constants.js +9 -3
  109. package/dataflow/extractor.d.ts +2 -3
  110. package/dataflow/extractor.js +25 -28
  111. package/dataflow/fn/higher-order-function.d.ts +2 -1
  112. package/dataflow/fn/higher-order-function.js +4 -4
  113. package/dataflow/graph/dataflowgraph-builder.d.ts +9 -5
  114. package/dataflow/graph/dataflowgraph-builder.js +21 -11
  115. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  116. package/dataflow/graph/graph.d.ts +13 -11
  117. package/dataflow/graph/graph.js +40 -24
  118. package/dataflow/graph/invert-dfg.d.ts +3 -2
  119. package/dataflow/graph/invert-dfg.js +3 -3
  120. package/dataflow/graph/resolve-graph.d.ts +2 -1
  121. package/dataflow/graph/resolve-graph.js +2 -2
  122. package/dataflow/graph/unknown-replacement.d.ts +4 -2
  123. package/dataflow/graph/unknown-replacement.js +4 -2
  124. package/dataflow/graph/vertex.d.ts +3 -3
  125. package/dataflow/graph/vertex.js +3 -3
  126. package/dataflow/info.d.ts +8 -1
  127. package/dataflow/info.js +21 -0
  128. package/dataflow/internal/linker.js +10 -11
  129. package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -2
  130. package/dataflow/internal/process/functions/call/argument/make-argument.js +2 -3
  131. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +7 -1
  132. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +12 -3
  133. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
  134. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -7
  135. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +2 -2
  136. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -1
  137. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -6
  138. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -14
  139. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +10 -8
  140. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -4
  141. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
  142. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +10 -14
  143. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  144. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
  145. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +3 -1
  146. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +8 -6
  147. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +1 -1
  148. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  149. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +4 -4
  150. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +6 -1
  151. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +7 -2
  152. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -5
  153. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +6 -4
  154. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +15 -10
  155. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +78 -75
  156. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +3 -1
  157. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -1
  158. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
  159. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -5
  160. package/dataflow/internal/process/functions/call/common.d.ts +1 -1
  161. package/dataflow/internal/process/functions/call/common.js +6 -7
  162. package/dataflow/internal/process/functions/call/default-call-handling.d.ts +3 -1
  163. package/dataflow/internal/process/functions/call/default-call-handling.js +3 -1
  164. package/dataflow/internal/process/functions/call/known-call-handling.js +4 -4
  165. package/dataflow/internal/process/functions/call/named-call-handling.js +4 -4
  166. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +1 -1
  167. package/dataflow/internal/process/functions/process-argument.js +1 -1
  168. package/dataflow/internal/process/functions/process-parameter.js +4 -4
  169. package/dataflow/internal/process/process-symbol.js +1 -1
  170. package/dataflow/internal/process/process-value.d.ts +1 -1
  171. package/dataflow/internal/process/process-value.js +7 -7
  172. package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -1
  173. package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
  174. package/dataflow/processor.d.ts +7 -16
  175. package/documentation/data/dfg/doc-data-dfg-util.d.ts +0 -2
  176. package/documentation/data/faq/faqs.js +27 -18
  177. package/documentation/data/faq/recommended-configs.d.ts +36 -0
  178. package/documentation/data/faq/recommended-configs.js +40 -0
  179. package/documentation/data/faq/wiki-faq-store.d.ts +1 -0
  180. package/documentation/data/faq/wiki-faq-store.js +10 -2
  181. package/documentation/data/server/doc-data-server-messages.js +1 -1
  182. package/documentation/doc-capabilities.d.ts +9 -0
  183. package/documentation/{print-capabilities-markdown.js → doc-capabilities.js} +18 -21
  184. package/documentation/doc-readme.d.ts +9 -0
  185. package/documentation/{print-readme.js → doc-readme.js} +31 -35
  186. package/documentation/doc-util/doc-benchmarks.d.ts +6 -4
  187. package/documentation/doc-util/doc-benchmarks.js +6 -4
  188. package/documentation/doc-util/doc-cfg.js +5 -8
  189. package/documentation/doc-util/doc-dfg.d.ts +7 -7
  190. package/documentation/doc-util/doc-dfg.js +15 -14
  191. package/documentation/doc-util/doc-escape.d.ts +6 -0
  192. package/documentation/doc-util/doc-escape.js +11 -0
  193. package/documentation/doc-util/doc-general.d.ts +22 -2
  194. package/documentation/doc-util/doc-general.js +22 -2
  195. package/documentation/doc-util/doc-normalized-ast.d.ts +10 -5
  196. package/documentation/doc-util/doc-normalized-ast.js +14 -10
  197. package/documentation/doc-util/doc-query.d.ts +12 -4
  198. package/documentation/doc-util/doc-query.js +18 -11
  199. package/documentation/doc-util/doc-search.d.ts +0 -30
  200. package/documentation/doc-util/doc-search.js +2 -73
  201. package/documentation/doc-util/doc-server-message.d.ts +5 -5
  202. package/documentation/doc-util/doc-server-message.js +4 -4
  203. package/documentation/doc-util/doc-types.d.ts +69 -32
  204. package/documentation/doc-util/doc-types.js +109 -62
  205. package/documentation/index.d.ts +9 -9
  206. package/documentation/index.js +9 -9
  207. package/documentation/issue-linting-rule.d.ts +9 -0
  208. package/documentation/{print-linter-issue.js → issue-linting-rule.js} +20 -23
  209. package/documentation/wiki-analyzer.d.ts +9 -0
  210. package/documentation/wiki-analyzer.js +425 -0
  211. package/documentation/wiki-cfg.d.ts +9 -0
  212. package/documentation/{print-cfg-wiki.js → wiki-cfg.js} +144 -160
  213. package/documentation/wiki-core.d.ts +14 -0
  214. package/documentation/{print-core-wiki.js → wiki-core.js} +164 -175
  215. package/documentation/wiki-dataflow-graph.d.ts +9 -0
  216. package/documentation/{print-dataflow-graph-wiki.js → wiki-dataflow-graph.js} +146 -177
  217. package/documentation/wiki-engine.d.ts +9 -0
  218. package/documentation/{print-engines-wiki.js → wiki-engine.js} +27 -42
  219. package/documentation/wiki-faq.d.ts +8 -0
  220. package/documentation/wiki-faq.js +21 -0
  221. package/documentation/wiki-interface.d.ts +9 -0
  222. package/documentation/{print-interface-wiki.js → wiki-interface.js} +59 -56
  223. package/documentation/wiki-linter.d.ts +9 -0
  224. package/documentation/{print-linter-wiki.js → wiki-linter.js} +52 -48
  225. package/documentation/wiki-linting-and-testing.d.ts +9 -0
  226. package/documentation/{print-linting-and-testing-wiki.js → wiki-linting-and-testing.js} +25 -32
  227. package/documentation/wiki-mk/doc-context.d.ts +186 -0
  228. package/documentation/wiki-mk/doc-context.js +84 -0
  229. package/documentation/wiki-mk/doc-maker.d.ts +95 -0
  230. package/documentation/wiki-mk/doc-maker.js +134 -0
  231. package/documentation/wiki-normalized-ast.d.ts +9 -0
  232. package/documentation/{print-normalized-ast-wiki.js → wiki-normalized-ast.js} +64 -47
  233. package/documentation/wiki-onboarding.d.ts +8 -0
  234. package/documentation/{print-onboarding-wiki.js → wiki-onboarding.js} +18 -15
  235. package/documentation/wiki-query.d.ts +9 -0
  236. package/documentation/{print-query-wiki.js → wiki-query.js} +62 -47
  237. package/documentation/wiki-search.d.ts +9 -0
  238. package/documentation/wiki-search.js +61 -0
  239. package/linter/linter-executor.js +3 -2
  240. package/linter/linter-format.d.ts +2 -2
  241. package/linter/linter-rules.d.ts +15 -19
  242. package/linter/rules/absolute-path.d.ts +1 -2
  243. package/linter/rules/absolute-path.js +5 -5
  244. package/linter/rules/dataframe-access-validation.d.ts +2 -2
  245. package/linter/rules/dataframe-access-validation.js +13 -9
  246. package/linter/rules/dead-code.d.ts +1 -1
  247. package/linter/rules/deprecated-functions.d.ts +1 -5
  248. package/linter/rules/file-path-validity.d.ts +1 -1
  249. package/linter/rules/file-path-validity.js +4 -4
  250. package/linter/rules/function-finder-util.d.ts +3 -7
  251. package/linter/rules/function-finder-util.js +1 -1
  252. package/linter/rules/naming-convention.d.ts +2 -2
  253. package/linter/rules/naming-convention.js +1 -1
  254. package/linter/rules/network-functions.d.ts +1 -1
  255. package/linter/rules/network-functions.js +1 -1
  256. package/linter/rules/seeded-randomness.d.ts +4 -3
  257. package/linter/rules/seeded-randomness.js +38 -18
  258. package/linter/rules/unused-definition.d.ts +1 -1
  259. package/linter/rules/useless-loop.d.ts +2 -2
  260. package/linter/rules/useless-loop.js +2 -2
  261. package/package.json +5 -17
  262. package/project/cache/flowr-analyzer-cache.d.ts +7 -10
  263. package/project/cache/flowr-analyzer-cache.js +17 -38
  264. package/project/cache/flowr-analyzer-controlflow-cache.d.ts +34 -0
  265. package/project/cache/flowr-analyzer-controlflow-cache.js +79 -0
  266. package/project/context/flowr-analyzer-context.d.ts +37 -5
  267. package/project/context/flowr-analyzer-context.js +51 -4
  268. package/project/context/flowr-analyzer-environment-context.d.ts +47 -0
  269. package/project/context/flowr-analyzer-environment-context.js +50 -0
  270. package/project/context/flowr-analyzer-files-context.d.ts +63 -13
  271. package/project/context/flowr-analyzer-files-context.js +110 -39
  272. package/project/context/flowr-file.d.ts +32 -10
  273. package/project/context/flowr-file.js +30 -9
  274. package/project/flowr-analyzer-builder.d.ts +22 -28
  275. package/project/flowr-analyzer-builder.js +32 -70
  276. package/project/flowr-analyzer.d.ts +55 -14
  277. package/project/flowr-analyzer.js +53 -8
  278. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +7 -1
  279. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +13 -5
  280. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +3 -3
  281. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +11 -5
  282. package/project/plugins/file-plugins/flowr-description-file.d.ts +3 -3
  283. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +22 -0
  284. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +33 -0
  285. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +22 -0
  286. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +33 -0
  287. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +22 -0
  288. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +33 -0
  289. package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.d.ts +20 -0
  290. package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.js +42 -0
  291. package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.d.ts +59 -0
  292. package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.js +132 -0
  293. package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
  294. package/project/plugins/file-plugins/notebooks/notebook.js +2 -0
  295. package/project/plugins/flowr-analyzer-plugin-defaults.d.ts +5 -0
  296. package/project/plugins/flowr-analyzer-plugin-defaults.js +23 -0
  297. package/project/plugins/flowr-analyzer-plugin.d.ts +2 -0
  298. package/project/plugins/flowr-analyzer-plugin.js +2 -0
  299. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  300. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  301. package/project/plugins/plugin-registry.d.ts +34 -0
  302. package/project/plugins/plugin-registry.js +62 -0
  303. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
  304. package/queries/catalog/call-context-query/call-context-query-executor.js +5 -6
  305. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +5 -2
  306. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +25 -18
  307. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  308. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  309. package/queries/catalog/control-flow-query/control-flow-query-format.js +3 -2
  310. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
  311. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  312. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  313. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
  314. package/queries/catalog/dependencies-query/dependencies-query-executor.js +5 -5
  315. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  316. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  317. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  318. package/queries/catalog/df-shape-query/df-shape-query-executor.js +2 -2
  319. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +6 -6
  320. package/queries/catalog/df-shape-query/df-shape-query-format.js +8 -7
  321. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +2 -1
  322. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
  323. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  324. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  325. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +1 -1
  326. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +4 -4
  327. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
  328. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  329. package/queries/catalog/linter-query/linter-query-format.js +13 -2
  330. package/queries/catalog/location-map-query/location-map-query-executor.js +2 -1
  331. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  332. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  333. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  334. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  335. package/queries/catalog/project-query/project-query-executor.js +3 -1
  336. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  337. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +2 -2
  338. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +3 -3
  339. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  340. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  341. package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -2
  342. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  343. package/queries/catalog/static-slice-query/static-slice-query-format.js +13 -1
  344. package/queries/query.d.ts +26 -18
  345. package/queries/query.js +21 -1
  346. package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -1
  347. package/r-bridge/lang-4.x/ast/model/collect.js +4 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +29 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +15 -0
  350. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +5 -7
  351. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +24 -11
  352. package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
  353. package/r-bridge/lang-4.x/ast/model/type.js +2 -0
  354. package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
  355. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +9 -8
  356. package/r-bridge/lang-4.x/ast/parser/json/parser.js +11 -10
  357. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.d.ts +4 -3
  358. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +20 -11
  359. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -3
  360. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +5 -4
  361. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +3 -2
  362. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +14 -5
  363. package/r-bridge/parser.d.ts +15 -5
  364. package/r-bridge/parser.js +27 -13
  365. package/r-bridge/retriever.d.ts +9 -15
  366. package/r-bridge/retriever.js +14 -5
  367. package/r-bridge/shell.d.ts +1 -1
  368. package/r-bridge/shell.js +1 -1
  369. package/reconstruct/auto-select/auto-select-defaults.d.ts +0 -1
  370. package/reconstruct/auto-select/magic-comments.js +1 -1
  371. package/reconstruct/reconstruct.d.ts +17 -9
  372. package/reconstruct/reconstruct.js +19 -8
  373. package/search/flowr-search.d.ts +12 -0
  374. package/search/search-executor/search-enrichers.d.ts +9 -2
  375. package/search/search-executor/search-enrichers.js +1 -3
  376. package/search/search-executor/search-generators.d.ts +1 -1
  377. package/search/search-executor/search-generators.js +9 -4
  378. package/slicing/criterion/collect-all.d.ts +3 -2
  379. package/slicing/criterion/collect-all.js +1 -1
  380. package/slicing/criterion/parse.js +4 -4
  381. package/slicing/static/slice-call.d.ts +3 -2
  382. package/slicing/static/slice-call.js +4 -4
  383. package/slicing/static/static-slicer.d.ts +3 -1
  384. package/slicing/static/static-slicer.js +6 -7
  385. package/statistics/features/supported/assignments/assignments.js +1 -1
  386. package/statistics/features/supported/control-flow/control-flow.js +2 -2
  387. package/statistics/features/supported/data-access/data-access.js +1 -1
  388. package/statistics/features/supported/defined-functions/defined-functions.js +1 -1
  389. package/statistics/features/supported/expression-list/statistics-expression-list.js +1 -1
  390. package/statistics/features/supported/loops/loops.js +1 -1
  391. package/statistics/features/supported/used-functions/used-functions.js +2 -2
  392. package/statistics/features/supported/variables/variables.js +3 -2
  393. package/statistics/statistics.js +3 -2
  394. package/util/assert.d.ts +4 -0
  395. package/util/assert.js +4 -0
  396. package/util/containers.js +1 -1
  397. package/util/files.d.ts +1 -1
  398. package/util/files.js +1 -1
  399. package/util/mermaid/ast.d.ts +4 -3
  400. package/util/mermaid/ast.js +36 -8
  401. package/util/mermaid/cfg.js +1 -1
  402. package/util/mermaid/dfg.d.ts +1 -0
  403. package/util/mermaid/dfg.js +3 -3
  404. package/util/simple-df/dfg-view.d.ts +2 -1
  405. package/util/simple-df/dfg-view.js +2 -2
  406. package/util/version.js +1 -1
  407. package/dataflow/environments/remove.d.ts +0 -12
  408. package/dataflow/environments/remove.js +0 -52
  409. package/documentation/print-analyzer-wiki.d.ts +0 -1
  410. package/documentation/print-analyzer-wiki.js +0 -141
  411. package/documentation/print-capabilities-markdown.d.ts +0 -1
  412. package/documentation/print-cfg-wiki.d.ts +0 -1
  413. package/documentation/print-core-wiki.d.ts +0 -5
  414. package/documentation/print-dataflow-graph-wiki.d.ts +0 -1
  415. package/documentation/print-engines-wiki.d.ts +0 -1
  416. package/documentation/print-faq-wiki.d.ts +0 -1
  417. package/documentation/print-faq-wiki.js +0 -18
  418. package/documentation/print-interface-wiki.d.ts +0 -1
  419. package/documentation/print-linter-issue.d.ts +0 -1
  420. package/documentation/print-linter-wiki.d.ts +0 -1
  421. package/documentation/print-linting-and-testing-wiki.d.ts +0 -1
  422. package/documentation/print-normalized-ast-wiki.d.ts +0 -1
  423. package/documentation/print-onboarding-wiki.d.ts +0 -1
  424. package/documentation/print-query-wiki.d.ts +0 -1
  425. package/documentation/print-readme.d.ts +0 -1
  426. package/documentation/print-search-wiki.d.ts +0 -1
  427. package/documentation/print-search-wiki.js +0 -74
  428. package/util/formats/adapter-format.d.ts +0 -6
  429. package/util/formats/adapter-format.js +0 -3
  430. package/util/formats/adapter.d.ts +0 -27
  431. package/util/formats/adapter.js +0 -58
  432. package/util/formats/adapters/r-adapter.d.ts +0 -4
  433. package/util/formats/adapters/r-adapter.js +0 -7
  434. package/util/formats/adapters/rmd-adapter.d.ts +0 -35
  435. package/util/formats/adapters/rmd-adapter.js +0 -100
@@ -7,7 +7,8 @@ exports.collectStrings = collectStrings;
7
7
  const general_1 = require("../general");
8
8
  const r_value_1 = require("../r-value");
9
9
  /**
10
- *
10
+ * Lift a raw string or R string value into a ValueString.
11
+ * @see {@link liftString} - for lifting a Lift<RStringValue>
11
12
  */
12
13
  function stringFrom(str) {
13
14
  return {
@@ -19,7 +20,8 @@ function stringFrom(str) {
19
20
  };
20
21
  }
21
22
  /**
22
- *
23
+ * Lift a Lift<RStringValue> into a ValueString.
24
+ * @see {@link stringFrom} - for lifting a raw string or R string value.
23
25
  */
24
26
  function liftString(str) {
25
27
  return {
@@ -28,7 +30,11 @@ function liftString(str) {
28
30
  };
29
31
  }
30
32
  /**
31
- *
33
+ * Collect strings from an array of ValueString.
34
+ * If any value is not a string, or is Bottom/Top, undefined is returned.
35
+ * @param a - The array of Value to collect strings from.
36
+ * @param withQuotes - Whether to include the quotes in the returned strings.
37
+ * @returns - An array of strings, or undefined if any value is not a string.
32
38
  */
33
39
  function collectStrings(a, withQuotes = false) {
34
40
  if ((0, general_1.bottomTopGuard)(a)) {
@@ -1,10 +1,9 @@
1
1
  import type { DataflowInformation } from './info';
2
2
  import { type DataflowProcessors } from './processor';
3
3
  import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
4
- import type { RParseRequests } from '../r-bridge/retriever';
5
4
  import type { KnownParserType, Parser } from '../r-bridge/parser';
6
5
  import type { ControlFlowInformation } from '../control-flow/control-flow-graph';
7
- import type { FlowrConfigOptions } from '../config';
6
+ import type { FlowrAnalyzerContext } from '../project/context/flowr-analyzer-context';
8
7
  /**
9
8
  * The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
10
9
  * Maps every {@link RType} in the normalized AST to a processor.
@@ -16,6 +15,6 @@ export declare const processors: DataflowProcessors<ParentInformation>;
16
15
  * (e.g., in the event of a `source` call).
17
16
  * For the actual, canonical fold entry point, see {@link processDataflowFor}.
18
17
  */
19
- export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, request: RParseRequests, completeAst: NormalizedAst<OtherInfo & ParentInformation>, config: FlowrConfigOptions): DataflowInformation & {
18
+ export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, completeAst: NormalizedAst<OtherInfo & ParentInformation>, ctx: FlowrAnalyzerContext): DataflowInformation & {
20
19
  cfgQuick: ControlFlowInformation | undefined;
21
20
  };
@@ -14,13 +14,12 @@ const named_call_handling_1 = require("./internal/process/functions/call/named-c
14
14
  const make_argument_1 = require("./internal/process/functions/call/argument/make-argument");
15
15
  const range_1 = require("../util/range");
16
16
  const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
17
- const environment_1 = require("./environments/environment");
18
17
  const built_in_source_1 = require("./internal/process/functions/call/built-in/built-in-source");
19
18
  const extract_cfg_1 = require("../control-flow/extract-cfg");
20
19
  const edge_1 = require("./graph/edge");
21
20
  const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
22
21
  const built_in_function_definition_1 = require("./internal/process/functions/call/built-in/built-in-function-definition");
23
- const built_in_config_1 = require("./environments/built-in-config");
22
+ const flowr_file_1 = require("../project/context/flowr-file");
24
23
  /**
25
24
  * The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
26
25
  * Maps every {@link RType} in the normalized AST to a processor.
@@ -60,13 +59,24 @@ exports.processors = {
60
59
  };
61
60
  function resolveLinkToSideEffects(ast, graph) {
62
61
  let cf = undefined;
62
+ let knownCalls;
63
+ const handled = new Set();
63
64
  for (const s of graph.unknownSideEffects) {
64
65
  if (typeof s !== 'object') {
65
66
  continue;
66
67
  }
67
- cf ??= (0, extract_cfg_1.extractCfgQuick)(ast);
68
+ if (cf === undefined) {
69
+ cf = (0, extract_cfg_1.extractCfgQuick)(ast);
70
+ if (graph.unknownSideEffects.size > 20) {
71
+ knownCalls = (0, extract_cfg_1.getCallsInCfg)(cf, graph);
72
+ }
73
+ }
74
+ else if (handled.has(s.id)) {
75
+ continue;
76
+ }
77
+ handled.add(s.id);
68
78
  /* this has to change whenever we add a new link to relations because we currently offer no abstraction for the type */
69
- const potentials = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(s.id, cf?.graph, graph, s.linkTo);
79
+ const potentials = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(s.id, cf.graph, graph, s.linkTo, knownCalls);
70
80
  for (const pot of potentials) {
71
81
  graph.addEdge(s.id, pot, edge_1.EdgeType.Reads);
72
82
  }
@@ -82,36 +92,23 @@ function resolveLinkToSideEffects(ast, graph) {
82
92
  * (e.g., in the event of a `source` call).
83
93
  * For the actual, canonical fold entry point, see {@link processDataflowFor}.
84
94
  */
85
- function produceDataFlowGraph(parser, request, completeAst, config) {
86
- let firstRequest;
87
- const multifile = Array.isArray(request);
88
- if (multifile) {
89
- firstRequest = request[0];
90
- }
91
- else {
92
- firstRequest = request;
93
- }
94
- const builtInsConfig = config.semantics.environment.overwriteBuiltIns;
95
- const builtIns = (0, built_in_config_1.getBuiltInDefinitions)(builtInsConfig.definitions, builtInsConfig.loadDefaults);
96
- const env = (0, environment_1.initializeCleanEnvironments)(builtIns.builtInMemory);
95
+ function produceDataFlowGraph(parser, completeAst, ctx) {
96
+ // we freeze the files here to avoid endless modifications during processing
97
+ const files = completeAst.ast.files.slice();
98
+ ctx.files.addConsideredFile(files[0].filePath ? files[0].filePath : flowr_file_1.FlowrFile.INLINE_PATH);
97
99
  const dfData = {
98
100
  parser,
99
101
  completeAst,
100
- environment: env,
101
- builtInEnvironment: env.current.parent,
102
+ environment: ctx.env.makeCleanEnv(),
102
103
  processors: exports.processors,
103
- currentRequest: firstRequest,
104
104
  controlDependencies: undefined,
105
- referenceChain: [firstRequest],
106
- flowrConfig: config
105
+ referenceChain: [files[0].filePath],
106
+ ctx
107
107
  };
108
- let df = (0, processor_1.processDataflowFor)(completeAst.ast, dfData);
109
- df.graph.sourced.unshift(firstRequest.request === 'file' ? firstRequest.content : '<inline>');
110
- if (multifile) {
111
- for (let i = 1; i < request.length; i++) {
112
- /* source requests register automatically */
113
- df = (0, built_in_source_1.standaloneSourceFile)(request[i], dfData, `root-${i}`, df);
114
- }
108
+ let df = (0, processor_1.processDataflowFor)(files[0].root, dfData);
109
+ for (let i = 1; i < files.length; i++) {
110
+ /* source requests register automatically */
111
+ df = (0, built_in_source_1.standaloneSourceFile)(i, files[i], dfData, df);
115
112
  }
116
113
  // finally, resolve linkages
117
114
  (0, built_in_function_definition_1.updateNestedFunctionCalls)(df.graph, df.environment);
@@ -1,9 +1,10 @@
1
1
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
2
  import type { DataflowGraph } from '../graph/graph';
3
+ import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
3
4
  /**
4
5
  * Determines whether the function with the given id is a higher-order function, i.e.,
5
6
  * either takes a function as an argument or (may) returns a function.
6
7
  * If the return is an identity, e.g., `function(x) x`, this is not considered higher-order,
7
8
  * if no function is passed as an argument.
8
9
  */
9
- export declare function isHigherOrder(id: NodeId, graph: DataflowGraph): boolean;
10
+ export declare function isHigherOrder(id: NodeId, graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext): boolean;
@@ -32,7 +32,7 @@ function isAnyReturnAFunction(def, graph) {
32
32
  }
33
33
  return false;
34
34
  }
35
- function inspectCallSitesArgumentsFns(def, graph) {
35
+ function inspectCallSitesArgumentsFns(def, graph, ctx) {
36
36
  const callSites = graph.ingoingEdges(def.id);
37
37
  for (const [callerId, { types }] of callSites ?? []) {
38
38
  if (!(0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.Calls)) {
@@ -46,7 +46,7 @@ function inspectCallSitesArgumentsFns(def, graph) {
46
46
  if (arg === r_function_call_1.EmptyArgument) {
47
47
  continue;
48
48
  }
49
- const value = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(arg.nodeId, { graph, idMap: graph.idMap, resolve: config_1.VariableResolve.Alias, full: true }));
49
+ const value = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(arg.nodeId, { graph, idMap: graph.idMap, resolve: config_1.VariableResolve.Alias, full: true, ctx }));
50
50
  if (value?.elements.some(e => e.type === 'function-definition')) {
51
51
  return true;
52
52
  }
@@ -60,7 +60,7 @@ function inspectCallSitesArgumentsFns(def, graph) {
60
60
  * If the return is an identity, e.g., `function(x) x`, this is not considered higher-order,
61
61
  * if no function is passed as an argument.
62
62
  */
63
- function isHigherOrder(id, graph) {
63
+ function isHigherOrder(id, graph, ctx) {
64
64
  const vert = graph.getVertex(id);
65
65
  if (!vert || !(0, vertex_1.isFunctionDefinitionVertex)(vert)) {
66
66
  return false;
@@ -70,6 +70,6 @@ function isHigherOrder(id, graph) {
70
70
  return true;
71
71
  }
72
72
  // 2. check whether any of the callsites passes a function
73
- return inspectCallSitesArgumentsFns(vert, graph);
73
+ return inspectCallSitesArgumentsFns(vert, graph, ctx);
74
74
  }
75
75
  //# sourceMappingURL=higher-order-function.js.map
@@ -1,23 +1,27 @@
1
1
  import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
2
  import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
- import { type DataflowFunctionFlowInformation, type FunctionArgument, DataflowGraph } from './graph';
3
+ import { type DataflowFunctionFlowInformation, DataflowGraph, type FunctionArgument } from './graph';
4
4
  import { type IEnvironment, type REnvironmentInformation } from '../environments/environment';
5
- import { type DataflowGraphVertexAstLink, type DataflowGraphVertexUse, type FunctionOriginInformation } from './vertex';
5
+ import { type DataflowGraphVertexArgument, type DataflowGraphVertexAstLink, type DataflowGraphVertexInfo, type DataflowGraphVertexUse, type FunctionOriginInformation } from './vertex';
6
6
  import type { ControlDependency } from '../info';
7
7
  import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
8
8
  import type { FlowrSearchLike } from '../../search/flowr-search-builder';
9
9
  import type { ReadonlyFlowrAnalysisProvider } from '../../project/flowr-analyzer';
10
10
  /**
11
- *
11
+ * Creates an empty dataflow graph.
12
+ * Should only be used in tests and documentation.
12
13
  */
13
- export declare function emptyGraph(idMap?: AstIdMap): DataflowGraphBuilder;
14
+ export declare function emptyGraph(cleanEnv?: REnvironmentInformation, idMap?: AstIdMap): DataflowGraphBuilder<DataflowGraphVertexInfo>;
14
15
  export type DataflowGraphEdgeTarget = NodeId | (readonly NodeId[]);
15
16
  /**
16
17
  * This DataflowGraphBuilder extends {@link DataflowGraph} with builder methods to
17
18
  * easily and compactly add vertices and edges to a dataflow graph. Its usage thus
18
19
  * simplifies writing tests for dataflow graphs.
19
20
  */
20
- export declare class DataflowGraphBuilder extends DataflowGraph {
21
+ export declare class DataflowGraphBuilder<Vertex extends DataflowGraphVertexInfo = DataflowGraphVertexInfo> extends DataflowGraph {
22
+ private readonly defaultEnvironment;
23
+ constructor(cleanEnv?: REnvironmentInformation, idMap?: AstIdMap);
24
+ addVertexWithDefaultEnv(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, asRoot?: boolean, overwrite?: boolean): this;
21
25
  /**
22
26
  * Adds a **vertex** for a **function definition** (V1).
23
27
  * @param id - AST node ID
@@ -6,7 +6,6 @@ exports.getBuiltInSideEffect = getBuiltInSideEffect;
6
6
  const objects_1 = require("../../util/objects");
7
7
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
8
8
  const graph_1 = require("./graph");
9
- const environment_1 = require("../environments/environment");
10
9
  const vertex_1 = require("./vertex");
11
10
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
12
11
  const built_in_1 = require("../environments/built-in");
@@ -14,11 +13,13 @@ const edge_1 = require("./edge");
14
13
  const default_builtin_config_1 = require("../environments/default-builtin-config");
15
14
  const flowr_search_executor_1 = require("../../search/flowr-search-executor");
16
15
  const assert_1 = require("../../util/assert");
16
+ const flowr_analyzer_context_1 = require("../../project/context/flowr-analyzer-context");
17
17
  /**
18
- *
18
+ * Creates an empty dataflow graph.
19
+ * Should only be used in tests and documentation.
19
20
  */
20
- function emptyGraph(idMap) {
21
- return new DataflowGraphBuilder(idMap);
21
+ function emptyGraph(cleanEnv, idMap) {
22
+ return new DataflowGraphBuilder(cleanEnv, idMap);
22
23
  }
23
24
  /**
24
25
  * This DataflowGraphBuilder extends {@link DataflowGraph} with builder methods to
@@ -26,6 +27,15 @@ function emptyGraph(idMap) {
26
27
  * simplifies writing tests for dataflow graphs.
27
28
  */
28
29
  class DataflowGraphBuilder extends graph_1.DataflowGraph {
30
+ defaultEnvironment;
31
+ constructor(cleanEnv, idMap) {
32
+ super(idMap);
33
+ this.defaultEnvironment = cleanEnv ?? (0, flowr_analyzer_context_1.contextFromInput)('').env.makeCleanEnv();
34
+ }
35
+ addVertexWithDefaultEnv(vertex, asRoot = true, overwrite = false) {
36
+ super.addVertex(vertex, this.defaultEnvironment, asRoot, overwrite);
37
+ return this;
38
+ }
29
39
  /**
30
40
  * Adds a **vertex** for a **function definition** (V1).
31
41
  * @param id - AST node ID
@@ -36,7 +46,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
36
46
  * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
37
47
  */
38
48
  defineFunction(id, exitPoints, subflow, info, asRoot = true) {
39
- return this.addVertex({
49
+ return this.addVertexWithDefaultEnv({
40
50
  tag: vertex_1.VertexType.FunctionDefinition,
41
51
  id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
42
52
  subflow: {
@@ -49,7 +59,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
49
59
  },
50
60
  exitPoints: exitPoints.map(node_id_1.normalizeIdToNumberIfPossible),
51
61
  cds: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
52
- environment: info?.environment
62
+ environment: info?.environment,
53
63
  }, asRoot);
54
64
  }
55
65
  /**
@@ -63,12 +73,12 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
63
73
  */
64
74
  call(id, name, args, info, asRoot = true) {
65
75
  const onlyBuiltInAuto = info?.reads?.length === 1 && (0, built_in_1.isBuiltIn)(info?.reads[0]);
66
- this.addVertex({
76
+ this.addVertexWithDefaultEnv({
67
77
  tag: vertex_1.VertexType.FunctionCall,
68
78
  id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
69
79
  name,
70
80
  args: args.map(a => a === r_function_call_1.EmptyArgument ? r_function_call_1.EmptyArgument : { ...a, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(a.nodeId), controlDependencies: undefined }),
71
- environment: (info?.onlyBuiltIn || onlyBuiltInAuto) ? undefined : info?.environment ?? (0, environment_1.initializeCleanEnvironments)(),
81
+ environment: (info?.onlyBuiltIn || onlyBuiltInAuto) ? undefined : info?.environment ?? this.defaultEnvironment,
72
82
  cds: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
73
83
  onlyBuiltin: info?.onlyBuiltIn ?? onlyBuiltInAuto ?? false,
74
84
  origin: info?.origin ?? [(0, default_builtin_config_1.getDefaultProcessor)(name) ?? 'function'],
@@ -115,7 +125,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
115
125
  * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
116
126
  */
117
127
  defineVariable(id, name, info, asRoot = true) {
118
- this.addVertex({
128
+ this.addVertexWithDefaultEnv({
119
129
  tag: vertex_1.VertexType.VariableDefinition,
120
130
  id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
121
131
  name,
@@ -137,7 +147,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
137
147
  * (i.e., be a valid entry point) or is it nested (e.g., as part of a function definition)
138
148
  */
139
149
  use(id, name, info, asRoot = true) {
140
- return this.addVertex((0, objects_1.deepMergeObject)({
150
+ return this.addVertexWithDefaultEnv((0, objects_1.deepMergeObject)({
141
151
  tag: vertex_1.VertexType.Use,
142
152
  id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
143
153
  name,
@@ -156,7 +166,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
156
166
  * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
157
167
  */
158
168
  constant(id, options, asRoot = true) {
159
- return this.addVertex({
169
+ return this.addVertexWithDefaultEnv({
160
170
  tag: vertex_1.VertexType.Value,
161
171
  id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
162
172
  cds: options?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
@@ -207,8 +207,8 @@ function diffVertices(ctx) {
207
207
  }
208
208
  }
209
209
  }
210
- if (lInfo.tag === 'function-definition') {
211
- if (rInfo.tag !== 'function-definition') {
210
+ if (lInfo.tag === vertex_1.VertexType.FunctionDefinition) {
211
+ if (rInfo.tag !== vertex_1.VertexType.FunctionDefinition) {
212
212
  ctx.report.addComment(`Vertex ${id} differs in tags. ${ctx.leftname}: ${lInfo.tag} vs. ${ctx.rightname}: ${rInfo.tag}`, { tag: 'vertex', id });
213
213
  }
214
214
  else {
@@ -4,6 +4,7 @@ import { type DataflowGraphVertexArgument, type DataflowGraphVertexFunctionCall,
4
4
  import { EmptyArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
5
  import type { Identifier, IdentifierDefinition, IdentifierReference } from '../environments/identifier';
6
6
  import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ import { type REnvironmentInformation } from '../environments/environment';
7
8
  import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
8
9
  import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
9
10
  /**
@@ -71,15 +72,15 @@ export interface DataflowGraphJson {
71
72
  readonly rootVertices: NodeId[];
72
73
  readonly vertexInformation: [NodeId, DataflowGraphVertexInfo][];
73
74
  readonly edgeInformation: [NodeId, [NodeId, DataflowGraphEdge][]][];
74
- readonly sourced?: (string | '<inline>')[];
75
+ readonly _unknownSideEffects: UnknownSideEffect[];
75
76
  }
76
77
  /**
77
78
  * An unknown side effect describes something that we cannot handle correctly (in all cases).
78
- * For example, `eval` will be marked as an unknown side effect as we have no idea of how it will affect the program.
79
+ * For example, `load` will be marked as an unknown side effect as we have no idea of how it will affect the program.
79
80
  * Linked side effects are used whenever we know that a call may be affected by another one in a way that we cannot
80
81
  * grasp from the dataflow perspective (e.g., an indirect dependency based on the currently active graphic device).
81
82
  */
82
- export type UnknownSidEffect = NodeId | {
83
+ export type UnknownSideEffect = NodeId | {
83
84
  id: NodeId;
84
85
  linkTo: LinkTo<RegExp>;
85
86
  };
@@ -99,10 +100,7 @@ export type UnknownSidEffect = NodeId | {
99
100
  * @see {@link emptyGraph|`emptyGraph`} - to create an empty graph (useful in tests)
100
101
  */
101
102
  export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = DataflowGraphVertexInfo, Edge extends DataflowGraphEdge = DataflowGraphEdge> {
102
- private static DEFAULT_ENVIRONMENT;
103
103
  private _idMap;
104
- /** all file paths included in this dfg */
105
- private _sourced;
106
104
  private readonly _unknownSideEffects;
107
105
  constructor(idMap: AstIdMap | undefined);
108
106
  /** Contains the vertices of the root level graph (i.e., included those vertices from the complete graph, that are nested within function definitions) */
@@ -111,6 +109,8 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
111
109
  private vertexInformation;
112
110
  /** All edges in the complete graph (including those nested in function definition) */
113
111
  private edgeInformation;
112
+ private types;
113
+ toJSON(): DataflowGraphJson;
114
114
  /**
115
115
  * Get the {@link DataflowGraphVertexInfo} attached to a node as well as all outgoing edges.
116
116
  * @param id - The id of the node to get
@@ -138,13 +138,10 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
138
138
  getLinked(nodeId: NodeId): NodeId[] | undefined;
139
139
  /** Retrieves the id-map to the normalized AST attached to the dataflow graph */
140
140
  get idMap(): AstIdMap | undefined;
141
- get sourced(): (string | '<inline>')[];
142
- /** Mark this file as being part of the dfg */
143
- addFile(source: string | '<inline>'): void;
144
141
  /**
145
142
  * Retrieves the set of vertices which have side effects that we do not know anything about.
146
143
  */
147
- get unknownSideEffects(): Set<UnknownSidEffect>;
144
+ get unknownSideEffects(): Set<UnknownSideEffect>;
148
145
  /** Allows setting the id-map explicitly (which should only be used when, e.g., you plan to compare two dataflow graphs on the same AST-basis) */
149
146
  setIdMap(idMap: AstIdMap): void;
150
147
  /**
@@ -153,6 +150,10 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
153
150
  * @see #edges
154
151
  */
155
152
  vertices(includeDefinedFunctions: boolean): MapIterator<[NodeId, Vertex]>;
153
+ verticesOfType<T extends Vertex['tag']>(type: T): MapIterator<[NodeId, Vertex & {
154
+ tag: T;
155
+ }]>;
156
+ vertexIdsOfType<T extends Vertex['tag']>(type: T): NodeId[];
156
157
  /**
157
158
  * @returns the ids of all edges in the graph together with their edge information
158
159
  * @see #vertices
@@ -172,13 +173,14 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
172
173
  /**
173
174
  * Adds a new vertex to the graph, for ease of use, some arguments are optional and filled automatically.
174
175
  * @param vertex - The vertex to add
176
+ * @param fallbackEnv - A clean environment to use if no environment is given in the vertex
175
177
  * @param asRoot - If false, this will only add the vertex but do not add it to the {@link rootIds|root vertices} of the graph.
176
178
  * This is probably only of use, when you construct dataflow graphs for tests.
177
179
  * @param overwrite - If true, this will overwrite the vertex if it already exists in the graph (based on the id).
178
180
  * @see DataflowGraphVertexInfo
179
181
  * @see DataflowGraphVertexArgument
180
182
  */
181
- addVertex(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, asRoot?: boolean, overwrite?: boolean): this;
183
+ addVertex(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, fallbackEnv: REnvironmentInformation, asRoot?: boolean, overwrite?: boolean): this;
182
184
  /** {@inheritDoc} */
183
185
  addEdge(from: NodeId, to: NodeId, type: EdgeType | number): this;
184
186
  /** {@inheritDoc} */
@@ -51,10 +51,7 @@ function getReferenceOfArgument(arg) {
51
51
  * @see {@link emptyGraph|`emptyGraph`} - to create an empty graph (useful in tests)
52
52
  */
53
53
  class DataflowGraph {
54
- static DEFAULT_ENVIRONMENT = undefined;
55
54
  _idMap;
56
- /** all file paths included in this dfg */
57
- _sourced = [];
58
55
  /*
59
56
  * Set of vertices which have sideEffects that we do not know anything about.
60
57
  * As a (temporary) solution until we have FD edges, a side effect may also store known target links
@@ -62,7 +59,6 @@ class DataflowGraph {
62
59
  */
63
60
  _unknownSideEffects = new Set();
64
61
  constructor(idMap) {
65
- DataflowGraph.DEFAULT_ENVIRONMENT ??= (0, environment_1.initializeCleanEnvironments)();
66
62
  this._idMap = idMap;
67
63
  }
68
64
  /** Contains the vertices of the root level graph (i.e., included those vertices from the complete graph, that are nested within function definitions) */
@@ -71,6 +67,15 @@ class DataflowGraph {
71
67
  vertexInformation = new Map();
72
68
  /** All edges in the complete graph (including those nested in function definition) */
73
69
  edgeInformation = new Map();
70
+ types = new Map();
71
+ toJSON() {
72
+ return {
73
+ rootVertices: Array.from(this.rootVertices),
74
+ vertexInformation: Array.from(this.vertexInformation.entries()),
75
+ edgeInformation: Array.from(this.edgeInformation.entries()).map(([id, edges]) => [id, Array.from(edges.entries())]),
76
+ _unknownSideEffects: Array.from(this._unknownSideEffects)
77
+ };
78
+ }
74
79
  /**
75
80
  * Get the {@link DataflowGraphVertexInfo} attached to a node as well as all outgoing edges.
76
81
  * @param id - The id of the node to get
@@ -127,13 +132,6 @@ class DataflowGraph {
127
132
  get idMap() {
128
133
  return this._idMap;
129
134
  }
130
- get sourced() {
131
- return this._sourced;
132
- }
133
- /** Mark this file as being part of the dfg */
134
- addFile(source) {
135
- this._sourced.push(source);
136
- }
137
135
  /**
138
136
  * Retrieves the set of vertices which have side effects that we do not know anything about.
139
137
  */
@@ -159,6 +157,15 @@ class DataflowGraph {
159
157
  }
160
158
  }
161
159
  }
160
+ *verticesOfType(type) {
161
+ const ids = this.types.get(type) ?? [];
162
+ for (const id of ids) {
163
+ yield [id, this.vertexInformation.get(id)];
164
+ }
165
+ }
166
+ vertexIdsOfType(type) {
167
+ return this.types.get(type) ?? [];
168
+ }
162
169
  /**
163
170
  * @returns the ids of all edges in the graph together with their edge information
164
171
  * @see #vertices
@@ -186,24 +193,32 @@ class DataflowGraph {
186
193
  /**
187
194
  * Adds a new vertex to the graph, for ease of use, some arguments are optional and filled automatically.
188
195
  * @param vertex - The vertex to add
196
+ * @param fallbackEnv - A clean environment to use if no environment is given in the vertex
189
197
  * @param asRoot - If false, this will only add the vertex but do not add it to the {@link rootIds|root vertices} of the graph.
190
198
  * This is probably only of use, when you construct dataflow graphs for tests.
191
199
  * @param overwrite - If true, this will overwrite the vertex if it already exists in the graph (based on the id).
192
200
  * @see DataflowGraphVertexInfo
193
201
  * @see DataflowGraphVertexArgument
194
202
  */
195
- addVertex(vertex, asRoot = true, overwrite = false) {
203
+ addVertex(vertex, fallbackEnv, asRoot = true, overwrite = false) {
196
204
  const oldVertex = this.vertexInformation.get(vertex.id);
197
205
  if (oldVertex !== undefined && !overwrite) {
198
206
  return this;
199
207
  }
200
- const fallback = vertex.tag === vertex_1.VertexType.VariableDefinition || vertex.tag === vertex_1.VertexType.Use || vertex.tag === vertex_1.VertexType.Value || (vertex.tag === vertex_1.VertexType.FunctionCall && vertex.onlyBuiltin) ? undefined : DataflowGraph.DEFAULT_ENVIRONMENT;
208
+ const fallback = vertex.tag === vertex_1.VertexType.FunctionDefinition || (vertex.tag === vertex_1.VertexType.FunctionCall && !vertex.onlyBuiltin) ? fallbackEnv : undefined;
201
209
  // keep a clone of the original environment
202
210
  const environment = vertex.environment ? (0, clone_1.cloneEnvironmentInformation)(vertex.environment) : fallback;
203
211
  this.vertexInformation.set(vertex.id, {
204
212
  ...vertex,
205
213
  environment
206
214
  });
215
+ const has = this.types.get(vertex.tag);
216
+ if (has) {
217
+ has.push(vertex.id);
218
+ }
219
+ else {
220
+ this.types.set(vertex.tag, [vertex.id]);
221
+ }
207
222
  if (asRoot) {
208
223
  this.rootVertices.add(vertex.id);
209
224
  }
@@ -248,7 +263,6 @@ class DataflowGraph {
248
263
  this.rootVertices.add(root);
249
264
  }
250
265
  }
251
- this._sourced = this._sourced.concat(otherGraph.sourced);
252
266
  for (const unknown of otherGraph.unknownSideEffects) {
253
267
  this._unknownSideEffects.add(unknown);
254
268
  }
@@ -256,6 +270,10 @@ class DataflowGraph {
256
270
  const currentInfo = this.vertexInformation.get(id);
257
271
  this.vertexInformation.set(id, currentInfo === undefined ? info : mergeNodeInfos(currentInfo, info));
258
272
  }
273
+ for (const [type, ids] of otherGraph.types) {
274
+ const existing = this.types.get(type);
275
+ this.types.set(type, existing ? existing.concat(ids) : ids.slice());
276
+ }
259
277
  this.mergeEdges(otherGraph);
260
278
  return this;
261
279
  }
@@ -299,7 +317,10 @@ class DataflowGraph {
299
317
  updateToFunctionCall(info) {
300
318
  const vertex = this.getVertex(info.id, true);
301
319
  (0, assert_1.guard)(vertex !== undefined && (vertex.tag === vertex_1.VertexType.Use || vertex.tag === vertex_1.VertexType.Value), () => `node must be a use or value node for ${JSON.stringify(info.id)} to update it to a function call but is ${vertex?.tag}`);
320
+ const previousTag = vertex.tag;
302
321
  this.vertexInformation.set(info.id, { ...vertex, ...info, tag: vertex_1.VertexType.FunctionCall });
322
+ this.types.set(previousTag, (this.types.get(previousTag) ?? []).filter(id => id !== info.id));
323
+ this.types.set(vertex_1.VertexType.FunctionCall, (this.types.get(vertex_1.VertexType.FunctionCall) ?? []).concat([info.id]));
303
324
  }
304
325
  /** If you do not pass the `to` node, this will just mark the node as maybe */
305
326
  addControlDependency(from, to, when) {
@@ -348,8 +369,8 @@ class DataflowGraph {
348
369
  }
349
370
  }
350
371
  graph.edgeInformation = new Map(data.edgeInformation.map(([id, edges]) => [id, new Map(edges)]));
351
- if (data.sourced) {
352
- graph._sourced = data.sourced;
372
+ for (const unknown of data._unknownSideEffects) {
373
+ graph._unknownSideEffects.add(unknown);
353
374
  }
354
375
  return graph;
355
376
  }
@@ -386,14 +407,9 @@ function envFromJson(json) {
386
407
  for (const [key, value] of Object.entries(json.memory)) {
387
408
  memory.set(key, value);
388
409
  }
389
- const obj = {
390
- id: json.id,
391
- parent: parent,
392
- memory
393
- };
394
- if (json.builtInEnv) {
395
- obj.builtInEnv = true;
396
- }
410
+ const obj = new environment_1.Environment(parent, json.builtInEnv);
411
+ obj.id = json.id;
412
+ obj.memory = memory;
397
413
  return obj;
398
414
  }
399
415
  function renvFromJson(json) {
@@ -1,5 +1,6 @@
1
1
  import { DataflowGraph } from './graph';
2
+ import type { REnvironmentInformation } from '../environments/environment';
2
3
  /**
3
- *
4
+ * Inverts the given dataflow graph by reversing all edges.
4
5
  */
5
- export declare function invertDfg(graph: DataflowGraph): DataflowGraph;
6
+ export declare function invertDfg(graph: DataflowGraph, cleanEnv: REnvironmentInformation): DataflowGraph;
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.invertDfg = invertDfg;
4
4
  const graph_1 = require("./graph");
5
5
  /**
6
- *
6
+ * Inverts the given dataflow graph by reversing all edges.
7
7
  */
8
- function invertDfg(graph) {
8
+ function invertDfg(graph, cleanEnv) {
9
9
  const invertedGraph = new graph_1.DataflowGraph(graph.idMap);
10
10
  for (const [, v] of graph.vertices(true)) {
11
- invertedGraph.addVertex(v);
11
+ invertedGraph.addVertex(v, cleanEnv);
12
12
  }
13
13
  for (const [from, targets] of graph.edges()) {
14
14
  for (const [to, { types }] of targets) {
@@ -1,7 +1,8 @@
1
1
  import { DataflowGraph } from './graph';
2
2
  import { type AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
+ import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
3
4
  /**
4
5
  * Resolves the dataflow graph ids from slicing criterion form to ids.
5
6
  * This returns a **new** graph with the resolved ids.
6
7
  */
7
- export declare function resolveDataflowGraph(graph: DataflowGraph, idMap?: AstIdMap): DataflowGraph;
8
+ export declare function resolveDataflowGraph(graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext, idMap?: AstIdMap): DataflowGraph;
@@ -9,7 +9,7 @@ const edge_1 = require("./edge");
9
9
  * Resolves the dataflow graph ids from slicing criterion form to ids.
10
10
  * This returns a **new** graph with the resolved ids.
11
11
  */
12
- function resolveDataflowGraph(graph, idMap) {
12
+ function resolveDataflowGraph(graph, ctx, idMap) {
13
13
  const resolveMap = idMap ?? graph.idMap;
14
14
  (0, assert_1.guard)(resolveMap !== undefined, 'idMap must be provided to resolve the graph');
15
15
  const cache = new Map();
@@ -36,7 +36,7 @@ function resolveDataflowGraph(graph, idMap) {
36
36
  resultGraph.addVertex({
37
37
  ...vertex,
38
38
  id: resolve(id)
39
- }, roots.has(id));
39
+ }, ctx.env.makeCleanEnv(), roots.has(id));
40
40
  }
41
41
  /* recreate edges */
42
42
  for (const [from, targets] of graph.edges()) {