@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
@@ -7,6 +7,8 @@ exports.attachDependencyToEnvironment = attachDependencyToEnvironment;
7
7
  exports.attachBaseRNamespaces = attachBaseRNamespaces;
8
8
  exports.attachDeclaredDependencies = attachDeclaredDependencies;
9
9
  exports.attachProjectImports = attachProjectImports;
10
+ exports.attachAssumedPackages = attachAssumedPackages;
11
+ exports.defineProjectSysdata = defineProjectSysdata;
10
12
  exports.attachProject = attachProject;
11
13
  const match_args_1 = require("../../../../../graph/match-args");
12
14
  const r_value_1 = require("../../../../../eval/values/r-value");
@@ -35,6 +37,7 @@ const vertex_1 = require("../../../../../graph/vertex");
35
37
  const r_base_packages_1 = require("../../../../../../util/r-base-packages");
36
38
  const built_in_envir_utils_1 = require("./built-in-envir-utils");
37
39
  const arrays_1 = require("../../../../../../util/collections/arrays");
40
+ const built_in_load_1 = require("./built-in-load");
38
41
  /**
39
42
  * Process a library call like `library` or `require`
40
43
  */
@@ -48,67 +51,49 @@ function processLibrary(name, args, rootId, data, config = {}) {
48
51
  }
49
52
  /* parse the import selection before the library flow rewrites `args` below */
50
53
  const parsedSpec = config.fromImports ? parseFromSpec(args) : { namespaceOnly: config.namespaceOnly };
51
- const params = {
52
- 'package': 'pkg',
53
- 'character.only': 'char',
54
- /* last, so the positional fallback keeps its previous order */
55
- 'pos': 'pos'
56
- };
57
- const argMaps = match_args_1.MatchArgs.toSpec((0, common_1.convertFnArguments)(args), params);
58
- const packageId = (0, arrays_1.uniqueArray)(argMaps.get('pkg') ?? []);
54
+ // 'pos' last, so the positional fallback keeps its previous order; `import::from` has no `pos`, its extra arguments name exports
55
+ const argMaps = match_args_1.MatchArgs.toSpec((0, common_1.convertFnArguments)(args), { 'package': 'pkg', 'character.only': 'char', 'pos': 'pos' });
59
56
  const charId = (0, arrays_1.uniqueArray)(argMaps.get('char') ?? []);
60
- /* `import::from` has no `pos`; its extra arguments name exports */
61
57
  const spec = { ...parsedSpec, pos: config.fromImports ? undefined : (0, built_in_envir_utils_1.resolveAttachPosition)(argMaps.get('pos')?.[0], data) };
62
- let namesToLoad = packageId.map(v => r_argument_1.RArgument.getValue(args, v));
63
- //check if library name provided
64
- namesToLoad = namesToLoad.filter(v => v !== undefined && (r_symbol_1.RSymbol.is(v) || r_string_1.RString.is(v)));
58
+ /* only a symbol or string literal names a package */
59
+ const namesToLoad = (0, arrays_1.uniqueArray)(argMaps.get('pkg') ?? [])
60
+ .map(v => r_argument_1.RArgument.getValue(args, v))
61
+ .filter((v) => v !== undefined && (r_symbol_1.RSymbol.is(v) || r_string_1.RString.is(v)));
65
62
  if (namesToLoad.length === 0) {
66
63
  logger_1.dataflowLogger.warn('No library name provided, skipping');
67
64
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true, origin: 'default' }).information;
68
65
  }
69
66
  for (const nameToLoad of namesToLoad) {
70
- if (nameToLoad !== undefined && (r_symbol_1.RSymbol.is(nameToLoad) || r_string_1.RString.is(nameToLoad)) && identifier_1.Identifier.getNamespace(r_string_1.RString.is(nameToLoad) ? nameToLoad.content.str : nameToLoad.content) !== undefined) {
67
+ if (identifier_1.Identifier.getNamespace(r_string_1.RString.is(nameToLoad) ? nameToLoad.content.str : nameToLoad.content) !== undefined) {
71
68
  logger_1.dataflowLogger.warn('Namespaced library names are not supported, ignoring namespace of library: ', nameToLoad);
72
69
  }
73
70
  }
74
71
  let isCharacterOnly = config.characterOnly === true;
75
72
  if (!config.characterOnly && charId.length >= 1) {
76
73
  const values = node_value_1.NodeValue.setOf(charId[0], data);
77
- if (values?.type === 'set' && values?.elements.length > 0) {
78
- let hasTrue = 0;
79
- let hasFalse = 0;
80
- let hasMaybe = 0;
74
+ if (values?.type === 'set' && values.elements.length > 0) {
75
+ let seenTrue = false;
76
+ let seenFalse = false;
77
+ let seenMaybe = false;
81
78
  for (const elem of values.elements) {
82
- if (elem.type === 'logical') {
83
- switch (elem.value) {
84
- case true:
85
- hasTrue++;
86
- break;
87
- case false:
88
- hasFalse++;
89
- break;
90
- default:
91
- hasMaybe++;
92
- break;
93
- }
79
+ if (elem.type !== 'logical') {
80
+ continue;
81
+ }
82
+ else if (elem.value === true) {
83
+ seenTrue = true;
84
+ }
85
+ else if (elem.value === false) {
86
+ seenFalse = true;
87
+ }
88
+ else {
89
+ seenMaybe = true;
94
90
  }
95
91
  }
96
- if (hasMaybe > 0) {
97
- isCharacterOnly = 'maybe';
98
- }
99
- else if (hasTrue === 0 && hasFalse > 0) {
100
- isCharacterOnly = false;
101
- }
102
- else if (hasTrue > 0 && hasFalse === 0) {
103
- isCharacterOnly = true;
104
- }
105
- else {
106
- isCharacterOnly = 'maybe';
107
- }
92
+ /* mixed true/false, no logical value at all, or an explicit NA are all treated the same: uncertain */
93
+ isCharacterOnly = seenMaybe || seenTrue === seenFalse ? 'maybe' : seenTrue;
108
94
  }
109
95
  }
110
96
  const packetName = [];
111
- //case: true or maybe
112
97
  if (isCharacterOnly) {
113
98
  for (const nameToLoad of namesToLoad) {
114
99
  const values = node_value_1.NodeValue.setOf(nameToLoad.info.id, data);
@@ -123,32 +108,20 @@ function processLibrary(name, args, rootId, data, config = {}) {
123
108
  }
124
109
  }
125
110
  if (!isCharacterOnly || isCharacterOnly === 'maybe') {
111
+ // treat as a function call but convert the argument(s) to a string; a quoted literal carries its name in `content.str`, not `lexeme`
112
+ const newArgs = [];
126
113
  for (const nameToLoad of namesToLoad) {
127
- // a quoted literal (`requireNamespace("pkg")`) carries its name in `content.str`, not the quoted `lexeme`
128
114
  const packageName = r_string_1.RString.is(nameToLoad) ? nameToLoad.content.str : nameToLoad.lexeme;
129
115
  if ((0, assert_1.isNotUndefined)(packageName)) {
130
116
  packetName.push(packageName);
131
117
  }
132
- }
133
- }
134
- if (!isCharacterOnly || isCharacterOnly === 'maybe') {
135
- // treat as a function call but convert the first argument to a string
136
- const newArgs = [];
137
- for (const nameToLoad of namesToLoad) {
138
- if (!(r_symbol_1.RSymbol.is(nameToLoad) || r_string_1.RString.is(nameToLoad))) {
139
- continue;
140
- }
141
- const newArg = r_string_1.RString.is(nameToLoad) ? nameToLoad : {
118
+ newArgs.push(r_string_1.RString.is(nameToLoad) ? nameToLoad : {
142
119
  type: type_1.RType.String,
143
120
  info: nameToLoad.info,
144
121
  lexeme: nameToLoad.lexeme,
145
122
  location: nameToLoad.location,
146
- content: {
147
- quotes: 'none',
148
- str: identifier_1.Identifier.getName(nameToLoad.content)
149
- }
150
- };
151
- newArgs.push(newArg);
123
+ content: { quotes: 'none', str: identifier_1.Identifier.getName(nameToLoad.content) }
124
+ });
152
125
  }
153
126
  args = (0, make_argument_1.wrapArgumentsUnnamed)([...newArgs, ...args.slice(1)], data.completeAst.idMap);
154
127
  }
@@ -163,6 +136,10 @@ function processLibrary(name, args, rootId, data, config = {}) {
163
136
  if (dependency) {
164
137
  linkLibrary(dependency, info, rootId, data, spec);
165
138
  }
139
+ else if (data.ctx.env.statedFor(p) !== undefined) {
140
+ /* nothing resolved the package's exports, but flowR states what some of its calls mean, so `library()` brings those into scope */
141
+ info.environment = attachStatedDefinitions(p, info.environment, data.ctx, spec, undefined, rootId, data.cds);
142
+ }
166
143
  else {
167
144
  if (!data.ctx.env.knowsPackage(p)) {
168
145
  info.graph.markIdForUnknownSideEffects(rootId);
@@ -259,13 +236,6 @@ function parseBoxSpec(first) {
259
236
  }
260
237
  return { pack, spec: { include: include.size > 0 ? include : undefined, all } };
261
238
  }
262
- /** Whether `use` should be read as `box::use` here: a `box::`-qualified call, or `box` is a loaded dependency. */
263
- function usesBoxSemantics(name, data) {
264
- if (identifier_1.Identifier.getNamespace(name.content) === "box" /* PkgName.Box */) {
265
- return true;
266
- }
267
- return data.ctx.deps.getDependency("box" /* PkgName.Box */) !== undefined;
268
- }
269
239
  /**
270
240
  * Process a `use` call, library-sensitively: `pkg[...]` uses box's bracket selection; a bare `pkg` is box's
271
241
  * namespace-only member access when box is loaded, otherwise `import::from`-style extra-argument selection.
@@ -278,6 +248,9 @@ function processUse(name, args, rootId, data) {
278
248
  if (parsed && dependency) {
279
249
  linkLibrary(dependency, info, rootId, data, parsed.spec);
280
250
  }
251
+ else if (parsed && data.ctx.env.statedFor(parsed.pack) !== undefined) {
252
+ info.environment = attachStatedDefinitions(parsed.pack, info.environment, data.ctx, parsed.spec, undefined, rootId, data.cds);
253
+ }
281
254
  else {
282
255
  info.graph.markIdForUnknownSideEffects(rootId);
283
256
  }
@@ -293,7 +266,8 @@ function parseUseSpec(name, first, args, data) {
293
266
  if (pack === undefined) {
294
267
  return undefined;
295
268
  }
296
- if (usesBoxSemantics(name, data)) {
269
+ // box::use is read as box's namespace-only member access: a box::-qualified call, or box is a loaded dependency
270
+ if (identifier_1.Identifier.getNamespace(name.content) === "box" /* PkgName.Box */ || data.ctx.deps.getDependency("box" /* PkgName.Box */) !== undefined) {
297
271
  return { pack, spec: { namespaceOnly: true } }; // box: use(pkg) is member access via pkg$fn
298
272
  }
299
273
  return { pack, spec: parseFromSpec(args) }; // extra-argument selection: use(pkg, a, b) / use(pkg)
@@ -314,10 +288,8 @@ function attachExportVertex(graph, builtInId, environment, ctx, cds) {
314
288
  /** Reserved marker binding recording an unresolved `library()`/`require()` load; the leading space cannot collide with a real export name. */
315
289
  const libraryLoadMarker = ' library-load';
316
290
  /**
317
- * Record a syntactically known but database-unresolved package load below the global environment: a bare
318
- * {@link EnvType.LoadedNamespace} layer for `pack` carrying only the reserved {@link libraryLoadMarker} whose
319
- * `definedAt` is the load call. This lets an explicit `pack::fn` link back via {@link loadNodesForNamespace}
320
- * even without a signature database.
291
+ * Record a syntactically known but database-unresolved package load: a bare {@link EnvType.LoadedNamespace} layer
292
+ * carrying only the reserved {@link libraryLoadMarker}, so an explicit `pack::fn` still links back via {@link loadNodesForNamespace}.
321
293
  */
322
294
  function recordUnresolvedLibraryLoad(envInfo, pack, rootId, pos, cds) {
323
295
  const layer = new environment_1.Environment(envInfo.current).asLibrary(pack, environment_1.EnvType.LoadedNamespace).define({
@@ -360,8 +332,7 @@ function linkLibrary(dependency, info, rootId, data, spec = {}) {
360
332
  if (isAttached(info.environment.current, pack, spec.namespaceOnly)) {
361
333
  return;
362
334
  }
363
- // by default only the environment carries the exports; their built-in vertices are materialized on
364
- // demand when a call resolves to one (see attachExportVertex). Eager mode registers them all upfront.
335
+ // by default only the environment carries the exports, materializing a vertex on demand (see attachExportVertex); eager mode registers them all upfront
365
336
  if (data.ctx.config.solver.sigdb.eagerlyLoadExports) {
366
337
  for (const { exported: func } of selectExports((0, flowr_namespace_file_1.getCallables)(dependency.namespaceInfo), spec)) {
367
338
  const builtInId = node_id_1.NodeId.fromPkgFn(pack, func);
@@ -379,42 +350,57 @@ function selectExports(callables, spec) {
379
350
  }
380
351
  return callables.filter(c => !spec.exclude?.has(c)).map(c => ({ exported: c, as: c }));
381
352
  }
382
- /** The identifier definition binding a package export (or its alias) to its built-in function-definition. */
383
- function exportDefinition(pack, exp, definedAt = node_id_1.NodeId.toBuiltIn(pack)) {
384
- return {
353
+ /**
354
+ * The identifier definition binding a package export (or its alias) to its built-in function-definition.
355
+ * The identity stays the plain export (so a call still materializes its `built-in:pkg:fn` vertex); whatever the configuration states about that name (processor, config, eval handler) rides along on top.
356
+ */
357
+ function exportDefinition(pack, exp, ctx, definedAt = node_id_1.NodeId.toBuiltIn(pack)) {
358
+ const identity = {
385
359
  name: identifier_1.Identifier.make(exp.as, pack),
386
360
  type: identifier_1.ReferenceType.Function,
387
361
  nodeId: node_id_1.NodeId.fromPkgFn(pack, exp.exported),
388
362
  definedAt,
389
363
  };
390
- }
391
- /** Whether a subset import restricts the attached exports, so no imports layer is materialized. */
392
- function isSubsetAttach(spec) {
393
- return spec.include !== undefined && !spec.all;
364
+ const stated = ctx.env.statedFor(pack)?.get(identifier_1.Identifier.make(exp.exported))?.[0];
365
+ if (stated === undefined) {
366
+ return identity;
367
+ }
368
+ /* the identity stays the export (so the call still earns its `built-in:pkg:fn` vertex); the configuration's take on the same name rides along */
369
+ const { processor, config, evalHandler } = stated;
370
+ return { ...identity, processor, config, evalHandler };
394
371
  }
395
372
  /**
396
- * Attaches `dependency`'s exports at `spec`'s {@link AttachSpec#pos|search position} (below the global environment by
397
- * default, see {@link REnvironment.attachAt|attachPackageAt}) and returns the
398
- * enriched environment (the graph is untouched). Used by `library()`, `import::from`, `box::use`, `requireNamespace`,
399
- * and the transitive side-effect propagation.
373
+ * Attaches `dependency`'s exports at `spec`'s {@link AttachSpec#pos|search position} (below global by default) and
374
+ * returns the enriched environment (graph untouched). Used by `library()`, `import::from`, `box::use`, `requireNamespace`, and transitive side-effect propagation.
400
375
  */
401
376
  function attachDependencyToEnvironment(dependency, envInfo, ctx, spec = {}, definedAt) {
402
377
  const pack = dependency.name;
403
- if ((0, assert_1.isUndefined)(dependency.namespaceInfo) || isAttached(envInfo.current, pack, spec.namespaceOnly)) {
378
+ if (isAttached(envInfo.current, pack, spec.namespaceOnly)) {
404
379
  return envInfo;
405
380
  }
381
+ if (spec.pos === undefined && !spec.namespaceOnly) {
382
+ const startup = startupAttachPosition(pack, envInfo.current);
383
+ if (startup !== undefined) {
384
+ spec = { ...spec, pos: startup };
385
+ }
386
+ }
387
+ if ((0, assert_1.isUndefined)(dependency.namespaceInfo)) {
388
+ /* nothing resolved the package's exports, but what flowR states about them is still what a call means, and `library()` brings it into scope */
389
+ return attachStatedDefinitions(pack, envInfo, ctx, spec);
390
+ }
406
391
  const exports = selectExports((0, flowr_namespace_file_1.getCallables)(dependency.namespaceInfo), spec);
407
- if (spec.namespaceOnly || isSubsetAttach(spec)) {
392
+ // a subset import restricts the attached exports, so no imports layer is materialized
393
+ if (spec.namespaceOnly || (spec.include !== undefined && !spec.all)) {
408
394
  const layerType = spec.namespaceOnly ? environment_1.EnvType.LoadedNamespace : environment_1.EnvType.Namespace;
409
395
  const layer = new environment_1.Environment(envInfo.current).asLibrary(pack, layerType)
410
- .defineAll(exports.map(exp => exportDefinition(pack, exp, definedAt)));
396
+ .defineAll(exports.map(exp => exportDefinition(pack, exp, ctx, definedAt)));
411
397
  return { level: envInfo.level, current: environment_1.REnvironment.attachAt(envInfo.current, layer, layer, spec.pos) };
412
398
  }
413
399
  // full attach: imports layer at the bottom, namespace (exports) layer on top
414
400
  let importsEnv = new environment_1.Environment(envInfo.current).asLibrary(pack, environment_1.EnvType.Imports);
415
401
  importsEnv = recImports(importsEnv, dependency.namespaceInfo, ctx, new Set());
416
402
  const namespaceEnv = new environment_1.Environment(importsEnv).asLibrary(pack, environment_1.EnvType.Namespace)
417
- .defineAll(exports.map(exp => exportDefinition(pack, exp, definedAt)));
403
+ .defineAll(exports.map(exp => exportDefinition(pack, exp, ctx, definedAt)));
418
404
  const attached = { level: envInfo.level, current: environment_1.REnvironment.attachAt(envInfo.current, namespaceEnv, importsEnv, spec.pos) };
419
405
  /* whatever R puts on the search path with it, `pack` first so a dependency cycle stays finite (the guard above stops it) */
420
406
  return (0, attached_packages_1.attachedAlongside)(pack, ctx.deps.signatureSources()).reduce((env, alongside) => {
@@ -425,9 +411,42 @@ function attachDependencyToEnvironment(dependency, envInfo, ctx, spec = {}, defi
425
411
  /** A namespace-only load is subsumed by any layer for `pack`; a full attach ignores a mere {@link EnvType.LoadedNamespace}. */
426
412
  function blocksAttach(layer, namespaceOnly) {
427
413
  if (namespaceOnly) {
428
- return true;
414
+ return layer.t !== environment_1.EnvType.AssumedNamespace;
415
+ }
416
+ /* an assumption stands in for a `library()` that was not analyzed, so the real one still attaches over it */
417
+ return layer.t !== environment_1.EnvType.LoadedNamespace && layer.t !== environment_1.EnvType.AssumedNamespace;
418
+ }
419
+ /**
420
+ * The `search()` order R attaches its startup packages in, deepest last (`base` is always the last entry),
421
+ * `undefined` for a package R does not attach on startup.
422
+ */
423
+ function startupAttachRank(pack) {
424
+ if (pack === undefined || !r_base_packages_1.AttachedBasePackageSet.has(pack)) {
425
+ return undefined;
429
426
  }
430
- return layer.t !== environment_1.EnvType.LoadedNamespace;
427
+ return pack === "base" /* PkgName.Base */ ? r_base_packages_1.AttachedBasePackages.length : r_base_packages_1.AttachedBasePackages.indexOf(pack);
428
+ }
429
+ /**
430
+ * The `search()` position `library(pack)` attaches a startup-attached package at, `undefined` for every other package.
431
+ * Re-attaching an already-attached package does not move it, so `library(dplyr); library(stats)` must still leave `filter` with `dplyr`.
432
+ */
433
+ function startupAttachPosition(pack, env) {
434
+ const rank = startupAttachRank(pack);
435
+ if (rank === undefined) {
436
+ return undefined;
437
+ }
438
+ let pos = environment_1.DefaultAttachPosition;
439
+ for (let e = environment_1.REnvironment.findGlobal(env).parent; !e.builtInEnv; e = e.parent) {
440
+ if (e.t === environment_1.EnvType.Imports) {
441
+ continue; // internal layer, not a search-path entry
442
+ }
443
+ const other = startupAttachRank(e.n);
444
+ if (other !== undefined && other > rank) {
445
+ break;
446
+ }
447
+ pos++;
448
+ }
449
+ return pos;
431
450
  }
432
451
  /** Whether package `pack` is already attached below the global env in a way that makes this (re-)attach a no-op. */
433
452
  function isAttached(env, pack, namespaceOnly) {
@@ -445,8 +464,7 @@ function baseNamespaceCacheKey(ctx, basePackages) {
445
464
  }
446
465
  /**
447
466
  * Attach the {@link baseRPackages|base-R} exports below the global so bare base calls resolve without `library()`.
448
- * Names with a registered built-in are skipped, it is a no-op when no database resolves a base package, and the
449
- * built layer is cached per {@link baseNamespaceCacheKey}.
467
+ * No-op when no database resolves a base package; the built layer is cached per {@link baseNamespaceCacheKey}.
450
468
  */
451
469
  function attachBaseRNamespaces(env, ctx) {
452
470
  if (!ctx.config.solver.sigdb.linkBaseR || !ctx.deps.hasBaseRSource()) {
@@ -475,11 +493,8 @@ function attachBaseRNamespaces(env, ctx) {
475
493
  return built;
476
494
  }
477
495
  /**
478
- * Attach the exports of the project's declared `DESCRIPTION` dependencies (Imports/Depends, registered by the
479
- * package-version plugins into {@link FlowrAnalyzerContext.deps|deps}) below the global so their bare calls resolve
480
- * without an explicit `library()`, mirroring base-R auto-attach. A dependency whose {@link Package.namespaceInfo|
481
- * namespaceInfo} no database resolves is skipped, and a package base-R or an earlier iteration already attached is a
482
- * no-op via the {@link isAttached} guard inside {@link attachDependencyToEnvironment}.
496
+ * Attach the project's declared `DESCRIPTION` dependencies below the global, mirroring base-R auto-attach, so their bare
497
+ * calls resolve without an explicit `library()`; skips a dependency no database resolves, no-ops via {@link isAttached}.
483
498
  */
484
499
  function attachDeclaredDependencies(env, ctx) {
485
500
  if (!ctx.config.solver.sigdb.linkDescriptionDependencies) {
@@ -532,9 +547,82 @@ function attachProjectImports(env, ctx) {
532
547
  const layer = new environment_1.Environment(env.current).asLibrary(layerNamespace, environment_1.EnvType.Imports).defineAll(toDefine);
533
548
  return { level: env.level, current: environment_1.REnvironment.attachAt(env.current, layer, layer) };
534
549
  }
535
- /** attach every project-level environment layer in order: base R namespaces, the project's own `importFrom` symbols, then its declared dependencies */
550
+ /** Attaches the definitions flowR states for `pack`, for a package whose own exports nothing could resolve. */
551
+ function attachStatedDefinitions(pack, envInfo, ctx, spec, as, loadedAt, cds) {
552
+ const stated = ctx.env.statedFor(pack);
553
+ if (stated === undefined) {
554
+ return envInfo;
555
+ }
556
+ /* keyed as the configuration states them: a replacement is bound under `f<-`, which its `name` does not say */
557
+ const memory = new Map(stated);
558
+ if (loadedAt !== undefined) {
559
+ /* the marker an unresolved load leaves behind, so a call links back to the `library()` that made it resolve */
560
+ memory.set(libraryLoadMarker, [{
561
+ name: identifier_1.Identifier.make(libraryLoadMarker, pack),
562
+ type: identifier_1.ReferenceType.Function,
563
+ nodeId: loadedAt,
564
+ definedAt: loadedAt,
565
+ cds: cds?.slice()
566
+ }]);
567
+ }
568
+ const layer = new environment_1.Environment(envInfo.current)
569
+ .asLibrary(pack, as ?? (spec.namespaceOnly ? environment_1.EnvType.LoadedNamespace : environment_1.EnvType.Namespace));
570
+ layer.memory = memory;
571
+ return { level: envInfo.level, current: environment_1.REnvironment.attachAt(envInfo.current, layer, layer, spec.pos) };
572
+ }
573
+ /**
574
+ * The `search()` position an assumed package attaches at: past every entry, directly above the built-ins.
575
+ * Anything the code attaches itself must be found first, or the assumption would wrongly answer for it.
576
+ */
577
+ const AssumedAttachPosition = Number.MAX_SAFE_INTEGER;
578
+ /**
579
+ * Attaches the packages `solver.assumeAttachedPackages` names as if the code had called `library()` on them.
580
+ * Covers the case where such a call is simply not part of what is being analyzed (a snippet, a chunk, a cell).
581
+ */
582
+ function attachAssumedPackages(env, ctx) {
583
+ const assumed = ctx.config.solver.assumeAttachedPackages;
584
+ if (assumed === undefined || assumed.length === 0) {
585
+ return env;
586
+ }
587
+ let built = env;
588
+ /* each attaches below the one before, so walking backwards makes the first name given win a shared export */
589
+ for (let i = assumed.length - 1; i >= 0; i--) {
590
+ const pkg = assumed[i];
591
+ const dependency = ctx.deps.getDependency(pkg);
592
+ if (dependency?.namespaceInfo !== undefined) {
593
+ built = attachDependencyToEnvironment(dependency, built, ctx, {}, node_id_1.NodeId.toBuiltIn(pkg));
594
+ continue;
595
+ }
596
+ built = attachStatedDefinitions(pkg, built, ctx, { pos: AssumedAttachPosition }, environment_1.EnvType.AssumedNamespace);
597
+ }
598
+ return built;
599
+ }
600
+ /**
601
+ * Defines the objects `R/sysdata.rda` lazy-loads into the package namespace: internal, not exported, available
602
+ * to the package's own code without a call bringing them in. Modelled on the global env for R's resolution order.
603
+ * @see https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Data-in-packages
604
+ */
605
+ function defineProjectSysdata(env, ctx) {
606
+ const namespace = ctx.meta.getNamespace();
607
+ /* only a package has a namespace to lazy-load into */
608
+ if (namespace === undefined) {
609
+ return env;
610
+ }
611
+ const objects = ctx.files.sysdataObjects();
612
+ if (objects.length === 0) {
613
+ return env;
614
+ }
615
+ const definedAt = node_id_1.NodeId.toBuiltIn(namespace);
616
+ return { level: env.level, current: env.current.defineAll(objects.map(object => ({
617
+ name: identifier_1.Identifier.make(object.name, namespace),
618
+ type: (0, built_in_load_1.sexpTypeToReferenceType)(object.type),
619
+ nodeId: node_id_1.NodeId.fromPkgFn(namespace, object.name),
620
+ definedAt
621
+ }))) };
622
+ }
623
+ /** attach every project-level environment layer in order: base R namespaces, the project's own `importFrom` symbols, its declared dependencies, whatever the configuration assumes attached, then the package's own system data */
536
624
  function attachProject(env, ctx) {
537
- return attachDeclaredDependencies(attachProjectImports(attachBaseRNamespaces(env, ctx), ctx), ctx);
625
+ return defineProjectSysdata(attachAssumedPackages(attachDeclaredDependencies(attachProjectImports(attachBaseRNamespaces(env, ctx), ctx), ctx), ctx), ctx);
538
626
  }
539
627
  function recImports(importsEnv, namespaceInfo, ctx, alreadyImportedAll) {
540
628
  for (const imp of namespaceInfo.importedPackages) {
@@ -3,6 +3,8 @@ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/
3
3
  import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
4
  import type { DataflowProcessorInformation } from '../../../../../processor';
5
5
  import type { DataflowInformation } from '../../../../../info';
6
+ import { ReferenceType } from '../../../../../environments/identifier';
7
+ import { SexpType } from '../../../../../../project/plugins/file-plugins/files/flowr-rda-file';
6
8
  import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
7
9
  /**
8
10
  * Processes a built-in 'load' function call by retrieving the names of the variables loaded by the given file.
@@ -10,3 +12,5 @@ import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-
10
12
  * adds control dependencies between the variables and the loaded file.
11
13
  */
12
14
  export declare function processLoadCall<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
15
+ /** The kind of reference a serialized R object stands for, from the {@link SexpType} it was stored as. */
16
+ export declare function sexpTypeToReferenceType(type?: SexpType): ReferenceType;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processLoadCall = processLoadCall;
4
+ exports.sexpTypeToReferenceType = sexpTypeToReferenceType;
4
5
  const match_args_1 = require("../../../../../graph/match-args");
5
6
  const known_call_handling_1 = require("../known-call-handling");
6
7
  const identifier_1 = require("../../../../../environments/identifier");
@@ -186,6 +187,7 @@ function defineLoadedClosure(syntheticId, variable, fn, envir, loadLocation, loa
186
187
  }, envir);
187
188
  fn.information.graph.addEdge(syntheticId, fdefId, edge_1.EdgeType.DefinedBy);
188
189
  }
190
+ /** The kind of reference a serialized R object stands for, from the {@link SexpType} it was stored as. */
189
191
  function sexpTypeToReferenceType(type) {
190
192
  if (type === undefined) {
191
193
  return identifier_1.ReferenceType.Unknown;
@@ -3,10 +3,9 @@ import { type DataflowInformation } from '../../../../../info';
3
3
  import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
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
- import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
- import type { ForceArguments } from '../common';
6
+ import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
8
7
  import { Unquote } from '../nse';
9
- interface QuoteConfig extends ForceArguments {
8
+ interface QuoteConfig {
10
9
  quoteArgumentsWithIndex: number;
11
10
  envArgIndex?: number;
12
11
  /** which unquote escape the function supports, {@link Unquote.None} if unset */
@@ -12,6 +12,7 @@ const graph_1 = require("../../../../../graph/graph");
12
12
  const nse_1 = require("../nse");
13
13
  const linker_1 = require("../../../../linker");
14
14
  const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
15
+ const scoping_1 = require("../../../../../environments/scoping");
15
16
  /**
16
17
  * Process a call to `quote` or similar nse/substitution functions.
17
18
  */
@@ -19,11 +20,11 @@ function processQuote(name, args, rootId, data, config) {
19
20
  const startEnv = data.environment;
20
21
  let lastEnv = startEnv;
21
22
  const { information, processedArguments, fnRef } = (0, known_call_handling_1.processKnownFunctionCall)({
22
- name, args, rootId, data, forceArgs: config.forceArgs, origin: built_in_proc_name_1.BuiltInProcName.Quote,
23
+ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Quote,
23
24
  patchData(data, index) {
24
25
  if (index === config.quoteArgumentsWithIndex) {
25
26
  lastEnv = data.environment;
26
- return { ...data, environment: data.ctx.env.makeCleanEnv() };
27
+ return { ...data, environment: (0, scoping_1.cleanEnvOf)(data.environment) };
27
28
  }
28
29
  else {
29
30
  return { ...data, environment: lastEnv };
@@ -81,7 +82,7 @@ function usesByName(expr) {
81
82
  const useMap = new Map();
82
83
  for (const vType of [vertex_1.VertexType.Use, vertex_1.VertexType.FunctionCall]) {
83
84
  for (const [useId] of expr.graph.verticesOfType(vType)) {
84
- const rn = (0, node_id_1.recoverName)(useId, expr.graph.idMap);
85
+ const rn = node_id_1.NodeId.recoverName(useId, expr.graph.idMap);
85
86
  if (rn) {
86
87
  const arr = useMap.get(rn);
87
88
  if (arr) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processRepeatLoop = processRepeatLoop;
4
+ const built_in_props_1 = require("../../../../../environments/built-in-props");
4
5
  const info_1 = require("../../../../../info");
5
6
  const linker_1 = require("../../../../linker");
6
7
  const known_call_handling_1 = require("../known-call-handling");
@@ -31,7 +32,7 @@ function processRepeatLoop(name, args, rootId, data) {
31
32
  args: unpacked ? [unpacked] : args,
32
33
  rootId,
33
34
  data,
34
- forceArgs: 'all',
35
+ sig: built_in_props_1.FnSig.every,
35
36
  patchData: (d, i) => {
36
37
  if (i === 0) {
37
38
  return { ...d, cds: [...d.cds ?? [], { id: name.info.id }] };
@@ -1,6 +1,5 @@
1
1
  import type { DataflowProcessorInformation } from '../../../../../processor';
2
2
  import { DataflowInformation } from '../../../../../info';
3
- import { type ForceArguments } from '../common';
4
3
  import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
4
  import { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
5
  import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
@@ -17,4 +16,4 @@ args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootI
17
16
  assignmentOperator?: '<-' | '<<-';
18
17
  readIndices?: boolean;
19
18
  assignRootId?: NodeId;
20
- } & ForceArguments): DataflowInformation;
19
+ }): DataflowInformation;
@@ -75,7 +75,6 @@ args, rootId, data, config) {
75
75
  data,
76
76
  functionRootId: rootId,
77
77
  finalGraph: res.graph,
78
- forceArgs: config.forceArgs,
79
78
  });
80
79
  const cfgEntry = control_flow_1.ControlFlow.inSequence(res.graph, indexArguments, control_flow_1.ControlFlow.entryOf(res));
81
80
  const targetNode = (0, unpack_argument_1.unpackArg)(args[0]);
@@ -18,6 +18,7 @@ const built_in_envir_utils_1 = require("./built-in-envir-utils");
18
18
  const built_in_stack_env_1 = require("./built-in-stack-env");
19
19
  const resolve_helper_1 = require("../../../../../environments/resolve-helper");
20
20
  const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
21
+ const scoping_1 = require("../../../../../environments/scoping");
21
22
  /** whether `value` is a call to the *built-in* `ls`/`objects` that lists (and thus clears) the whole scope */
22
23
  function isBuiltInLsCall(value, data) {
23
24
  if (!r_function_call_2.RFunctionCall.is(value) || !value.named) {
@@ -182,7 +183,7 @@ function processRm(name, args, rootId, data) {
182
183
  name, args, rootId, data,
183
184
  origin: built_in_proc_name_1.BuiltInProcName.Rm,
184
185
  /* an unevaluated name must not resolve against the environment */
185
- patchData: (d, i) => nse.has(i) ? { ...d, environment: d.ctx.env.makeCleanEnv() } : d
186
+ patchData: (d, i) => nse.has(i) ? { ...d, environment: (0, scoping_1.cleanEnvOf)(d.environment) } : d
186
187
  });
187
188
  (0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, [...nse]);
188
189
  /* the enclosing scope would link the unevaluated names, so they must not escape this call */
@@ -0,0 +1,31 @@
1
+ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
2
+ import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
3
+ import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
4
+ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
5
+ import type { DataflowInformation } from '../../../../../info';
6
+ import type { DataflowProcessorInformation } from '../../../../../processor';
7
+ import { type ClassArgRef, argFor } from '../../../../../fn/class-declaration';
8
+ import { type Identifier } from '../../../../../environments/identifier';
9
+ /** shorthand for the decorated-info generics every helper below carries through */
10
+ type Data<O> = DataflowProcessorInformation<O & ParentInformation>;
11
+ type Args<O> = readonly PotentiallyEmptyRArgument<O & ParentInformation>[];
12
+ /** The registry name of the S4 class `cls`, see {@link S4ClassMark}. */
13
+ export declare function s4ClassName(cls: string): Identifier;
14
+ /** Which arguments of a call name S4 registrations it depends on rather than declares. */
15
+ export interface S4UseConfig {
16
+ /** the argument naming the S4 generic the call answers or asks about (`f` in `setMethod`) */
17
+ readonly genericArg?: ClassArgRef;
18
+ /** the arguments naming S4 classes the call uses (`Class` in `new`, `signature` in `setMethod`) */
19
+ readonly classArgs?: readonly ClassArgRef[];
20
+ /** the argument naming an S4 class the call adds to without declaring it (`to` in `setAs`): read and registered anew, so a later use depends on this call as well as on the declaration */
21
+ readonly registersArg?: ClassArgRef;
22
+ }
23
+ export { argFor };
24
+ /** 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 */
25
+ export declare function linkS4Uses<O>(info: DataflowInformation, args: Args<O>, rootId: NodeId, data: Data<O>, config: S4UseConfig): void;
26
+ /** 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 */
27
+ export declare function linkS4Declaration<O>(info: DataflowInformation, rootId: NodeId, data: Data<O>): void;
28
+ /** Records that the call registers the S4 generics it names, which `setMethod` and a call of the name depend on. */
29
+ export declare function linkS4Generic<O>(info: DataflowInformation, rootId: NodeId, names: readonly string[], data: Data<O>): void;
30
+ /** Processes a call that consumes S4 registrations without declaring any, like `new("P")` or `getMethod("f", "P")`. */
31
+ export declare function processS4Use<O>(name: RSymbol<O & ParentInformation>, args: Args<O>, rootId: NodeId, data: Data<O>, config: S4UseConfig): DataflowInformation;