@eagleoutice/flowr 2.14.3 → 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 (385) 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 -328
  56. package/dataflow/environments/default-builtin-config.js +804 -1031
  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 +36 -0
  60. package/dataflow/environments/group-generics.js +58 -0
  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 +23 -6
  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 +51 -6
  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 +102 -26
  254. package/project/sigdb/schema.js +14 -6
  255. package/project/sigdb/signature-db.d.ts +4 -0
  256. package/project/sigdb/signature-db.js +8 -1
  257. package/queries/base-query-format.d.ts +7 -0
  258. package/queries/base-query-format.js +29 -0
  259. package/queries/catalog/absint-query/absint-query-executor.js +8 -6
  260. package/queries/catalog/absint-query/absint-query-format.d.ts +20 -9
  261. package/queries/catalog/absint-query/absint-query-format.js +32 -19
  262. package/queries/catalog/call-context-query/call-context-query-executor.js +3 -3
  263. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
  264. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  265. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  266. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
  267. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  268. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  269. package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -7
  270. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  271. package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +2 -2
  272. package/queries/catalog/dependencies-query/function-info/derived-functions.js +14 -4
  273. package/queries/catalog/dependencies-query/function-info/read-functions.js +7 -121
  274. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +1 -1
  275. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +2 -2
  276. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +4 -46
  277. package/queries/catalog/dependencies-query/function-info/write-functions.js +3 -76
  278. package/queries/catalog/dependencies-query/implicit-echo.js +2 -2
  279. package/queries/catalog/dependencies-query/link-devices.d.ts +2 -2
  280. package/queries/catalog/dependencies-query/link-devices.js +6 -7
  281. package/queries/catalog/dice-query/dice-query-executor.js +1 -1
  282. package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
  283. package/queries/catalog/does-call-query/does-call-query-executor.js +4 -0
  284. package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -1
  285. package/queries/catalog/files-query/files-query-format.d.ts +1 -1
  286. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +1 -1
  287. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -1
  288. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  289. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  290. package/queries/catalog/input-sources-query/input-source-functions.d.ts +1 -1
  291. package/queries/catalog/input-sources-query/input-source-functions.js +2 -2
  292. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -17
  293. package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -27
  294. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
  295. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +3 -8
  296. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -11
  297. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +4 -0
  298. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +60 -0
  299. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +35 -0
  300. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +63 -0
  301. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -6
  302. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +3 -8
  303. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -11
  304. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +3 -8
  305. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -12
  306. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  307. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  308. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  309. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  310. package/queries/catalog/provenance-query/provenance-query-format.d.ts +3 -8
  311. package/queries/catalog/provenance-query/provenance-query-format.js +2 -14
  312. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  313. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  314. package/queries/catalog/signature-query/signature-query-executor.d.ts +9 -9
  315. package/queries/catalog/signature-query/signature-query-executor.js +104 -95
  316. package/queries/catalog/signature-query/signature-query-format.d.ts +34 -8
  317. package/queries/catalog/signature-query/signature-query-format.js +16 -4
  318. package/queries/catalog/signature-query/signature-query-render.js +24 -4
  319. package/queries/catalog/slice-query-options.d.ts +14 -0
  320. package/queries/catalog/slice-query-options.js +15 -0
  321. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +2 -1
  322. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
  323. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -3
  324. package/queries/catalog/static-slice-query/static-slice-query-format.js +7 -5
  325. package/queries/query-function-filter.d.ts +8 -3
  326. package/queries/query-function-filter.js +16 -6
  327. package/queries/query.d.ts +38 -38
  328. package/queries/query.js +30 -4
  329. package/r-bridge/lang-4.x/ast/model/model.d.ts +5 -0
  330. package/r-bridge/lang-4.x/ast/model/model.js +14 -0
  331. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  332. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +1 -0
  333. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  334. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  335. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  336. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  337. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +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-unary-op.d.ts +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  352. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +17 -9
  353. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +35 -27
  354. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -22
  355. package/reconstruct/reconstruct.d.ts +9 -20
  356. package/reconstruct/reconstruct.js +66 -28
  357. package/search/flowr-search-filters.d.ts +7 -6
  358. package/search/flowr-search-filters.js +6 -4
  359. package/search/search-executor/search-enrichers.d.ts +10 -10
  360. package/search/search-executor/search-enrichers.js +32 -3
  361. package/search/search-executor/search-transformer.js +15 -23
  362. package/slicing/criterion/parse.js +2 -12
  363. package/slicing/static/slice-call.js +1 -8
  364. package/slicing/static/static-slicer.js +1 -1
  365. package/util/collections/bimap.js +14 -6
  366. package/util/objects.js +16 -17
  367. package/util/r-value.d.ts +5 -4
  368. package/util/record.d.ts +38 -3
  369. package/util/record.js +48 -1
  370. package/util/simple-df/dfg-ascii.js +1 -1
  371. package/util/text/name-rank.js +8 -2
  372. package/util/text/strings.d.ts +5 -0
  373. package/util/text/strings.js +10 -0
  374. package/util/version.js +2 -2
  375. package/abstract-interpretation/absint-visitor.d.ts +0 -223
  376. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +0 -19
  377. package/abstract-interpretation/data-frame/mappers/access-mapper.js +0 -151
  378. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +0 -287
  379. package/abstract-interpretation/data-frame/mappers/function-mapper.js +0 -1096
  380. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +0 -15
  381. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +0 -207
  382. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +0 -6
  383. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +0 -25
  384. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +0 -31
  385. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +0 -56
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.argFor = void 0;
4
+ exports.s4ClassName = s4ClassName;
5
+ exports.linkS4Uses = linkS4Uses;
6
+ exports.linkS4Declaration = linkS4Declaration;
7
+ exports.linkS4Generic = linkS4Generic;
8
+ exports.processS4Use = processS4Use;
9
+ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
10
+ const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
11
+ const class_declaration_1 = require("../../../../../fn/class-declaration");
12
+ Object.defineProperty(exports, "argFor", { enumerable: true, get: function () { return class_declaration_1.argFor; } });
13
+ const identifier_1 = require("../../../../../environments/identifier");
14
+ const define_1 = require("../../../../../environments/define");
15
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
16
+ const vertex_1 = require("../../../../../graph/vertex");
17
+ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
18
+ const known_call_handling_1 = require("../known-call-handling");
19
+ /** marks a name in R's S4 class registry (the string-keyed table `setClass` writes and `new("P")` reads), separate from the variable scope so a class `P` stays apart from a variable `P` */
20
+ const S4ClassMark = '﹕s4class﹕';
21
+ /** The registry name of the S4 class `cls`, see {@link S4ClassMark}. */
22
+ function s4ClassName(cls) {
23
+ return S4ClassMark + cls;
24
+ }
25
+ /** The names an argument states, looking through the `c(...)`/`signature(...)` wrappers a signature may use. */
26
+ function namesOf(node, data) {
27
+ if (node === undefined) {
28
+ return [];
29
+ }
30
+ const known = node_value_1.NodeValue.knownStringsOf(node.info.id, data);
31
+ if (known.length > 0 || !r_function_call_1.RFunctionCall.isNamed(node)) {
32
+ return known;
33
+ }
34
+ const collected = [];
35
+ for (const arg of node.arguments) {
36
+ if (!r_argument_1.RArgument.isEmpty(arg) && arg.value !== undefined) {
37
+ collected.push(...namesOf(arg.value, data));
38
+ }
39
+ }
40
+ return collected;
41
+ }
42
+ /** Adds a read of every given name to the call, so the call depends on whatever registered them. */
43
+ function readNames(info, rootId, names, type, data) {
44
+ const added = [];
45
+ for (const name of names) {
46
+ added.push({ nodeId: rootId, name, type, cds: data.cds });
47
+ }
48
+ if (added.length > 0) {
49
+ info.in = [...info.in, ...added];
50
+ }
51
+ }
52
+ /** Defines `name` in the environment and records it as an out-reference of the call at `rootId`. */
53
+ function defineOut(info, rootId, name, type, data) {
54
+ info.environment = (0, define_1.define)({ name, nodeId: rootId, type, definedAt: rootId, cds: data.cds }, false, info.environment);
55
+ info.out = [...info.out, { nodeId: rootId, name, type, cds: data.cds }];
56
+ }
57
+ /** wires the S4 registrations a call *uses* (the classes and generic its arguments name by string), read against the registry so the call depends on whatever `setClass`/`setGeneric` wrote them */
58
+ function linkS4Uses(info, args, rootId, data, config) {
59
+ for (const ref of config.classArgs ?? []) {
60
+ readNames(info, rootId, namesOf((0, class_declaration_1.argFor)(args, ref), data).map(s4ClassName), identifier_1.ReferenceType.Variable, data);
61
+ }
62
+ if (config.genericArg !== undefined) {
63
+ readNames(info, rootId, namesOf((0, class_declaration_1.argFor)(args, config.genericArg), data), identifier_1.ReferenceType.Function, data);
64
+ }
65
+ if (config.registersArg !== undefined) {
66
+ const registered = namesOf((0, class_declaration_1.argFor)(args, config.registersArg), data);
67
+ readNames(info, rootId, registered.map(s4ClassName), identifier_1.ReferenceType.Variable, data);
68
+ for (const cls of registered) {
69
+ defineOut(info, rootId, s4ClassName(cls), identifier_1.ReferenceType.Variable, data);
70
+ }
71
+ }
72
+ }
73
+ /** wires what the attached {@link DataflowGraphVertexFunctionCall.classDecl|class declaration} states, S4 only: a declaration reads the classes it builds on and registers its own name; a mere relation (`setIs`, `setValidity`) reads and re-registers the class it names */
74
+ function linkS4Declaration(info, rootId, data) {
75
+ const vertex = info.graph.getVertex(rootId);
76
+ const decl = vertex_1.FunctionCallVertex.is(vertex) ? vertex.classDecl : undefined;
77
+ if (decl === undefined || decl.system !== "s4" /* ClassSystem.S4 */) {
78
+ return;
79
+ }
80
+ const used = [...decl.contains, ...(decl.union ?? []), ...decl.members.map(m => m.type).filter(t => t !== undefined)];
81
+ if (decl.relation !== undefined && decl.name !== undefined) {
82
+ used.push(decl.name);
83
+ }
84
+ readNames(info, rootId, used.map(s4ClassName), identifier_1.ReferenceType.Variable, data);
85
+ if (decl.name !== undefined) {
86
+ defineOut(info, rootId, s4ClassName(decl.name), identifier_1.ReferenceType.Variable, data);
87
+ }
88
+ }
89
+ /** Records that the call registers the S4 generics it names, which `setMethod` and a call of the name depend on. */
90
+ function linkS4Generic(info, rootId, names, data) {
91
+ for (const name of names) {
92
+ defineOut(info, rootId, name, identifier_1.ReferenceType.Function, data);
93
+ }
94
+ }
95
+ /** Processes a call that consumes S4 registrations without declaring any, like `new("P")` or `getMethod("f", "P")`. */
96
+ function processS4Use(name, args, rootId, data, config) {
97
+ const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.S4Use }).information;
98
+ linkS4Uses(info, args, rootId, data, config);
99
+ return info;
100
+ }
101
+ //# sourceMappingURL=built-in-s-four.js.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.S7DispatchSeparator = void 0;
4
4
  exports.processS7Dispatch = processS7Dispatch;
5
+ const built_in_props_1 = require("../../../../../environments/built-in-props");
5
6
  const known_call_handling_1 = require("../known-call-handling");
6
7
  const identifier_1 = require("../../../../../environments/identifier");
7
8
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
@@ -14,7 +15,7 @@ function processS7Dispatch(name, args, rootId, data) {
14
15
  if (!('currentS7name' in data) || !Array.isArray(data.currentS7name)) {
15
16
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.S7Dispatch }).information;
16
17
  }
17
- const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, forceArgs: 'all', args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.S7Dispatch }).information;
18
+ const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, sig: built_in_props_1.FnSig.every, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.S7Dispatch }).information;
18
19
  for (const id of data.currentS7name) {
19
20
  if (typeof id === 'string') {
20
21
  const newIn = info.in.slice();
@@ -4,6 +4,7 @@ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/
4
4
  import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
5
  import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
6
  import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ import { type ClassDeclarationConfig } from '../../../../../fn/class-declaration';
7
8
  /** e.g. new_generic(name, dispatch_args, fun=NULL) */
8
9
  interface S7GenericDispatchConfig {
9
10
  args: {
@@ -11,6 +12,8 @@ interface S7GenericDispatchConfig {
11
12
  dispatchArg: string | undefined;
12
13
  fun: string;
13
14
  };
15
+ /** the call binds the generic under the name it is given, as `setGeneric` does (S7 hands its generic back instead) */
16
+ binds?: boolean;
14
17
  }
15
18
  /**
16
19
  * Process an S7 new generic dispatch call like `new_generic` or `setGeneric`.
@@ -26,7 +29,11 @@ export declare function processMakeConstructor<OtherInfo>(name: RSymbol<OtherInf
26
29
  readonly mode?: readonly ('s7' | 's3' | 's4')[];
27
30
  readonly wrapIndex?: number;
28
31
  readonly wrapName?: string;
32
+ /** what the call declares about a class, see {@link classDeclarationOf} */
33
+ readonly classDecl?: ClassDeclarationConfig;
29
34
  }): DataflowInformation;
35
+ /** Records on the call vertex what a class-declaring call states, see {@link DataflowGraphVertexFunctionCall.classDecl}. */
36
+ export declare function attachClassDeclaration<OtherInfo>(info: DataflowInformation, rootId: NodeId, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], config: ClassDeclarationConfig | undefined): void;
30
37
  /**
31
38
  * Node-id suffix of the `fun = function(...) S7_dispatch()` argument flowR synthesizes for S7 calls that do not
32
39
  * carry one (`new_class`, `new_generic`, ...). It stands for no argument in the source, so consumers that reason
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.S7SyntheticFunArgSuffix = void 0;
4
4
  exports.processS7NewGeneric = processS7NewGeneric;
5
5
  exports.processMakeConstructor = processMakeConstructor;
6
+ exports.attachClassDeclaration = attachClassDeclaration;
6
7
  const match_args_1 = require("../../../../../graph/match-args");
8
+ const built_in_props_1 = require("../../../../../environments/built-in-props");
7
9
  const known_call_handling_1 = require("../known-call-handling");
8
10
  const built_in_apply_1 = require("./built-in-apply");
9
11
  const logger_1 = require("../../../../../logger");
@@ -18,7 +20,8 @@ const node_value_1 = require("../../../../../eval/resolve/node-value");
18
20
  const vertex_1 = require("../../../../../graph/vertex");
19
21
  const range_1 = require("../../../../../../util/range");
20
22
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
21
- const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
23
+ const class_declaration_1 = require("../../../../../fn/class-declaration");
24
+ const built_in_s_four_1 = require("./built-in-s-four");
22
25
  /**
23
26
  * Process an S7 new generic dispatch call like `new_generic` or `setGeneric`.
24
27
  */
@@ -55,13 +58,16 @@ function processS7NewGeneric(name, args, rootId, data, config) {
55
58
  effectiveArgs.push(newFun[0]);
56
59
  funArg = newFun[1];
57
60
  }
58
- const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, forceArgs: 'all', args: effectiveArgs, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.S7NewGeneric }).information;
61
+ const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, sig: built_in_props_1.FnSig.every, args: effectiveArgs, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.S7NewGeneric }).information;
59
62
  info.graph.addEdge(rootId, funArg, edge_1.EdgeType.Returns);
60
63
  info.entryPoint = funArg;
61
64
  const fArg = info.graph.getVertex(funArg);
62
65
  if (vertex_1.FunctionDefinitionVertex.is(fArg)) {
63
66
  fArg.mode ??= ['s4', 's7'];
64
67
  }
68
+ if (config.binds) {
69
+ (0, built_in_s_four_1.linkS4Generic)(info, rootId, accessedIdentifiers, data);
70
+ }
65
71
  return info;
66
72
  }
67
73
  /**
@@ -73,7 +79,7 @@ function processS7NewGeneric(name, args, rootId, data, config) {
73
79
  function processMakeConstructor(name, args, rootId, data, config) {
74
80
  // synthesise `function(...) S7_dispatch()` and make the call return it
75
81
  const [funArg, funId] = makeS7DispatchFDef(name, [], rootId, args.length, data.completeAst.idMap);
76
- const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, forceArgs: 'all', args: [...args, funArg], rootId, data, origin: built_in_proc_name_1.BuiltInProcName.S7MakeConstructor }).information;
82
+ const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, sig: built_in_props_1.FnSig.every, args: [...args, funArg], rootId, data, origin: built_in_proc_name_1.BuiltInProcName.S7MakeConstructor }).information;
77
83
  info.graph.addEdge(rootId, funId, edge_1.EdgeType.Returns);
78
84
  info.entryPoint = funId;
79
85
  const fArg = info.graph.getVertex(funId);
@@ -83,31 +89,27 @@ function processMakeConstructor(name, args, rootId, data, config) {
83
89
  if (config?.wrapIndex !== undefined) {
84
90
  linkWrappedFunction(info, args, config.wrapIndex, config.wrapName, data);
85
91
  }
92
+ attachClassDeclaration(info, rootId, args, config?.classDecl);
93
+ (0, built_in_s_four_1.linkS4Declaration)(info, rootId, data);
86
94
  return info;
87
95
  }
96
+ /** Records on the call vertex what a class-declaring call states, see {@link DataflowGraphVertexFunctionCall.classDecl}. */
97
+ function attachClassDeclaration(info, rootId, args, config) {
98
+ if (config === undefined) {
99
+ return;
100
+ }
101
+ const vertex = info.graph.getVertex(rootId);
102
+ if (vertex_1.FunctionCallVertex.is(vertex)) {
103
+ vertex.classDecl = class_declaration_1.ClassDeclarations.of(config, args);
104
+ }
105
+ }
88
106
  /** Mark the wrapped function of an eager higher-order wrapper (`Negate`/`Vectorize`/`partial`) as called. */
89
107
  function linkWrappedFunction(info, args, wrapIndex, wrapName, data) {
90
- let wrapped = undefined;
91
- if (wrapName !== undefined) {
92
- wrapped = args.find(a => a !== r_function_call_1.EmptyArgument && a.name?.content === wrapName);
93
- }
108
+ const wrapped = (0, built_in_s_four_1.argFor)(args, { name: wrapName, idx: wrapIndex });
94
109
  if (wrapped === undefined) {
95
- let pos = 0;
96
- for (const a of args) {
97
- if (r_argument_1.RArgument.isEmpty(a) || a.name) {
98
- continue;
99
- }
100
- if (pos === wrapIndex) {
101
- wrapped = a;
102
- break;
103
- }
104
- pos++;
105
- }
106
- }
107
- if (wrapped === undefined || r_argument_1.RArgument.isEmpty(wrapped) || !wrapped.value) {
108
110
  return;
109
111
  }
110
- const resolved = (0, built_in_apply_1.resolveFunctionArgument)(wrapped.value, data, {});
112
+ const resolved = (0, built_in_apply_1.resolveFunctionArgument)(wrapped, data, {});
111
113
  if (resolved === undefined || resolved.anonymous) {
112
114
  return;
113
115
  }
@@ -4,7 +4,6 @@ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/
4
4
  import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
5
  import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
6
  import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
- import type { ForceArguments } from '../common';
8
7
  /**
9
8
  * Process a special built-in binary operator, possibly lazily.
10
9
  * Only `&&`/`||` short-circuit: their right-hand side gets a control dependency and only the left is read.
@@ -14,4 +13,4 @@ import type { ForceArguments } from '../common';
14
13
  export declare function processSpecialBinOp<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: {
15
14
  readonly lazy: boolean;
16
15
  readonly evalRhsWhen?: boolean;
17
- } & ForceArguments): DataflowInformation;
16
+ }): DataflowInformation;
@@ -16,11 +16,11 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
16
16
  function processSpecialBinOp(name, args, rootId, data, config) {
17
17
  if (args.length != 2) {
18
18
  logger_1.dataflowLogger.warn(`Logical bin-op ${identifier_1.Identifier.toString(name.content)} has something else than 2 arguments, skipping`);
19
- return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'default' }).information;
19
+ return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
20
20
  }
21
21
  /* the very dependency the right-hand side runs under, carried by its vertices and by the branch alike */
22
22
  const evalsRhs = { id: rootId, when: config.evalRhsWhen ?? true };
23
- const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs,
23
+ const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data,
24
24
  patchData: (d, i) => {
25
25
  if (config.lazy && i === 1) {
26
26
  return { ...d, cds: [...d.cds ?? [], evalsRhs] };
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processTryCatch = processTryCatch;
4
4
  const match_args_1 = require("../../../../../graph/match-args");
5
+ const built_in_props_1 = require("../../../../../environments/built-in-props");
6
+ const condition_handlers_1 = require("../../../../../fn/condition-handlers");
5
7
  const info_1 = require("../../../../../info");
6
8
  const known_call_handling_1 = require("../known-call-handling");
7
9
  const control_flow_1 = require("../../../../control-flow");
@@ -22,7 +24,7 @@ const r_function_definition_1 = require("../../../../../../r-bridge/lang-4.x/ast
22
24
  * Process a built-in try-catch or similar handler.
23
25
  */
24
26
  function processTryCatch(name, args, rootId, data, config) {
25
- const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: args.map(unpack_argument_1.tryUnpackNoNameArg), rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Try, forceArgs: 'all' });
27
+ const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: args.map(unpack_argument_1.tryUnpackNoNameArg), rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Try, sig: built_in_props_1.FnSig.every });
26
28
  if (args.length < 1 || r_argument_1.RArgument.isEmpty(args[0])) {
27
29
  logger_1.dataflowLogger.warn(`TryCatch Handler ${identifier_1.Identifier.toString(name.content)} does not have 1 argument, skipping`);
28
30
  return res.information;
@@ -44,6 +46,10 @@ function processTryCatch(name, args, rootId, data, config) {
44
46
  const blockArg = new Set(argMaps.get('block'));
45
47
  const errorArg = new Set(argMaps.get('error'));
46
48
  const finallyArg = new Set(argMaps.get('finally'));
49
+ /* handlers are matched by the class of the condition, so a call naming none for an error lets it out:
50
+ `tryCatch(stop("x"), warning = ...)` throws, and so does one with nothing but a `finally`.
51
+ A construct declaring no handler parameter at all, as `try` does, catches whatever arrives. */
52
+ const catchesError = config.handlers.error === undefined || (0, condition_handlers_1.namesAnErrorHandler)(args);
47
53
  // only take those exit points from the block
48
54
  // check whether blockArg has *always* happening exceptions, if so we do not constrain the error handler
49
55
  const blockErrorExitPoints = [];
@@ -63,6 +69,9 @@ function processTryCatch(name, args, rootId, data, config) {
63
69
  // not killing other args
64
70
  return arg.exitPoints;
65
71
  }
72
+ if (!catchesError) {
73
+ return arg.exitPoints;
74
+ }
66
75
  blockErrorExitPoints.push(...arg.exitPoints.filter(ep => ep.type === 4 /* ExitPointType.Error */).flatMap(a => a.cds));
67
76
  return arg.exitPoints.filter(ep => ep.type !== 4 /* ExitPointType.Error */);
68
77
  });
@@ -114,6 +123,13 @@ function processTryCatch(name, args, rootId, data, config) {
114
123
  const cleanup = res.processedArguments.find(arg => arg !== undefined && finallyArg.has(arg.entryPoint));
115
124
  const caughtAt = handler !== undefined ? control_flow_1.ControlFlow.entryOf(handler)
116
125
  : cleanup === undefined ? rootId : control_flow_1.ControlFlow.entryOf(cleanup);
126
+ /* R runs `finally` whatever leaves the block, so a jump reaches it on its way out just as an error does */
127
+ const cleanupEntry = cleanup !== undefined ? control_flow_1.ControlFlow.entryOf(cleanup) : undefined;
128
+ if (cleanupEntry !== undefined) {
129
+ /* and it leaves through the call, so whatever claims the jump links to where the cleanup ends, not to the
130
+ jump itself, which would let control out without running it */
131
+ info.exitPoints = info.exitPoints.map(e => JumpExitPoints.includes(e.type) ? { ...e, nodeId: rootId } : e);
132
+ }
117
133
  for (const arg of res.processedArguments) {
118
134
  if (arg === undefined || errorArg.has(arg.entryPoint) || finallyArg.has(arg.entryPoint)) {
119
135
  continue;
@@ -122,6 +138,9 @@ function processTryCatch(name, args, rootId, data, config) {
122
138
  if (exit.type === 4 /* ExitPointType.Error */) {
123
139
  info.graph.addEdge(exit.nodeId, caughtAt, edge_1.EdgeType.FlowEdge);
124
140
  }
141
+ else if (cleanupEntry !== undefined && JumpExitPoints.includes(exit.type)) {
142
+ info.graph.addEdge(exit.nodeId, cleanupEntry, edge_1.EdgeType.FlowEdge);
143
+ }
125
144
  }
126
145
  }
127
146
  if (escaping.length === 0 && escapingKills === undefined) {
@@ -134,6 +153,8 @@ function processTryCatch(name, args, rootId, data, config) {
134
153
  kill: escapingKills
135
154
  };
136
155
  }
156
+ /** the exits that leave the construct for a destination of their own, which `finally` still runs before */
157
+ const JumpExitPoints = [2 /* ExitPointType.Break */, 3 /* ExitPointType.Next */, 1 /* ExitPointType.Return */];
137
158
  function promoteCallToFunction(call, arg, info, data) {
138
159
  let functionId = undefined;
139
160
  let functionName = undefined;
@@ -15,11 +15,9 @@ import type { REnvironmentInformation } from '../../../../environments/environme
15
15
  import { type IdentifierReference } from '../../../../environments/identifier';
16
16
  import { type DataflowGraphVertexAstLink, type FunctionOriginInformation } from '../../../../graph/vertex';
17
17
  import type { RSymbol } from '../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
18
- export interface ForceArguments {
19
- /** which of the arguments should be forced? this may be all, e.g., if the function itself is unknown on encounter */
20
- readonly forceArgs?: 'all' | readonly boolean[];
21
- }
22
- export interface ProcessAllArgumentInput<OtherInfo> extends ForceArguments {
18
+ export interface ProcessAllArgumentInput<OtherInfo> {
19
+ /** which of the arguments the call evaluates, as {@link FnSig.forced} answers it for the signature */
20
+ readonly forced?: readonly boolean[];
23
21
  readonly functionName: DataflowInformation;
24
22
  readonly args: readonly (RNode<OtherInfo & ParentInformation> | PotentiallyEmptyRArgument<OtherInfo & ParentInformation>)[];
25
23
  readonly data: DataflowProcessorInformation<OtherInfo & ParentInformation>;
@@ -52,7 +50,7 @@ export declare function convertFnArgument<OtherInfo>(this: void, arg: typeof Emp
52
50
  /**
53
51
  * Processes all arguments for a function call, updating the given final graph and environment.
54
52
  */
55
- export declare function processAllArguments<OtherInfo>({ functionName, args, data, finalGraph, functionRootId, forceArgs, patchData, nonFunction }: ProcessAllArgumentInput<OtherInfo>): ProcessAllArgumentResult;
53
+ export declare function processAllArguments<OtherInfo>({ functionName, args, data, finalGraph, functionRootId, forced, patchData, nonFunction }: ProcessAllArgumentInput<OtherInfo>): ProcessAllArgumentResult;
56
54
  export interface PatchFunctionCallInput<OtherInfo> {
57
55
  readonly nextGraph: DataflowGraph;
58
56
  readonly rootId: NodeId;
@@ -86,7 +86,7 @@ function convertFnArgument(arg) {
86
86
  /**
87
87
  * Processes all arguments for a function call, updating the given final graph and environment.
88
88
  */
89
- function processAllArguments({ functionName, args, data, finalGraph, functionRootId, forceArgs = [], patchData, nonFunction }) {
89
+ function processAllArguments({ functionName, args, data, finalGraph, functionRootId, forced = [], patchData, nonFunction }) {
90
90
  let finalEnv = functionName.environment;
91
91
  // arg env contains the environments with other args defined
92
92
  let argEnv = functionName.environment;
@@ -110,7 +110,7 @@ function processAllArguments({ functionName, args, data, finalGraph, functionRoo
110
110
  else {
111
111
  processed = r_argument_1.RArgument.is(arg) ? (0, process_argument_1.processFunctionArgument)(arg, data) : (0, processor_1.processDataflowFor)(arg, data);
112
112
  }
113
- if (r_argument_1.RArgument.isWithValue(arg) && (forceArgs === 'all' || forceArgs[i]) && !model_1.RConstant.is(arg.value)) {
113
+ if (r_argument_1.RArgument.isWithValue(arg) && forced[i] && !model_1.RConstant.is(arg.value)) {
114
114
  forceVertexArgumentValueReferences(functionRootId, processed, processed.graph, data.environment);
115
115
  }
116
116
  processedArguments.push(processed);
@@ -1,5 +1,5 @@
1
1
  import type { AstIdMap, ParentInformation } from '../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
2
- import type { NodeId } from '../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
+ import { NodeId } from '../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
3
  import type { DataflowGraph } from '../../../../graph/graph';
4
4
  import type { ControlFlowGraph } from '../../../../../control-flow/control-flow-graph';
5
5
  /** The reads that may force the expression, and the control flow deciding what they can see. */
@@ -66,7 +66,7 @@ exports.Deferred = {
66
66
  const uses = new Map();
67
67
  for (const [type, index] of [[vertex_1.VertexType.VariableDefinition, definitions], [vertex_1.VertexType.Use, uses]]) {
68
68
  for (const [id] of graph.verticesOfType(type)) {
69
- const name = (0, node_id_1.recoverName)(id, idMap);
69
+ const name = node_id_1.NodeId.recoverName(id, idMap);
70
70
  if (name !== undefined) {
71
71
  add(index, name, id);
72
72
  }
@@ -123,7 +123,7 @@ exports.Deferred = {
123
123
  const reachedByAForce = (use) => forces === undefined
124
124
  || (!forces.sites.includes(use) && forces.sites.some(site => (0, happens_before_1.happensBefore)(forces.cfg, site, use) !== logic_1.Ternary.Never));
125
125
  /* `delayedAssign` names its variable with a string literal, so the recovered name still carries quotes */
126
- const bindingName = forces === undefined ? undefined : (0, retriever_1.removeRQuotes)((0, node_id_1.recoverName)(forces.binding, idMap) ?? '');
126
+ const bindingName = forces === undefined ? undefined : (0, retriever_1.removeRQuotes)(node_id_1.NodeId.recoverName(forces.binding, idMap) ?? '');
127
127
  for (const [node, name, writes] of within) {
128
128
  if (writes) {
129
129
  /* a write of the bound name replaces the binding, so a read it definitely reaches sees only it */
@@ -1,6 +1,6 @@
1
1
  import { type DataflowProcessorInformation } from '../../../../processor';
2
+ import { FnSig } from '../../../../environments/built-in-props';
2
3
  import type { DataflowInformation } from '../../../../info';
3
- import { type ForceArguments } from './common';
4
4
  import type { RSymbol } from '../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
5
5
  import type { ParentInformation } from '../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
6
6
  import { type PotentiallyEmptyRArgument } from '../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
@@ -10,7 +10,9 @@ import { type IdentifierReference } from '../../../../environments/identifier';
10
10
  import type { FunctionArgument } from '../../../../graph/graph';
11
11
  import { DataflowGraph } from '../../../../graph/graph';
12
12
  import { type FunctionOriginInformation } from '../../../../graph/vertex';
13
- export interface ProcessKnownFunctionCallInput<OtherInfo> extends ForceArguments {
13
+ export interface ProcessKnownFunctionCallInput<OtherInfo> {
14
+ /** the signature of the called function, the one place stating which arguments it evaluates */
15
+ readonly sig?: FnSig;
14
16
  /** The name of the function being called. */
15
17
  readonly name: RSymbol<OtherInfo & ParentInformation>;
16
18
  /** The arguments to the function call. */
@@ -96,4 +98,4 @@ export declare function markArgumentsAsNonStandardEvaluation(graph: DataflowGrap
96
98
  * The main processor for function calls for which we know the target but need not
97
99
  * add any specific handling.
98
100
  */
99
- export declare function processKnownFunctionCall<OtherInfo>({ name, args, rootId, data, reverseOrder, markAsNSE, forceArgs, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom }: ProcessKnownFunctionCallInput<OtherInfo>): ProcessKnownFunctionCallResult;
101
+ export declare function processKnownFunctionCall<OtherInfo>({ name, args, rootId, data, reverseOrder, markAsNSE, sig, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom }: ProcessKnownFunctionCallInput<OtherInfo>): ProcessKnownFunctionCallResult;
@@ -4,6 +4,7 @@ exports.NseKind = exports.NseArguments = void 0;
4
4
  exports.markArgumentsAsNonStandardEvaluation = markArgumentsAsNonStandardEvaluation;
5
5
  exports.processKnownFunctionCall = processKnownFunctionCall;
6
6
  const processor_1 = require("../../../../processor");
7
+ const built_in_props_1 = require("../../../../environments/built-in-props");
7
8
  const common_1 = require("./common");
8
9
  const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
9
10
  const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
@@ -93,12 +94,13 @@ function markArgument(graph, rootId, arg, kind, evaluated) {
93
94
  * The main processor for function calls for which we know the target but need not
94
95
  * add any specific handling.
95
96
  */
96
- function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = false, markAsNSE = undefined, forceArgs, patchData = d => d, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom }) {
97
+ function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = false, markAsNSE = undefined, sig, patchData = d => d, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom }) {
97
98
  const functionName = (0, processor_1.processDataflowFor)(name, data);
98
99
  const finalGraph = new graph_1.DataflowGraph(data.completeAst.idMap);
99
100
  const functionCallName = name.content;
100
101
  const processArgs = reverseOrder ? args.toReversed() : args;
101
- const { finalEnv, callArgs, remainingReadInArgs, processedArguments } = (0, common_1.processAllArguments)({ functionName, args: processArgs, data, finalGraph, functionRootId: rootId, patchData, forceArgs, nonFunction });
102
+ const forced = built_in_props_1.FnSig.forced(sig, processArgs.length);
103
+ const { finalEnv, callArgs, remainingReadInArgs, processedArguments } = (0, common_1.processAllArguments)({ functionName, args: processArgs, data, finalGraph, functionRootId: rootId, patchData, forced, nonFunction });
102
104
  markArgumentsAsNonStandardEvaluation(finalGraph, rootId, processedArguments, markAsNSE, { kind: NseKind.Reevaluated });
103
105
  const onlyBuiltin = data.builtInNoEnv === rootId;
104
106
  finalGraph.addVertex({
@@ -122,10 +124,10 @@ function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = fal
122
124
  let exitPoints = undefined;
123
125
  /* a jump that only happens under a condition still lets the call complete, so its default exit has to stay */
124
126
  let alwaysJumps = false;
125
- if (forceArgs) {
127
+ if (forced) {
126
128
  for (let i = 0; i < processedArguments.length; i++) {
127
129
  const p = processedArguments[i];
128
- if (p === undefined || (forceArgs !== 'all' && !forceArgs[i])) {
130
+ if (p === undefined || !forced[i]) {
129
131
  continue;
130
132
  }
131
133
  const before = exitPoints?.length ?? 0;
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.markAsOnlyBuiltIn = markAsOnlyBuiltIn;
4
4
  exports.processNamedCall = processNamedCall;
5
+ const built_in_props_1 = require("../../../../environments/built-in-props");
5
6
  const info_1 = require("../../../../info");
6
7
  const known_call_handling_1 = require("./known-call-handling");
7
8
  const append_1 = require("../../../../environments/append");
8
9
  const node_id_1 = require("../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
9
10
  const identifier_1 = require("../../../../environments/identifier");
10
11
  const r_base_packages_1 = require("../../../../../util/r-base-packages");
11
- const built_in_1 = require("../../../../environments/built-in");
12
12
  const edge_1 = require("../../../../graph/edge");
13
13
  const built_in_library_1 = require("./built-in/built-in-library");
14
14
  const vertex_1 = require("../../../../graph/vertex");
@@ -34,10 +34,11 @@ function mergeInformation(info, newInfo) {
34
34
  /**
35
35
  * The flowR definition of `pkg::fn` behind an export a signature database attached. Such an export binds the
36
36
  * name in a layer below the global environment, which hides the built-in environment underneath, and with it
37
- * how the call evaluates its arguments: without this lookup `library(dplyr); filter(df, id > 2)` loses the data
38
- * mask of `dplyr::filter`. Only that is recovered here. What a definition merely states about a call (its
39
- * properties, its signature) reaches every consumer through the export vertex already, so a definition saying
40
- * nothing about evaluation is left to the default processor, which keeps the call to one target.
37
+ * everything the configuration models about the call: how it evaluates its arguments, the class it declares,
38
+ * the value it folds to. Without this lookup, attaching the package would silently disable all of it, so
39
+ * `library(dplyr); filter(df, id > 2)` would lose the data mask of `dplyr::filter`, and attaching `R6` would
40
+ * lose the class `R6Class("P")` declares. The call itself stays a call to the export, it is only
41
+ * processed by what flowR states about the very same name.
41
42
  */
42
43
  function builtInBehindExport(data, definition) {
43
44
  if (definition.type !== identifier_1.ReferenceType.Function || definition.name === undefined || !node_id_1.NodeId.isBuiltIn(definition.nodeId)
@@ -45,7 +46,13 @@ function builtInBehindExport(data, definition) {
45
46
  return undefined;
46
47
  }
47
48
  const known = data.ctx.env.builtInFunctionOf(definition.name);
48
- return (0, built_in_1.statesNonStandardEvaluation)(known) ? known : undefined;
49
+ if (known !== undefined) {
50
+ return known;
51
+ }
52
+ /* an alias binds the export under a name no built-in lookup finds, but attaching it carried what the
53
+ configuration states about the exported name along */
54
+ const attached = definition;
55
+ return typeof attached.processor === 'function' ? attached : undefined;
49
56
  }
50
57
  /**
51
58
  * Marks the given function call node as only calling built-in functions.
@@ -79,16 +86,15 @@ function processNamedCall(name, args, rootId, data) {
79
86
  /* a set, because an export and the built-in behind it are two ways to the same definition */
80
87
  const toRun = new Set();
81
88
  for (const resolvedFunction of resolved) {
82
- const own = resolvedFunction.type === identifier_1.ReferenceType.BuiltInFunction && typeof resolvedFunction.processor === 'function'
83
- ? resolvedFunction
84
- /* the call goes through the attached export, so it is not built-in only, but flowR's own
85
- definition of that export is what knows how to process it */
86
- : builtInBehindExport(data, resolvedFunction);
89
+ const isBuiltIn = resolvedFunction.type === identifier_1.ReferenceType.BuiltInFunction && typeof resolvedFunction.processor === 'function';
90
+ /* the call goes through the attached export, so it is not built-in only, but flowR's own
91
+ definition of that export is what knows how to process it */
92
+ const own = isBuiltIn ? resolvedFunction : builtInBehindExport(data, resolvedFunction);
87
93
  if (own === undefined) {
88
94
  defaultProcessor = true;
89
95
  continue;
90
96
  }
91
- builtIn ||= own === resolvedFunction && own.config?.libFn !== true;
97
+ builtIn ||= isBuiltIn && own.config?.libFn !== true;
92
98
  toRun.add(own);
93
99
  }
94
100
  for (const own of toRun) {
@@ -96,7 +102,7 @@ function processNamedCall(name, args, rootId, data) {
96
102
  }
97
103
  if (defaultProcessor) {
98
104
  /* if we do not know where we land, we force! reuse `resolved`, data.environment did not change above */
99
- const call = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: resolved.length > 0 ? undefined : 'all', origin: 'default' });
105
+ const call = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, sig: resolved.length > 0 ? undefined : built_in_props_1.FnSig.every, origin: 'default' });
100
106
  information = mergeInformation(information, call.information);
101
107
  }
102
108
  else if (information && builtIn) {
@@ -14,8 +14,8 @@ import { linkExpressionIn } from '../../../linker';
14
14
  */
15
15
  export declare const Quoted: {
16
16
  readonly name: "Quoted";
17
- /** The expression a capturing call holds on to. */
18
- readonly capturedBy: (this: void, graph: DataflowGraph, id: NodeId) => NodeId | undefined;
17
+ /** The expressions a capturing call holds on to. */
18
+ readonly capturedBy: (this: void, graph: DataflowGraph, id: NodeId) => readonly NodeId[];
19
19
  /** Every expression the value at `id` may hold, with the call that captured it. Several is normal. */
20
20
  readonly sourcesOf: (this: void, graph: DataflowGraph, id: NodeId) => readonly CapturedExpression[];
21
21
  /** Links every name in `expr` against `environment` and hands back what stays unresolved. */