@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
@@ -0,0 +1,69 @@
1
+ import { Identifier } from '../../dataflow/environments/identifier';
2
+ import type { DecodedFunction } from './decode';
3
+ import type { PackageSignatureSource } from './reader';
4
+ import type { LibraryExports } from './schema';
5
+ import type { ReadOnlyFlowrAnalyzerDependenciesContext } from '../context/flowr-analyzer-dependencies-context';
6
+ /**
7
+ * The signature database as the analyzed project sees it.
8
+ *
9
+ * A {@link PackageSignatureSource} answers for a version you name, and falls back to whatever it holds as newest
10
+ * when you name none. This adds the step above that, taking the version from what flowR resolved for the project,
11
+ * which is where `solver.sigdb.versionOverrides`, `solver.sigdb.versionSelection` and
12
+ * `solver.sigdb.assumedRVersion` have already been applied. So a query without a version is answered for the
13
+ * version the analysis actually assumes, not for the newest the database happens to carry.
14
+ *
15
+ * Obtain one from {@link ReadOnlyFlowrAnalyzerDependenciesContext.signatures}, and reach for
16
+ * {@link SignatureDb.sources|sources} only for what this does not cover.
17
+ * @example
18
+ * ```ts
19
+ * const db = analyzer.inspectContext().deps.signatures();
20
+ * db.versionOf('dplyr'); // the version the analysis assumes
21
+ * db.parametersOf(Identifier.make('lead', 'dplyr')); // its formals, for MatchArgs
22
+ * ```
23
+ */
24
+ export interface SignatureDb {
25
+ /** Whether any signature source is loaded at all, i.e. whether anything below can answer. */
26
+ available(this: void): boolean;
27
+ /**
28
+ * The version the analysis assumes for `pkg`, `undefined` if flowR could not pin one down. This is what every
29
+ * lookup here uses when no version is given.
30
+ */
31
+ versionOf(this: void, pkg: string): string | undefined;
32
+ /** Whether the database can resolve `pkg` at all, at any version. */
33
+ has(this: void, pkg: string): boolean;
34
+ /**
35
+ * The export view of a package.
36
+ * @param pkg - The package to look up.
37
+ * @param version - The version to answer for, {@link versionOf} if omitted.
38
+ */
39
+ exportsOf(this: void, pkg: string, version?: string): LibraryExports | undefined;
40
+ /**
41
+ * The database entry for a *qualified* call, i.e. a `pkg::fn` {@link Identifier}. Decodes only that one
42
+ * function rather than the whole package.
43
+ * @param id - The qualified identifier of the function.
44
+ * @param version - The version to answer for, {@link versionOf} of its package if omitted.
45
+ */
46
+ functionOf(this: void, id: Identifier, version?: string): DecodedFunction | undefined;
47
+ /**
48
+ * The formal parameter names of a qualified call, ready to hand to {@link MatchArgs.toNames}.
49
+ * @param id - The qualified identifier of the function.
50
+ * @param version - The version to answer for, {@link versionOf} of its package if omitted.
51
+ */
52
+ parametersOf(this: void, id: Identifier, version?: string): readonly string[] | undefined;
53
+ /** The packages exporting `name`, ordered by downloads, see {@link PackageSignatureSource.packagesExporting}. */
54
+ packagesExporting(this: void, name: string): readonly string[];
55
+ /** Every loaded source as one, for the questions this interface does not ask. */
56
+ sources(this: void): PackageSignatureSource;
57
+ }
58
+ /**
59
+ * Builds the {@link SignatureDb} that {@link ReadOnlyFlowrAnalyzerDependenciesContext.signatures} hands out.
60
+ *
61
+ * Call this only where you hold a dependencies context but no analyzer, e.g. inside a plugin or a query
62
+ * executor. Everywhere else go through `analyzer.inspectContext().deps.signatures()`. It exists so the version
63
+ * resolution lives in one place instead of every caller pairing a {@link PackageSignatureSource} with a
64
+ * `getDependency(...)?.resolvedVersion` of its own.
65
+ *
66
+ * The result keeps no state, so it stays correct when a database is mounted or a version is re-resolved later.
67
+ * @param deps - The dependencies context the versions and the sources come from.
68
+ */
69
+ export declare function signatureDbOf(deps: ReadOnlyFlowrAnalyzerDependenciesContext): SignatureDb;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.signatureDbOf = signatureDbOf;
4
+ const identifier_1 = require("../../dataflow/environments/identifier");
5
+ const reader_1 = require("./reader");
6
+ const log_1 = require("../../util/log");
7
+ const signatureDbLog = log_1.log.getSubLogger({ name: 'signature-db' });
8
+ /**
9
+ * Builds the {@link SignatureDb} that {@link ReadOnlyFlowrAnalyzerDependenciesContext.signatures} hands out.
10
+ *
11
+ * Call this only where you hold a dependencies context but no analyzer, e.g. inside a plugin or a query
12
+ * executor. Everywhere else go through `analyzer.inspectContext().deps.signatures()`. It exists so the version
13
+ * resolution lives in one place instead of every caller pairing a {@link PackageSignatureSource} with a
14
+ * `getDependency(...)?.resolvedVersion` of its own.
15
+ *
16
+ * The result keeps no state, so it stays correct when a database is mounted or a version is re-resolved later.
17
+ * @param deps - The dependencies context the versions and the sources come from.
18
+ */
19
+ function signatureDbOf(deps) {
20
+ const merged = () => new reader_1.MergedSignatureSource(deps.signatureSources());
21
+ const versionOf = (pkg) => deps.getDependency(pkg)?.resolvedVersion;
22
+ const answerFor = (pkg, version, ask) => {
23
+ const src = merged();
24
+ const assumed = version ?? versionOf(pkg);
25
+ const found = ask(src, assumed);
26
+ if (found !== undefined || assumed === undefined) {
27
+ return found;
28
+ }
29
+ const any = ask(src, undefined);
30
+ if (any !== undefined) {
31
+ signatureDbLog.debug(`no signature for ${pkg} ${assumed}, answering from the newest version the database holds`);
32
+ }
33
+ return any;
34
+ };
35
+ const functionOf = (id, version) => {
36
+ const pkg = identifier_1.Identifier.getNamespace(id);
37
+ if (pkg === undefined) {
38
+ return undefined; // without a package there is nothing to look the function up in
39
+ }
40
+ const name = identifier_1.Identifier.getName(id);
41
+ return answerFor(pkg, version, (src, v) => src.functionByName(pkg, name, v));
42
+ };
43
+ return {
44
+ available: () => deps.signatureSources().length > 0,
45
+ versionOf,
46
+ has: pkg => merged().has(pkg),
47
+ exportsOf: (pkg, version) => answerFor(pkg, version, (src, v) => src.lookup(pkg, v)),
48
+ packagesExporting: name => deps.packagesExporting(name),
49
+ sources: () => merged(),
50
+ functionOf,
51
+ parametersOf: (id, version) => functionOf(id, version)?.signature.map(p => p.name)
52
+ };
53
+ }
54
+ //# sourceMappingURL=signature-db.js.map
@@ -1,13 +1,18 @@
1
1
  import type { FunctionArgument } from '../../dataflow/graph/graph';
2
2
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
3
  import type { SigParameter } from './decode';
4
- /** the {@link pMatch} parameter spec of a *known* signature: every formal maps to itself as its own target */
4
+ /**
5
+ * The {@link MatchArgs.toSpec} parameter spec of a *known* signature, where every formal maps to itself.
6
+ * @useInstead {@link MatchArgs.toSpec}
7
+ */
5
8
  export declare function signatureParameterSpec(signature: readonly SigParameter[]): Record<string, string>;
6
9
  /**
7
- * {@link pMatch|Matches} a call's `args` against a *known* signature (typically from the signature database via
8
- * `PackageSignatureSource.functions(pkg)`), returning per parameter name the id(s) bound to it, e.g.
9
- * `matchArgumentsToSignature(ggplotCall.args, ggplotSignature).get('data')`.
10
+ * Matches a call's `args` against a *known* signature, returning per parameter name the id(s) bound to it.
11
+ * @useInstead {@link MatchArgs.toSpec}
10
12
  */
11
13
  export declare function matchArgumentsToSignature(args: readonly FunctionArgument[], signature: readonly SigParameter[]): Map<string, NodeId[]>;
12
- /** the id(s) {@link matchArgumentsToSignature} binds to a single `parameter`, `undefined` if nothing is */
14
+ /**
15
+ * The id(s) a *known* signature binds to a single `parameter`, `undefined` if nothing is.
16
+ * @useInstead {@link MatchArgs.toSpec}
17
+ */
13
18
  export declare function argumentForParameter(args: readonly FunctionArgument[], signature: readonly SigParameter[], parameter: string): NodeId[] | undefined;
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.signatureParameterSpec = signatureParameterSpec;
4
4
  exports.matchArgumentsToSignature = matchArgumentsToSignature;
5
5
  exports.argumentForParameter = argumentForParameter;
6
- const linker_1 = require("../../dataflow/internal/linker");
7
- /** the {@link pMatch} parameter spec of a *known* signature: every formal maps to itself as its own target */
6
+ const match_args_1 = require("../../dataflow/graph/match-args");
7
+ /**
8
+ * The {@link MatchArgs.toSpec} parameter spec of a *known* signature, where every formal maps to itself.
9
+ * @useInstead {@link MatchArgs.toSpec}
10
+ */
8
11
  function signatureParameterSpec(signature) {
9
12
  const spec = {};
10
13
  for (const p of signature) {
@@ -13,15 +16,17 @@ function signatureParameterSpec(signature) {
13
16
  return spec;
14
17
  }
15
18
  /**
16
- * {@link pMatch|Matches} a call's `args` against a *known* signature (typically from the signature database via
17
- * `PackageSignatureSource.functions(pkg)`), returning per parameter name the id(s) bound to it, e.g.
18
- * `matchArgumentsToSignature(ggplotCall.args, ggplotSignature).get('data')`.
19
+ * Matches a call's `args` against a *known* signature, returning per parameter name the id(s) bound to it.
20
+ * @useInstead {@link MatchArgs.toSpec}
19
21
  */
20
22
  function matchArgumentsToSignature(args, signature) {
21
- return (0, linker_1.pMatch)(args, signatureParameterSpec(signature));
23
+ return match_args_1.MatchArgs.toSpec(args, signature);
22
24
  }
23
- /** the id(s) {@link matchArgumentsToSignature} binds to a single `parameter`, `undefined` if nothing is */
25
+ /**
26
+ * The id(s) a *known* signature binds to a single `parameter`, `undefined` if nothing is.
27
+ * @useInstead {@link MatchArgs.toSpec}
28
+ */
24
29
  function argumentForParameter(args, signature, parameter) {
25
- return matchArgumentsToSignature(args, signature).get(parameter);
30
+ return match_args_1.MatchArgs.toSpec(args, signature).get(parameter);
26
31
  }
27
32
  //# sourceMappingURL=signature-match.js.map
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeAbsintQuery = executeAbsintQuery;
4
- const cfg_kind_1 = require("../../../project/cfg-kind");
5
4
  const parse_1 = require("../../../slicing/criterion/parse");
6
5
  const log_1 = require("../../../util/log");
7
6
  const absint_query_format_1 = require("./absint-query-format");
@@ -19,7 +18,7 @@ async function executeAbsintQuery({ analyzer }, queries) {
19
18
  const inference = absint_query_format_1.AbsintQueryInferences[queries[0].inference];
20
19
  const ast = await analyzer.normalize();
21
20
  const dfg = (await analyzer.dataflow()).graph;
22
- const cfg = await analyzer.controlflow(undefined, cfg_kind_1.CfgKind.NoFunctionDefs);
21
+ const cfg = await analyzer.controlflow(undefined);
23
22
  const start = Date.now();
24
23
  const visitor = inference({ controlFlow: cfg, dfg, normalizedAst: ast, ctx: analyzer.inspectContext() });
25
24
  visitor.start();
@@ -8,8 +8,6 @@ const edge_1 = require("../../../dataflow/graph/edge");
8
8
  const two_layer_collector_1 = require("../../two-layer-collector");
9
9
  const objects_1 = require("../../../util/objects");
10
10
  const identify_link_to_last_call_relation_1 = require("./identify-link-to-last-call-relation");
11
- const cfg_kind_1 = require("../../../project/cfg-kind");
12
- const extract_cfg_1 = require("../../../control-flow/extract-cfg");
13
11
  const identify_link_to_relation_1 = require("./identify-link-to-relation");
14
12
  const identifier_1 = require("../../../dataflow/environments/identifier");
15
13
  const df_helper_1 = require("../../../dataflow/graph/df-helper");
@@ -237,9 +235,9 @@ async function executeCallContextQueries({ analyzer }, queries) {
237
235
  const sigDbReady = primeSigDbForNamespaceFilter(promotedQueries, deps);
238
236
  let cfg = undefined;
239
237
  if (requiresCfg) {
240
- cfg = await analyzer.controlflow(undefined, cfg_kind_1.CfgKind.Quick);
238
+ cfg = await analyzer.controlflow(undefined);
241
239
  }
242
- const calls = cfg ? (0, extract_cfg_1.getCallsInCfg)(cfg, dataflow.graph) : undefined;
240
+ const calls = cfg ? new Map(dataflow.graph.verticesOfType(vertex_1.VertexType.FunctionCall)) : undefined;
243
241
  const queriesWhichWantAliases = promotedQueries.filter(q => q.includeAliases);
244
242
  /* index exact-name queries so each vertex costs one map lookup instead of a predicate check per query */
245
243
  const nonAliasByName = new Map();
@@ -1,7 +1,7 @@
1
1
  import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
2
  import { type DataflowGraph } from '../../../dataflow/graph/graph';
3
3
  import { type DataflowGraphVertexFunctionCall } from '../../../dataflow/graph/vertex';
4
- import { RType } from '../../../r-bridge/lang-4.x/ast/model/type';
4
+ import type { RType } from '../../../r-bridge/lang-4.x/ast/model/type';
5
5
  import type { RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
6
6
  import type { LinkToLastCall } from './call-context-query-format';
7
7
  import type { PromotedLinkTo } from './call-context-query-executor';
@@ -8,14 +8,15 @@ exports.identifyLinkToLastCallRelationSync = identifyLinkToLastCallRelationSync;
8
8
  const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
9
9
  const graph_1 = require("../../../dataflow/graph/graph");
10
10
  const simple_visitor_1 = require("../../../control-flow/simple-visitor");
11
+ const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
11
12
  const vertex_1 = require("../../../dataflow/graph/vertex");
12
13
  const edge_1 = require("../../../dataflow/graph/edge");
13
14
  const identifier_1 = require("../../../dataflow/environments/identifier");
14
15
  const assert_1 = require("../../../util/assert");
15
- const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
16
16
  const cascade_action_1 = require("./cascade-action");
17
- const cfg_kind_1 = require("../../../project/cfg-kind");
17
+ const control_flow_graph_1 = require("../../../control-flow/control-flow-graph");
18
18
  const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
19
+ const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
19
20
  var CallTargets;
20
21
  (function (CallTargets) {
21
22
  /** call targets a function that is not defined locally in the script (e.g., the call targets a library function) */
@@ -112,7 +113,7 @@ function getValueOfArgument(graph, call, argument, additionalAllowedTypes) {
112
113
  return undefined;
113
114
  }
114
115
  let valueNode = graph.idMap?.get(refAtIndex);
115
- if (valueNode?.type === type_1.RType.Argument) {
116
+ if (r_argument_1.RArgument.is(valueNode)) {
116
117
  valueNode = valueNode.value;
117
118
  }
118
119
  if (valueNode) {
@@ -130,7 +131,7 @@ function getValueOfArgument(graph, call, argument, additionalAllowedTypes) {
130
131
  */
131
132
  async function identifyLinkToLastCallRelation(from, analyzer, l, knownCalls) {
132
133
  const graph = (await analyzer.dataflow()).graph;
133
- const cfg = (await analyzer.controlflow([], cfg_kind_1.CfgKind.WithDataflow)).graph;
134
+ const cfg = (await analyzer.controlflow([])).graph;
134
135
  return identifyLinkToLastCallRelationSync(from, cfg, graph, l, knownCalls);
135
136
  }
136
137
  /**
@@ -174,15 +175,32 @@ function identifyLinkToLastCallRelationSync(from, cfg, graph, { callName, cascad
174
175
  const v = graph.getVertex(node);
175
176
  return vertex_1.FunctionCallVertex.is(v) ? v : undefined;
176
177
  };
178
+ /* function bodies the walk steps into, collected while walking and drained afterwards */
179
+ const searchFrom = [];
180
+ /*
181
+ * A call made while evaluating the arguments of `from` is part of that call, not something that happened
182
+ * before it, so what `from` is made of is skipped.
183
+ */
184
+ const within = model_1.RNode.collectAllIds(graph.idMap?.get(from));
177
185
  (0, simple_visitor_1.visitCfgInReverseOrder)(cfg, [from], node => {
178
- /* we ignore the start id as it cannot be the last call */
179
- if (node === from) {
186
+ if (within.has(node)) {
180
187
  return;
181
188
  }
182
189
  const vertex = getVertex(node);
183
190
  if (vertex === undefined) {
184
191
  return;
185
192
  }
193
+ /*
194
+ * A call runs whatever it dispatches to, so the last call before it may sit in that function's body.
195
+ * The control flow itself stays intra-procedural, which is why the step happens along the call targets:
196
+ * a function that is never called is never entered this way.
197
+ */
198
+ for (const target of control_flow_graph_1.CfgVertex.getCallTargets(cfg.getVertex(node)) ?? []) {
199
+ const definition = graph.getVertex(target);
200
+ if (vertex_1.FunctionDefinitionVertex.is(definition)) {
201
+ searchFrom.push(...definition.exitPoints.map(e => e.nodeId));
202
+ }
203
+ }
186
204
  if (cNameCheck(vertex)) {
187
205
  const act = cascadeIf ? cascadeIf(vertex, from, graph) : cascade_action_1.CascadeAction.Stop;
188
206
  if (act === cascade_action_1.CascadeAction.Skip) {
@@ -195,6 +213,15 @@ function identifyLinkToLastCallRelationSync(from, cfg, graph, { callName, cascad
195
213
  return act === cascade_action_1.CascadeAction.Stop;
196
214
  }
197
215
  });
216
+ while (searchFrom.length > 0) {
217
+ (0, simple_visitor_1.visitCfgInReverseOrder)(cfg, searchFrom.splice(0), node => {
218
+ const vertex = getVertex(node);
219
+ if (vertex !== undefined && cNameCheck(vertex) && satisfiesCallTargets(vertex, graph, CallTargets.MustIncludeGlobal) !== 'no') {
220
+ found.push(node);
221
+ return true;
222
+ }
223
+ });
224
+ }
198
225
  return found;
199
226
  }
200
227
  //# sourceMappingURL=identify-link-to-last-call-relation.js.map
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeControlFlowQuery = executeControlFlowQuery;
4
4
  const log_1 = require("../../../util/log");
5
- const cfg_kind_1 = require("../../../project/cfg-kind");
6
5
  /**
7
6
  * Executes the control flow query with the given simplification passes.
8
7
  */
@@ -12,7 +11,7 @@ async function executeControlFlowQuery({ analyzer }, queries) {
12
11
  }
13
12
  const query = queries[0];
14
13
  const start = Date.now();
15
- const controlFlow = await analyzer.controlflow(query.config?.simplificationPasses, cfg_kind_1.CfgKind.WithDataflow);
14
+ const controlFlow = await analyzer.controlflow(query.config?.simplificationPasses);
16
15
  return {
17
16
  '.meta': {
18
17
  timing: Date.now() - start
@@ -6,7 +6,6 @@ const dependencies_query_format_1 = require("./dependencies-query-format");
6
6
  const vertex_1 = require("../../../dataflow/graph/vertex");
7
7
  const identifier_1 = require("../../../dataflow/environments/identifier");
8
8
  const df_helper_1 = require("../../../dataflow/graph/df-helper");
9
- const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
10
9
  const objects_1 = require("../../../util/objects");
11
10
  const function_info_1 = require("./function-info/function-info");
12
11
  const identify_link_to_last_call_relation_1 = require("../call-context-query/identify-link-to-last-call-relation");
@@ -16,6 +15,7 @@ const log_1 = require("../../../util/log");
16
15
  const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
17
16
  const graph_1 = require("../../../dataflow/graph/graph");
18
17
  const link_devices_1 = require("./link-devices");
18
+ const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
19
19
  /**
20
20
  * Executes a dependencies query.
21
21
  */
@@ -219,7 +219,7 @@ function getResults(queries, { dataflow, config, normalize }, results, kind, fun
219
219
  return undefined;
220
220
  }
221
221
  let get = normalize.idMap.get(id);
222
- if (get?.type === type_1.RType.Argument) {
222
+ if (r_argument_1.RArgument.is(get)) {
223
223
  get = get.value;
224
224
  }
225
225
  return model_1.RNode.lexeme(get);
@@ -32,7 +32,7 @@ export interface DependencyCategorySettings {
32
32
  export declare const DefaultDependencyCategories: {
33
33
  readonly library: {
34
34
  readonly queryDisplayName: "Libraries";
35
- readonly functions: FunctionInfo[];
35
+ readonly functions: import("./function-info/library-functions").LibraryFunctionInfo[];
36
36
  readonly defaultValue: "unknown";
37
37
  readonly additionalAnalysis: (data: BasicQueryData, ignoreDefault: boolean, _functions: FunctionInfo[], _queryResults: CallContextQueryResult, result: DependencyInfo[]) => Promise<void>;
38
38
  };
@@ -53,14 +53,9 @@ export declare const DefaultDependencyCategories: {
53
53
  readonly defaultValue: "unknown";
54
54
  };
55
55
  readonly write: {
56
- readonly queryDisplayName: "Written Data";
56
+ readonly queryDisplayName: "Outputs";
57
57
  readonly functions: FunctionInfo[];
58
58
  readonly defaultValue: "stdout";
59
- };
60
- readonly print: {
61
- readonly queryDisplayName: "Auto-printed Results";
62
- readonly functions: [];
63
- readonly defaultValue: "stdout";
64
59
  readonly additionalAnalysis: (data: BasicQueryData, ignoreDefault: boolean, _functions: FunctionInfo[], queryResults: CallContextQueryResult, result: DependencyInfo[]) => Promise<void>;
65
60
  };
66
61
  readonly visualize: {
@@ -71,6 +66,10 @@ export declare const DefaultDependencyCategories: {
71
66
  readonly queryDisplayName: "Tests";
72
67
  readonly functions: FunctionInfo[];
73
68
  };
69
+ readonly statistics: {
70
+ readonly queryDisplayName: "Statistical Tests";
71
+ readonly functions: FunctionInfo[];
72
+ };
74
73
  };
75
74
  export type DefaultDependencyCategoryName = keyof typeof DefaultDependencyCategories;
76
75
  export type DependencyCategoryName = DefaultDependencyCategoryName | string;
@@ -106,6 +105,8 @@ export interface DependencyInfo extends Record<string, unknown> {
106
105
  lexemeOfArgument?: string;
107
106
  /** The library name, file, source, destination etc. being sourced, read from, or written to. */
108
107
  value?: string;
108
+ /** the output is not written by a call asking for it: R echoes the top-level statement on its own */
109
+ implicit?: boolean;
109
110
  versionConstraints?: readonly Range[];
110
111
  derivedRange?: Range;
111
112
  namespaceInfo?: NamespaceInfo;
@@ -15,16 +15,14 @@ const remote_functions_1 = require("./function-info/remote-functions");
15
15
  const read_functions_1 = require("./function-info/read-functions");
16
16
  const write_functions_1 = require("./function-info/write-functions");
17
17
  const visualize_functions_1 = require("./function-info/visualize-functions");
18
- const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
18
+ const statistics_functions_1 = require("./function-info/statistics-functions");
19
19
  const test_functions_1 = require("./function-info/test-functions");
20
20
  const identifier_1 = require("../../../dataflow/environments/identifier");
21
21
  const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
22
22
  const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
23
23
  const objects_1 = require("../../../util/objects");
24
- const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
25
- const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
26
- const vertex_1 = require("../../../dataflow/graph/vertex");
27
- const df_helper_1 = require("../../../dataflow/graph/df-helper");
24
+ const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
25
+ const implicit_echo_1 = require("./implicit-echo");
28
26
  /** The value could not be resolved, e.g. a path assembled at runtime. Such a dependency may be missing or fetchable. */
29
27
  exports.Unknown = 'unknown';
30
28
  /** The value resolved, but to data given inline rather than to a path (`matrix(0, 2, 2)`, `data.frame(a = 1)`). */
@@ -39,7 +37,7 @@ exports.DefaultDependencyCategories = {
39
37
  if (!ignoreDefault) {
40
38
  r_project_1.RProject.visitAst((await data.analyzer.normalize()).ast, node => {
41
39
  let ns;
42
- if (node.type === type_1.RType.Symbol && (ns = identifier_1.Identifier.getNamespace(node.content)) !== undefined) {
40
+ if (r_symbol_1.RSymbol.is(node) && (ns = identifier_1.Identifier.getNamespace(node.content)) !== undefined) {
43
41
  const dep = data.analyzer.inspectContext().deps.getDependency(ns);
44
42
  /* we should improve the identification of ':::' */
45
43
  result.push({
@@ -80,39 +78,22 @@ exports.DefaultDependencyCategories = {
80
78
  defaultValue: exports.Unknown
81
79
  },
82
80
  'write': {
83
- queryDisplayName: 'Written Data',
81
+ queryDisplayName: 'Outputs',
84
82
  functions: write_functions_1.WriteFunctions,
85
- defaultValue: 'stdout'
86
- },
87
- 'print': {
88
- queryDisplayName: 'Auto-printed Results',
89
- functions: [],
90
83
  defaultValue: 'stdout',
84
+ /* what the top level prints on its own is an output like any other, marked {@link DependencyInfo#implicit} */
91
85
  additionalAnalysis: async (data, ignoreDefault, _functions, queryResults, result) => {
92
- if (ignoreDefault) {
86
+ /* without implicit echo (e.g. in a package, whose top-level code runs at install time) nothing is auto-printed */
87
+ if (ignoreDefault || data.analyzer.flowrConfig.project.assumeImplicitEcho === false) {
93
88
  return;
94
89
  }
95
- const [{ ast }, dataflow] = await Promise.all([data.analyzer.normalize(), data.analyzer.dataflow()]);
96
- const accountedFor = new Set(Object.values(queryResults?.kinds ?? {})
97
- .flatMap(k => Object.values(k.subkinds).flat()).map(r => r.id));
98
- for (const file of ast.files) {
99
- for (const statement of file.root.children) {
100
- if (statement.type !== type_1.RType.FunctionCall || accountedFor.has(statement.info.id)) {
101
- continue;
102
- }
103
- const vertex = dataflow.graph.getVertex(statement.info.id);
104
- const functionName = vertex_1.FunctionCallVertex.is(vertex)
105
- ? df_helper_1.Dataflow.qualify(statement.info.id, dataflow.graph, false) ?? vertex.name : undefined;
106
- if (functionName === undefined) {
107
- continue;
108
- }
109
- const props = (0, query_fn_props_1.queryFnProps)(functionName, { environment: dataflow.environment })?.props ?? 0;
110
- if ((props & (built_in_props_1.CallProp.Invisible | built_in_props_1.CallProp.Graphics)) !== 0 || test_functions_1.ExpectFunctionNames.test(identifier_1.Identifier.getName(functionName))) {
111
- continue;
112
- }
113
- result.push({ nodeId: statement.info.id, functionName, value: 'stdout' });
114
- }
115
- }
90
+ const [ast, dataflow] = await Promise.all([data.analyzer.normalize(), data.analyzer.dataflow()]);
91
+ /* a call another category reports belongs to that category, except for a statistical test: what it
92
+ is asked for is the statistic it prints, so a top-level one is an output like any other */
93
+ const accountedFor = new Set(Object.entries(queryResults?.kinds ?? {})
94
+ .filter(([kind]) => kind !== 'statistics')
95
+ .flatMap(([, k]) => Object.values(k.subkinds).flat()).map(r => r.id));
96
+ (0, implicit_echo_1.collectImplicitEchoes)(ast, dataflow, accountedFor, result);
116
97
  }
117
98
  },
118
99
  'visualize': {
@@ -122,6 +103,10 @@ exports.DefaultDependencyCategories = {
122
103
  'test': {
123
104
  queryDisplayName: 'Tests',
124
105
  functions: test_functions_1.TestFunctions
106
+ },
107
+ 'statistics': {
108
+ queryDisplayName: 'Statistical Tests',
109
+ functions: (0, statistics_functions_1.statisticsFunctions)()
125
110
  }
126
111
  };
127
112
  function printResultSection(title, infos, result, formatter) {
@@ -137,7 +122,9 @@ function printResultSection(title, infos, result, formatter) {
137
122
  const value = stands !== undefined ? (0, ansi_1.faint)(stands, formatter) : (0, ansi_1.bold)(i.value, formatter);
138
123
  const version = i.derivedRange !== undefined ? ` ${(0, ansi_1.faint)(i.derivedRange.format(), formatter)}` : '';
139
124
  const linked = i.linkedIds ? `, linked ${i.linkedIds.join(', ')}` : '';
140
- result.push(` ${value}${version} ${(0, ansi_1.faint)(`via ${fn} (node ${i.nodeId}${linked})`, formatter)}`);
125
+ /* an output nothing asked for reads like every other one, so it says that it is the top level echoing */
126
+ const how = i.implicit ? 'auto-printed by' : 'via';
127
+ result.push(` ${value}${version} ${(0, ansi_1.faint)(`${how} ${fn} (node ${i.nodeId}${linked})`, formatter)}`);
141
128
  }
142
129
  }
143
130
  /**
@@ -1,2 +1,14 @@
1
1
  import type { FunctionInfo } from './function-info';
2
- export declare const LibraryFunctions: FunctionInfo[];
2
+ /**
3
+ * A loader of the `library` category, together with whether it attaches the package it names.
4
+ * @see {@link LibraryFunctions}
5
+ */
6
+ export interface LibraryFunctionInfo extends FunctionInfo {
7
+ /**
8
+ * Whether the call makes the package's exports reachable by their bare name, which is what tells a package
9
+ * that is loaded and used apart from one that is loaded and never touched. `false` for a loader that only
10
+ * readies a namespace to reach as `pkg::fn`, and for one whose argument is not a package at all.
11
+ */
12
+ attaches: boolean;
13
+ }
14
+ export declare const LibraryFunctions: LibraryFunctionInfo[];
@@ -2,27 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LibraryFunctions = void 0;
4
4
  exports.LibraryFunctions = [
5
- { package: 'base', name: 'library', argIdx: 0, argName: 'package', resolveValue: 'library' },
6
- { package: 'base', name: 'require', argIdx: 0, argName: 'package', resolveValue: 'library' },
7
- { package: 'base', name: 'loadNamespace', argIdx: 0, argName: 'package', resolveValue: true },
8
- { package: 'base', name: 'requireNamespace', argIdx: 0, argName: 'package', resolveValue: true },
9
- { package: 'base', name: 'attachNamespace', argIdx: 0, argName: 'ns', resolveValue: true },
10
- { package: 'base', name: 'attach', argIdx: 0, argName: 'what', resolveValue: true },
11
- { package: 'base', name: 'use', argIdx: 0, argName: 'package', resolveValue: 'library' },
12
- { package: 'groundhog', name: 'groundhog.library', argIdx: 0, argName: 'pkg', resolveValue: true },
13
- { package: 'pacman', name: 'p_load', argIdx: 'unnamed', resolveValue: 'library' },
14
- { package: 'pacman', name: 'p_load_gh', argIdx: 'unnamed', resolveValue: 'library' },
15
- { package: 'pacman', name: 'p_load_current_gh', argIdx: 'unnamed', resolveValue: 'library' },
16
- { package: 'xfun', name: 'pkg_attach', argIdx: 'unnamed', resolveValue: true },
17
- { package: 'xfun', name: 'pkg_attach2', argIdx: 'unnamed', resolveValue: true },
18
- { package: 'needs', name: 'needs', argIdx: 'unnamed', resolveValue: 'library' },
19
- { package: 'modules', name: 'import', argIdx: 0, argName: 'from', resolveValue: 'library' },
20
- { package: 'easypackages', name: 'from_import', argIdx: 0, argName: 'package', resolveValue: true },
21
- { package: 'easypackages', name: 'libraries', argIdx: 'unnamed', resolveValue: true },
22
- { package: 'librarian', name: 'shelf', argIdx: 'unnamed', resolveValue: true },
23
- { package: 'devtools', name: 'load_all', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
24
- { package: 'pkgload', name: 'load_code', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
25
- { package: 'import', name: 'from', argIdx: 0, argName: 'package', resolveValue: true },
26
- { package: 'rlang', name: 'on_package_load', argIdx: 0, argName: 'pkg', resolveValue: true }
5
+ { package: 'base', name: 'library', argIdx: 0, argName: 'package', resolveValue: 'library', attaches: true },
6
+ { package: 'base', name: 'require', argIdx: 0, argName: 'package', resolveValue: 'library', attaches: true },
7
+ /* a namespace is loaded, not attached: whoever calls these reaches the package as `pkg::fn` */
8
+ { package: 'base', name: 'loadNamespace', argIdx: 0, argName: 'package', resolveValue: true, attaches: false },
9
+ { package: 'base', name: 'requireNamespace', argIdx: 0, argName: 'package', resolveValue: true, attaches: false },
10
+ { package: 'base', name: 'attachNamespace', argIdx: 0, argName: 'ns', resolveValue: true, attaches: true },
11
+ /* what is attached here is a list or a data frame, never a package */
12
+ { package: 'base', name: 'attach', argIdx: 0, argName: 'what', resolveValue: true, attaches: false },
13
+ { package: 'base', name: 'use', argIdx: 0, argName: 'package', resolveValue: 'library', attaches: true },
14
+ { package: 'groundhog', name: 'groundhog.library', argIdx: 0, argName: 'pkg', resolveValue: true, attaches: true },
15
+ { package: 'pacman', name: 'p_load', argIdx: 'unnamed', resolveValue: 'library', attaches: true },
16
+ { package: 'pacman', name: 'p_load_gh', argIdx: 'unnamed', resolveValue: 'library', attaches: true },
17
+ { package: 'pacman', name: 'p_load_current_gh', argIdx: 'unnamed', resolveValue: 'library', attaches: true },
18
+ { package: 'xfun', name: 'pkg_attach', argIdx: 'unnamed', resolveValue: true, attaches: true },
19
+ { package: 'xfun', name: 'pkg_attach2', argIdx: 'unnamed', resolveValue: true, attaches: true },
20
+ { package: 'needs', name: 'needs', argIdx: 'unnamed', resolveValue: 'library', attaches: true },
21
+ { package: 'modules', name: 'import', argIdx: 0, argName: 'from', resolveValue: 'library', attaches: true },
22
+ { package: 'easypackages', name: 'from_import', argIdx: 0, argName: 'package', resolveValue: true, attaches: true },
23
+ { package: 'easypackages', name: 'libraries', argIdx: 'unnamed', resolveValue: true, attaches: true },
24
+ { package: 'librarian', name: 'shelf', argIdx: 'unnamed', resolveValue: true, attaches: true },
25
+ { package: 'devtools', name: 'load_all', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.', attaches: true },
26
+ /* the code of a package is loaded into its namespace, and nothing is put on the search path */
27
+ { package: 'pkgload', name: 'load_code', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.', attaches: false },
28
+ { package: 'import', name: 'from', argIdx: 0, argName: 'package', resolveValue: true, attaches: true },
29
+ /* a hook that runs when the package is loaded by someone else, which loads nothing itself */
30
+ { package: 'rlang', name: 'on_package_load', argIdx: 0, argName: 'pkg', resolveValue: true, attaches: false }
27
31
  ];
28
32
  //# sourceMappingURL=library-functions.js.map
@@ -0,0 +1,9 @@
1
+ import type { FunctionInfo } from './function-info';
2
+ import { BuiltInIndex } from '../../../../dataflow/environments/query-fn-props';
3
+ /**
4
+ * The statistical tests, read back from the {@link CallProp.Statistics} built-ins so the dependency query and
5
+ * the built-in configuration cannot disagree about them. Every one of them names the package it belongs to,
6
+ * which is what keeps `stats::t.test` a test and drops a `t.test` of somebody else's package.
7
+ * Label a built-in `Statistics` and it shows up here.
8
+ */
9
+ export declare function statisticsFunctions(index?: BuiltInIndex): FunctionInfo[];
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.statisticsFunctions = statisticsFunctions;
4
+ const identifier_1 = require("../../../../dataflow/environments/identifier");
5
+ const built_in_props_1 = require("../../../../dataflow/environments/built-in-props");
6
+ const query_fn_props_1 = require("../../../../dataflow/environments/query-fn-props");
7
+ /**
8
+ * The statistical tests, read back from the {@link CallProp.Statistics} built-ins so the dependency query and
9
+ * the built-in configuration cannot disagree about them. Every one of them names the package it belongs to,
10
+ * which is what keeps `stats::t.test` a test and drops a `t.test` of somebody else's package.
11
+ * Label a built-in `Statistics` and it shows up here.
12
+ */
13
+ function statisticsFunctions(index = query_fn_props_1.BuiltInIndex.default()) {
14
+ return index.with(built_in_props_1.CallProp.Statistics).map(call => ({
15
+ name: identifier_1.Identifier.getName(call),
16
+ package: identifier_1.Identifier.getNamespace(call)
17
+ }));
18
+ }
19
+ //# sourceMappingURL=statistics-functions.js.map