@eagleoutice/flowr 2.14.1 → 2.14.2

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 (413) hide show
  1. package/README.md +154 -87
  2. package/abstract-interpretation/absint-visitor.d.ts +91 -25
  3. package/abstract-interpretation/absint-visitor.js +235 -74
  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 +6 -0
  41. package/config.js +8 -4
  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 -26
  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 +112 -7
  71. package/dataflow/environments/default-builtin-config.js +82 -34
  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 +2 -2
  81. package/dataflow/eval/resolve/alias-tracking.js +2 -2
  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 +14 -0
  106. package/dataflow/internal/control-flow.d.ts +102 -0
  107. package/dataflow/internal/control-flow.js +200 -0
  108. package/dataflow/internal/linker.d.ts +6 -31
  109. package/dataflow/internal/linker.js +24 -81
  110. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
  111. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +3 -3
  112. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +2 -2
  113. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +9 -6
  114. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  115. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +6 -4
  116. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -10
  117. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +18 -37
  118. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -3
  120. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +1 -1
  121. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +11 -7
  122. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
  123. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  124. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +18 -14
  125. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +8 -1
  126. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +11 -0
  127. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
  128. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +27 -20
  129. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -2
  130. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
  131. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +35 -6
  132. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
  133. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +20 -17
  134. package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
  135. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +6 -4
  136. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +4 -3
  137. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +8 -3
  138. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +2 -2
  139. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +5 -5
  140. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
  141. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +5 -4
  142. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +7 -5
  143. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +1 -1
  144. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +15 -13
  145. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
  146. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  147. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +4 -3
  148. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +1 -1
  149. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +26 -4
  150. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
  151. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +17 -4
  152. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
  153. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +71 -33
  154. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +6 -15
  155. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +12 -13
  156. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  157. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +14 -11
  158. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +15 -1
  159. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
  160. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +12 -8
  161. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -5
  162. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +1 -1
  163. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +5 -4
  164. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
  165. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +45 -10
  166. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
  167. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +19 -3
  168. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +6 -2
  169. package/dataflow/internal/process/functions/call/common.js +5 -6
  170. package/dataflow/internal/process/functions/call/deferred.js +2 -2
  171. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +12 -2
  172. package/dataflow/internal/process/functions/call/known-call-handling.js +23 -1
  173. package/dataflow/internal/process/functions/call/named-call-handling.js +2 -0
  174. package/dataflow/internal/process/functions/call/nse.d.ts +1 -1
  175. package/dataflow/internal/process/functions/call/nse.js +6 -1
  176. package/dataflow/internal/process/functions/call/quoted.js +2 -2
  177. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +19 -6
  178. package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
  179. package/dataflow/internal/process/functions/process-argument.js +12 -4
  180. package/dataflow/internal/process/functions/process-parameter.js +13 -0
  181. package/dataflow/internal/process/process-named-call.d.ts +2 -2
  182. package/dataflow/internal/process/process-named-call.js +9 -7
  183. package/documentation/data/server/doc-data-server-messages.js +4 -4
  184. package/documentation/doc-readme.js +45 -0
  185. package/documentation/doc-util/doc-cfg.d.ts +8 -7
  186. package/documentation/doc-util/doc-cfg.js +10 -10
  187. package/documentation/doc-util/doc-playground.d.ts +12 -0
  188. package/documentation/doc-util/doc-playground.js +21 -0
  189. package/documentation/doc-util/doc-query.d.ts +4 -1
  190. package/documentation/doc-util/doc-query.js +4 -2
  191. package/documentation/wiki-absint.d.ts +3 -4
  192. package/documentation/wiki-absint.js +12 -5
  193. package/documentation/wiki-analyzer.js +2 -2
  194. package/documentation/wiki-cfg.js +101 -106
  195. package/documentation/wiki-dataflow-graph.js +84 -53
  196. package/documentation/wiki-linter.js +15 -1
  197. package/documentation/wiki-linting-and-testing.js +1 -16
  198. package/documentation/wiki-mk/doc-maker.js +6 -4
  199. package/documentation/wiki-query.js +14 -4
  200. package/documentation/wiki-signature-database.js +28 -2
  201. package/linter/linter-fix.d.ts +16 -0
  202. package/linter/linter-fix.js +104 -0
  203. package/linter/linter-format.d.ts +18 -1
  204. package/linter/linter-format.js +31 -1
  205. package/linter/linter-output.js +46 -10
  206. package/linter/linter-rules.d.ts +40 -9
  207. package/linter/linter-rules.js +2 -0
  208. package/linter/rules/absolute-path.js +4 -2
  209. package/linter/rules/dataframe-access-validation.js +6 -7
  210. package/linter/rules/deprecated-functions.d.ts +107 -10
  211. package/linter/rules/deprecated-functions.js +309 -23
  212. package/linter/rules/file-path-validity.js +5 -4
  213. package/linter/rules/function-finder-util.d.ts +6 -0
  214. package/linter/rules/function-finder-util.js +21 -13
  215. package/linter/rules/naming-convention.js +1 -1
  216. package/linter/rules/network-functions.d.ts +2 -2
  217. package/linter/rules/stop-with-call-arg.js +2 -2
  218. package/linter/rules/unclosed-connection.js +2 -2
  219. package/linter/rules/undefined-symbol-util.js +6 -4
  220. package/linter/rules/undefined-symbol.js +2 -2
  221. package/linter/rules/unused-definition.js +8 -4
  222. package/linter/rules/unused-import.d.ts +60 -0
  223. package/linter/rules/unused-import.js +179 -0
  224. package/package.json +2 -2
  225. package/project/attached-packages.js +2 -1
  226. package/project/cache/flowr-analyzer-cache.d.ts +2 -5
  227. package/project/cache/flowr-analyzer-cache.js +4 -7
  228. package/project/cache/flowr-analyzer-controlflow-cache.d.ts +9 -8
  229. package/project/cache/flowr-analyzer-controlflow-cache.js +17 -34
  230. package/project/cache/flowr-cache.d.ts +9 -0
  231. package/project/cache/flowr-cache.js +19 -0
  232. package/project/context/flowr-analyzer-context.d.ts +7 -3
  233. package/project/context/flowr-analyzer-context.js +15 -9
  234. package/project/context/flowr-analyzer-dependencies-context.d.ts +24 -3
  235. package/project/context/flowr-analyzer-dependencies-context.js +9 -14
  236. package/project/context/flowr-analyzer-files-context.js +15 -17
  237. package/project/context/flowr-analyzer-meta-context.js +2 -12
  238. package/project/dependency-version-space.d.ts +0 -7
  239. package/project/dependency-version-space.js +8 -7
  240. package/project/flowr-analyzer.d.ts +4 -6
  241. package/project/flowr-analyzer.js +4 -5
  242. package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -34
  243. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +13 -13
  244. package/project/plugins/file-plugins/files/flowr-rda-file.js +131 -286
  245. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +1 -0
  246. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -0
  247. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +2 -5
  248. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +2 -8
  249. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +32 -0
  250. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +43 -1
  251. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +4 -12
  252. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +3 -16
  253. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +5 -8
  254. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +4 -10
  255. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +3 -10
  256. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +1 -13
  257. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +3 -6
  258. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +2 -8
  259. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +2 -5
  260. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +2 -8
  261. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +2 -5
  262. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +2 -8
  263. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +3 -4
  264. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -6
  265. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +4 -12
  266. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +3 -16
  267. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +4 -12
  268. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +3 -16
  269. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +4 -12
  270. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -16
  271. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +2 -5
  272. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +2 -8
  273. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +2 -6
  274. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +1 -10
  275. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +2 -5
  276. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.js +2 -8
  277. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +2 -1
  278. package/project/sigdb/build.d.ts +2 -2
  279. package/project/sigdb/decode.d.ts +0 -5
  280. package/project/sigdb/decode.js +0 -8
  281. package/project/sigdb/index-format.d.ts +4 -4
  282. package/project/sigdb/manifest.d.ts +2 -2
  283. package/project/sigdb/reader.d.ts +48 -13
  284. package/project/sigdb/reader.js +2 -1
  285. package/project/sigdb/schema.d.ts +3 -1
  286. package/project/sigdb/signature-db.d.ts +69 -0
  287. package/project/sigdb/signature-db.js +54 -0
  288. package/project/sigdb/signature-match.d.ts +10 -5
  289. package/project/sigdb/signature-match.js +13 -8
  290. package/queries/catalog/absint-query/absint-query-executor.js +1 -2
  291. package/queries/catalog/call-context-query/call-context-query-executor.js +2 -4
  292. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
  293. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +33 -6
  294. package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -2
  295. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  296. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +8 -7
  297. package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -35
  298. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +13 -1
  299. package/queries/catalog/dependencies-query/function-info/library-functions.js +26 -22
  300. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +9 -0
  301. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +19 -0
  302. package/queries/catalog/dependencies-query/implicit-echo.d.ts +13 -0
  303. package/queries/catalog/dependencies-query/implicit-echo.js +133 -0
  304. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
  305. package/queries/catalog/happens-before-query/happens-before-query-executor.js +1 -2
  306. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
  307. package/queries/catalog/signature-query/signature-query-executor.js +4 -3
  308. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  309. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  310. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  311. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  312. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
  313. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +4 -1
  314. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -2
  315. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  316. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
  317. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  318. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
  319. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  320. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
  321. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  322. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
  323. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  324. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
  325. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +6 -4
  326. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +6 -4
  327. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  328. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
  329. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  330. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
  331. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  332. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
  333. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  334. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
  335. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  336. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
  337. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +6 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +13 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +1 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +1 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  350. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  352. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
  353. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  354. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
  355. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  356. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
  357. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +3 -2
  358. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.js +2 -1
  359. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +2 -1
  360. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
  361. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -1
  362. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.d.ts +2 -2
  363. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +6 -3
  364. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +2 -1
  365. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -1
  366. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +5 -3
  367. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +2 -1
  368. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -1
  369. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  370. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +5 -3
  371. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -1
  372. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +1 -1
  373. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -1
  374. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -1
  375. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +1 -1
  376. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +2 -1
  377. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +5 -3
  378. package/reconstruct/inline/source-inline-map.js +3 -3
  379. package/reconstruct/reconstruct.js +6 -4
  380. package/search/flowr-search-builder.d.ts +8 -8
  381. package/search/flowr-search-builder.js +4 -4
  382. package/search/flowr-search-filters.d.ts +2 -2
  383. package/search/flowr-search-filters.js +3 -2
  384. package/search/search-executor/search-enrichers.d.ts +6 -4
  385. package/search/search-executor/search-enrichers.js +44 -5
  386. package/slicing/criterion/filters/all-variables.js +2 -1
  387. package/slicing/criterion/parse.js +8 -6
  388. package/slicing/static/slice-call.js +2 -2
  389. package/util/arg-matching.d.ts +3 -0
  390. package/util/arg-matching.js +12 -1
  391. package/util/collections/arrays.d.ts +0 -4
  392. package/util/collections/arrays.js +4 -26
  393. package/util/diff-graph.d.ts +1 -1
  394. package/util/diff-graph.js +17 -3
  395. package/util/diff.d.ts +6 -0
  396. package/util/mermaid/ast.d.ts +1 -1
  397. package/util/mermaid/ast.js +5 -4
  398. package/util/mermaid/cfg.js +130 -24
  399. package/util/mermaid/dfg.js +31 -10
  400. package/util/mermaid/mermaid.js +2 -0
  401. package/util/objects.d.ts +9 -0
  402. package/util/objects.js +12 -0
  403. package/util/prefix.d.ts +1 -1
  404. package/util/text/playground-link.d.ts +131 -0
  405. package/util/text/playground-link.js +214 -0
  406. package/util/text/strings.js +7 -3
  407. package/util/version.js +1 -1
  408. package/control-flow/cfg-builder.d.ts +0 -30
  409. package/control-flow/cfg-builder.js +0 -79
  410. package/control-flow/extract-cfg.d.ts +0 -36
  411. package/control-flow/extract-cfg.js +0 -693
  412. package/project/cfg-kind.d.ts +0 -21
  413. package/project/cfg-kind.js +0 -26
@@ -25,15 +25,14 @@ const doc_code_1 = require("./doc-util/doc-code");
25
25
  const path_1 = __importDefault(require("path"));
26
26
  const doc_general_1 = require("./doc-util/doc-general");
27
27
  const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
28
+ const control_flow_graph_1 = require("../control-flow/control-flow-graph");
28
29
  const identifier_1 = require("../dataflow/environments/identifier");
29
30
  const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
30
31
  const default_pipelines_1 = require("../core/steps/pipeline/default-pipelines");
31
- const text_1 = require("../util/text/text");
32
32
  const linker_1 = require("../dataflow/internal/linker");
33
33
  const apply_kill_1 = require("../dataflow/environments/apply-kill");
34
34
  const doc_normalized_ast_1 = require("./doc-util/doc-normalized-ast");
35
35
  const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
36
- const alias_tracking_1 = require("../dataflow/eval/resolve/alias-tracking");
37
36
  const doc_issue_1 = require("./doc-util/doc-issue");
38
37
  const unnamed_call_handling_1 = require("../dataflow/internal/process/functions/call/unnamed-call-handling");
39
38
  const environment_builder_1 = require("../../test/functionality/_helper/dataflow/environment-builder");
@@ -48,8 +47,10 @@ const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
48
47
  const range_1 = require("../util/range");
49
48
  const df_helper_1 = require("../dataflow/graph/df-helper");
50
49
  const resolve_helper_1 = require("../dataflow/environments/resolve-helper");
50
+ const match_args_1 = require("../dataflow/graph/match-args");
51
51
  const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
52
52
  const vertex_2 = require("../dataflow/graph/vertex");
53
+ const objects_1 = require("../util/objects");
53
54
  async function subExplanation(parser, ctx, { description, code, expectedSubgraph }) {
54
55
  expectedSubgraph = await (0, doc_dfg_1.verifyExpectedSubgraph)(parser, code, expectedSubgraph);
55
56
  const marks = [];
@@ -147,7 +148,7 @@ The name of the symbol is not actually part of what we store in the dataflow gra
147
148
  as we have it within the normalized AST.
148
149
  To access the name, you can use the \`id\` of the vertex:
149
150
 
150
- ${(0, doc_code_1.codeBlock)('ts', `const name = ${node_id_1.recoverName.name}(id, graph.idMap);`)}
151
+ ${(0, doc_code_1.codeBlock)('ts', 'const name = RNode.lexeme(graph.idMap?.get(id));')}
151
152
  `
152
153
  })}
153
154
 
@@ -215,7 +216,7 @@ ${(0, doc_structure_1.details)('Example: Simple Function Call (unresolved)', awa
215
216
  const callInfo = info.dataflow.graph.vertices(true).find(([, vertex]) => vertex_2.FunctionCallVertex.is(vertex) && identifier_1.Identifier.getName(vertex.name) === 'foo');
216
217
  (0, assert_1.guard)(callInfo !== undefined, () => `Could not find call vertex for ${code}`);
217
218
  const [callId, callVert] = callInfo;
218
- const inverseMapReferenceTypes = Object.fromEntries(Object.entries(identifier_1.ReferenceType).map(([k, v]) => [v, k]));
219
+ const inverseMapReferenceTypes = Object.fromEntries((0, objects_1.enumMembers)(identifier_1.ReferenceType).map(([name, value]) => [value, name]));
219
220
  const identifierType = (0, doc_types_1.getTypesFromFolder)({
220
221
  files: [path_1.default.resolve('./src/dataflow/environments/identifier.ts')],
221
222
  inlineTypes: ['ControlDependency']
@@ -234,7 +235,7 @@ as the \`type\` of these references is a bit-mask, encoding one of the following
234
235
 
235
236
  | Value | Reference Type |
236
237
  |------:|----------------|
237
- ${Object.values(identifier_1.ReferenceType).filter(k => typeof k === 'string').map(k => `| ${identifier_1.ReferenceType[k]} | ${k} |`).join('\n')}
238
+ ${(0, objects_1.enumMembers)(identifier_1.ReferenceType).map(([name, value]) => `| ${value} | ${name} |`).join('\n')}
238
239
 
239
240
  In other words, we classify the references as ${(0, doc_general_1.lastJoin)(callVert.args.map(a => {
240
241
  if (a === r_function_call_1.EmptyArgument) {
@@ -345,7 +346,7 @@ For starters, let's have a look at the environment of the call to \`<-\` in the
345
346
 
346
347
  ${(0, doc_env_1.printEnvironmentToMarkdown)(env.current)}
347
348
 
348
- Great, you should see a definition of \`<-\` which is constraint by the [control dependency](#control-dependencies) to the \`if\`.
349
+ Great, you should see a definition of \`<-\` which is constraint by the [control dependency](#branches) to the \`if\`.
349
350
  Hence, trying to re-resolve the call using ${ctx.link(linker_1.getAllFunctionCallTargets)} (defined in ${(0, doc_files_1.getFilePathMd)('../dataflow/internal/linker.ts')}) with the id \`${id}\` of the call as starting point will present you with
350
351
  the following target ids: { \`${[...(0, linker_1.getAllFunctionCallTargets)(id, info.dataflow.graph)].join('`, `')}\` }.
351
352
  This way we know that the call may refer to the built-in assignment operator or to the multiplication.
@@ -411,7 +412,7 @@ Of only interest is \`par\`, which signals that the definitions is partial (e.g.
411
412
  Of course, there are not just operators that define variables, but also functions, like \`assign\`.
412
413
 
413
414
  ${(0, doc_structure_1.details)('Example: Using <code>assign</code>', await (0, doc_dfg_1.printDfGraphForCode)(parser, 'assign("x", 1)\nx', { mark: new Set([1]), ctx })
414
- + `\nThe example may be misleading as the visualization uses \`${node_id_1.recoverName.name}\` to print the lexeme of the variable. However, this actually defines the variable \`x\` (without the quotes) as you can see with the ${linkEdgeName(edge_1.EdgeType.Reads)} edge.`)}
415
+ + `\nThe example may be misleading as the visualization prints the lexeme of the variable. However, this actually defines the variable \`x\` (without the quotes) as you can see with the ${linkEdgeName(edge_1.EdgeType.Reads)} edge.`)}
415
416
 
416
417
  Please be aware, that the name of the symbol defined may differ from what you read in the program as R allows the assignments to strings, escaped names, and more:
417
418
 
@@ -736,6 +737,27 @@ ${ctx.link(deferred_1.Deferred.name, undefined, { type: 'variable' })} links an
736
737
  .nse('1@quote', '1@x')
737
738
  .nse('1@quote', '1@y')
738
739
  }]]);
740
+ edgeExplanations.set(edge_1.EdgeType.FlowEdge, [{
741
+ name: 'FlowDependency Edge',
742
+ type: edge_1.EdgeType.FlowEdge,
743
+ description: `
744
+ Marks that the source is evaluated before the target, which is what the ${ctx.linkPage('wiki/Control Flow Graph', 'control flow graph')} is a view on.
745
+ The dataflow analysis records the control flow while it walks the program, so these edges (together with the
746
+ ${linkEdgeName(edge_1.EdgeType.ControlEdge)} edges) already carry the program's control flow and no separate extraction is needed.
747
+ `,
748
+ code: 'x <- 1\ny <- 2',
749
+ expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)()
750
+ }, []]);
751
+ edgeExplanations.set(edge_1.EdgeType.ControlEdge, [{
752
+ name: 'ControlDependency Edge',
753
+ type: edge_1.EdgeType.ControlEdge,
754
+ description: `
755
+ The counterpart of the ${linkEdgeName(edge_1.EdgeType.FlowEdge)} edge for everything that only happens under a condition:
756
+ the edge names the vertex that decides (e.g. an \`if\`) and whether it is the branch taken when that decision holds.
757
+ `,
758
+ code: 'if(u) 1 else 2',
759
+ expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)()
760
+ }, []]);
739
761
  const results = [];
740
762
  let i = 0;
741
763
  for (const [, edge] of (0, doc_data_dfg_util_1.getAllEdges)()) {
@@ -771,12 +793,13 @@ In summary, we discuss the following topics in this wiki page:
771
793
  - [Reading the Visualization](#reading-the-visualization)
772
794
  - [Vertices](#vertices)
773
795
  - [Edges](#edges)
774
- - [Control Dependencies](#control-dependencies)
796
+ - [Branches](#branches)
775
797
  - [Dataflow Information](#dataflow-information)
776
798
  - [Unknown Side Effects](#unknown-side-effects)
777
799
  - [Perspectives on the Dataflow Graph](#perspectives)
778
800
  - [Call Graph Perspective](#perspectives-cg)
779
801
  - [Working with the Dataflow Graph](#dfg-working)
802
+ - [Matching Arguments to Parameters](#dfg-matching-arguments)
780
803
 
781
804
  Please be aware that the accompanied [dataflow information](#dataflow-information) (${ctx.link('DataflowInformation')}) returned by _flowR_
782
805
  contains things besides the graph, like the entry and exit points of the subgraphs, and currently active references (see [below](#dataflow-information)).
@@ -803,8 +826,9 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(treeSitter, introExampleCode, { showC
803
826
  The above dataflow graph showcases the general gist. We define a dataflow graph as a directed graph G&nbsp;=&nbsp;(V,&nbsp;E),
804
827
  differentiating between ${(0, doc_data_dfg_util_1.getAllVertices)().length} types of vertices&nbsp;V and
805
828
  ${(0, doc_data_dfg_util_1.getAllEdges)().length} types of edges&nbsp;E allowing each vertex to have a single, and each edge to have multiple distinct types.
806
- Additionally, every node may have links to its [control dependencies](#control-dependencies) (which you may view as a ${(0, text_1.nth)((0, doc_data_dfg_util_1.getAllEdges)().length + 1)} edge type,
807
- although they are explicitly no data dependency and relate to the ${ctx.linkPage('wiki/Control Flow Graph')}.
829
+ Two of these edge types carry the control flow rather than the data: the ${ctx.linkPage('wiki/Control Flow Graph')} is a view on them.
830
+ Additionally, every vertex lists the [control dependencies](#branches) it runs under, which is the same
831
+ information a control edge carries, collected for the whole path that leads to the vertex.
808
832
 
809
833
  ${(0, doc_structure_1.details)('Simplified Version of the graph', await (0, doc_dfg_1.printDfGraphForCode)(treeSitter, 'x <- 3\ny <- x + 1\ny', { simplified: true, showCode: false, ctx }))}
810
834
 
@@ -831,8 +855,8 @@ The following sections present details on the different types of vertices and ed
831
855
  > So if you want more information about the respective vertex, you can usually access more information
832
856
  > using the <code>${ctx.link(`${graph_1.DataflowGraph.name}`, { codeFont: false, realNameWrapper: 'i' })}::idMap</code> linked to the dataflow graph:
833
857
  ${(0, doc_general_1.prefixLines)((0, doc_code_1.codeBlock)('ts', 'const node = graph.idMap.get(id);'), '> ')}
834
- > In case you just need the name (\`lexeme\`) of the respective vertex, ${ctx.link(node_id_1.recoverName)} can help you out:
835
- ${(0, doc_general_1.prefixLines)((0, doc_code_1.codeBlock)('ts', `const name = ${node_id_1.recoverName.name}(id, graph.idMap);`), '> ')}
858
+ > In case you just need the name (\`lexeme\`) of the respective vertex, ${ctx.linkO(model_1.RNode, 'lexeme')} can help you out:
859
+ ${(0, doc_general_1.prefixLines)((0, doc_code_1.codeBlock)('ts', 'const name = RNode.lexeme(graph.idMap?.get(id));'), '> ')}
836
860
  >
837
861
  > Please note, that not every node in the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} is represented in the dataflow graph.
838
862
  > For example, if the node is unreachable in a way that can be detected during the analysis and flowR
@@ -879,12 +903,11 @@ You can access the lexeme too with ${ctx.linkO(model_1.RNode, 'lexeme')}.
879
903
 
880
904
  ${(0, doc_structure_1.section)('Vertex Id', 3, 'vtx-id')}
881
905
 
882
- In the second line, you will usually find the id (in the form of a ${ctx.link(node_id_1.NodeId, undefined, { type: 'variable' })}) of the vertex &mdash; kept compact by sharing the line with the [location](#vtx-location), in the form \`*location* (**id: <id>**)\` with the id in **bold** &mdash;
883
- alongside its [control dependencies](#control-dependencies) if it has any. This id links the vertex to the respective node in the ${ctx.linkPage('wiki/Normalized AST')} (and all other perspectives created by flowR).
906
+ In the second line, you will usually find the id (in the form of a ${ctx.link(node_id_1.NodeId, undefined, { type: 'variable' })}) of the vertex &mdash; kept compact by sharing the line with the [location](#vtx-location), in the form \`*location* (**id: <id>**)\` with the id in **bold**. This id links the vertex to the respective node in the ${ctx.linkPage('wiki/Normalized AST')} (and all other perspectives created by flowR).
884
907
  To give you an example, have a look at the following graph:
885
908
 
886
909
  ${await (0, doc_dfg_1.printDfGraphForCode)(treeSitter, 'if(u) a', { showCode: false, mark: new Set(['1']), ctx })}
887
- The \`3+\` tells you that \`a\` has a [control dependency](#control-dependencies) on the vertex with id \`3\`, the \`if\`,
910
+ The \`3+\` tells you that \`a\` has a [control dependency](#branches) on the vertex with id \`3\`, the \`if\`,
888
911
  which only triggers when the condition is \`true\`; a \`-\` suffix marks the \`false\` case.
889
912
 
890
913
  Other vertices are named by their id too: \`v: <id>\` is the value of a definition, \`links: <id>\` the AST vertices that
@@ -916,20 +939,25 @@ ${(0, doc_structure_1.section)('Edges', 2, 'edges')}
916
939
 
917
940
  ${await getEdgesExplanations(treeSitter, ctx)}
918
941
 
919
- ${(0, doc_structure_1.section)('Control Dependencies', 2, 'control-dependencies')}
942
+ ${(0, doc_structure_1.section)('Branches', 2, 'branches')}
943
+
944
+ A ${ctx.link('ControlDependency')} names the node that decides whether something is evaluated, together with a
945
+ \`when\` flag for the outcome it takes, e.g. \`{ id: <the if>, when: true }\`.
920
946
 
921
- Each vertex may have a list of active control dependencies.
922
- They hold the ${ctx.link('NodeId')} of all nodes that effect if the current vertex is part of the execution or not,
923
- and a boolean flag \`when\` to indicate if the control dependency is active when the condition is \`true\` or \`false\`.
947
+ Each vertex lists the ones it runs under in its \`cds\`, and the control flow puts the very same objects on its
948
+ ${ctx.linkE('EdgeType', 'ControlEdge')} edges, so the two never drift apart.
924
949
 
925
950
  As an example, consider the following dataflow graph:
926
951
 
927
952
  ${await (0, doc_dfg_1.printDfGraphForCode)(treeSitter, 'if(p) a else b', { ctx })}
928
953
 
929
- Whenever we visualize a graph, we represent the control dependencies as grayed out edges with a \`CD\` prefix, followed
930
- by the \`when\` flag.
931
- In the above example, both \`a\` and \`b\` depend on the \`if\`. Please note that they are _not_ linked to the result of
932
- the condition itself as this is the more general linkage point (and harmonizes with other control structures, especially those which are user-defined).
954
+ Control flow is drawn dashed and gray, and such an edge reads \`branch\` (it is a \`branches-to\` edge, called
955
+ \`branch on ... if T\` in the ${ctx.linkPage('wiki/Control Flow Graph')}).
956
+ It starts at the condition, since that is what has to run first, and its label says which decision it belongs to,
957
+ so \`p\` leads to \`a\` when the \`if\` is \`true\` and to \`b\` when it is \`false\`.
958
+ Both \`a\` and \`b\` therefore depend on the \`if\` and not on the result of the condition itself, as the \`if\` is the more
959
+ general linkage point (and harmonizes with other control structures, especially those which are user-defined).
960
+ See the ${ctx.linkPage('wiki/Control Flow Graph', 'control flow graph')} for the view these edges make up.
933
961
 
934
962
  ${(0, doc_structure_1.details)('Example: Multiple Vertices (Assignment)', await (0, doc_dfg_1.printDfGraphForCode)(treeSitter, 'if(p) a <- 1', { ctx }))}
935
963
  ${(0, doc_structure_1.details)('Example: Multiple Vertices (Arithmetic Expression)', await (0, doc_dfg_1.printDfGraphForCode)(treeSitter, 'if(p) 3 + 2', { ctx }))}
@@ -941,23 +969,9 @@ ${(0, doc_structure_1.section)('Dataflow Information', 2, 'dataflow-information'
941
969
  Using _flowR's_ code interface (see the ${ctx.linkPage('wiki/Interface', 'Interface', 'creating-analyses-with-flowr')} wiki page for more), you can generate the dataflow information
942
970
  for a given piece of R code (in this case \`x <- 1; x + 1\`) as follows:
943
971
 
944
- ${(0, doc_code_1.codeBlock)('ts', `
945
- const analyzer = await new FlowrAnalyzerBuilder(requestFromInput('x <- 1\nx + 1')).build();
946
- const result = await analyzer.dataflow();
947
- `)}
948
-
949
- <details>
950
-
951
- <summary style="color:gray">Transpiled Code</summary>
952
-
953
- The actual code we are using in case the example above gets oudated:
954
-
955
- ${(0, doc_code_1.codeBlock)('ts', dummyDataflow.toString())}
956
-
957
- </details>
958
-
972
+ ${ctx.code(dummyDataflow, { dropLinesStart: 1, dropLinesEnd: 2 })}
959
973
 
960
- Now, you can find the dataflow _information_ with \`result.dataflow\`. More specifically, the graph is stored in \`result.dataflow.graph\` and looks like this:
974
+ The call returns the dataflow _information_, with the graph in \`result.graph\`, which looks like this:
961
975
 
962
976
  ${await (async () => {
963
977
  const result = await dummyDataflow();
@@ -983,8 +997,8 @@ ${ctx.hierarchy('DataflowInformation')}
983
997
  Let's start by looking at the properties of the dataflow information object: ${Object.keys(result).map(k => `\`${k}\``).join(', ')}.
984
998
 
985
999
  ${(() => {
986
- /* this includes the meta field for timing and the quick CFG in order to enable re-use and improve performance */
987
- (0, assert_1.guard)(Object.keys(result).length === 11, () => 'Update Dataflow Documentation! (Keys: ' + Object.keys(result).join(', ') + ')');
1000
+ /* this includes the meta field for timing as well as the control flow entry and exit of the program */
1001
+ (0, assert_1.guard)(Object.keys(result).length === 12, () => 'Update Dataflow Documentation! (Keys: ' + Object.keys(result).join(', ') + ')');
988
1002
  return '';
989
1003
  })()}
990
1004
 
@@ -1019,6 +1033,7 @@ Besides marking potential exits, the exit points also provide information about
1019
1033
 
1020
1034
  Finally, the **kill** property (${ctx.link('KillReference', undefined, { type: 'type' })}) tracks references that are removed from scope within the current subtree (e.g., via \`rm(x)\`).
1021
1035
  It is \`undefined\` unless such a removal occurred and, like the outgoing references, bubbles up so that the enclosing scope can apply the removal (see ${ctx.link(apply_kill_1.applyKills)}) at the right location.
1036
+ A definition that such a removal undid is dropped from the outgoing references, so \`x <- 1; rm(x)\` has an empty **out** set (a conditional removal keeps the now maybe-defined \`x\`).
1022
1037
 
1023
1038
  ### Unknown Side Effects
1024
1039
 
@@ -1095,20 +1110,19 @@ Generally, we recommend you check out the ${ctx.link(df_helper_1.Dataflow, undef
1095
1110
 
1096
1111
  * The **${ctx.linkPage('wiki/Query API')}** provides many functions to query the dataflow graph for specific information (dependencies, calls, slices, clusters, ...)
1097
1112
  * The **${ctx.linkPage('wiki/Search API')}** allows you to search for specific vertices or edges in the dataflow graph or the original program
1098
- * ${ctx.link(node_id_1.recoverName)} and ${ctx.link(node_id_1.recoverContent)} to get the name or content of a vertex in the dataflow graph
1099
- * ${ctx.link(resolve_helper_1.Resolve.toValue)} to resolve the value of a variable or id (if possible, see [below](#dfg-resolving-values))
1100
- * ${ctx.link(alias_tracking_1.getAliases)} to get all (potentially currently) aliases of a given definition
1101
- * ${ctx.link(identify_link_to_last_call_relation_1.getValueOfArgument)} to get the (syntactical) value of an argument in a function call
1102
- * ${ctx.link(df_helper_1.Dataflow.origin)} to get information about where a read, call, ... comes from (see [below](#dfg-resolving-values))
1113
+ * The ${ctx.linkPage('wiki/Control Flow Graph')} is a view on this graph, so ${ctx.link(control_flow_graph_1.ControlFlowGraph)} answers what runs before what without a second analysis
1103
1114
 
1104
- FlowR also provides various helper objects (with the same name as the corresponding type) to help you work with the dataflow graph:
1115
+ Everything else lives on a helper object named after the thing it works on:
1105
1116
 
1106
- * ${ctx.link(edge_1.DfEdge, undefined, { type: 'variable' })} to get helpful functions wrt. edges (see [below](#dfg-resolving-values))
1107
- * ${ctx.link(identifier_1.Identifier, undefined, { type: 'variable' })} to get helpful functions wrt. identifiers
1108
- * ${ctx.link(graph_1.FunctionArgument, undefined, { type: 'variable' })} to get helpful functions wrt. function arguments
1109
- * ${ctx.link(resolve_helper_1.Resolve, undefined, { type: 'variable' })} (also reachable as \`Dataflow.resolve\`) to resolve a name against an environment or a node to its value.
1110
- The entry points differ a lot in cost, so take the narrowest one that answers your question: \`byName\` walks the environment layers once and is served from the layer cache,
1111
- \`byNameAndType\` additionally filters and merges the definitions of every layer it passes, and \`toValue\` as well as the \`argument\` family run the evaluator on top of a resolution.
1117
+ * ${ctx.link(df_helper_1.Dataflow, undefined, { type: 'variable' })} for the graph itself, e.g. ${ctx.linkO(df_helper_1.Dataflow, 'origin')} tells you where a read, call,&nbsp;... comes from (see [below](#dfg-resolving-values))
1118
+ * ${ctx.link(edge_1.DfEdge, undefined, { type: 'variable' })} for edges, e.g. \`DfEdge.includesType(edge, EdgeType.Reads)\` (see [below](#dfg-resolving-values))
1119
+ * ${ctx.link(model_1.RNode, undefined, { type: 'variable' })} for the nodes behind the vertices, e.g. \`RNode.lexeme(graph.idMap?.get(id))\` for what a vertex is written as
1120
+ * ${ctx.link(identifier_1.Identifier, undefined, { type: 'variable' })} for identifiers, e.g. \`Identifier.toString(vertex.name)\`
1121
+ * ${ctx.link(graph_1.FunctionArgument, undefined, { type: 'variable' })} for the arguments of a call, e.g. \`FunctionArgument.isNotEmpty(arg)\`
1122
+ * ${ctx.link(resolve_helper_1.Resolve, undefined, { type: 'variable' })} (also reachable as \`Dataflow.resolve\`) for everything that resolves. Take the narrowest entry point:
1123
+ ${ctx.linkO(resolve_helper_1.Resolve, 'byName')} walks the environment layers once, ${ctx.linkO(resolve_helper_1.Resolve, 'byNameAndType')} merges the definitions of every layer it passes,
1124
+ and ${ctx.linkO(resolve_helper_1.Resolve, 'toValue')} as well as ${ctx.linkO(resolve_helper_1.Resolve, 'argument')} run the evaluator on top of a resolution (see [below](#dfg-resolving-values))
1125
+ * ${ctx.link(match_args_1.MatchArgs, undefined, { type: 'variable' })} to bind a call's arguments to the formals of what it calls (see [below](#dfg-matching-arguments))
1112
1126
 
1113
1127
  Some of these functions have been explained in their respective wiki pages. However, some are part of the ${ctx.linkPage('wiki/Dataflow Graph', 'Dataflow Graph API')} and so we explain them here.
1114
1128
  If you are interested in which features we support and which features are still to be worked on, please refer to our ${ctx.linkPage('wiki/Capabilities', 'capabilities')} page.
@@ -1127,6 +1141,23 @@ Additionally, to ${ctx.link(resolve_helper_1.Resolve.toValue)}, we offer the afo
1127
1141
  Be aware, that this function is currently not optimized for speed, so if you frequently require the values of multiple arguments of the same function call, you may want to open [an issue](${doc_issue_1.NewIssueUrl}) to request support for resolving
1128
1142
  multiple arguments at once.
1129
1143
 
1144
+ ${(0, doc_structure_1.section)('Matching Arguments to Parameters', 3, 'dfg-matching-arguments')}
1145
+
1146
+ R does not bind a call's arguments to the formals left to right. An exactly named argument takes its formal, then a
1147
+ uniquely abbreviated one does (\`pmatch\`), then the rest fill what is still free until \`...\`, and whatever is
1148
+ left over goes to \`...\`. ${ctx.link('matchArgumentsToParameters')} is that algorithm, and
1149
+ ${ctx.link(match_args_1.MatchArgs, undefined, { type: 'variable' })} is how you ask for it:
1150
+
1151
+ | Use case | member |
1152
+ |----------|--------|
1153
+ | AST arguments and the formal names | ${ctx.linkO(match_args_1.MatchArgs, 'toNames')} |
1154
+ | graph arguments and the formals (a spec, or a database signature) | ${ctx.linkO(match_args_1.MatchArgs, 'toSpec')} |
1155
+ | graph arguments and the callee's ${ctx.link('RParameter')}s, **also adding the [DefinesOnCall](#5-definesoncall-edge) and [DefinedByOnCall](#6-definedbyoncall-edge) edges** | ${ctx.linkO(match_args_1.MatchArgs, 'onCallAndLink')} |
1156
+ | only the call, the formals are looked up for you | ${ctx.linkO(match_args_1.MatchArgs, 'toDefinition')} |
1157
+
1158
+ ${ctx.linkO(match_args_1.MatchArgs, 'toDefinition')} takes the formals from the ${ctx.link('RFunctionDefinition')} the call
1159
+ resolves to in user code, and from the ${ctx.linkPage('wiki/Signature Database', 'signature database')} otherwise.
1160
+
1130
1161
  ${(0, doc_structure_1.section)('Assessing Edges', 3, 'dfg-assess-edge')}
1131
1162
 
1132
1163
  The [edges](#edges) of the dataflow graph use bitmasks to represent an edge with multiple types. While this compacts the representation greatly, it makes it
@@ -19,6 +19,7 @@ const strings_1 = require("../util/text/strings");
19
19
  const assert_1 = require("../util/assert");
20
20
  const doc_functions_1 = require("./doc-util/doc-functions");
21
21
  const linter_format_1 = require("../linter/linter-format");
22
+ const linter_fix_1 = require("../linter/linter-fix");
22
23
  const doc_maker_1 = require("./wiki-mk/doc-maker");
23
24
  const SpecialTagColors = {
24
25
  [linter_tags_1.LintingRuleTag.Bug]: 'red',
@@ -91,7 +92,7 @@ See [here](${(0, doc_types_1.getTypePathLink)({ filePath: report.source.fileName
91
92
  }
92
93
  function registerRules(knownParser, tagTypes, format = 'short') {
93
94
  const ruleExplanations = new Map();
94
- rule(knownParser, 'deprecated-functions', 'FunctionsToDetectConfig', 'DEPRECATED_FUNCTIONS', 'lint-deprecated-functions', `
95
+ rule(knownParser, 'deprecated-functions', 'DeprecatedFunctionsConfig', 'DEPRECATED_FUNCTIONS', 'lint-deprecated-functions', `
95
96
  first <- data.frame(x = c(1, 2, 3), y = c(1, 2, 3))
96
97
  second <- data.frame(x = c(1, 3, 2), y = c(1, 3, 2))
97
98
  dplyr::all_equal(first, second)
@@ -135,6 +136,7 @@ function(x) {
135
136
  rule(knownParser, 'undefined-symbol', 'UndefinedSymbolConfig', 'UNDEFINED_SYMBOL', 'lint-undefined-symbol', 'undefined_helper(42)', tagTypes);
136
137
  rule(knownParser, 'syntactically-valid', 'SyntacticallyValidConfig', 'SYNTACTICALLY_VALID', 'lint-syntactically-valid', 'x <- c(1, 2', tagTypes);
137
138
  rule(knownParser, 'unclosed-connection', 'UnclosedConnectionConfig', 'UNCLOSED_CONNECTION', 'lint-unclosed-connection', 'con <- file("data.csv")\nreadLines(con)', tagTypes);
139
+ rule(knownParser, 'unused-import', 'UnusedImportConfig', 'UNUSED_IMPORT', 'lint-unused-import', 'library(stats)\nprint("no stats function is used")', tagTypes);
138
140
  function rule(parser, name, configType, ruleType, testfile, example, types) {
139
141
  const rule = linter_rules_1.LintingRules[name];
140
142
  const tags = rule.info.tags.toSorted((a, b) => {
@@ -248,6 +250,18 @@ ${await (async () => {
248
250
  return result;
249
251
  })()}
250
252
 
253
+ ${(0, doc_structure_1.section)('Quick Fixes', 2, 'quick-fixes')}
254
+
255
+ Rules tagged ${makeTagBadge(linter_tags_1.LintingRuleTag.QuickFix, tagTypes.info)} attach a ${(0, doc_types_1.shortLink)('LintQuickFix', tagTypes.info)} to their results,
256
+ describing the edit that resolves the finding. flowR does not only report them, it carries them out:
257
+ ${ctx.link(linter_fix_1.LintQuickFixes.byFile)} collects the fixes of a lint run per file and ${ctx.link(linter_fix_1.LintQuickFixes.apply)}
258
+ returns that file's content with them applied. Of two overlapping fixes only the one coming first in the file is kept,
259
+ and a removal that leaves nothing but whitespace behind takes its line with it.
260
+
261
+ In ${ctx.linkE('LinterOutputFormat', 'Sarif')} output the fixes become SARIF \`fixes\`, which an editor
262
+ or code scanner can offer directly. ${ctx.linkE('LinterOutputFormat', 'Github')} annotations carry no
263
+ fix of their own, so the descriptions are appended to the message.
264
+
251
265
  ${(0, doc_structure_1.section)('Tags', 2, 'tags')}
252
266
 
253
267
  We use tags to categorize linting rules for users. The following tags are available:
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.WikiLintingAndTesting = void 0;
7
4
  const log_1 = require("../util/log");
@@ -9,19 +6,10 @@ const doc_code_1 = require("./doc-util/doc-code");
9
6
  const doc_files_1 = require("./doc-util/doc-files");
10
7
  const doc_structure_1 = require("./doc-util/doc-structure");
11
8
  const doc_cli_option_1 = require("./doc-util/doc-cli-option");
12
- const patterns_1 = __importDefault(require("@eagleoutice/eslint-config-flowr/patterns"));
13
9
  const edge_1 = require("../dataflow/graph/edge");
14
10
  const resolve_helper_1 = require("../dataflow/environments/resolve-helper");
15
11
  const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
16
12
  const doc_maker_1 = require("./wiki-mk/doc-maker");
17
- /** the default patterns of `flowr/replacement-pattern`, rendered so the wiki cannot drift from the configuration */
18
- /** two of the default patterns, kept generated so the wiki cannot drift from the configuration */
19
- function patternExamples() {
20
- const shown = ['edge-is-only-type', 'vertex-is'];
21
- const cell = (text) => text.replaceAll('|', '\\|');
22
- const rows = patterns_1.default.filter(p => p.id !== undefined && shown.includes(p.id)).map(p => `| \`${p.id}\` | ${cell(p.message ?? '')} | \`${cell(p.replace)}\` |`);
23
- return ['| id | what it says | replacement |', '| :-- | :-- | :-- |', ...rows].join('\n');
24
- }
25
13
  /**
26
14
  * https://github.com/flowr-analysis/flowr/wiki/Linting-and-Testing
27
15
  */
@@ -302,10 +290,7 @@ Never reported are the references that make the replacement exist: the wiring in
302
290
  Some replacements are a shape of code rather than a renamed function, such as \`edge.types === EdgeType.Reads\`, which
303
291
  reads like "has this type" (${ctx.linkO(edge_1.DfEdge, 'includesType')}) but holds only if it is the *only* type
304
292
  (${ctx.linkO(edge_1.DfEdge, 'isOnlyType')}). These are matched with [esquery](https://github.com/estools/esquery) selectors,
305
- the language \`no-restricted-syntax\` uses. Two of the ${patterns_1.default.length} that ship, the rest are in
306
- [\`patterns.ts\`](${doc_files_1.FlowrGithubBaseRef}/flowr-lint/blob/main/patterns.ts):
307
-
308
- ${patternExamples()}
293
+ the language \`no-restricted-syntax\` uses.
309
294
 
310
295
  The [flowr-lint README](${doc_files_1.FlowrGithubBaseRef}/flowr-lint#flowrreplacement-pattern) documents the fields of a pattern,
311
296
  and \`npx eslint\` names the id of whichever one fires.
@@ -12,7 +12,11 @@ var WikiChangeType;
12
12
  function normalizeLineEndings(text) {
13
13
  return text.replace(/\r\n/g, '\n');
14
14
  }
15
+ /** url-encoded home paths like `%2Fhome%2Fuser%2Fgit%2F` or `C%3A%5CUsers%5Cuser%5C` */
16
+ const UrlEncodedHomePath = /(?:[a-z]%3A)?(%2F|%5C)(?:home|users)\1(?:[\w.%-]+\1)*/gi;
15
17
  const DefaultReplacementPatterns = [
18
+ // mute signature database load time variance in wiki table (before the `ms` rule, which would eat half of it)
19
+ [/≈\s*<?[\d.]+\s*[µm]s/g, ''],
16
20
  // eslint-disable-next-line no-irregular-whitespace -- we may produce it in output
17
21
  [/\d+(\.\d+)?( |\s*)?ms/g, ''],
18
22
  [/tmp[%A-Za-z0-9-]+/g, ''],
@@ -23,12 +27,10 @@ const DefaultReplacementPatterns = [
23
27
  [/R\s*\d+\.\d+\.\d+/g, ''],
24
28
  [/v\d+\.\d+\.\d+/g, ''],
25
29
  // clean paths
26
- [/%2Fhome%2F([a-zA-Z0-9._-]+%2F)*/g, ''],
30
+ [UrlEncodedHomePath, ''],
27
31
  // async wrapper depends on whether the promise got fulfilled already
28
32
  [/async|%20/g, ''],
29
- [/\s*Copied mermaid url to clipboard\s*\([^)]+\)/gmi, ''],
30
- // mute signature database load time variance in wiki table
31
- [/≈\s*<?[\d.]+\s*[µm]s/g, '']
33
+ [/\s*Copied mermaid url to clipboard\s*\([^)]+\)/gmi, '']
32
34
  ];
33
35
  /**
34
36
  * Abstract base class for generating wiki files.
@@ -31,6 +31,7 @@ const doc_cfg_1 = require("./doc-util/doc-cfg");
31
31
  const doc_repl_1 = require("./doc-util/doc-repl");
32
32
  const inspect_higher_order_query_executor_1 = require("../queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor");
33
33
  const doc_escape_1 = require("./doc-util/doc-escape");
34
+ const config_1 = require("../config");
34
35
  const doc_maker_1 = require("./wiki-mk/doc-maker");
35
36
  const files_query_executor_1 = require("../queries/catalog/files-query/files-query-executor");
36
37
  const call_graph_query_executor_1 = require("../queries/catalog/call-graph-query/call-graph-query-executor");
@@ -853,7 +854,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
853
854
 
854
855
  this produces:
855
856
 
856
- ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], ctx })}
857
+ ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart LR\n', simplifications: ['to-basic-blocks'], ctx })}
857
858
 
858
859
 
859
860
  If, on the other hand, you want to prune dead code edges:
@@ -866,7 +867,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
866
867
 
867
868
  this produces:
868
869
 
869
- ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['analyze-dead-code'], ctx })}
870
+ ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart LR\n', simplifications: ['analyze-dead-code'], ctx })}
870
871
 
871
872
 
872
873
  Or, completely remove dead code:
@@ -879,7 +880,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
879
880
 
880
881
  this produces:
881
882
 
882
- ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['analyze-dead-code', 'remove-dead-code'], ctx })}
883
+ ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart LR\n', simplifications: ['analyze-dead-code', 'remove-dead-code'], ctx })}
883
884
 
884
885
  `;
885
886
  }
@@ -1030,6 +1031,15 @@ To find out what a script _uses_, reach for the ${(0, doc_query_1.linkToQueryOfN
1030
1031
  `;
1031
1032
  }
1032
1033
  });
1034
+ /** Pins the R version so this page reports the same bounds, whatever R the machine regenerating it has. */
1035
+ function guessDepVersionsExampleOptions(ctx) {
1036
+ return {
1037
+ showCode: false,
1038
+ collapseResult: true,
1039
+ ctx,
1040
+ prepare: b => b.configure('solver.sigdb.assumedRVersion', config_1.DefaultAssumedRVersion)
1041
+ };
1042
+ }
1033
1043
  (0, doc_query_1.registerQueryDocumentation)('guess-dep-versions', {
1034
1044
  type: 'active',
1035
1045
  shortDescription: 'Guesses the version range each dependency must have, from declared constraints and actual code usage.',
@@ -1056,7 +1066,7 @@ ${(0, doc_code_1.codeBlock)('r', exampleCode)}
1056
1066
  \`across\` was only introduced in dplyr 1.0.0, so the script cannot run on anything older. The result names the function
1057
1067
  that produced the bound:
1058
1068
 
1059
- ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'guess-dep-versions' }], { showCode: false, collapseResult: true, ctx })}
1069
+ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'guess-dep-versions' }], guessDepVersionsExampleOptions(ctx))}
1060
1070
 
1061
1071
  The guess can be narrowed further:
1062
1072
 
@@ -17,6 +17,7 @@ const codec_1 = require("../project/sigdb/codec");
17
17
  const config_1 = require("../config");
18
18
  const flowr_analyzer_package_versions_sigdb_plugin_1 = require("../project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin");
19
19
  const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
20
+ const identifier_1 = require("../dataflow/environments/identifier");
20
21
  const flowr_analyzer_dependencies_context_1 = require("../project/context/flowr-analyzer-dependencies-context");
21
22
  const doc_sigdb_1 = require("./doc-util/doc-sigdb");
22
23
  /** point the resolver at your own database (a file path or manifest) */
@@ -24,6 +25,17 @@ function usePackageDatabase(parser) {
24
25
  const sigdb = new flowr_analyzer_package_versions_sigdb_plugin_1.FlowrAnalyzerPackageVersionsSigDbPlugin('/path/to/sigs.manifest.json.br');
25
26
  return new flowr_analyzer_builder_1.FlowrAnalyzerBuilder().setParser(parser).registerPlugins(sigdb).build();
26
27
  }
28
+ /** the entry point: one database, versions already resolved the way the project's configuration says */
29
+ function fromTheAnalyzer(analyzer) {
30
+ const db = analyzer.inspectContext().deps.signatures();
31
+ const lead = identifier_1.Identifier.make('lead', 'dplyr');
32
+ return {
33
+ version: db.versionOf('dplyr'), // the version this analysis assumes
34
+ fn: db.functionOf(lead), // its entry, decoding only this one function
35
+ parameters: db.parametersOf(lead), // its formals, ready for MatchArgs.toNames
36
+ exports: db.exportsOf('dplyr')?.exported
37
+ };
38
+ }
27
39
  function accessTheDatabase(source) {
28
40
  const fn = source.functionByName('dplyr', 'lead', '1.1.4');
29
41
  return {
@@ -214,7 +226,7 @@ class WikiSignatureDatabase extends doc_maker_1.DocMaker {
214
226
  flowR ships a database of the complete history of all exports in every version of all CRAN packages so it can resolve calls into the packages you load.
215
227
  After \`library(ggplot2)\`, a call to \`ggplot()\` resolves to \`ggplot2::ggplot\`. The same database
216
228
  qualifies bare names and backs various components like the ${ctx.linkPage('wiki/Query API', 'dependencies and call-context queries')}
217
- as well as the ${ctx.linkPage('wiki/Linter', 'undefined symbol')} rule.
229
+ as well as the ${ctx.linkPage('wiki/Linter', 'undefined symbol')} and ${ctx.linkPage('wiki/Linter', 'unused import')} rules.
218
230
 
219
231
  You can search what it knows at [flowr-analysis.github.io/flowr/wiki/sigdb](https://flowr-analysis.github.io/flowr/wiki/sigdb/),
220
232
  a static page listing every exported name, generated from this database by \`npm run gen:landing\`.
@@ -242,7 +254,21 @@ These are derived on demand by the ${ctx.linkPage('wiki/Query API', 'signature q
242
254
  - the S3 method to generic backlink ${ctx.link('SignatureFunctionView::s3method')}, for a ${ctx.linkE('FnProp', 'S3Method')} function, resolving its generic
243
255
  - the transitive call graph ${ctx.linkM(reader_1.SigDatabase, 'transitiveCallees')}, expanding the stored local callees inside one version
244
256
 
245
- Read it back like this:
257
+ ## Reading It From an Analyzer
258
+
259
+ ${ctx.linkM(flowr_analyzer_dependencies_context_1.FlowrAnalyzerDependenciesContext, 'signatures')} is the entry point, and it is the one you want.
260
+
261
+ ${ctx.code(fromTheAnalyzer, { dropLinesStart: 1 })}
262
+
263
+ The ${ctx.link('SignatureDb')} it hands back is every loaded source as one database, answering for the version
264
+ *the analyzed project* assumes for each package, which is the version \`solver.sigdb.versionOverrides\`,
265
+ \`solver.sigdb.versionSelection\` and \`solver.sigdb.assumedRVersion\` produced. That matters, because a
266
+ ${ctx.link('PackageSignatureSource')} asked without a version answers for whatever it happens to hold as newest,
267
+ which is not what the analysis assumes. When the assumed version is one the database does not carry, the answer
268
+ falls back to the newest it has and says so in the log rather than quietly answering for another version.
269
+
270
+ ${ctx.link('SignatureDb::sources')} is the escape hatch to the raw sources for what the interface above does not
271
+ cover, and reaches the same functions directly.
246
272
 
247
273
  ${ctx.code(accessTheDatabase, { dropLinesStart: 1 })}
248
274
 
@@ -0,0 +1,16 @@
1
+ import { LintQuickFix } from './linter-format';
2
+ import type { LintResultsByRule } from './linter-output';
3
+ export declare const LintQuickFixes: {
4
+ /** Every quick fix a lint run offers, grouped by the file it changes. Fixes flowR cannot place are left out. */
5
+ readonly byFile: (this: void, results: LintResultsByRule) => Map<string, LintQuickFix[]>;
6
+ /**
7
+ * The content of one file with the given fixes carried out, as {@link LintQuickFixes.byFile} groups them. Of two
8
+ * overlapping fixes only the one coming first in the file is kept, since the second would be applied to a range
9
+ * that no longer says what it did. What survives is then carried out back to front, so the offsets of the edits
10
+ * still to come stay valid.
11
+ *
12
+ * Fixes naming a file must all name the same one, as those of another file would cut at offsets of a text that
13
+ * is not this one. Fixes naming none are taken to belong to whatever `code` is.
14
+ */
15
+ readonly apply: (this: void, code: string, fixes: readonly LintQuickFix[]) => string;
16
+ };