@eagleoutice/flowr 2.14.4 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/README.md +76 -63
  2. package/abstract-interpretation/absint-inference.d.ts +347 -0
  3. package/abstract-interpretation/{absint-visitor.js → absint-inference.js} +327 -97
  4. package/abstract-interpretation/abstract-semantics.d.ts +246 -0
  5. package/abstract-interpretation/abstract-semantics.js +3 -0
  6. package/abstract-interpretation/data-frame/{mappers/arguments.d.ts → arguments.d.ts} +18 -16
  7. package/abstract-interpretation/data-frame/{mappers/arguments.js → arguments.js} +20 -21
  8. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +52 -0
  9. package/abstract-interpretation/data-frame/dataframe-semantics.js +1656 -0
  10. package/abstract-interpretation/data-frame/resolve-args.js +4 -4
  11. package/abstract-interpretation/data-frame/semantics.d.ts +15 -21
  12. package/abstract-interpretation/data-frame/semantics.js +27 -29
  13. package/abstract-interpretation/data-frame/shape-inference.d.ts +28 -24
  14. package/abstract-interpretation/data-frame/shape-inference.js +14 -79
  15. package/abstract-interpretation/domains/interval-domain.d.ts +5 -1
  16. package/abstract-interpretation/domains/interval-domain.js +25 -33
  17. package/abstract-interpretation/domains/multi-value-state-domain.d.ts +6 -3
  18. package/abstract-interpretation/domains/multi-value-state-domain.js +24 -4
  19. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -6
  20. package/abstract-interpretation/domains/partial-product-domain.js +26 -43
  21. package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -6
  22. package/abstract-interpretation/domains/positive-interval-domain.js +3 -29
  23. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  24. package/abstract-interpretation/domains/set-range-domain.d.ts +6 -0
  25. package/abstract-interpretation/domains/set-range-domain.js +29 -62
  26. package/abstract-interpretation/domains/state-abstract-domain.d.ts +9 -2
  27. package/abstract-interpretation/domains/state-abstract-domain.js +26 -37
  28. package/abstract-interpretation/domains/{state-domain-like.d.ts → state-domain.d.ts} +10 -6
  29. package/abstract-interpretation/domains/{state-domain-like.js → state-domain.js} +1 -1
  30. package/abstract-interpretation/value-semantics.d.ts +113 -0
  31. package/abstract-interpretation/value-semantics.js +115 -0
  32. package/benchmark/slicer.js +12 -6
  33. package/benchmark/stats/feature-counts.d.ts +2 -1
  34. package/benchmark/stats/feature-counts.js +25 -1
  35. package/benchmark/stats/stats.d.ts +4 -0
  36. package/benchmark/summarizer/second-phase/graph.js +7 -0
  37. package/cli/repl/commands/repl-parse.js +11 -22
  38. package/cli/repl/parser/slice-query-parser.d.ts +2 -0
  39. package/cli/repl/parser/slice-query-parser.js +1 -0
  40. package/config.d.ts +30 -205
  41. package/config.js +37 -3
  42. package/control-flow/cfg-properties.d.ts +5 -0
  43. package/control-flow/cfg-properties.js +25 -7
  44. package/control-flow/control-flow-graph.d.ts +11 -37
  45. package/control-flow/control-flow-graph.js +33 -77
  46. package/control-flow/semantic-cfg-guided-visitor.d.ts +63 -320
  47. package/control-flow/semantic-cfg-guided-visitor.js +65 -320
  48. package/dataflow/environments/built-in-config.d.ts +2 -0
  49. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  50. package/dataflow/environments/built-in-proc-name.js +4 -0
  51. package/dataflow/environments/built-in-props.d.ts +192 -82
  52. package/dataflow/environments/built-in-props.js +336 -106
  53. package/dataflow/environments/built-in.d.ts +21 -9
  54. package/dataflow/environments/built-in.js +43 -12
  55. package/dataflow/environments/default-builtin-config.d.ts +3219 -313
  56. package/dataflow/environments/default-builtin-config.js +803 -1012
  57. package/dataflow/environments/environment.d.ts +26 -49
  58. package/dataflow/environments/environment.js +34 -47
  59. package/dataflow/environments/group-generics.d.ts +11 -2
  60. package/dataflow/environments/group-generics.js +22 -3
  61. package/dataflow/environments/identifier.d.ts +106 -6
  62. package/dataflow/environments/identifier.js +19 -1
  63. package/dataflow/environments/query-fn-props.d.ts +16 -8
  64. package/dataflow/environments/query-fn-props.js +45 -21
  65. package/dataflow/environments/resolve-by-name.js +9 -2
  66. package/dataflow/environments/scoping.d.ts +5 -0
  67. package/dataflow/environments/scoping.js +11 -0
  68. package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
  69. package/dataflow/eval/resolve/alias-tracking.js +20 -2
  70. package/dataflow/eval/resolve/resolve-numbers.d.ts +182 -7
  71. package/dataflow/eval/resolve/resolve-numbers.js +44 -9
  72. package/dataflow/eval/resolve/resolve-strings.d.ts +79 -2
  73. package/dataflow/eval/resolve/resolve-strings.js +16 -7
  74. package/dataflow/eval/resolve/resolve.d.ts +5 -22
  75. package/dataflow/eval/resolve/resolve.js +24 -34
  76. package/dataflow/eval/values/general.d.ts +7 -1
  77. package/dataflow/eval/values/general.js +17 -3
  78. package/dataflow/eval/values/string/string-constants.d.ts +16 -15
  79. package/dataflow/eval/values/string/string-constants.js +59 -27
  80. package/dataflow/extractor.d.ts +2 -1
  81. package/dataflow/extractor.js +16 -4
  82. package/dataflow/fn/argument-roles.d.ts +35 -0
  83. package/dataflow/fn/argument-roles.js +252 -0
  84. package/dataflow/fn/class-declaration.d.ts +148 -0
  85. package/dataflow/fn/class-declaration.js +317 -0
  86. package/dataflow/fn/condition-handlers.d.ts +5 -0
  87. package/dataflow/fn/condition-handlers.js +13 -0
  88. package/dataflow/fn/exceptions-of-function.d.ts +21 -7
  89. package/dataflow/fn/exceptions-of-function.js +74 -43
  90. package/dataflow/fn/frame-reflection.d.ts +46 -0
  91. package/dataflow/fn/frame-reflection.js +169 -0
  92. package/dataflow/fn/function-props.d.ts +32 -0
  93. package/dataflow/fn/function-props.js +160 -0
  94. package/dataflow/fn/higher-order-function.d.ts +23 -5
  95. package/dataflow/fn/higher-order-function.js +64 -18
  96. package/dataflow/fn/strict-function.d.ts +24 -2
  97. package/dataflow/fn/strict-function.js +49 -19
  98. package/dataflow/graph/call-graph.js +10 -2
  99. package/dataflow/graph/df-helper.d.ts +1 -12
  100. package/dataflow/graph/df-helper.js +2 -19
  101. package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
  102. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  103. package/dataflow/graph/graph.d.ts +39 -188
  104. package/dataflow/graph/graph.js +46 -163
  105. package/dataflow/graph/match-args.d.ts +34 -2
  106. package/dataflow/graph/match-args.js +45 -12
  107. package/dataflow/graph/vertex.d.ts +8 -0
  108. package/dataflow/info.d.ts +7 -5
  109. package/dataflow/info.js +1 -5
  110. package/dataflow/internal/control-flow.js +20 -17
  111. package/dataflow/internal/linker.d.ts +8 -37
  112. package/dataflow/internal/linker.js +22 -55
  113. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -2
  114. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -8
  115. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -4
  116. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +8 -14
  117. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +43 -50
  118. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +4 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +5 -2
  120. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.d.ts +23 -0
  121. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.js +24 -0
  122. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -2
  123. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
  124. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +0 -4
  125. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +73 -27
  126. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -11
  127. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +131 -92
  128. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +17 -12
  129. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +187 -99
  130. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +4 -0
  131. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -0
  132. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +2 -3
  133. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +4 -3
  134. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
  135. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
  136. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +0 -1
  137. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -1
  138. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +31 -0
  139. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +101 -0
  140. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +2 -1
  141. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -0
  142. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +23 -21
  143. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +1 -2
  144. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -2
  145. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +22 -1
  146. package/dataflow/internal/process/functions/call/common.d.ts +4 -6
  147. package/dataflow/internal/process/functions/call/common.js +2 -2
  148. package/dataflow/internal/process/functions/call/deferred.d.ts +1 -1
  149. package/dataflow/internal/process/functions/call/deferred.js +2 -2
  150. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +5 -3
  151. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -4
  152. package/dataflow/internal/process/functions/call/named-call-handling.js +19 -13
  153. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -2
  154. package/dataflow/internal/process/functions/call/quoted.js +144 -28
  155. package/dataflow/origin/dfg-get-origin.js +23 -10
  156. package/dataflow/processor.d.ts +2 -1
  157. package/dataflow/processor.js +6 -0
  158. package/documentation/data/interface/doc-writing-code.js +2 -0
  159. package/documentation/doc-util/doc-search.js +1 -1
  160. package/documentation/wiki-absint.d.ts +11 -14
  161. package/documentation/wiki-absint.js +73 -59
  162. package/documentation/wiki-core.js +64 -24
  163. package/documentation/wiki-linter.js +1 -0
  164. package/documentation/wiki-query.js +82 -264
  165. package/documentation/wiki-signature-database.js +17 -5
  166. package/gas.d.ts +91 -47
  167. package/gas.js +97 -13
  168. package/index.d.ts +31 -0
  169. package/index.js +52 -0
  170. package/linter/linter-rules.d.ts +87 -23
  171. package/linter/linter-rules.js +3 -1
  172. package/linter/rules/absolute-path.d.ts +1 -1
  173. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  174. package/linter/rules/dataframe-access-validation.js +10 -8
  175. package/linter/rules/dead-code.d.ts +1 -1
  176. package/linter/rules/deprecated-functions.js +14 -5
  177. package/linter/rules/file-path-validity.d.ts +1 -1
  178. package/linter/rules/naming-convention.d.ts +1 -1
  179. package/linter/rules/naming-convention.js +13 -2
  180. package/linter/rules/network-functions.d.ts +10 -5
  181. package/linter/rules/network-functions.js +48 -36
  182. package/linter/rules/no-leaked-credentials.d.ts +1 -1
  183. package/linter/rules/problematic-inputs.d.ts +1 -1
  184. package/linter/rules/problematic-inputs.js +1 -1
  185. package/linter/rules/seeded-randomness.d.ts +3 -2
  186. package/linter/rules/seeded-randomness.js +7 -3
  187. package/linter/rules/software-has-license.d.ts +1 -1
  188. package/linter/rules/software-has-tests.d.ts +1 -1
  189. package/linter/rules/stop-with-call-arg.d.ts +1 -1
  190. package/linter/rules/syntactically-valid.d.ts +1 -1
  191. package/linter/rules/unclosed-connection.d.ts +3 -3
  192. package/linter/rules/unclosed-connection.js +3 -4
  193. package/linter/rules/undefined-symbol.d.ts +1 -1
  194. package/linter/rules/unescaped-arguments.d.ts +161 -0
  195. package/linter/rules/unescaped-arguments.js +293 -0
  196. package/linter/rules/unused-definition.d.ts +1 -1
  197. package/linter/rules/unused-definition.js +49 -4
  198. package/linter/rules/unused-import.d.ts +1 -1
  199. package/linter/rules/useless-loop.d.ts +1 -1
  200. package/package.json +3 -198
  201. package/project/context/flowr-analyzer-environment-context.d.ts +12 -1
  202. package/project/context/flowr-analyzer-environment-context.js +33 -1
  203. package/project/context/flowr-analyzer-files-context.d.ts +24 -1
  204. package/project/context/flowr-analyzer-files-context.js +42 -21
  205. package/project/context/flowr-analyzer-functions-context.d.ts +8 -0
  206. package/project/context/flowr-analyzer-functions-context.js +2 -0
  207. package/project/context/flowr-analyzer-gas-context.d.ts +9 -1
  208. package/project/context/flowr-analyzer-gas-context.js +21 -0
  209. package/project/context/flowr-file.d.ts +16 -1
  210. package/project/context/flowr-file.js +26 -2
  211. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +19 -20
  212. package/project/plugins/file-plugins/files/flowr-description-file.js +55 -41
  213. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +9 -4
  214. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +11 -3
  215. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +6 -9
  216. package/project/plugins/file-plugins/files/flowr-manifest-files.js +5 -21
  217. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +11 -12
  218. package/project/plugins/file-plugins/files/flowr-namespace-file.js +48 -61
  219. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +3 -12
  220. package/project/plugins/file-plugins/files/flowr-news-file.js +2 -19
  221. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +145 -0
  222. package/project/plugins/file-plugins/files/flowr-rd-file.js +676 -0
  223. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +122 -422
  224. package/project/plugins/file-plugins/files/flowr-rda-file.js +517 -1005
  225. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +8 -2
  226. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +10 -1
  227. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +7 -2
  228. package/project/plugins/file-plugins/files/flowr-sweave-file.js +9 -1
  229. package/project/plugins/file-plugins/files/flowr-sysdata-file.d.ts +17 -0
  230. package/project/plugins/file-plugins/files/flowr-sysdata-file.js +40 -0
  231. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -0
  232. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -1
  233. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.d.ts +58 -0
  234. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.js +95 -0
  235. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.d.ts +23 -0
  236. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.js +33 -0
  237. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +33 -72
  238. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +17 -15
  239. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +20 -37
  240. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +29 -53
  241. package/project/plugins/package-version-plugins/package.js +2 -1
  242. package/project/plugins/plugin-registry.d.ts +3 -1
  243. package/project/plugins/plugin-registry.js +11 -0
  244. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +20 -4
  245. package/project/sigdb/build.d.ts +9 -15
  246. package/project/sigdb/build.js +63 -42
  247. package/project/sigdb/decode.d.ts +10 -4
  248. package/project/sigdb/decode.js +60 -21
  249. package/project/sigdb/memory-source.d.ts +4 -0
  250. package/project/sigdb/memory-source.js +8 -0
  251. package/project/sigdb/reader.d.ts +50 -100
  252. package/project/sigdb/reader.js +84 -105
  253. package/project/sigdb/schema.d.ts +90 -26
  254. package/project/sigdb/schema.js +12 -6
  255. package/queries/base-query-format.d.ts +7 -0
  256. package/queries/base-query-format.js +29 -0
  257. package/queries/catalog/absint-query/absint-query-executor.js +8 -6
  258. package/queries/catalog/absint-query/absint-query-format.d.ts +20 -9
  259. package/queries/catalog/absint-query/absint-query-format.js +32 -19
  260. package/queries/catalog/call-context-query/call-context-query-executor.js +3 -3
  261. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
  262. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  263. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  264. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
  265. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  266. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  267. package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -7
  268. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  269. package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +2 -2
  270. package/queries/catalog/dependencies-query/function-info/derived-functions.js +14 -4
  271. package/queries/catalog/dependencies-query/function-info/read-functions.js +7 -121
  272. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +1 -1
  273. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +2 -2
  274. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +4 -46
  275. package/queries/catalog/dependencies-query/function-info/write-functions.js +3 -76
  276. package/queries/catalog/dependencies-query/implicit-echo.js +2 -2
  277. package/queries/catalog/dependencies-query/link-devices.d.ts +2 -2
  278. package/queries/catalog/dependencies-query/link-devices.js +6 -7
  279. package/queries/catalog/dice-query/dice-query-executor.js +1 -1
  280. package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
  281. package/queries/catalog/does-call-query/does-call-query-executor.js +4 -0
  282. package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -1
  283. package/queries/catalog/files-query/files-query-format.d.ts +1 -1
  284. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +1 -1
  285. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  286. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  287. package/queries/catalog/input-sources-query/input-source-functions.d.ts +1 -1
  288. package/queries/catalog/input-sources-query/input-source-functions.js +2 -2
  289. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -17
  290. package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -27
  291. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
  292. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +3 -8
  293. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -11
  294. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +4 -0
  295. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +60 -0
  296. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +35 -0
  297. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +63 -0
  298. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -6
  299. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +3 -8
  300. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -11
  301. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +3 -8
  302. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -12
  303. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  304. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  305. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  306. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  307. package/queries/catalog/provenance-query/provenance-query-format.d.ts +3 -8
  308. package/queries/catalog/provenance-query/provenance-query-format.js +2 -14
  309. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  310. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  311. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -10
  312. package/queries/catalog/signature-query/signature-query-executor.js +87 -93
  313. package/queries/catalog/signature-query/signature-query-format.d.ts +20 -5
  314. package/queries/catalog/signature-query/signature-query-format.js +16 -4
  315. package/queries/catalog/signature-query/signature-query-render.js +18 -4
  316. package/queries/catalog/slice-query-options.d.ts +14 -0
  317. package/queries/catalog/slice-query-options.js +15 -0
  318. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +2 -1
  319. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
  320. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -3
  321. package/queries/catalog/static-slice-query/static-slice-query-format.js +7 -5
  322. package/queries/query-function-filter.d.ts +8 -3
  323. package/queries/query-function-filter.js +16 -6
  324. package/queries/query.d.ts +38 -38
  325. package/queries/query.js +30 -4
  326. package/r-bridge/lang-4.x/ast/model/model.d.ts +5 -0
  327. package/r-bridge/lang-4.x/ast/model/model.js +14 -0
  328. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  329. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +1 -0
  330. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  331. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  332. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  333. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  334. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  335. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  336. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  337. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  349. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +17 -9
  350. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +35 -27
  351. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -22
  352. package/reconstruct/reconstruct.d.ts +9 -20
  353. package/reconstruct/reconstruct.js +66 -28
  354. package/search/flowr-search-filters.d.ts +7 -6
  355. package/search/flowr-search-filters.js +6 -4
  356. package/search/search-executor/search-enrichers.d.ts +10 -10
  357. package/search/search-executor/search-enrichers.js +32 -3
  358. package/search/search-executor/search-transformer.js +15 -23
  359. package/slicing/criterion/parse.js +2 -12
  360. package/slicing/static/slice-call.js +1 -8
  361. package/slicing/static/static-slicer.js +1 -1
  362. package/util/collections/bimap.js +14 -6
  363. package/util/objects.js +16 -17
  364. package/util/r-value.d.ts +5 -4
  365. package/util/record.d.ts +38 -3
  366. package/util/record.js +48 -1
  367. package/util/simple-df/dfg-ascii.js +1 -1
  368. package/util/text/strings.d.ts +5 -0
  369. package/util/text/strings.js +10 -0
  370. package/util/version.js +2 -2
  371. package/abstract-interpretation/absint-visitor.d.ts +0 -223
  372. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +0 -19
  373. package/abstract-interpretation/data-frame/mappers/access-mapper.js +0 -151
  374. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +0 -287
  375. package/abstract-interpretation/data-frame/mappers/function-mapper.js +0 -1096
  376. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +0 -15
  377. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +0 -207
  378. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +0 -6
  379. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +0 -25
  380. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +0 -31
  381. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +0 -56
@@ -7,102 +7,46 @@ const vertex_1 = require("./vertex");
7
7
  const arrays_1 = require("../../util/collections/arrays");
8
8
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
9
9
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
10
+ const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
10
11
  const environment_1 = require("../environments/environment");
11
12
  const clone_1 = require("../environments/clone");
12
13
  const vertex_2 = require("./vertex");
13
- /**
14
- * Helper functions to work with {@link FunctionArgument}s.
15
- * @see {@link EmptyArgument} - the marker for empty arguments
16
- */
14
+ const gas_1 = require("../../gas");
15
+ /** Helper functions to work with {@link FunctionArgument}s. {@link EmptyArgument} marks an empty argument. */
17
16
  exports.FunctionArgument = {
18
17
  name: 'FunctionArgument',
19
- /**
20
- * Checks whether the given argument is a positional argument.
21
- * @example
22
- * ```r
23
- * foo(b=3, 2) # the second argument is positional
24
- * ```
25
- */
18
+ /** Whether `arg` is positional, e.g. the `2` in `foo(b=3, 2)`. */
26
19
  isPositional(arg) {
27
20
  return arg !== r_function_call_1.EmptyArgument && arg.name === undefined;
28
21
  },
29
- /**
30
- * Checks whether the given argument is a named argument.
31
- * @example
32
- * ```r
33
- * foo(b=3, 2) # the first argument is named
34
- * ```
35
- * @see {@link isPositional}
36
- * @see {@link isEmpty}
37
- * @see {@link hasName}
38
- */
22
+ /** Whether `arg` is named, e.g. the `b=3` in `foo(b=3, 2)`. */
39
23
  isNamed(arg) {
40
24
  return arg !== r_function_call_1.EmptyArgument && arg.name !== undefined;
41
25
  },
42
- /**
43
- * Checks whether the given argument is an unnamed argument (either positional or empty).
44
- * @example
45
- * ```r
46
- * foo(, 2) # the first argument is unnamed (empty)
47
- * foo(3, 2) # both arguments are unnamed (positional)
48
- * ```
49
- * @see {@link isNamed}
50
- */
26
+ /** Whether `arg` is unnamed, i.e. positional or empty, e.g. both arguments of `foo(, 2)` and `foo(3, 2)`. */
51
27
  isUnnamed(arg) {
52
28
  return arg === r_function_call_1.EmptyArgument || arg.name === undefined;
53
29
  },
54
- /**
55
- * Checks whether the given argument is an empty argument.
56
- * @example
57
- * ```r
58
- * foo(, 2) # the first argument is empty
59
- * ```
60
- * @see {@link isNotEmpty}
61
- */
30
+ /** Whether `arg` is the {@link EmptyArgument} marker, e.g. the first argument of `foo(, 2)`. */
62
31
  isEmpty(arg) {
63
32
  return arg === r_function_call_1.EmptyArgument;
64
33
  },
65
- /**
66
- * Checks whether the given argument is not an empty argument.
67
- * @see {@link FunctionArgument.isEmpty}
68
- */
34
+ /** @see {@link FunctionArgument.isEmpty} */
69
35
  isNotEmpty(arg) {
70
36
  return arg !== r_function_call_1.EmptyArgument;
71
37
  },
72
- /**
73
- * Returns the id of a non-empty argument.
74
- * @example
75
- * ```r
76
- * foo(a=3, 2) # returns the node id of either `a` or `2`
77
- * ```
78
- * @see {@link FunctionArgument.getReference}
79
- * @see {@link FunctionArgument.getName}
80
- */
38
+ /** The node id of a non-empty `arg`, e.g. of either `a` or `2` in `foo(a=3, 2)`. */
81
39
  getId(arg) {
82
40
  if (arg !== r_function_call_1.EmptyArgument) {
83
41
  return arg?.nodeId;
84
42
  }
85
43
  return undefined;
86
44
  },
87
- /**
88
- * Returns the name of a named argument.
89
- * @example
90
- * ```r
91
- * foo(a = 3, 2) # returns 'a' or undefined
92
- * ```
93
- * @see {@link FunctionArgument.getId}
94
- */
45
+ /** The name of `arg` if named, `undefined` otherwise. */
95
46
  getName(arg) {
96
47
  return exports.FunctionArgument.isNamed(arg) ? arg.name : undefined;
97
48
  },
98
- /**
99
- * Returns the reference of a non-empty argument.
100
- * @example
101
- * ```r
102
- * foo(a=3, 2) # returns the node id of either `3` or `2`, but skips a
103
- * ```
104
- * @see {@link FunctionArgument.getId}
105
- */
49
+ /** The value node id of a non-empty `arg`: its own id if positional, or its value's id (skipping the name) if named. */
106
50
  getReference(arg) {
107
51
  if (arg === r_function_call_1.EmptyArgument) {
108
52
  return undefined;
@@ -112,13 +56,7 @@ exports.FunctionArgument = {
112
56
  }
113
57
  return arg.valueId;
114
58
  },
115
- /**
116
- * Checks whether the given argument is a named argument with the specified name.
117
- * Please note that this only checks whether the name is exactly identical and not whether
118
- * R's argument matching resolves to the correct argument.
119
- * For this, please refer to the {@link pMatch} function!
120
- * @see {@link isNamed}
121
- */
59
+ /** Whether `arg` is named exactly `name` (textual match only, not R's argument-matching; see {@link pMatch} for that). */
122
60
  hasName(arg, name) {
123
61
  return exports.FunctionArgument.isNamed(arg) && arg.name === name;
124
62
  }
@@ -157,20 +95,10 @@ exports.UnknownSideEffect = {
157
95
  }
158
96
  };
159
97
  /**
160
- * The dataflow graph holds the dataflow information found within the given AST.
161
- * We differentiate the directed edges in {@link EdgeType} and the vertices indicated by {@link DataflowGraphVertexArgument}.
162
- * The helper object associated with the DFG is {@link Dataflow}.
163
- *
164
- * The vertices of the graph are organized in a hierarchical fashion, with a function-definition node containing the node ids of its subgraph.
165
- * However, all *edges* are hoisted at the top level in the form of an (attributed) adjacency list.
166
- * After the dataflow analysis, all sources and targets of the edges *must* be part of the vertices.
167
- * However, this does not have to hold during the construction as edges may point from or to vertices which are yet to be constructed.
168
- *
169
- * All methods return the modified graph to allow for chaining.
170
- * @see {@link DataflowGraph#addEdge|`addEdge`} - to add an edge to the graph
171
- * @see {@link DataflowGraph#addVertex|`addVertex`} - to add a vertex to the graph
172
- * @see {@link DataflowGraph#fromJson|`fromJson`} - to construct a dataflow graph object from a deserialized JSON object.
173
- * @see {@link emptyGraph|`emptyGraph`} - to create an empty graph (useful in tests)
98
+ * The dataflow graph holds the dataflow information found within the given AST: directed edges ({@link EdgeType}) are hoisted
99
+ * into a flat adjacency list, while vertices ({@link DataflowGraphVertexArgument}) nest hierarchically (a function-definition
100
+ * vertex contains its subgraph's node ids). After analysis every edge endpoint must be a vertex, though not yet during construction.
101
+ * All methods return the modified graph to allow for chaining. The helper object associated with the DFG is {@link Dataflow}.
174
102
  */
175
103
  class DataflowGraph {
176
104
  _idMap;
@@ -204,35 +132,17 @@ class DataflowGraph {
204
132
  _unknownSideEffects: Array.from(this._unknownSideEffects)
205
133
  };
206
134
  }
207
- /**
208
- * Get the {@link DataflowGraphVertexInfo} attached to a node as well as all outgoing edges.
209
- * @param id - The id of the node to get
210
- * @param includeDefinedFunctions - If true this will search function definitions as well and not just the toplevel
211
- * @returns the node info for the given id (if it exists)
212
- * @see #getVertex
213
- */
135
+ /** Gets the {@link DataflowGraphVertexInfo} attached to `id` (searching function definitions too if `includeDefinedFunctions`) and its outgoing edges. */
214
136
  get(id, includeDefinedFunctions = true) {
215
137
  // if we do not want to include function definitions, only retrieve the value if the id is part of the root vertices
216
138
  const vertex = includeDefinedFunctions ? this.getVertex(id) : this.getRootVertex(id);
217
139
  return vertex === undefined ? undefined : [vertex, this.outgoingEdges(id) ?? new Map()];
218
140
  }
219
- /**
220
- * Get the {@link DataflowGraphVertexInfo} attached to a vertex.
221
- * @param id - The id of the node to get
222
- * @returns the node info for the given id (if it exists)
223
- * @see #get
224
- * @see #getRootVertex
225
- */
141
+ /** Gets the {@link DataflowGraphVertexInfo} attached to `id`, see {@link DataflowGraph#getRootVertex}. */
226
142
  getVertex(id) {
227
143
  return this.vertexInformation.get(id);
228
144
  }
229
- /**
230
- * Get the {@link DataflowGraphVertexInfo} attached to a root-level vertex.
231
- * @param id - The id of the node to get
232
- * @returns the node info for the given id (if it exists)
233
- * @see #get
234
- * @see #getVertex
235
- */
145
+ /** Gets the {@link DataflowGraphVertexInfo} attached to `id`, but only if it is a root-level vertex, see {@link DataflowGraph#getVertex}. */
236
146
  getRootVertex(id) {
237
147
  if (!this.rootVertices.has(id)) {
238
148
  return undefined;
@@ -262,6 +172,18 @@ class DataflowGraph {
262
172
  * case in traversal loops, so it answers with the shared empty map rather than a fresh one */
263
173
  return this.incomingIndex.get(id) ?? exports.NoEdges;
264
174
  }
175
+ /**
176
+ * Whether `id` is quoted, i.e. affected by a {@link EdgeType.NonStandardEvaluation} edge that keeps it from being
177
+ * evaluated (a loop's own NSE-marked body still is evaluated, so that does not count). `withOutgoing` also checks whether `id` itself quotes something.
178
+ */
179
+ isQuoted(id, withOutgoing = false) {
180
+ /* an nse edge quotes iff it does not originate from a loop marking its body */
181
+ const quotes = (source, e) => edge_1.DfEdge.includesType(e, edge_1.EdgeType.NonStandardEvaluation) && !model_1.RLoopConstructs.is(this.idMap?.get(source));
182
+ if (this.ingoingEdges(id)?.entries().some(([source, e]) => quotes(source, e))) {
183
+ return true;
184
+ }
185
+ return withOutgoing && (this.outgoingEdges(id)?.values().some(e => quotes(id, e)) ?? false);
186
+ }
265
187
  /**
266
188
  * The cached `pkg::fn` name of the call `id`, asking `resolve` only for a call the cache does not know yet.
267
189
  * @useInstead {@link Dataflow.qualify} - which passes the resolution
@@ -309,12 +231,7 @@ class DataflowGraph {
309
231
  this.qualifiedNames = undefined;
310
232
  }
311
233
  }
312
- /**
313
- * Given a node in the normalized AST this either:
314
- * returns the id if the node directly exists in the DFG
315
- * returns the ids of all vertices in the DFG that are linked to this
316
- * returns undefined if the node is not part of the DFG and not linked to any node
317
- */
234
+ /** For a node of the normalized AST: `nodeId` if it is a DFG vertex itself, else the DFG vertices linked to it, else `undefined`. */
318
235
  getLinked(nodeId) {
319
236
  if (this.vertexInformation.has(nodeId)) {
320
237
  return [nodeId];
@@ -331,9 +248,7 @@ class DataflowGraph {
331
248
  get idMap() {
332
249
  return this._idMap;
333
250
  }
334
- /**
335
- * Retrieves the set of vertices which have side effects that we do not know anything about.
336
- */
251
+ /** Retrieves the set of vertices which have side effects that we do not know anything about. */
337
252
  get unknownSideEffects() {
338
253
  return this._unknownSideEffects;
339
254
  }
@@ -341,11 +256,7 @@ class DataflowGraph {
341
256
  setIdMap(idMap) {
342
257
  this._idMap = idMap;
343
258
  }
344
- /**
345
- * @param includeDefinedFunctions - If true this will iterate over function definitions as well and not just the toplevel
346
- * @returns the ids of all toplevel vertices in the graph together with their vertex information
347
- * @see #edges
348
- */
259
+ /** Ids of all toplevel vertices (or all, including those nested in function definitions, if `includeDefinedFunctions`) with their info, see {@link DataflowGraph#edges}. */
349
260
  *vertices(includeDefinedFunctions) {
350
261
  if (includeDefinedFunctions) {
351
262
  yield* this.vertexInformation.entries();
@@ -365,24 +276,15 @@ class DataflowGraph {
365
276
  vertexIdsOfType(type) {
366
277
  return this.types.get(type) ?? [];
367
278
  }
368
- /**
369
- * @returns the ids of all edges in the graph together with their edge information
370
- * @see #vertices
371
- */
279
+ /** Ids of all edges in the graph together with their edge information, see {@link DataflowGraph#vertices}. */
372
280
  *edges() {
373
281
  yield* this.edgeInformation.entries();
374
282
  }
375
- /**
376
- * Returns true if the graph contains a node with the given id.
377
- * @param id - The id to check for
378
- * @param includeDefinedFunctions - If true this will check function definitions as well and not just the toplevel
379
- */
283
+ /** Whether the graph contains a node with `id` (checking function definitions too if `includeDefinedFunctions`). */
380
284
  hasVertex(id, includeDefinedFunctions = true) {
381
285
  return includeDefinedFunctions ? this.vertexInformation.has(id) : this.rootVertices.has(id);
382
286
  }
383
- /**
384
- * Returns true if the root level of the graph contains a node with the given id.
385
- */
287
+ /** Returns true if the root level of the graph contains a node with the given id. */
386
288
  isRoot(id) {
387
289
  return this.rootVertices.has(id);
388
290
  }
@@ -418,14 +320,8 @@ class DataflowGraph {
418
320
  return this;
419
321
  }
420
322
  /**
421
- * Adds a new vertex to the graph, for ease of use, some arguments are optional and filled automatically.
422
- * @param vertex - The vertex to add
423
- * @param fallbackEnv - A clean environment to use if no environment is given in the vertex
424
- * @param asRoot - If false, this will only add the vertex but do not add it to the {@link rootIds|root vertices} of the graph.
425
- * This is probably only of use, when you construct dataflow graphs for tests.
426
- * @param overwrite - If true, this will overwrite the vertex if it already exists in the graph (based on the id).
427
- * @see DataflowGraphVertexInfo
428
- * @see DataflowGraphVertexArgument
323
+ * Adds `vertex` to the graph, filling in `fallbackEnv` if it carries no environment. `asRoot = false` skips
324
+ * adding it to {@link rootIds|root vertices} (mostly useful when constructing graphs for tests); `overwrite` replaces an existing vertex of the same id.
429
325
  */
430
326
  addVertex(vertex, fallbackEnv, asRoot = true, overwrite = false) {
431
327
  const vid = vertex.id;
@@ -437,6 +333,9 @@ class DataflowGraph {
437
333
  // keep a clone of the original environment, isolating the snapshot from later updates
438
334
  vertex.environment = vertex.environment ? (0, clone_1.cloneEnvironmentInformation)(vertex.environment) : (vtag === vertex_1.VertexType.FunctionDefinition || (vtag === vertex_1.VertexType.FunctionCall && !vertex.onlyBuiltin) ? fallbackEnv : undefined);
439
335
  this.vertexInformation.set(vid, vertex);
336
+ if (gas_1.activeDataflowBudget !== undefined) {
337
+ gas_1.activeDataflowBudget.vertex();
338
+ }
440
339
  const typeIds = this.types.get(vtag);
441
340
  if (typeIds) {
442
341
  typeIds.push(vid);
@@ -485,12 +384,7 @@ class DataflowGraph {
485
384
  }
486
385
  return this;
487
386
  }
488
- /**
489
- * Merges the other graph into *this* one (in-place). The return value is only for convenience.
490
- * @param otherGraph - The graph to merge into this one
491
- * @param mergeRootVertices - If false, this will only merge the vertices and edges but exclude the root vertices this is probably only of use
492
- * in the context of function definitions
493
- */
387
+ /** Merges `otherGraph` into *this* one in-place (the return value is only for convenience); `mergeRootVertices = false` excludes its root vertices (useful when merging in a function definition). */
494
388
  mergeWith(otherGraph, mergeRootVertices = true) {
495
389
  if (otherGraph === undefined || otherGraph === this) {
496
390
  return this;
@@ -550,11 +444,7 @@ class DataflowGraph {
550
444
  }
551
445
  }
552
446
  }
553
- /**
554
- * Marks a vertex in the graph to be a definition
555
- * @param reference - The reference to the vertex to mark as definition
556
- * @param sourceIds - The id of the source vertex of the def, if available
557
- */
447
+ /** Marks the vertex referenced by `reference` as a definition, with `sourceIds` as the source vertex ids of the def if known. */
558
448
  setDefinitionOfVertex(reference, sourceIds) {
559
449
  this.dropQualifications();
560
450
  const vertex = this.getVertex(reference.nodeId);
@@ -584,10 +474,7 @@ class DataflowGraph {
584
474
  }
585
475
  }
586
476
  }
587
- /**
588
- * Marks a vertex in the graph to be a function call with the new information
589
- * @param info - The information about the new function call node
590
- */
477
+ /** Marks the vertex `info.id` in the graph to be a function call with the new `info`. */
591
478
  updateToFunctionCall(info) {
592
479
  this.dropQualifications();
593
480
  const infoId = info.id;
@@ -639,11 +526,7 @@ class DataflowGraph {
639
526
  this._unknownSideEffects.add(node_id_1.NodeId.normalize(id));
640
527
  return this;
641
528
  }
642
- /**
643
- * Constructs a dataflow graph instance from the given JSON data and returns the result.
644
- * This can be useful for data sent by the flowR server when analyzing it further.
645
- * @param data - The JSON data to construct the graph from
646
- */
529
+ /** Constructs a dataflow graph instance from the given JSON data, e.g. as sent by the flowR server for further analysis. */
647
530
  static fromJson(data) {
648
531
  const graph = new DataflowGraph(undefined);
649
532
  graph.rootVertices = new Set(data.rootVertices);
@@ -1,12 +1,13 @@
1
- import { type PotentiallyEmptyRArgument, type RFunctionCall } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
1
+ import { type PotentiallyEmptyRArgument, RFunctionCall } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
2
2
  import type { RArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-argument';
3
3
  import type { RParameter } from '../../r-bridge/lang-4.x/ast/model/nodes/r-parameter';
4
4
  import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
- import type { NoInfo } from '../../r-bridge/lang-4.x/ast/model/model';
6
5
  import { type DataflowGraph, FunctionArgument } from './graph';
7
6
  import type { SigParameter } from '../../project/sigdb/decode';
8
7
  import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
9
8
  import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
9
+ import type { ArgProps } from '../environments/built-in-props';
10
+ import { FnSig } from '../environments/built-in-props';
10
11
  /**
11
12
  * R's argument matching, as {@link matchArgumentsToParameters} implements it. Pick by what you hold:
12
13
  *
@@ -14,6 +15,7 @@ import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
14
15
  * - {@link MatchArgs.toSpec|toSpec} - graph arguments and the formals (a spec or a database signature)
15
16
  * - {@link MatchArgs.onCallAndLink|onCallAndLink} - as `toSpec`, and **adds the argument edges to the graph**
16
17
  * - {@link MatchArgs.toDefinition|toDefinition} - only the call, the formals are looked up for you
18
+ * - {@link MatchArgs.findWithProps|findWithProps} - graph arguments and a built-in signature, keeping the ones used for given {@link ArgProp}s
17
19
  * @example
18
20
  * ```ts
19
21
  * MatchArgs.toNames(call.arguments, ['x', 'value']).get('value');
@@ -29,6 +31,7 @@ export declare const MatchArgs: {
29
31
  * @param args - The arguments as they stand in the normalized AST.
30
32
  * @param paramNames - The formals of the called function, in order.
31
33
  * @returns Per formal name the argument bound to it.
34
+ * @see {@link RFunctionCall.matchArgsToParams} - the implementation, kept there to avoid a load-time import cycle.
32
35
  */
33
36
  readonly toNames: <Info = object>(this: void, args: readonly PotentiallyEmptyRArgument<Info>[], paramNames: readonly string[]) => ReadonlyMap<string, RArgument<Info>>;
34
37
  /**
@@ -66,4 +69,33 @@ export declare const MatchArgs: {
66
69
  * @returns Per formal name the argument bound to it, `undefined` if the formals could not be found.
67
70
  */
68
71
  readonly toDefinition: <Info>(this: void, call: RFunctionCall<Info & ParentInformation>, graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext) => ReadonlyMap<string, RArgument<Info & ParentInformation>> | undefined;
72
+ /** The formal names a call binds against, whichever of flowR's sources knows them; see {@link formalsOf}. */
73
+ readonly formalsOf: typeof formalsOf;
74
+ /**
75
+ * Find all arguments of a function call that have a given argument property using the function signature.
76
+ * @param args - The function arguments as the graph holds them.
77
+ * @param signature - The function signature whose names are the targets.
78
+ * @param props - The {@link ArgProp}s the function arguments should have.
79
+ * @returns The value ids of the matching arguments.
80
+ */
81
+ readonly findWithProps: (this: void, args: readonly FunctionArgument[], signature: FnSig, props: ArgProps) => NodeId[];
69
82
  };
83
+ /**
84
+ * The formals a call binds against, taken from the first of flowR's three sources that knows them:
85
+ *
86
+ * 1. the {@link RFunctionDefinition} the call resolves to in user code, whose parameters are already in the
87
+ * AST, so the common case never looks anything up;
88
+ * 2. the signature database at the version the analysis assumes (see {@link SignatureDb}), which records what
89
+ * the package really declares and is therefore the one to believe about a package function;
90
+ * 3. the {@link BuiltInFnInfo#sig|signature} flowR's own {@link DefaultBuiltinConfig} states, which answers for
91
+ * everything the database has no entry for: a built-in of flowR's own, and every package function on a
92
+ * machine carrying no database. flowR states the parameters it models rather than all of them, so this is
93
+ * a prefix of R's formals -- enough to bind what it names, and never more than R would.
94
+ *
95
+ * `undefined` when the call resolves to none of them, so fall back to a hardcoded list then.
96
+ * @param call - The call whose formals are wanted.
97
+ * @param graph - The finished graph the call was analyzed into.
98
+ * @param ctx - The analyzer context the database, the assumed versions and the built-ins come from.
99
+ */
100
+ declare function formalsOf<Info>(this: void, call: RFunctionCall<Info & ParentInformation>, graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext): readonly string[] | undefined;
101
+ export {};
@@ -11,6 +11,9 @@ const signature_db_1 = require("../../project/sigdb/signature-db");
11
11
  const df_helper_1 = require("./df-helper");
12
12
  const identifier_1 = require("../environments/identifier");
13
13
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
14
+ const assert_1 = require("../../util/assert");
15
+ const built_in_props_1 = require("../environments/built-in-props");
16
+ const query_fn_props_1 = require("../environments/query-fn-props");
14
17
  /** the argument names in the shape {@link matchArgumentsToParameters} takes, unnamed arguments as `undefined` */
15
18
  function graphArgumentNames(args) {
16
19
  return args.map(a => graph_1.FunctionArgument.isNamed(a) ? a.name : undefined);
@@ -22,6 +25,7 @@ function graphArgumentNames(args) {
22
25
  * - {@link MatchArgs.toSpec|toSpec} - graph arguments and the formals (a spec or a database signature)
23
26
  * - {@link MatchArgs.onCallAndLink|onCallAndLink} - as `toSpec`, and **adds the argument edges to the graph**
24
27
  * - {@link MatchArgs.toDefinition|toDefinition} - only the call, the formals are looked up for you
28
+ * - {@link MatchArgs.findWithProps|findWithProps} - graph arguments and a built-in signature, keeping the ones used for given {@link ArgProp}s
25
29
  * @example
26
30
  * ```ts
27
31
  * MatchArgs.toNames(call.arguments, ['x', 'value']).get('value');
@@ -37,17 +41,10 @@ exports.MatchArgs = {
37
41
  * @param args - The arguments as they stand in the normalized AST.
38
42
  * @param paramNames - The formals of the called function, in order.
39
43
  * @returns Per formal name the argument bound to it.
44
+ * @see {@link RFunctionCall.matchArgsToParams} - the implementation, kept there to avoid a load-time import cycle.
40
45
  */
41
46
  toNames(args, paramNames) {
42
- const matched = (0, arg_matching_1.matchArgumentsToParameters)(args.map(a => a === r_function_call_1.EmptyArgument ? undefined : a.name?.content), paramNames);
43
- const bound = new Map();
44
- for (let i = 0; i < args.length; i++) {
45
- const arg = args[i], param = matched[i];
46
- if (arg !== r_function_call_1.EmptyArgument && param !== undefined) {
47
- bound.set(paramNames[param], arg);
48
- }
49
- }
50
- return bound;
47
+ return r_function_call_1.RFunctionCall.matchArgsToParams(args, paramNames);
51
48
  },
52
49
  /**
53
50
  * Binds a call's graph `args` against the formals, reading nothing from the graph, so it also serves a
@@ -132,11 +129,40 @@ exports.MatchArgs = {
132
129
  toDefinition(call, graph, ctx) {
133
130
  const names = formalsOf(call, graph, ctx);
134
131
  return names === undefined ? undefined : exports.MatchArgs.toNames(call.arguments, names);
132
+ },
133
+ /** The formal names a call binds against, whichever of flowR's sources knows them; see {@link formalsOf}. */
134
+ formalsOf,
135
+ /**
136
+ * Find all arguments of a function call that have a given argument property using the function signature.
137
+ * @param args - The function arguments as the graph holds them.
138
+ * @param signature - The function signature whose names are the targets.
139
+ * @param props - The {@link ArgProp}s the function arguments should have.
140
+ * @returns The value ids of the matching arguments.
141
+ */
142
+ findWithProps(args, signature, props) {
143
+ const layout = built_in_props_1.FnSig.layout(signature);
144
+ const bound = (0, arg_matching_1.matchArgumentsToParameters)(args.map(graph_1.FunctionArgument.getName), signature.map(([param]) => param));
145
+ return args
146
+ .filter((_, index) => bound[index] !== undefined && (built_in_props_1.FnSig.propAt(layout, bound[index]) & props) !== 0)
147
+ .map(graph_1.FunctionArgument.getReference).filter(assert_1.isNotUndefined);
135
148
  }
136
149
  };
137
150
  /**
138
- * The formals {@link MatchArgs.toDefinition} binds against. User code is tried first because its parameters are
139
- * already in the AST, so the common case never touches the signature database.
151
+ * The formals a call binds against, taken from the first of flowR's three sources that knows them:
152
+ *
153
+ * 1. the {@link RFunctionDefinition} the call resolves to in user code, whose parameters are already in the
154
+ * AST, so the common case never looks anything up;
155
+ * 2. the signature database at the version the analysis assumes (see {@link SignatureDb}), which records what
156
+ * the package really declares and is therefore the one to believe about a package function;
157
+ * 3. the {@link BuiltInFnInfo#sig|signature} flowR's own {@link DefaultBuiltinConfig} states, which answers for
158
+ * everything the database has no entry for: a built-in of flowR's own, and every package function on a
159
+ * machine carrying no database. flowR states the parameters it models rather than all of them, so this is
160
+ * a prefix of R's formals -- enough to bind what it names, and never more than R would.
161
+ *
162
+ * `undefined` when the call resolves to none of them, so fall back to a hardcoded list then.
163
+ * @param call - The call whose formals are wanted.
164
+ * @param graph - The finished graph the call was analyzed into.
165
+ * @param ctx - The analyzer context the database, the assumed versions and the built-ins come from.
140
166
  */
141
167
  function formalsOf(call, graph, ctx) {
142
168
  const origins = df_helper_1.Dataflow.origin(graph, call.info.id);
@@ -152,15 +178,22 @@ function formalsOf(call, graph, ctx) {
152
178
  }
153
179
  }
154
180
  let db;
181
+ let stated;
155
182
  for (const origin of origins) {
156
183
  if (origin.type !== 3 /* OriginType.BuiltInFunctionOrigin */) {
157
184
  continue;
158
185
  }
186
+ const name = identifier_1.Identifier.toQualified([origin], origin.fn.name) ?? origin.fn.name;
159
187
  db ??= (0, signature_db_1.signatureDbOf)(ctx.deps);
160
- const found = db.parametersOf(identifier_1.Identifier.toQualified([origin], origin.fn.name) ?? origin.fn.name);
188
+ const found = db.parametersOf(name);
161
189
  if (found !== undefined && found.length > 0) {
162
190
  return found;
163
191
  }
192
+ stated ??= (0, query_fn_props_1.builtInLookup)(ctx);
193
+ const declared = stated(name)?.sig;
194
+ if (declared !== undefined && declared.length > 0) {
195
+ return declared.map(([param]) => param);
196
+ }
164
197
  }
165
198
  return undefined;
166
199
  }
@@ -6,6 +6,7 @@ import type { ControlDependency, ExitPoint } from '../info';
6
6
  import type { Identifier } from '../environments/identifier';
7
7
  import type { BuiltInProcName } from '../environments/built-in-proc-name';
8
8
  import type { Value } from '../eval/values/r-value';
9
+ import type { ClassDeclaration } from '../fn/class-declaration';
9
10
  export declare enum VertexType {
10
11
  Value = "value",
11
12
  Use = "use",
@@ -112,6 +113,13 @@ export interface DataflowGraphVertexFunctionCall extends DataflowGraphVertexBase
112
113
  * argument can be statically resolved (tracked env variable or `emptyenv()`-family call).
113
114
  */
114
115
  newEnvParent?: REnvironmentInformation;
116
+ /**
117
+ * For a class-declaring call (`setClass`, `setClassUnion`, `setIs`, `setValidity`, `setRefClass`,
118
+ * `S7::new_class`, `R6::R6Class`): what the declaration states -- its name, superclasses, members, and
119
+ * whether it can be instantiated. Filled from the {@link ClassDeclarationConfig} the built-in declares,
120
+ * so no argument's meaning is guessed. See {@link declaredClasses} to collect these across a graph.
121
+ */
122
+ classDecl?: ClassDeclaration;
115
123
  }
116
124
  /** Describes the processor responsible for a function call */
117
125
  export type FunctionOriginInformation = BuiltInProcName;
@@ -6,6 +6,7 @@ import { DataflowGraph } from './graph/graph';
6
6
  import type { GenericDifferenceInformation, WriteableDifferenceReport } from '../util/diff';
7
7
  import type { HookInformation } from './hooks';
8
8
  import type { AstIdMap } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
9
+ import type { DataflowBudgetExhaustion } from '../gas';
9
10
  /**
10
11
  * A control dependency links a vertex to the control flow element which
11
12
  * may have an influence on its execution.
@@ -194,6 +195,11 @@ export interface DataflowInformation extends DataflowCfgInformation {
194
195
  * @see {@link KillReference}
195
196
  */
196
197
  kill?: readonly KillReference[];
198
+ /**
199
+ * Set by {@link produceDataFlowGraph} when a {@link DataflowBudget} ended the extraction early. The
200
+ * {@link graph} is then partial: everything processed before the bound was hit, and nothing after it.
201
+ */
202
+ cutShort?: DataflowBudgetExhaustion;
197
203
  }
198
204
  /**
199
205
  * Helper object for {@link DataflowInformation}
@@ -217,11 +223,7 @@ export declare const DataflowInformation: {
217
223
  * @see {@link happensInEveryBranchSet} - for the set-based version
218
224
  */
219
225
  export declare function happensInEveryBranch(cds: readonly ControlDependency[] | undefined): boolean;
220
- /**
221
- * Checks whether the given control dependencies are exhaustive (i.e. if for every control dependency on a boolean,
222
- * the list contains a dependency on the `true` and on the `false` case).
223
- * @see {@link happensInEveryBranch} - for the array-based version
224
- */
226
+ /** As {@link happensInEveryBranch}, but for a set of control dependencies. */
225
227
  export declare function happensInEveryBranchSet(cds: ReadonlySet<ControlDependency> | undefined): boolean;
226
228
  /**
227
229
  * Filters out exit points which end their cascade within a loop.
package/dataflow/info.js CHANGED
@@ -163,11 +163,7 @@ function coversSet(cds) {
163
163
  }
164
164
  return true;
165
165
  }
166
- /**
167
- * Checks whether the given control dependencies are exhaustive (i.e. if for every control dependency on a boolean,
168
- * the list contains a dependency on the `true` and on the `false` case).
169
- * @see {@link happensInEveryBranch} - for the array-based version
170
- */
166
+ /** As {@link happensInEveryBranch}, but for a set of control dependencies. */
171
167
  function happensInEveryBranchSet(cds) {
172
168
  return cds === undefined || (cds.size !== 0 && coversSet(cds));
173
169
  }
@@ -4,6 +4,11 @@ exports.ControlFlow = void 0;
4
4
  const edge_1 = require("../graph/edge");
5
5
  const info_1 = require("../info");
6
6
  const r_binary_op_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
7
+ /** Where `from` completes: its single CFG exit when it has one, else each of its default exit points. */
8
+ function completionsOf(from) {
9
+ return from.cfgExit !== undefined ? [from.cfgExit]
10
+ : from.exitPoints.filter(e => e.type === 0 /* ExitPointType.Default */).map(e => e.nodeId);
11
+ }
7
12
  /**
8
13
  * Records the control flow of a program in the {@link DataflowGraph} while the dataflow analysis walks it.
9
14
  * The {@link ControlFlowGraph} is a view on what is recorded here.
@@ -102,14 +107,8 @@ exports.ControlFlow = {
102
107
  * @see {@link ControlFlow#branchesTo|branchesTo()} - if it only continues under a condition
103
108
  */
104
109
  continuesWith(graph, from, next) {
105
- if (from.cfgExit !== undefined) {
106
- graph.addEdge(from.cfgExit, next, edge_1.EdgeType.FlowEdge);
107
- return;
108
- }
109
- for (const exit of from.exitPoints) {
110
- if (exit.type === 0 /* ExitPointType.Default */) {
111
- graph.addEdge(exit.nodeId, next, edge_1.EdgeType.FlowEdge);
112
- }
110
+ for (const exit of completionsOf(from)) {
111
+ graph.addEdge(exit, next, edge_1.EdgeType.FlowEdge);
113
112
  }
114
113
  },
115
114
  /**
@@ -122,14 +121,8 @@ exports.ControlFlow = {
122
121
  * @see {@link ControlFlow#continuesWith|continuesWith()} - if it always continues
123
122
  */
124
123
  branchesTo(graph, from, target, cd) {
125
- if (from.cfgExit !== undefined) {
126
- graph.addEdge(from.cfgExit, target, edge_1.EdgeType.ControlEdge, { cd });
127
- return;
128
- }
129
- for (const exit of from.exitPoints) {
130
- if (exit.type === 0 /* ExitPointType.Default */) {
131
- graph.addEdge(exit.nodeId, target, edge_1.EdgeType.ControlEdge, { cd });
132
- }
124
+ for (const exit of completionsOf(from)) {
125
+ graph.addEdge(exit, target, edge_1.EdgeType.ControlEdge, { cd });
133
126
  }
134
127
  },
135
128
  /**
@@ -166,7 +159,17 @@ exports.ControlFlow = {
166
159
  entry = exports.ControlFlow.entryOf(part);
167
160
  }
168
161
  else {
169
- exports.ControlFlow.continuesWith(graph, previous, exports.ControlFlow.entryOf(part));
162
+ const next = exports.ControlFlow.entryOf(part);
163
+ exports.ControlFlow.continuesWith(graph, previous, next);
164
+ /*
165
+ * R promises the parts are evaluated in this order, not that one jumping away keeps the next
166
+ * from running at all, so a part that cannot complete still leads into the one after it.
167
+ */
168
+ if (!exports.ControlFlow.canComplete(previous)) {
169
+ for (const exit of previous.exitPoints) {
170
+ graph.addEdge(exit.nodeId, next, edge_1.EdgeType.FlowEdge);
171
+ }
172
+ }
170
173
  }
171
174
  previous = part;
172
175
  }