@eagleoutice/flowr 2.14.1 → 2.14.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 (419) hide show
  1. package/README.md +142 -87
  2. package/abstract-interpretation/absint-visitor.d.ts +132 -25
  3. package/abstract-interpretation/absint-visitor.js +459 -99
  4. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +1 -1
  5. package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
  6. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
  7. package/abstract-interpretation/data-frame/mappers/arguments.js +1 -1
  8. package/abstract-interpretation/data-frame/mappers/function-mapper.js +107 -254
  9. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +5 -5
  10. package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -1
  11. package/abstract-interpretation/data-frame/resolve-args.js +6 -4
  12. package/abstract-interpretation/data-frame/shape-inference.d.ts +4 -9
  13. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -0
  14. package/abstract-interpretation/domains/bounded-set-domain.js +1 -0
  15. package/abstract-interpretation/domains/partial-product-domain.js +1 -1
  16. package/abstract-interpretation/domains/set-range-domain.d.ts +3 -2
  17. package/abstract-interpretation/domains/set-range-domain.js +3 -2
  18. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +3 -2
  19. package/abstract-interpretation/domains/set-upper-bound-domain.js +3 -2
  20. package/benchmark/calibration.d.ts +11 -6
  21. package/benchmark/calibration.js +19 -8
  22. package/benchmark/slicer.d.ts +7 -1
  23. package/benchmark/slicer.js +38 -34
  24. package/benchmark/stats/count-comments.d.ts +16 -0
  25. package/benchmark/stats/count-comments.js +30 -0
  26. package/benchmark/stats/print.js +2 -0
  27. package/benchmark/stats/size-of.d.ts +7 -3
  28. package/benchmark/stats/size-of.js +7 -3
  29. package/benchmark/stats/stats.d.ts +7 -0
  30. package/benchmark/summarizer/first-phase/process.js +2 -19
  31. package/benchmark/summarizer/second-phase/graph.js +13 -3
  32. package/benchmark/summarizer/second-phase/process.js +2 -0
  33. package/cli/repl/commands/repl-dataflow.js +70 -27
  34. package/cli/repl/core.d.ts +1 -1
  35. package/cli/repl/core.js +1 -1
  36. package/cli/repl/parser/slice-query-parser.js +2 -1
  37. package/cli/repl/server/connection.d.ts +4 -0
  38. package/cli/repl/server/connection.js +19 -16
  39. package/cli/repl/server/messages/message-analysis.d.ts +1 -1
  40. package/config.d.ts +21 -8
  41. package/config.js +12 -5
  42. package/control-flow/basic-cfg-guided-visitor.d.ts +7 -2
  43. package/control-flow/basic-cfg-guided-visitor.js +37 -24
  44. package/control-flow/cfg-dead-code.js +44 -33
  45. package/control-flow/cfg-properties.js +2 -2
  46. package/control-flow/cfg-simplification.js +6 -5
  47. package/control-flow/cfg-to-basic-blocks.js +11 -13
  48. package/control-flow/control-flow-graph.d.ts +179 -189
  49. package/control-flow/control-flow-graph.js +400 -263
  50. package/control-flow/dfg-cfg-guided-visitor.d.ts +21 -3
  51. package/control-flow/dfg-cfg-guided-visitor.js +17 -13
  52. package/control-flow/diff-cfg.js +6 -14
  53. package/control-flow/happens-before.js +5 -4
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +44 -101
  55. package/control-flow/semantic-cfg-guided-visitor.js +6 -3
  56. package/control-flow/simple-visitor.js +14 -15
  57. package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -1
  58. package/control-flow/useless-loop.js +18 -14
  59. package/core/steps/all/core/20-dataflow.d.ts +1 -3
  60. package/core/steps/pipeline/default-pipelines.d.ts +141 -157
  61. package/dataflow/cluster.js +7 -0
  62. package/dataflow/environments/apply-kill.d.ts +6 -0
  63. package/dataflow/environments/apply-kill.js +63 -31
  64. package/dataflow/environments/built-in-props.d.ts +5 -1
  65. package/dataflow/environments/built-in-props.js +4 -0
  66. package/dataflow/environments/built-in.d.ts +6 -3
  67. package/dataflow/environments/built-in.js +8 -5
  68. package/dataflow/environments/clone.d.ts +3 -3
  69. package/dataflow/environments/clone.js +5 -5
  70. package/dataflow/environments/default-builtin-config.d.ts +114 -3
  71. package/dataflow/environments/default-builtin-config.js +137 -35
  72. package/dataflow/environments/environment.d.ts +5 -5
  73. package/dataflow/environments/environment.js +5 -5
  74. package/dataflow/environments/identifier.d.ts +11 -1
  75. package/dataflow/environments/identifier.js +4 -1
  76. package/dataflow/environments/resolve-by-name.d.ts +7 -0
  77. package/dataflow/environments/resolve-by-name.js +12 -0
  78. package/dataflow/environments/resolve-helper.d.ts +3 -1
  79. package/dataflow/environments/resolve-helper.js +2 -0
  80. package/dataflow/eval/resolve/alias-tracking.d.ts +3 -3
  81. package/dataflow/eval/resolve/alias-tracking.js +3 -3
  82. package/dataflow/eval/resolve/match-arguments.js +7 -5
  83. package/dataflow/eval/resolve/node-value.d.ts +3 -1
  84. package/dataflow/eval/resolve/node-value.js +12 -0
  85. package/dataflow/eval/resolve/resolve-argument.js +5 -4
  86. package/dataflow/eval/resolve/resolve-operators.js +9 -6
  87. package/dataflow/eval/resolve/resolve-strings.js +2 -2
  88. package/dataflow/eval/resolve/resolve-working-directory.js +4 -3
  89. package/dataflow/eval/resolve/resolve.js +3 -2
  90. package/dataflow/eval/values/general.js +8 -5
  91. package/dataflow/extractor.d.ts +1 -4
  92. package/dataflow/extractor.js +11 -10
  93. package/dataflow/fn/exceptions-of-function.d.ts +3 -1
  94. package/dataflow/fn/strict-function.js +7 -5
  95. package/dataflow/graph/call-graph.js +2 -2
  96. package/dataflow/graph/df-helper.d.ts +8 -1
  97. package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
  98. package/dataflow/graph/diff-dataflow-graph.js +19 -2
  99. package/dataflow/graph/edge.d.ts +38 -2
  100. package/dataflow/graph/edge.js +32 -2
  101. package/dataflow/graph/graph.d.ts +4 -3
  102. package/dataflow/graph/graph.js +6 -2
  103. package/dataflow/graph/match-args.d.ts +69 -0
  104. package/dataflow/graph/match-args.js +167 -0
  105. package/dataflow/info.d.ts +15 -6
  106. package/dataflow/info.js +0 -17
  107. package/dataflow/internal/control-flow.d.ts +114 -0
  108. package/dataflow/internal/control-flow.js +224 -0
  109. package/dataflow/internal/linker.d.ts +6 -31
  110. package/dataflow/internal/linker.js +24 -81
  111. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
  112. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +3 -3
  113. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +2 -2
  114. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +9 -6
  115. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  116. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +6 -4
  117. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -10
  118. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +18 -37
  119. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
  120. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -3
  121. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +1 -1
  122. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +11 -7
  123. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
  124. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  125. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +18 -14
  126. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +18 -2
  127. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +12 -1
  128. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
  129. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +38 -30
  130. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -2
  131. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
  132. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +36 -8
  133. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
  134. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +20 -17
  135. package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
  136. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +6 -4
  137. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +4 -3
  138. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +9 -4
  139. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +2 -2
  140. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +5 -5
  141. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
  142. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +5 -4
  143. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +7 -5
  144. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +1 -1
  145. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +15 -13
  146. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
  147. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +11 -2
  148. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  149. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +4 -3
  150. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +1 -1
  151. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +26 -4
  152. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
  153. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +17 -4
  154. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
  155. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +71 -33
  156. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +6 -15
  157. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +13 -14
  158. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  159. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +14 -11
  160. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +15 -1
  161. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
  162. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +12 -8
  163. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -5
  164. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +1 -1
  165. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +5 -4
  166. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
  167. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +50 -10
  168. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
  169. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +20 -4
  170. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +6 -2
  171. package/dataflow/internal/process/functions/call/common.js +5 -6
  172. package/dataflow/internal/process/functions/call/deferred.js +2 -2
  173. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +12 -2
  174. package/dataflow/internal/process/functions/call/known-call-handling.js +41 -15
  175. package/dataflow/internal/process/functions/call/named-call-handling.js +2 -0
  176. package/dataflow/internal/process/functions/call/nse.d.ts +1 -1
  177. package/dataflow/internal/process/functions/call/nse.js +6 -1
  178. package/dataflow/internal/process/functions/call/quoted.js +2 -2
  179. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +19 -6
  180. package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
  181. package/dataflow/internal/process/functions/process-argument.js +12 -4
  182. package/dataflow/internal/process/functions/process-parameter.js +13 -0
  183. package/dataflow/internal/process/process-named-call.d.ts +2 -2
  184. package/dataflow/internal/process/process-named-call.js +9 -7
  185. package/documentation/data/server/doc-data-server-messages.js +4 -4
  186. package/documentation/doc-readme.js +33 -0
  187. package/documentation/doc-util/doc-cfg.d.ts +8 -7
  188. package/documentation/doc-util/doc-cfg.js +10 -10
  189. package/documentation/doc-util/doc-playground.d.ts +12 -0
  190. package/documentation/doc-util/doc-playground.js +21 -0
  191. package/documentation/doc-util/doc-query.d.ts +4 -1
  192. package/documentation/doc-util/doc-query.js +4 -2
  193. package/documentation/wiki-absint.d.ts +3 -4
  194. package/documentation/wiki-absint.js +17 -5
  195. package/documentation/wiki-analyzer.js +2 -2
  196. package/documentation/wiki-cfg.js +101 -106
  197. package/documentation/wiki-dataflow-graph.js +84 -53
  198. package/documentation/wiki-interface.js +1 -0
  199. package/documentation/wiki-linter.js +15 -1
  200. package/documentation/wiki-linting-and-testing.js +1 -16
  201. package/documentation/wiki-mk/doc-maker.js +6 -4
  202. package/documentation/wiki-query.js +14 -4
  203. package/documentation/wiki-signature-database.js +28 -2
  204. package/linter/linter-fix.d.ts +16 -0
  205. package/linter/linter-fix.js +104 -0
  206. package/linter/linter-format.d.ts +18 -1
  207. package/linter/linter-format.js +31 -1
  208. package/linter/linter-output.js +46 -10
  209. package/linter/linter-rules.d.ts +40 -9
  210. package/linter/linter-rules.js +2 -0
  211. package/linter/rules/absolute-path.js +4 -2
  212. package/linter/rules/dataframe-access-validation.js +6 -7
  213. package/linter/rules/deprecated-functions.d.ts +107 -10
  214. package/linter/rules/deprecated-functions.js +311 -23
  215. package/linter/rules/file-path-validity.js +5 -4
  216. package/linter/rules/function-finder-util.d.ts +6 -0
  217. package/linter/rules/function-finder-util.js +21 -13
  218. package/linter/rules/naming-convention.js +1 -1
  219. package/linter/rules/network-functions.d.ts +2 -2
  220. package/linter/rules/stop-with-call-arg.js +2 -2
  221. package/linter/rules/unclosed-connection.js +2 -2
  222. package/linter/rules/undefined-symbol-util.js +6 -4
  223. package/linter/rules/undefined-symbol.js +2 -2
  224. package/linter/rules/unused-definition.js +8 -4
  225. package/linter/rules/unused-import.d.ts +60 -0
  226. package/linter/rules/unused-import.js +179 -0
  227. package/package.json +2 -2
  228. package/project/attached-packages.js +2 -1
  229. package/project/cache/flowr-analyzer-cache.d.ts +2 -5
  230. package/project/cache/flowr-analyzer-cache.js +4 -7
  231. package/project/cache/flowr-analyzer-controlflow-cache.d.ts +9 -8
  232. package/project/cache/flowr-analyzer-controlflow-cache.js +17 -34
  233. package/project/cache/flowr-cache.d.ts +9 -0
  234. package/project/cache/flowr-cache.js +19 -0
  235. package/project/context/flowr-analyzer-context.d.ts +7 -3
  236. package/project/context/flowr-analyzer-context.js +15 -9
  237. package/project/context/flowr-analyzer-dependencies-context.d.ts +24 -3
  238. package/project/context/flowr-analyzer-dependencies-context.js +9 -14
  239. package/project/context/flowr-analyzer-files-context.js +15 -17
  240. package/project/context/flowr-analyzer-meta-context.js +2 -12
  241. package/project/dependency-version-space.d.ts +1 -7
  242. package/project/dependency-version-space.js +9 -8
  243. package/project/flowr-analyzer-builder.d.ts +4 -4
  244. package/project/flowr-analyzer.d.ts +4 -6
  245. package/project/flowr-analyzer.js +4 -5
  246. package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -34
  247. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +13 -13
  248. package/project/plugins/file-plugins/files/flowr-rda-file.js +131 -286
  249. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +1 -0
  250. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -0
  251. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +2 -5
  252. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +2 -8
  253. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +32 -0
  254. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +43 -1
  255. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +4 -12
  256. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +3 -16
  257. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +5 -8
  258. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +4 -10
  259. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +3 -10
  260. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +1 -13
  261. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +3 -6
  262. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +2 -8
  263. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +2 -5
  264. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +2 -8
  265. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +2 -5
  266. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +2 -8
  267. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +3 -4
  268. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -6
  269. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +4 -12
  270. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +3 -16
  271. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +4 -12
  272. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +3 -16
  273. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +4 -12
  274. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -16
  275. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +2 -5
  276. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +2 -8
  277. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +2 -6
  278. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +1 -10
  279. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +2 -5
  280. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.js +2 -8
  281. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +2 -1
  282. package/project/sigdb/build.d.ts +2 -2
  283. package/project/sigdb/decode.d.ts +0 -5
  284. package/project/sigdb/decode.js +0 -8
  285. package/project/sigdb/index-format.d.ts +4 -4
  286. package/project/sigdb/manifest.d.ts +2 -2
  287. package/project/sigdb/reader.d.ts +54 -13
  288. package/project/sigdb/reader.js +4 -3
  289. package/project/sigdb/schema.d.ts +3 -1
  290. package/project/sigdb/signature-db.d.ts +69 -0
  291. package/project/sigdb/signature-db.js +54 -0
  292. package/project/sigdb/signature-match.d.ts +10 -5
  293. package/project/sigdb/signature-match.js +13 -8
  294. package/queries/catalog/absint-query/absint-query-executor.js +1 -2
  295. package/queries/catalog/call-context-query/call-context-query-executor.js +2 -4
  296. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
  297. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +33 -6
  298. package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -2
  299. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  300. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +8 -7
  301. package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -35
  302. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +13 -1
  303. package/queries/catalog/dependencies-query/function-info/library-functions.js +26 -22
  304. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +9 -0
  305. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +19 -0
  306. package/queries/catalog/dependencies-query/implicit-echo.d.ts +13 -0
  307. package/queries/catalog/dependencies-query/implicit-echo.js +133 -0
  308. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
  309. package/queries/catalog/happens-before-query/happens-before-query-executor.js +1 -2
  310. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
  311. package/queries/catalog/signature-query/signature-query-executor.js +4 -3
  312. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  313. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  314. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  315. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  316. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
  317. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +4 -1
  318. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -2
  319. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  320. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
  321. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  322. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
  323. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  324. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
  325. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  326. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
  327. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  328. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
  329. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +6 -4
  330. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +6 -4
  331. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  332. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
  333. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  334. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
  335. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  336. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
  337. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +6 -0
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +13 -0
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +8 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +8 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +1 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +1 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  350. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  352. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +1 -0
  353. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  354. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
  355. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  356. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
  357. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  358. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
  359. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  360. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -1
  361. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +0 -5
  362. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
  363. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +3 -2
  364. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.js +2 -1
  365. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +2 -1
  366. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
  367. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -1
  368. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.d.ts +2 -2
  369. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +6 -3
  370. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +2 -1
  371. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -1
  372. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +5 -3
  373. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +2 -1
  374. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -1
  375. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  376. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +5 -3
  377. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -1
  378. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +1 -1
  379. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -1
  380. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -1
  381. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +1 -1
  382. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +2 -1
  383. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +5 -3
  384. package/reconstruct/inline/source-inline-map.js +3 -3
  385. package/reconstruct/reconstruct.js +6 -4
  386. package/search/flowr-search-builder.d.ts +8 -8
  387. package/search/flowr-search-builder.js +4 -4
  388. package/search/flowr-search-filters.d.ts +2 -2
  389. package/search/flowr-search-filters.js +3 -2
  390. package/search/search-executor/search-enrichers.d.ts +6 -0
  391. package/search/search-executor/search-enrichers.js +44 -5
  392. package/slicing/criterion/filters/all-variables.js +2 -1
  393. package/slicing/criterion/parse.js +8 -6
  394. package/slicing/static/slice-call.js +2 -2
  395. package/util/arg-matching.d.ts +3 -0
  396. package/util/arg-matching.js +12 -1
  397. package/util/collections/arrays.d.ts +0 -4
  398. package/util/collections/arrays.js +4 -26
  399. package/util/diff-graph.d.ts +1 -1
  400. package/util/diff-graph.js +17 -3
  401. package/util/diff.d.ts +6 -0
  402. package/util/mermaid/ast.d.ts +1 -1
  403. package/util/mermaid/ast.js +5 -4
  404. package/util/mermaid/cfg.js +130 -24
  405. package/util/mermaid/dfg.js +31 -10
  406. package/util/mermaid/mermaid.js +2 -0
  407. package/util/objects.d.ts +24 -4
  408. package/util/objects.js +12 -0
  409. package/util/prefix.d.ts +1 -1
  410. package/util/text/playground-link.d.ts +131 -0
  411. package/util/text/playground-link.js +214 -0
  412. package/util/text/strings.js +7 -3
  413. package/util/version.js +1 -1
  414. package/control-flow/cfg-builder.d.ts +0 -30
  415. package/control-flow/cfg-builder.js +0 -79
  416. package/control-flow/extract-cfg.d.ts +0 -36
  417. package/control-flow/extract-cfg.js +0 -693
  418. package/project/cfg-kind.d.ts +0 -21
  419. package/project/cfg-kind.js +0 -26
@@ -1,12 +1,31 @@
1
- import { type CfgBasicBlockVertex, type CfgMarkerVertex, type CfgExpressionVertex, CfgVertex, type CfgStatementVertex, type ControlFlowInformation } from './control-flow-graph';
1
+ import { type CfgBasicBlockVertex, type CfgExpressionVertex, CfgVertex, type CfgStatementVertex, type ControlFlowInformation } from './control-flow-graph';
2
2
  import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
3
3
  import { type DataflowGraphVertexArgument, type DataflowGraphVertexFunctionCall, type DataflowGraphVertexFunctionDefinition, type DataflowGraphVertexUse, type DataflowGraphVertexValue, type DataflowGraphVertexVariableDefinition } from '../dataflow/graph/vertex';
4
4
  import { type BasicCfgGuidedVisitorConfiguration, BasicCfgGuidedVisitor } from './basic-cfg-guided-visitor';
5
5
  import type { DataflowGraph } from '../dataflow/graph/graph';
6
+ import type { AstIdMap } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
6
7
  export interface DataflowCfgGuidedVisitorConfiguration<ControlFlow extends ControlFlowInformation = ControlFlowInformation, Dfg extends DataflowGraph = DataflowGraph> extends BasicCfgGuidedVisitorConfiguration<ControlFlow> {
7
8
  readonly dfg: Dfg;
8
- readonly defaultVisitingType?: 'entry' | 'exit';
9
9
  }
10
+ /**
11
+ * Fill in what a cfg-guided visitor can take from the control flow view itself: the dataflow graph it views,
12
+ * and the ast that graph knows. Pass either yourself to use a different one.
13
+ * @example
14
+ * ```ts
15
+ * new MyVisitor(cfgVisitorConfig({ controlFlow, defaultVisitingOrder: 'forward' }))
16
+ * ```
17
+ */
18
+ export declare function cfgVisitorConfig<Config extends BasicCfgGuidedVisitorConfiguration & {
19
+ dfg?: DataflowGraph;
20
+ normalizedAst?: {
21
+ idMap: AstIdMap;
22
+ };
23
+ }>(config: Config): Config & {
24
+ dfg: DataflowGraph;
25
+ normalizedAst: {
26
+ idMap: AstIdMap;
27
+ };
28
+ };
10
29
  /**
11
30
  * This visitor extends on the {@link BasicCfgGuidedVisitor} by dispatching visitors based on the dataflow graph.
12
31
  *
@@ -19,7 +38,6 @@ export declare class DataflowAwareCfgGuidedVisitor<ControlFlow extends ControlFl
19
38
  protected getDataflowGraph(id: NodeId): DataflowGraphVertexArgument | undefined;
20
39
  protected onStatementNode(node: CfgStatementVertex): void;
21
40
  protected onExpressionNode(node: CfgExpressionVertex): void;
22
- protected onEndMarkerNode(node: CfgMarkerVertex): void;
23
41
  protected visitDataflowNode(node: Exclude<CfgVertex, CfgBasicBlockVertex>): void;
24
42
  /**
25
43
  * called for every cfg vertex that has no corresponding dataflow vertex.
@@ -1,10 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataflowAwareCfgGuidedVisitor = void 0;
4
+ exports.cfgVisitorConfig = cfgVisitorConfig;
4
5
  const control_flow_graph_1 = require("./control-flow-graph");
5
6
  const vertex_1 = require("../dataflow/graph/vertex");
6
7
  const basic_cfg_guided_visitor_1 = require("./basic-cfg-guided-visitor");
7
8
  const assert_1 = require("../util/assert");
9
+ /**
10
+ * Fill in what a cfg-guided visitor can take from the control flow view itself: the dataflow graph it views,
11
+ * and the ast that graph knows. Pass either yourself to use a different one.
12
+ * @example
13
+ * ```ts
14
+ * new MyVisitor(cfgVisitorConfig({ controlFlow, defaultVisitingOrder: 'forward' }))
15
+ * ```
16
+ */
17
+ function cfgVisitorConfig(config) {
18
+ const dfg = config.dfg ?? config.controlFlow.graph.dataflow();
19
+ (0, assert_1.guard)(dfg?.idMap !== undefined, 'pass the dataflow graph, this control flow graph is not a view of one');
20
+ return { ...config, dfg, normalizedAst: config.normalizedAst ?? { idMap: dfg.idMap } };
21
+ }
8
22
  /**
9
23
  * This visitor extends on the {@link BasicCfgGuidedVisitor} by dispatching visitors based on the dataflow graph.
10
24
  *
@@ -19,24 +33,14 @@ class DataflowAwareCfgGuidedVisitor extends basic_cfg_guided_visitor_1.BasicCfgG
19
33
  }
20
34
  onStatementNode(node) {
21
35
  super.onStatementNode(node);
22
- if (this.config.defaultVisitingType !== 'exit' || control_flow_graph_1.CfgVertex.getEnd(node) === undefined) {
23
- this.visitDataflowNode(node);
24
- }
36
+ this.visitDataflowNode(node);
25
37
  }
26
38
  onExpressionNode(node) {
27
39
  super.onExpressionNode(node);
28
- if (this.config.defaultVisitingType !== 'exit' || control_flow_graph_1.CfgVertex.getEnd(node) === undefined) {
29
- this.visitDataflowNode(node);
30
- }
31
- }
32
- onEndMarkerNode(node) {
33
- super.onEndMarkerNode(node);
34
- if (this.config.defaultVisitingType === 'exit') {
35
- this.visitDataflowNode(node);
36
- }
40
+ this.visitDataflowNode(node);
37
41
  }
38
42
  visitDataflowNode(node) {
39
- const dfgVertex = this.getDataflowGraph(control_flow_graph_1.CfgVertex.getRootId(node));
43
+ const dfgVertex = this.getDataflowGraph(control_flow_graph_1.CfgVertex.getId(node));
40
44
  if (!dfgVertex) {
41
45
  this.visitUnknown(node);
42
46
  return;
@@ -67,20 +67,12 @@ function diffVertices(ctx) {
67
67
  ctx.report.addComment(`Vertex ${id} differs in elems.\n ${ctx.leftname}: ${JSON.stringify(lElems)}\n vs\n ${ctx.rightname}: ${JSON.stringify(rElems)}`, { tag: 'vertex', id });
68
68
  }
69
69
  }
70
- (0, diff_1.setDifference)(new Set(control_flow_graph_1.CfgVertex.getMid(lInfo) ?? []), new Set(control_flow_graph_1.CfgVertex.getMid(rInfo) ?? []), {
71
- ...ctx,
72
- position: `${ctx.position}Vertex ${id} differs in attached mid markers. `
73
- });
74
- (0, diff_1.setDifference)(new Set(control_flow_graph_1.CfgVertex.getEnd(lInfo) ?? []), new Set(control_flow_graph_1.CfgVertex.getEnd(rInfo) ?? []), {
75
- ...ctx,
76
- position: `${ctx.position}Vertex ${id} differs in attached end markers. `
77
- });
78
- const lRoot = control_flow_graph_1.CfgVertex.getRootId(lInfo);
79
- const rRoot = control_flow_graph_1.CfgVertex.getRootId(rInfo);
80
- if (lRoot !== rRoot) {
81
- ctx.report.addComment(`Vertex ${id} differs in root. ${ctx.leftname}: ${JSON.stringify(lRoot)} vs ${ctx.rightname}: ${JSON.stringify(rRoot)}`, {
82
- tag: 'vertex',
83
- id
70
+ const lTargets = control_flow_graph_1.CfgVertex.getCallTargets(lInfo);
71
+ const rTargets = control_flow_graph_1.CfgVertex.getCallTargets(rInfo);
72
+ if (lTargets !== undefined || rTargets !== undefined) {
73
+ (0, diff_1.setDifference)(lTargets ?? new Set(), rTargets ?? new Set(), {
74
+ ...ctx,
75
+ position: `${ctx.position}Vertex ${id} differs in call targets. `
84
76
  });
85
77
  }
86
78
  (0, diff_1.setDifference)(new Set(control_flow_graph_1.CfgVertex.getChildren(lInfo)), new Set(control_flow_graph_1.CfgVertex.getChildren(rInfo)), {
@@ -8,7 +8,7 @@ const control_flow_graph_1 = require("./control-flow-graph");
8
8
  */
9
9
  function happensBefore(cfg, a, b) {
10
10
  const visited = new Set();
11
- /* the first is the id we are currently at, the second one the exit marker of the current largest cd scope */
11
+ /* the first is the id we are currently at, the second one the vertex the current largest cd scope joins on */
12
12
  const stack = [[b, undefined]];
13
13
  while (stack.length > 0) {
14
14
  const [current, cd] = stack.pop();
@@ -23,9 +23,10 @@ function happensBefore(cfg, a, b) {
23
23
  useCd = undefined;
24
24
  }
25
25
  visited.add(current);
26
- for (const [id, t] of cfg.outgoingEdges(current) ?? []) {
27
- const marker = control_flow_graph_1.CfgEdge.isControlDependency(t) ? control_flow_graph_1.CfgVertex.toExitId(control_flow_graph_1.CfgEdge.unpackCause(t)) : useCd;
28
- stack.push([id, useCd ?? marker]);
26
+ for (const [id, t] of cfg.ingoingEdges(current) ?? []) {
27
+ /* the vertex that caused the branch is where its arms join again, so it closes the scope */
28
+ const joinsAt = control_flow_graph_1.CfgEdge.isControlDependency(t) ? control_flow_graph_1.CfgEdge.unpackCause(t) : useCd;
29
+ stack.push([id, useCd ?? joinsAt]);
29
30
  }
30
31
  }
31
32
  return logic_1.Ternary.Never;
@@ -11,13 +11,20 @@ import type { RLogical } from '../r-bridge/lang-4.x/ast/model/nodes/r-logical';
11
11
  import type { DataflowGraph, FunctionArgument } from '../dataflow/graph/graph';
12
12
  import type { NoInfo, RNode } from '../r-bridge/lang-4.x/ast/model/model';
13
13
  import type { RSymbol } from '../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
14
- import type { RExpressionList } from '../r-bridge/lang-4.x/ast/model/nodes/r-expression-list';
14
+ import { RExpressionList } from '../r-bridge/lang-4.x/ast/model/nodes/r-expression-list';
15
15
  import type { ReadOnlyFlowrAnalyzerContext } from '../project/context/flowr-analyzer-context';
16
16
  import { RNull } from '../r-bridge/lang-4.x/convert-values';
17
17
  import { BuiltInProcName } from '../dataflow/environments/built-in-proc-name';
18
18
  export interface SemanticCfgGuidedVisitorConfiguration<OtherInfo = NoInfo, ControlFlow extends ControlFlowInformation = ControlFlowInformation, Ast extends NormalizedAst<OtherInfo> = NormalizedAst<OtherInfo>, Dfg extends DataflowGraph = DataflowGraph> extends DataflowCfgGuidedVisitorConfiguration<ControlFlow, Dfg>, SyntaxCfgGuidedVisitorConfiguration<OtherInfo, ControlFlow, Ast> {
19
19
  readonly ctx: ReadOnlyFlowrAnalyzerContext;
20
20
  }
21
+ /**
22
+ * What every `on...Call` hook of the {@link SemanticCfgGuidedVisitor} receives: the call vertex it fired for.
23
+ * Hooks that recognize more of the call's shape extend this with the parts they resolved.
24
+ */
25
+ export interface OnCall {
26
+ readonly call: DataflowGraphVertexFunctionCall;
27
+ }
21
28
  /**
22
29
  * This visitor extends on the {@link DataflowAwareCfgGuidedVisitor} by dispatching visitors for separate function calls as well,
23
30
  * providing more information!
@@ -50,9 +57,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
50
57
  * The logical the call's only argument resolves to, `undefined` if the call does not take exactly one
51
58
  * argument or if that argument does not resolve to a single logical.
52
59
  */
53
- protected getBoolArgValue(data: {
54
- call: DataflowGraphVertexFunctionCall;
55
- }): boolean | undefined;
60
+ protected getBoolArgValue(data: OnCall): boolean | undefined;
56
61
  /**
57
62
  * See {@link DataflowAwareCfgGuidedVisitor#visitValue} for the base implementation.
58
63
  * This now dispatches the value to the appropriate event handler based on its type.
@@ -212,9 +217,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
212
217
  * to rely on {@link SemanticCfgGuidedVisitor#getOrigins|`getOrigins`} to get more information.
213
218
  * @protected
214
219
  */
215
- protected onUnnamedCall(_data: {
216
- call: DataflowGraphVertexFunctionCall;
217
- }): void;
220
+ protected onUnnamedCall(_data: OnCall): void;
218
221
  /**
219
222
  * This event triggers for every function call that is not handled by a specific overload,
220
223
  * and hence may be a function that targets a user-defined function. In a way, these are functions that are named,
@@ -234,9 +237,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
234
237
  * The main reason for this separation is part of flowR's handling of these functions, as anonymous calls cannot be resolved using the active environment.
235
238
  * @protected
236
239
  */
237
- protected onDefaultFunctionCall(_data: {
238
- call: DataflowGraphVertexFunctionCall;
239
- }): void;
240
+ protected onDefaultFunctionCall(_data: OnCall): void;
240
241
  /**
241
242
  * This event triggers for every call to the `eval` function.
242
243
  *
@@ -245,9 +246,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
245
246
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
246
247
  * @protected
247
248
  */
248
- protected onEvalFunctionCall(_data: {
249
- call: DataflowGraphVertexFunctionCall;
250
- }): void;
249
+ protected onEvalFunctionCall(_data: OnCall): void;
251
250
  /**
252
251
  * This event triggers for every call to any of the `*apply` functions.
253
252
  *
@@ -256,9 +255,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
256
255
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
257
256
  * @protected
258
257
  */
259
- protected onApplyFunctionCall(_data: {
260
- call: DataflowGraphVertexFunctionCall;
261
- }): void;
258
+ protected onApplyFunctionCall(_data: OnCall): void;
262
259
  /**
263
260
  * This event triggers for every expression list - implicit or explicit, _but_ not for the root program (see {@link SemanticCfgGuidedVisitor#onProgram|`onProgram`} for that).
264
261
  *
@@ -266,9 +263,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
266
263
  * expression list `x <- x + 1` in `for(x in 1:10) x <- x + 1`.
267
264
  * @protected
268
265
  */
269
- protected onExpressionList(_data: {
270
- call: DataflowGraphVertexFunctionCall;
271
- }): void;
266
+ protected onExpressionList(_data: OnCall): void;
272
267
  /**
273
268
  * This event triggers for every call to the `source` function.
274
269
  *
@@ -279,22 +274,17 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
279
274
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
280
275
  * @protected
281
276
  */
282
- protected onSourceCall(_data: {
283
- call: DataflowGraphVertexFunctionCall;
284
- }): void;
277
+ protected onSourceCall(_data: OnCall): void;
285
278
  /**
286
279
  * This event triggers for every subsetting call, i.e., for every call to `[[`, `[`, or `$`.
287
280
  * @protected
288
281
  */
289
- protected onAccessCall(_data: {
290
- call: DataflowGraphVertexFunctionCall;
291
- }): void;
282
+ protected onAccessCall(_data: OnCall): void;
292
283
  /**
293
284
  * This event triggers for every call to the `if` function, which is used to implement the `if-then-else` control flow.
294
285
  * @protected
295
286
  */
296
- protected onIfThenElseCall(_data: {
297
- call: DataflowGraphVertexFunctionCall;
287
+ protected onIfThenElseCall(_data: OnCall & {
298
288
  condition: NodeId | undefined;
299
289
  yes: NodeId | undefined;
300
290
  no: NodeId | undefined;
@@ -308,18 +298,14 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
308
298
  * this may very well trigger a {@link SemanticCfgGuidedVisitor#onVariableUse|`onVariableUse`} event as well.
309
299
  * @protected
310
300
  */
311
- protected onGetCall(_data: {
312
- call: DataflowGraphVertexFunctionCall;
313
- }): void;
301
+ protected onGetCall(_data: OnCall): void;
314
302
  /**
315
303
  * This event triggers for every call to the `rm` function, which is used to remove variables from the environment.
316
304
  *
317
305
  * For example, `rm` in `rm(x)`.
318
306
  * @protected
319
307
  */
320
- protected onRmCall(_data: {
321
- call: DataflowGraphVertexFunctionCall;
322
- }): void;
308
+ protected onRmCall(_data: OnCall): void;
323
309
  /**
324
310
  * This event triggers for every call to a function which loads a library.
325
311
  *
@@ -328,9 +314,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
328
314
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
329
315
  * @protected
330
316
  */
331
- protected onLibraryCall(_data: {
332
- call: DataflowGraphVertexFunctionCall;
333
- }): void;
317
+ protected onLibraryCall(_data: OnCall): void;
334
318
  /**
335
319
  * This event triggers for every assignment call, i.e., for every call to `<-` or `=` that assigns a value to a variable.
336
320
  *
@@ -340,8 +324,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
340
324
  * Please be aware that replacements (e.g. assignments with a function call on the target side) like `names(x) <- 3` are subject to {@link SemanticCfgGuidedVisitor#onReplacementCall|`onReplacementCall`} instead.
341
325
  * @protected
342
326
  */
343
- protected onAssignmentCall(_data: {
344
- call: DataflowGraphVertexFunctionCall;
327
+ protected onAssignmentCall(_data: OnCall & {
345
328
  target?: NodeId;
346
329
  source?: NodeId;
347
330
  }): void;
@@ -353,8 +336,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
353
336
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
354
337
  * @protected
355
338
  */
356
- protected onSpecialBinaryOpCall(_data: {
357
- call: DataflowGraphVertexFunctionCall;
339
+ protected onSpecialBinaryOpCall(_data: OnCall & {
358
340
  lhs?: FunctionArgument;
359
341
  rhs?: FunctionArgument;
360
342
  }): void;
@@ -362,8 +344,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
362
344
  * This event triggers for every call to R's pipe operator, i.e., for every call to `|>`.
363
345
  * @protected
364
346
  */
365
- protected onPipeCall(_data: {
366
- call: DataflowGraphVertexFunctionCall;
347
+ protected onPipeCall(_data: OnCall & {
367
348
  lhs?: FunctionArgument;
368
349
  rhs?: FunctionArgument;
369
350
  }): void;
@@ -375,9 +356,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
375
356
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
376
357
  * @protected
377
358
  */
378
- protected onQuoteCall(_data: {
379
- call: DataflowGraphVertexFunctionCall;
380
- }): void;
359
+ protected onQuoteCall(_data: OnCall): void;
381
360
  /**
382
361
  * This event triggers for every call to the `for` loop function, which is used to implement the `for` loop control flow.
383
362
  *
@@ -386,8 +365,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
386
365
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
387
366
  * @protected
388
367
  */
389
- protected onForLoopCall(_data: {
390
- call: DataflowGraphVertexFunctionCall;
368
+ protected onForLoopCall(_data: OnCall & {
391
369
  variable: FunctionArgument;
392
370
  vector: FunctionArgument;
393
371
  body: FunctionArgument;
@@ -400,8 +378,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
400
378
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
401
379
  * @protected
402
380
  */
403
- protected onWhileLoopCall(_data: {
404
- call: DataflowGraphVertexFunctionCall;
381
+ protected onWhileLoopCall(_data: OnCall & {
405
382
  condition: FunctionArgument;
406
383
  body: FunctionArgument;
407
384
  }): void;
@@ -413,8 +390,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
413
390
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
414
391
  * @protected
415
392
  */
416
- protected onRepeatLoopCall(_data: {
417
- call: DataflowGraphVertexFunctionCall;
393
+ protected onRepeatLoopCall(_data: OnCall & {
418
394
  body: FunctionArgument;
419
395
  }): void;
420
396
  /**
@@ -428,8 +404,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
428
404
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
429
405
  * @protected
430
406
  */
431
- protected onReplacementCall(_data: {
432
- call: DataflowGraphVertexFunctionCall;
407
+ protected onReplacementCall(_data: OnCall & {
433
408
  source: NodeId | undefined;
434
409
  target: NodeId | undefined;
435
410
  }): void;
@@ -441,9 +416,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
441
416
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
442
417
  * @protected
443
418
  */
444
- protected onListCall(_data: {
445
- call: DataflowGraphVertexFunctionCall;
446
- }): void;
419
+ protected onListCall(_data: OnCall): void;
447
420
  /**
448
421
  * This event triggers for every call that (to the knowledge of flowr) constructs a (new) vector.
449
422
  *
@@ -452,9 +425,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
452
425
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
453
426
  * @protected
454
427
  */
455
- protected onVectorCall(_data: {
456
- call: DataflowGraphVertexFunctionCall;
457
- }): void;
428
+ protected onVectorCall(_data: OnCall): void;
458
429
  /**
459
430
  * This event triggers for every call to the `stop` function.
460
431
  *
@@ -463,9 +434,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
463
434
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
464
435
  * @protected
465
436
  */
466
- protected onStopCall(_data: {
467
- call: DataflowGraphVertexFunctionCall;
468
- }): void;
437
+ protected onStopCall(_data: OnCall): void;
469
438
  /**
470
439
  * This event triggers for every call to the `stopifnot` function.
471
440
  *
@@ -474,9 +443,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
474
443
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
475
444
  * @protected
476
445
  */
477
- protected onStopIfNotCall(_data: {
478
- call: DataflowGraphVertexFunctionCall;
479
- }): void;
446
+ protected onStopIfNotCall(_data: OnCall): void;
480
447
  /**
481
448
  * This event triggers for every call the `try` function, which is used to catch possible errors.
482
449
  *
@@ -485,9 +452,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
485
452
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
486
453
  * @protected
487
454
  */
488
- protected onTryCall(_data: {
489
- call: DataflowGraphVertexFunctionCall;
490
- }): void;
455
+ protected onTryCall(_data: OnCall): void;
491
456
  /**
492
457
  * This event triggers for every call to a function that performs a local call, such as `local`.
493
458
  *
@@ -496,9 +461,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
496
461
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
497
462
  * @protected
498
463
  */
499
- protected onLocalCall(_data: {
500
- call: DataflowGraphVertexFunctionCall;
501
- }): void;
464
+ protected onLocalCall(_data: OnCall): void;
502
465
  /**
503
466
  * This event triggers for every call to a function that performs an S3-like dispatch.
504
467
  *
@@ -506,9 +469,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
506
469
  * @see {@link SemanticCfgGuidedVisitor#onS3DispatchNextCall|`onS3DispatchNextCall`} for `NextMethod` calls.
507
470
  * @protected
508
471
  */
509
- protected onS3DispatchCall(_data: {
510
- call: DataflowGraphVertexFunctionCall;
511
- }): void;
472
+ protected onS3DispatchCall(_data: OnCall): void;
512
473
  /**
513
474
  * This event triggers for every call to a function that performs an S3-like *next* dispatch.
514
475
  *
@@ -516,23 +477,17 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
516
477
  * @see {@link SemanticCfgGuidedVisitor#onS3DispatchCall|`onS3DispatchCall`} for `UseMethod` calls.
517
478
  * @protected
518
479
  */
519
- protected onS3DispatchNextCall(_data: {
520
- call: DataflowGraphVertexFunctionCall;
521
- }): void;
480
+ protected onS3DispatchNextCall(_data: OnCall): void;
522
481
  /**
523
482
  * This event triggers for every call to a function that creates a new S7 generic, such as `new_generic`.
524
483
  * @protected
525
484
  */
526
- protected onS7NewGenericCall(_data: {
527
- call: DataflowGraphVertexFunctionCall;
528
- }): void;
485
+ protected onS7NewGenericCall(_data: OnCall): void;
529
486
  /**
530
487
  * This event triggers for every call to a function that performs an S7 dispatch, such as `S7_dispatch`.
531
488
  * @protected
532
489
  */
533
- protected onS7DispatchCall(_data: {
534
- call: DataflowGraphVertexFunctionCall;
535
- }): void;
490
+ protected onS7DispatchCall(_data: OnCall): void;
536
491
  /**
537
492
  * This event triggers for every call to a function that registers a hook, such as `on.exit`.
538
493
  *
@@ -541,9 +496,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
541
496
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
542
497
  * @protected
543
498
  */
544
- protected onRegisterHookCall(_data: {
545
- call: DataflowGraphVertexFunctionCall;
546
- }): void;
499
+ protected onRegisterHookCall(_data: OnCall): void;
547
500
  /**
548
501
  * This event triggers for every call to `break` to exit a loop.
549
502
  *
@@ -552,9 +505,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
552
505
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
553
506
  * @protected
554
507
  */
555
- protected onBreakCall(_data: {
556
- call: DataflowGraphVertexFunctionCall;
557
- }): void;
508
+ protected onBreakCall(_data: OnCall): void;
558
509
  /**
559
510
  * This event triggers for every call to `return` to explicitly return a value in a function.
560
511
  *
@@ -563,27 +514,19 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
563
514
  * More specifically, this relates to the corresponding {@link BuiltInProcessorMapper} handler.
564
515
  * @protected
565
516
  */
566
- protected onReturnCall(_data: {
567
- call: DataflowGraphVertexFunctionCall;
568
- }): void;
517
+ protected onReturnCall(_data: OnCall): void;
569
518
  /**
570
519
  * This event triggers for every call to `Recall`, which is used to recall the function closure (usually in recursive functions).
571
520
  * @protected
572
521
  */
573
- protected onRecallCall(_data: {
574
- call: DataflowGraphVertexFunctionCall;
575
- }): void;
522
+ protected onRecallCall(_data: OnCall): void;
576
523
  /**
577
524
  * This event triggers for any purr formula as in `map(df, ~ .x + 1)`
578
525
  */
579
- protected onPurrFormulaCall(_data: {
580
- call: DataflowGraphVertexFunctionCall;
581
- }): void;
526
+ protected onPurrFormulaCall(_data: OnCall): void;
582
527
  protected getSourceAndTarget(call: DataflowGraphVertexFunctionCall): {
583
528
  target: NodeId | undefined;
584
529
  source: NodeId | undefined;
585
530
  };
586
- protected onLoadCall(_param: {
587
- call: DataflowGraphVertexFunctionCall;
588
- }): void;
531
+ protected onLoadCall(_param: OnCall): void;
589
532
  }
@@ -6,12 +6,15 @@ const dfg_cfg_guided_visitor_1 = require("./dfg-cfg-guided-visitor");
6
6
  const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
7
7
  const edge_1 = require("../dataflow/graph/edge");
8
8
  const assert_1 = require("../util/assert");
9
+ const r_expression_list_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
9
10
  const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
10
11
  const convert_values_1 = require("../r-bridge/lang-4.x/convert-values");
11
12
  const df_helper_1 = require("../dataflow/graph/df-helper");
12
13
  const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
13
14
  const node_value_1 = require("../dataflow/eval/resolve/node-value");
14
15
  const r_value_1 = require("../dataflow/eval/values/r-value");
16
+ const r_function_definition_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
17
+ const r_if_then_else_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-if-then-else");
15
18
  /**
16
19
  * This visitor extends on the {@link DataflowAwareCfgGuidedVisitor} by dispatching visitors for separate function calls as well,
17
20
  * providing more information!
@@ -112,7 +115,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
112
115
  visitFunctionDefinition(vertex) {
113
116
  super.visitFunctionDefinition(vertex);
114
117
  const ast = this.getNormalizedAst(vertex.id);
115
- if (ast?.type === type_1.RType.FunctionDefinition) {
118
+ if (r_function_definition_1.RFunctionDefinition.is(ast)) {
116
119
  this.onFunctionDefinition({ vertex, parameters: ast.parameters.map(p => p.info.id) });
117
120
  }
118
121
  else {
@@ -147,7 +150,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
147
150
  visitUnknown(vertex) {
148
151
  super.visitUnknown(vertex);
149
152
  const ast = this.getNormalizedAst(control_flow_graph_1.CfgVertex.getId(vertex));
150
- if (ast && ast.type === type_1.RType.ExpressionList && ast.info.parent === undefined) {
153
+ if (ast && r_expression_list_1.RExpressionList.is(ast) && ast.info.parent === undefined) {
151
154
  this.onProgram(ast);
152
155
  }
153
156
  }
@@ -186,7 +189,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
186
189
  case built_in_proc_name_1.BuiltInProcName.IfThenElse: {
187
190
  // recover dead arguments from ast
188
191
  const ast = this.getNormalizedAst(call.id);
189
- if (!ast || ast.type !== type_1.RType.IfThenElse) {
192
+ if (!ast || !r_if_then_else_1.RIfThenElse.is(ast)) {
190
193
  return this.onIfThenElseCall({
191
194
  call,
192
195
  condition: call.args[0] === r_function_call_1.EmptyArgument ? undefined : call.args[0].nodeId,
@@ -32,17 +32,13 @@ visitor) {
32
32
  else if (hasBb) {
33
33
  const get = graph.getVertex(current);
34
34
  if (control_flow_graph_1.CfgVertex.isBlock(get)) {
35
- const elems = control_flow_graph_1.CfgVertex.getBasicBlockElements(get);
36
- for (const e of elems.toReversed()) {
35
+ for (const e of control_flow_graph_1.CfgVertex.getBasicBlockElements(get)) {
37
36
  queue.push(control_flow_graph_1.CfgVertex.getId(e));
38
37
  }
39
38
  }
40
39
  }
41
- const incoming = graph.outgoingEdges(current);
42
- if (incoming) {
43
- for (const c of incoming.keys()) {
44
- queue.push(c);
45
- }
40
+ for (const c of graph.predecessors(current)) {
41
+ queue.push(c);
46
42
  }
47
43
  }
48
44
  }
@@ -70,17 +66,20 @@ visitor) {
70
66
  if (visitor(current)) {
71
67
  continue;
72
68
  }
73
- else if (hasBb) {
74
- const get = graph.getVertex(current);
75
- if (control_flow_graph_1.CfgVertex.isBlock(get)) {
76
- const elems = control_flow_graph_1.CfgVertex.getBasicBlockElements(get);
77
- for (const e of elems.toReversed()) {
78
- queue.enqueue(control_flow_graph_1.CfgVertex.getId(e));
69
+ else {
70
+ if (hasBb) {
71
+ const get = graph.getVertex(current);
72
+ if (control_flow_graph_1.CfgVertex.isBlock(get)) {
73
+ for (const e of control_flow_graph_1.CfgVertex.getBasicBlockElements(get)) {
74
+ queue.enqueue(control_flow_graph_1.CfgVertex.getId(e));
75
+ }
79
76
  }
80
77
  }
78
+ for (const child of graph.childrenOf(current) ?? control_flow_graph_1.NoNeighbors) {
79
+ queue.enqueue(child);
80
+ }
81
81
  }
82
- const outgoing = graph.ingoingEdges(current) ?? [];
83
- for (const [to] of outgoing) {
82
+ for (const to of graph.successors(current)) {
84
83
  queue.enqueue(to);
85
84
  }
86
85
  }
@@ -25,7 +25,8 @@ import type { RNumber } from '../r-bridge/lang-4.x/ast/model/nodes/r-number';
25
25
  import type { RSymbol } from '../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
26
26
  import type { NoInfo, RNode } from '../r-bridge/lang-4.x/ast/model/model';
27
27
  export interface SyntaxCfgGuidedVisitorConfiguration<OtherInfo = NoInfo, ControlFlow extends ControlFlowInformation = ControlFlowInformation, Ast extends NormalizedAst<OtherInfo> = NormalizedAst<OtherInfo>> extends BasicCfgGuidedVisitorConfiguration<ControlFlow> {
28
- readonly normalizedAst: Ast;
28
+ /** the ast the vertices refer to; only the id map is used, so {@link cfgVisitorConfig} can take it from the dataflow graph */
29
+ readonly normalizedAst: Pick<Ast, 'idMap'>;
29
30
  }
30
31
  /**
31
32
  * This visitor extends on the {@link BasicCfgGuidedVisitor} by dispatching visitors based on the AST type of the node.