@eagleoutice/flowr 2.12.2 → 2.13.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 (319) hide show
  1. package/README.md +38 -91
  2. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
  3. package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
  4. package/abstract-interpretation/data-frame/semantics.js +12 -16
  5. package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
  6. package/abstract-interpretation/domains/abstract-domain.js +146 -6
  7. package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
  8. package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
  9. package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
  10. package/abstract-interpretation/domains/interval-domain.js +111 -146
  11. package/abstract-interpretation/domains/lattice.d.ts +3 -3
  12. package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
  13. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
  14. package/abstract-interpretation/domains/partial-product-domain.js +21 -54
  15. package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
  16. package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
  17. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/product-domain.js +4 -4
  19. package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
  20. package/abstract-interpretation/domains/set-range-domain.js +141 -200
  21. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
  22. package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
  23. package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
  24. package/abstract-interpretation/domains/singleton-domain.js +33 -72
  25. package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
  26. package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
  27. package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
  28. package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
  29. package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
  30. package/benchmark/slicer.d.ts +2 -2
  31. package/benchmark/slicer.js +6 -5
  32. package/cli/common/options.d.ts +10 -0
  33. package/cli/common/options.js +2 -0
  34. package/cli/common/scripts-info.d.ts +10 -0
  35. package/cli/flowr-main-options.d.ts +4 -0
  36. package/cli/flowr-main-options.js +5 -0
  37. package/cli/flowr.d.ts +5 -0
  38. package/cli/flowr.js +15 -7
  39. package/cli/repl/commands/repl-query.js +42 -20
  40. package/cli/repl/commands/repl-signature.js +2 -2
  41. package/cli/repl/core.d.ts +14 -5
  42. package/cli/repl/core.js +32 -17
  43. package/cli/repl/parser/slice-query-parser.d.ts +69 -8
  44. package/cli/repl/parser/slice-query-parser.js +82 -13
  45. package/cli/repl/path-input.d.ts +6 -0
  46. package/cli/repl/path-input.js +41 -0
  47. package/cli/repl/print-version.js +3 -5
  48. package/cli/slicer-app.d.ts +2 -0
  49. package/cli/slicer-app.js +2 -1
  50. package/config.d.ts +54 -6
  51. package/config.js +133 -12
  52. package/control-flow/control-flow-graph.d.ts +3 -2
  53. package/control-flow/control-flow-graph.js +34 -14
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
  55. package/control-flow/semantic-cfg-guided-visitor.js +3 -0
  56. package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
  57. package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
  58. package/data/r-base-packages.generated.d.ts +1 -1
  59. package/data/r-base-packages.generated.js +3 -3
  60. package/data/sigdb/sigdb.remote.json +53 -53
  61. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  62. package/dataflow/environments/built-in-proc-name.js +2 -0
  63. package/dataflow/environments/built-in.d.ts +2 -0
  64. package/dataflow/environments/built-in.js +2 -0
  65. package/dataflow/environments/default-builtin-config.d.ts +3 -5
  66. package/dataflow/environments/default-builtin-config.js +2 -2
  67. package/dataflow/environments/environment.d.ts +9 -0
  68. package/dataflow/environments/environment.js +28 -7
  69. package/dataflow/environments/identifier.d.ts +1 -2
  70. package/dataflow/environments/identifier.js +1 -5
  71. package/dataflow/extractor.js +1 -2
  72. package/dataflow/graph/dataflowgraph-builder.js +42 -3
  73. package/dataflow/graph/df-helper.d.ts +15 -0
  74. package/dataflow/graph/df-helper.js +20 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
  76. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  77. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
  80. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
  84. package/documentation/data/faq/faqs.js +12 -1
  85. package/documentation/doc-readme.js +1 -1
  86. package/documentation/doc-util/doc-files.d.ts +2 -2
  87. package/documentation/doc-util/doc-files.js +4 -7
  88. package/documentation/doc-util/doc-query.d.ts +12 -9
  89. package/documentation/doc-util/doc-query.js +63 -28
  90. package/documentation/wiki-absint.js +1 -4
  91. package/documentation/wiki-analyzer.js +8 -3
  92. package/documentation/wiki-cfg.js +3 -2
  93. package/documentation/wiki-dataflow-graph.js +14 -4
  94. package/documentation/wiki-interface.js +29 -16
  95. package/documentation/wiki-mk/doc-maker.js +1 -1
  96. package/documentation/wiki-query.js +189 -30
  97. package/documentation/wiki-signature-database.d.ts +1 -1
  98. package/documentation/wiki-signature-database.js +53 -27
  99. package/linter/linter-output.d.ts +24 -0
  100. package/linter/linter-output.js +117 -0
  101. package/linter/linter-rules.d.ts +2 -4
  102. package/linter/rules/dataframe-access-validation.js +4 -4
  103. package/linter/rules/deprecated-functions.d.ts +2 -4
  104. package/linter/rules/deprecated-functions.js +58 -3
  105. package/linter/rules/undefined-symbol.js +18 -10
  106. package/linter/rules/unused-definition.js +24 -0
  107. package/package.json +5 -2
  108. package/project/context/flowr-analyzer-context.d.ts +59 -1
  109. package/project/context/flowr-analyzer-context.js +118 -3
  110. package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
  111. package/project/context/flowr-analyzer-dependencies-context.js +33 -3
  112. package/project/context/flowr-analyzer-files-context.d.ts +32 -0
  113. package/project/context/flowr-analyzer-files-context.js +132 -14
  114. package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
  115. package/project/context/flowr-analyzer-loading-order-context.js +20 -0
  116. package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
  117. package/project/context/flowr-analyzer-meta-context.js +64 -23
  118. package/project/context/flowr-file.d.ts +7 -0
  119. package/project/context/flowr-file.js +7 -0
  120. package/project/context/project-kind.d.ts +22 -0
  121. package/project/context/project-kind.js +27 -0
  122. package/project/dependency-version-space.d.ts +166 -0
  123. package/project/dependency-version-space.js +564 -0
  124. package/project/flowr-analyzer-builder.js +1 -1
  125. package/project/flowr-analyzer.d.ts +4 -0
  126. package/project/flowr-analyzer.js +5 -0
  127. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  128. package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
  129. package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
  130. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
  131. package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
  132. package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
  133. package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
  134. package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
  135. package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
  136. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  137. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  138. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
  139. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
  140. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
  141. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
  142. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
  143. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
  144. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
  145. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
  146. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
  147. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
  148. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
  149. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
  150. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
  151. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
  152. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
  153. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
  154. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  155. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
  156. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  157. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
  158. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
  159. package/project/plugins/flowr-analyzer-plugin.js +5 -0
  160. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
  161. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  162. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
  163. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
  164. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
  165. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
  166. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
  167. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
  168. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
  169. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
  170. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
  171. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
  172. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
  175. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
  176. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
  177. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
  178. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
  179. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
  180. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
  181. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
  182. package/project/plugins/package-version-plugins/package.d.ts +4 -1
  183. package/project/plugins/package-version-plugins/package.js +8 -5
  184. package/project/plugins/plugin-registry.d.ts +11 -3
  185. package/project/plugins/plugin-registry.js +24 -5
  186. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
  187. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
  188. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
  189. package/project/sigdb/build.js +12 -2
  190. package/project/sigdb/decode.d.ts +7 -0
  191. package/project/sigdb/decode.js +35 -4
  192. package/project/sigdb/decompress.d.ts +2 -0
  193. package/project/sigdb/decompress.js +5 -0
  194. package/project/sigdb/manifest.d.ts +5 -0
  195. package/project/sigdb/manifest.js +37 -6
  196. package/project/sigdb/reader.d.ts +82 -2
  197. package/project/sigdb/reader.js +226 -14
  198. package/project/sigdb/schema.d.ts +31 -5
  199. package/project/sigdb/schema.js +7 -3
  200. package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
  201. package/project/sigdb/sigdb-version.js +119 -0
  202. package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
  203. package/queries/catalog/absint-query/absint-query-format.js +2 -0
  204. package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
  205. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
  206. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  207. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  208. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
  209. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
  210. package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
  211. package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
  212. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
  213. package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
  214. package/queries/catalog/config-query/config-query-executor.js +15 -6
  215. package/queries/catalog/config-query/config-query-format.d.ts +18 -4
  216. package/queries/catalog/config-query/config-query-format.js +246 -96
  217. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
  218. package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
  219. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
  220. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
  221. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
  222. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
  223. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
  224. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
  225. package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
  226. package/queries/catalog/dice-query/dice-query-executor.js +6 -9
  227. package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
  228. package/queries/catalog/dice-query/dice-query-format.js +10 -6
  229. package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
  230. package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
  231. package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
  232. package/queries/catalog/files-query/files-query-format.d.ts +2 -0
  233. package/queries/catalog/files-query/files-query-format.js +2 -0
  234. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
  235. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +277 -0
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +119 -0
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +331 -0
  238. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
  239. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
  240. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
  241. package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
  242. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  243. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
  244. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  245. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
  246. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  247. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
  248. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
  249. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
  250. package/queries/catalog/linter-query/linter-query-executor.js +11 -2
  251. package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
  252. package/queries/catalog/linter-query/linter-query-format.js +44 -21
  253. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  254. package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
  255. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
  256. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
  257. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  258. package/queries/catalog/origin-query/origin-query-format.js +2 -0
  259. package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
  260. package/queries/catalog/project-query/project-query-executor.js +19 -62
  261. package/queries/catalog/project-query/project-query-format.d.ts +7 -18
  262. package/queries/catalog/project-query/project-query-format.js +3 -18
  263. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  264. package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
  265. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  266. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
  267. package/queries/catalog/search-query/search-query-format.d.ts +1 -0
  268. package/queries/catalog/search-query/search-query-format.js +1 -0
  269. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
  270. package/queries/catalog/signature-query/signature-query-executor.js +267 -57
  271. package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
  272. package/queries/catalog/signature-query/signature-query-format.js +41 -5
  273. package/queries/catalog/signature-query/signature-query-render.js +48 -6
  274. package/queries/catalog/slice-query-options.d.ts +49 -0
  275. package/queries/catalog/slice-query-options.js +50 -0
  276. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
  277. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
  278. package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
  279. package/queries/query-print.js +3 -1
  280. package/queries/query.d.ts +63 -3
  281. package/queries/query.js +9 -2
  282. package/r-bridge/data/data.d.ts +16 -0
  283. package/r-bridge/data/data.js +20 -0
  284. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
  285. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  286. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  287. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
  288. package/reconstruct/reconstruct.d.ts +18 -1
  289. package/reconstruct/reconstruct.js +42 -19
  290. package/slicing/criterion/parse.d.ts +4 -0
  291. package/slicing/criterion/parse.js +4 -0
  292. package/slicing/static/slice-call.js +17 -9
  293. package/slicing/static/static-slicer.d.ts +1 -1
  294. package/slicing/static/static-slicer.js +5 -4
  295. package/util/files.d.ts +19 -1
  296. package/util/files.js +45 -3
  297. package/util/glob.d.ts +19 -0
  298. package/util/glob.js +67 -0
  299. package/util/log.d.ts +12 -0
  300. package/util/log.js +17 -1
  301. package/util/logic.d.ts +6 -0
  302. package/util/logic.js +31 -1
  303. package/util/mermaid/dfg.js +17 -12
  304. package/util/mermaid/mermaid.js +2 -2
  305. package/util/objects.d.ts +5 -0
  306. package/util/objects.js +8 -0
  307. package/util/r-version.d.ts +9 -1
  308. package/util/r-version.js +27 -2
  309. package/util/schema.d.ts +16 -0
  310. package/util/schema.js +89 -4
  311. package/util/text/ansi.d.ts +4 -0
  312. package/util/text/ansi.js +27 -3
  313. package/util/text/strings.d.ts +9 -0
  314. package/util/text/strings.js +29 -0
  315. package/util/version.js +79 -6
  316. package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
  317. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
  318. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
  319. package/project/sigdb/version.js +0 -55
@@ -69,6 +69,15 @@ export declare class Environment implements IEnvironment {
69
69
  define(definition: IdentifierDefinition & {
70
70
  name: Identifier;
71
71
  }): Environment;
72
+ /**
73
+ * Define several identifiers at once in a more performant fashion.
74
+ * @param definitions - The definitions to add.
75
+ */
76
+ defineAll(definitions: Iterable<IdentifierDefinition & {
77
+ name: Identifier;
78
+ }>): Environment;
79
+ /** Only sound on an environment nobody else holds yet. */
80
+ private apply;
72
81
  private defineInNamespace;
73
82
  defineSuper(definition: IdentifierDefinition & {
74
83
  name: Identifier;
@@ -96,31 +96,52 @@ class Environment {
96
96
  if (ns !== undefined && this.n !== ns) {
97
97
  return this.defineInNamespace(definition, ns);
98
98
  }
99
+ const newEnvironment = this.clone(false);
100
+ newEnvironment.apply(name, definition);
101
+ return newEnvironment;
102
+ }
103
+ /**
104
+ * Define several identifiers at once in a more performant fashion.
105
+ * @param definitions - The definitions to add.
106
+ */
107
+ defineAll(definitions) {
108
+ let env = this.clone(false);
109
+ for (const definition of definitions) {
110
+ const [name, ns] = identifier_1.Identifier.toArray(definition.name);
111
+ if (ns !== undefined && env.n !== ns) {
112
+ env = env.defineInNamespace(definition, ns);
113
+ }
114
+ else {
115
+ env.apply(name, definition);
116
+ }
117
+ }
118
+ return env;
119
+ }
120
+ /** Only sound on an environment nobody else holds yet. */
121
+ apply(name, definition) {
99
122
  /* isolate the cds from the originating reference, which may still be updated in place */
100
123
  if (definition.cds !== undefined) {
101
124
  definition = { ...definition, cds: definition.cds.slice() };
102
125
  }
103
- const newEnvironment = this.clone(false);
104
126
  // When there are defined indices, merge the definitions
105
127
  if (definition.cds === undefined) {
106
- newEnvironment.memory.set(name, [definition]);
128
+ this.memory.set(name, [definition]);
107
129
  }
108
130
  else {
109
- const existing = newEnvironment.memory.get(name);
131
+ const existing = this.memory.get(name);
110
132
  const inGraphDefinition = definition;
111
133
  if (existing !== undefined &&
112
134
  inGraphDefinition.cds === undefined) {
113
- newEnvironment.memory.set(name, [inGraphDefinition]);
135
+ this.memory.set(name, [inGraphDefinition]);
114
136
  }
115
137
  else if (existing === undefined || definition.cds === undefined) {
116
- newEnvironment.memory.set(name, [definition]);
138
+ this.memory.set(name, [definition]);
117
139
  }
118
140
  else {
119
141
  /* the array may be shared with clones, so replace instead of push */
120
- newEnvironment.memory.set(name, [...existing, definition]);
142
+ this.memory.set(name, [...existing, definition]);
121
143
  }
122
144
  }
123
- return newEnvironment;
124
145
  }
125
146
  defineInNamespace(definition, ns) {
126
147
  if (this.n === ns) {
@@ -120,10 +120,9 @@ export declare const Identifier: {
120
120
  * from the base package that exports it (`sd` yields `stats::sd`, `plot` yields `base::plot`) via the
121
121
  * precomputed {@link baseRExportOwner} store -- no loaded database, no graph edges. This is suppressed when
122
122
  * the call resolves to a user definition or is already namespaced, so a local `sd()` is never `stats::sd`.
123
+ * @see {@link Dataflow.qualify} - the compact form, if you have the call's id and its graph
123
124
  */
124
125
  readonly toQualified: (this: void, origins: readonly Origin[] | undefined, name?: Identifier) => Identifier | undefined;
125
- /** The fully qualified `package::name` of a resolved call (see {@link Identifier.toQualified}). */
126
- readonly toQualifiedName: (this: void, origins: readonly Origin[] | undefined, name?: Identifier) => string | undefined;
127
126
  };
128
127
  /**
129
128
  * Well-known R package names used in {@link DefaultBuiltinConfig}.
@@ -200,6 +200,7 @@ exports.Identifier = {
200
200
  * from the base package that exports it (`sd` yields `stats::sd`, `plot` yields `base::plot`) via the
201
201
  * precomputed {@link baseRExportOwner} store -- no loaded database, no graph edges. This is suppressed when
202
202
  * the call resolves to a user definition or is already namespaced, so a local `sd()` is never `stats::sd`.
203
+ * @see {@link Dataflow.qualify} - the compact form, if you have the call's id and its graph
203
204
  */
204
205
  toQualified(origins, name) {
205
206
  let sawUserDefinition = false;
@@ -224,11 +225,6 @@ exports.Identifier = {
224
225
  }
225
226
  }
226
227
  return undefined;
227
- },
228
- /** The fully qualified `package::name` of a resolved call (see {@link Identifier.toQualified}). */
229
- toQualifiedName(origins, name) {
230
- const qualified = exports.Identifier.toQualified(origins, name);
231
- return qualified === undefined ? undefined : exports.Identifier.toString(qualified);
232
228
  }
233
229
  };
234
230
  /**
@@ -126,8 +126,7 @@ function produceDataFlowGraph(parser, completeAst, ctx) {
126
126
  ctx.files.addConsideredFile(files[0].filePath ? files[0].filePath : flowr_file_1.FlowrFile.INLINE_PATH);
127
127
  const env = ctx.env.makeCleanEnv();
128
128
  env.current.n = ctx.meta.getNamespace();
129
- // eagerly attach the always-available base-R namespaces, then the project's declared DESCRIPTION dependencies
130
- const environment = (0, built_in_library_1.attachDeclaredDependencies)((0, built_in_library_1.attachBaseRNamespaces)(env, ctx), ctx);
129
+ const environment = (0, built_in_library_1.attachProject)(env, ctx);
131
130
  const dfData = {
132
131
  parser,
133
132
  completeAst,
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.DataflowGraphBuilder = void 0;
4
37
  exports.emptyGraph = emptyGraph;
@@ -10,7 +43,6 @@ const vertex_1 = require("./vertex");
10
43
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
11
44
  const edge_1 = require("./edge");
12
45
  const default_builtin_config_1 = require("../environments/default-builtin-config");
13
- const flowr_search_executor_1 = require("../../search/flowr-search-executor");
14
46
  const assert_1 = require("../../util/assert");
15
47
  const flowr_analyzer_context_1 = require("../../project/context/flowr-analyzer-context");
16
48
  const built_in_proc_name_1 = require("../environments/built-in-proc-name");
@@ -189,12 +221,19 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
189
221
  return this.addEdge(node_id_1.NodeId.normalize(from), node_id_1.NodeId.normalize(to), type);
190
222
  }
191
223
  async queryHelper(from, to, data, type) {
224
+ /*
225
+ * the search executor reaches back into the dataflow graph (via the queries and the linter), so importing it
226
+ * up here would make this cycle load-bearing: whoever is loaded first sees the other half-initialized, which
227
+ * breaks at module-evaluation time (a subclass extending an `undefined` base). We only need it once a query
228
+ * is actually run, which is long after every module is up.
229
+ */
230
+ const { runSearch } = await Promise.resolve().then(() => __importStar(require('../../search/flowr-search-executor')));
192
231
  let fromId;
193
232
  if ('nodeId' in from) {
194
233
  fromId = from.nodeId;
195
234
  }
196
235
  else {
197
- const result = (await (0, flowr_search_executor_1.runSearch)(from.query, data)).getElements();
236
+ const result = (await runSearch(from.query, data)).getElements();
198
237
  (0, assert_1.guard)(result.length === 1, `from query result should yield exactly one node, but yielded ${result.length}`);
199
238
  fromId = result[0].node.info.id;
200
239
  }
@@ -203,7 +242,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
203
242
  toIds = to.target;
204
243
  }
205
244
  else {
206
- const result = (await (0, flowr_search_executor_1.runSearch)(to.query, data)).getElements();
245
+ const result = (await runSearch(to.query, data)).getElements();
207
246
  toIds = result.map(r => r.node.info.id);
208
247
  }
209
248
  return this.edgeHelper(fromId, toIds, type);
@@ -7,12 +7,14 @@ import { computeCallGraphSummaries, propagateTransitiveSideEffects } from '../in
7
7
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
8
8
  import type { REnvironmentInformation } from '../environments/environment';
9
9
  import type { DataflowGraphVertexInfo } from './vertex';
10
+ import { Identifier } from '../environments/identifier';
10
11
  /**
11
12
  * This is the root helper object to work with the {@link DataflowGraph}.
12
13
  *
13
14
  * - {@link Dataflow.visualize} - for visualization helpers (e.g., rendering the DFG as a mermaid graph),
14
15
  * - {@link Dataflow.views} - for working with specific views of the dataflow graph (e.g., the call graph),
15
16
  * - {@link Dataflow.edge} - for working with the edges in the dataflow graph,
17
+ * - {@link Dataflow.qualify} - for the package-qualified `pkg::fn` identifier of a call from its id and graph,
16
18
  */
17
19
  export declare const Dataflow: {
18
20
  /**
@@ -81,6 +83,19 @@ export declare const Dataflow: {
81
83
  * @see {@link getOriginInDfg} - for the underlying function
82
84
  */
83
85
  readonly origin: typeof getOriginInDfg;
86
+ /**
87
+ * The qualified identifier of the call with the given id, or `undefined` if it does not resolve to a package
88
+ * export (with `purrr` loaded, a `map()` call yields `Identifier.make('map', 'purrr')`).
89
+ *
90
+ * This is the compact form of {@link Identifier.toQualified}, reconstructing both the
91
+ * {@link Dataflow.origin|origins} and the call's name from the graph.
92
+ * @param id - The id of the call to qualify
93
+ * @param graph - The graph the call is part of
94
+ * @param qualifyBaseR - Whether to also qualify a bare base-R call from the package exporting it
95
+ * (`sd` yields `stats::sd`), which needs neither a loaded database nor graph edges.
96
+ * Set this to `false` to only qualify what the origins resolve to.
97
+ */
98
+ readonly qualify: (this: void, id: NodeId, graph: DataflowGraph, qualifyBaseR?: boolean) => Identifier | undefined;
84
99
  /**
85
100
  * Interprocedural propagation of escaped side effects (attached packages, `<<-` definitions) to their callers.
86
101
  */
@@ -8,12 +8,15 @@ const dfg_get_origin_1 = require("../origin/dfg-get-origin");
8
8
  const graph_helper_1 = require("./graph-helper");
9
9
  const call_graph_1 = require("./call-graph");
10
10
  const transitive_side_effects_1 = require("../internal/process/functions/call/built-in/transitive-side-effects");
11
+ const vertex_1 = require("./vertex");
12
+ const identifier_1 = require("../environments/identifier");
11
13
  /**
12
14
  * This is the root helper object to work with the {@link DataflowGraph}.
13
15
  *
14
16
  * - {@link Dataflow.visualize} - for visualization helpers (e.g., rendering the DFG as a mermaid graph),
15
17
  * - {@link Dataflow.views} - for working with specific views of the dataflow graph (e.g., the call graph),
16
18
  * - {@link Dataflow.edge} - for working with the edges in the dataflow graph,
19
+ * - {@link Dataflow.qualify} - for the package-qualified `pkg::fn` identifier of a call from its id and graph,
17
20
  */
18
21
  exports.Dataflow = {
19
22
  name: 'Dataflow',
@@ -51,6 +54,23 @@ exports.Dataflow = {
51
54
  * @see {@link getOriginInDfg} - for the underlying function
52
55
  */
53
56
  origin: dfg_get_origin_1.getOriginInDfg,
57
+ /**
58
+ * The qualified identifier of the call with the given id, or `undefined` if it does not resolve to a package
59
+ * export (with `purrr` loaded, a `map()` call yields `Identifier.make('map', 'purrr')`).
60
+ *
61
+ * This is the compact form of {@link Identifier.toQualified}, reconstructing both the
62
+ * {@link Dataflow.origin|origins} and the call's name from the graph.
63
+ * @param id - The id of the call to qualify
64
+ * @param graph - The graph the call is part of
65
+ * @param qualifyBaseR - Whether to also qualify a bare base-R call from the package exporting it
66
+ * (`sd` yields `stats::sd`), which needs neither a loaded database nor graph edges.
67
+ * Set this to `false` to only qualify what the origins resolve to.
68
+ */
69
+ qualify(id, graph, qualifyBaseR = true) {
70
+ // only look the vertex up when its name is actually needed (base-R qualification)
71
+ const vertex = qualifyBaseR ? graph.getVertex(id) : undefined;
72
+ return identifier_1.Identifier.toQualified((0, dfg_get_origin_1.getOriginInDfg)(graph, id), (0, vertex_1.isFunctionCallVertex)(vertex) ? vertex.name : undefined);
73
+ },
54
74
  /**
55
75
  * Interprocedural propagation of escaped side effects (attached packages, `<<-` definitions) to their callers.
56
76
  */
@@ -26,19 +26,19 @@ function processAttach(name, args, rootId, data) {
26
26
  return result;
27
27
  }
28
28
  /* build the attached layer with the env's known bindings */
29
- let attachedLayer = new environment_1.Environment(result.environment.current);
29
+ const injected = [];
30
30
  for (const [varName, varDefs] of envirResolution.envDef.envState.current.memory) {
31
31
  for (const varDef of varDefs) {
32
32
  const inDef = varDef;
33
- const injected = {
33
+ injected.push({
34
34
  ...inDef,
35
35
  name: varName,
36
36
  type: identifier_1.ReferenceType.Variable,
37
- };
38
- attachedLayer = attachedLayer.define(injected);
37
+ });
39
38
  result.graph.addEdge(inDef.nodeId, rootId, edge_1.EdgeType.Reads);
40
39
  }
41
40
  }
41
+ const attachedLayer = new environment_1.Environment(result.environment.current).defineAll(injected);
42
42
  /* R attaches below `.GlobalEnv`, so existing global bindings shadow the attached ones */
43
43
  return { ...result, environment: {
44
44
  current: environment_1.REnvironment.attachBelowGlobal(result.environment.current, attachedLayer, attachedLayer),
@@ -25,6 +25,13 @@ export interface EnvirResolution<OtherInfo> {
25
25
  * Thin alias for {@link RFunctionCall.matchArgumentsToParameters}, which owns the (pure) matching logic.
26
26
  */
27
27
  export declare function bindArgs<OtherInfo>(args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], paramNames: readonly string[]): ReadonlyMap<string, PotentiallyEmptyRArgument<OtherInfo & ParentInformation>>;
28
+ /**
29
+ * The formal parameter names of the qualified call `id` (a `pkg::fn` {@link Identifier}) from the signature
30
+ * database (excluding `...`), or `fallback` when the database is disabled or does not carry the function. Lets a
31
+ * built-in argument matcher use R's real signature (via {@link ReadOnlyFlowrAnalyzerDependenciesContext#signatureOf})
32
+ * instead of a hardcoded formal list, while staying correct -- and graph-invariant -- when no signature is available.
33
+ */
34
+ export declare function signatureParamNames<OtherInfo>(data: DataflowProcessorInformation<OtherInfo & ParentInformation>, id: Identifier, fallback: readonly string[]): readonly string[];
28
35
  /** Resolves a single already-found argument (e.g. from {@link bindArgs}) to an {@link EnvirResolution} when it is a symbol holding a tracked envState. */
29
36
  export declare function resolveArgToEnvir<OtherInfo>(arg: PotentiallyEmptyRArgument<OtherInfo & ParentInformation>, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): EnvirResolution<OtherInfo> | undefined;
30
37
  /** Resolves the `argName` argument (default `'envir'`, pmatch against `allParamNames`), falling back to `positionalFallbackIndex`, to an {@link EnvirResolution}. */
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.bindArgs = bindArgs;
4
+ exports.signatureParamNames = signatureParamNames;
4
5
  exports.resolveArgToEnvir = resolveArgToEnvir;
5
6
  exports.resolveEnvirArg = resolveEnvirArg;
6
7
  exports.resolveSymbolToEnvir = resolveSymbolToEnvir;
@@ -8,6 +9,7 @@ exports.routeWrittenToCustomEnv = routeWrittenToCustomEnv;
8
9
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
9
10
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
10
11
  const unpack_argument_1 = require("../argument/unpack-argument");
12
+ const decode_1 = require("../../../../../../project/sigdb/decode");
11
13
  const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
12
14
  const identifier_1 = require("../../../../../environments/identifier");
13
15
  const define_1 = require("../../../../../environments/define");
@@ -59,6 +61,17 @@ function resolveDefsToEnvirResolution(defs, nodeId, data) {
59
61
  function bindArgs(args, paramNames) {
60
62
  return r_function_call_1.RFunctionCall.matchArgsToParams(args, paramNames);
61
63
  }
64
+ /**
65
+ * The formal parameter names of the qualified call `id` (a `pkg::fn` {@link Identifier}) from the signature
66
+ * database (excluding `...`), or `fallback` when the database is disabled or does not carry the function. Lets a
67
+ * built-in argument matcher use R's real signature (via {@link ReadOnlyFlowrAnalyzerDependenciesContext#signatureOf})
68
+ * instead of a hardcoded formal list, while staying correct -- and graph-invariant -- when no signature is available.
69
+ */
70
+ function signatureParamNames(data, id, fallback) {
71
+ const sig = data.ctx.deps.signatureOf(id)?.signature;
72
+ const names = sig ? (0, decode_1.signatureParameterNames)(sig) : [];
73
+ return names.length > 0 ? names : fallback;
74
+ }
62
75
  /** Resolves a single already-found argument (e.g. from {@link bindArgs}) to an {@link EnvirResolution} when it is a symbol holding a tracked envState. */
63
76
  function resolveArgToEnvir(arg, data) {
64
77
  if (arg === r_function_call_1.EmptyArgument) {
@@ -60,4 +60,8 @@ export declare function attachBaseRNamespaces(env: REnvironmentInformation, ctx:
60
60
  * no-op via the {@link isAttached} guard inside {@link attachDependencyToEnvironment}.
61
61
  */
62
62
  export declare function attachDeclaredDependencies(env: REnvironmentInformation, ctx: FlowrAnalyzerContext): REnvironmentInformation;
63
+ /** attach the analyzed package's own `NAMESPACE importFrom(...)` symbols (by their bare name) below the global, so a bare imported call resolves to its source package */
64
+ export declare function attachProjectImports(env: REnvironmentInformation, ctx: FlowrAnalyzerContext): REnvironmentInformation;
65
+ /** attach every project-level environment layer in order: base R namespaces, the project's own `importFrom` symbols, then its declared dependencies */
66
+ export declare function attachProject(env: REnvironmentInformation, ctx: FlowrAnalyzerContext): REnvironmentInformation;
63
67
  export {};
@@ -6,6 +6,8 @@ exports.loadNodesForNamespace = loadNodesForNamespace;
6
6
  exports.attachDependencyToEnvironment = attachDependencyToEnvironment;
7
7
  exports.attachBaseRNamespaces = attachBaseRNamespaces;
8
8
  exports.attachDeclaredDependencies = attachDeclaredDependencies;
9
+ exports.attachProjectImports = attachProjectImports;
10
+ exports.attachProject = attachProject;
9
11
  const known_call_handling_1 = require("../known-call-handling");
10
12
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
11
13
  const r_access_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
@@ -392,19 +394,15 @@ function attachDependencyToEnvironment(dependency, envInfo, ctx, spec = {}, defi
392
394
  const exports = selectExports((0, flowr_namespace_file_1.getCallables)(dependency.namespaceInfo), spec);
393
395
  if (spec.namespaceOnly || isSubsetAttach(spec)) {
394
396
  const layerType = spec.namespaceOnly ? environment_1.EnvType.LoadedNamespace : environment_1.EnvType.Namespace;
395
- let layer = new environment_1.Environment(envInfo.current).asLibrary(pack, layerType);
396
- for (const exp of exports) {
397
- layer = layer.define(exportDefinition(pack, exp, definedAt));
398
- }
397
+ const layer = new environment_1.Environment(envInfo.current).asLibrary(pack, layerType)
398
+ .defineAll(exports.map(exp => exportDefinition(pack, exp, definedAt)));
399
399
  return { level: envInfo.level, current: environment_1.REnvironment.attachBelowGlobal(envInfo.current, layer, layer) };
400
400
  }
401
401
  // full attach: imports layer at the bottom, namespace (exports) layer on top
402
402
  let importsEnv = new environment_1.Environment(envInfo.current).asLibrary(pack, environment_1.EnvType.Imports);
403
403
  importsEnv = recImports(importsEnv, dependency.namespaceInfo, ctx, new Set());
404
- let namespaceEnv = new environment_1.Environment(importsEnv).asLibrary(pack, environment_1.EnvType.Namespace);
405
- for (const exp of exports) {
406
- namespaceEnv = namespaceEnv.define(exportDefinition(pack, exp, definedAt));
407
- }
404
+ const namespaceEnv = new environment_1.Environment(importsEnv).asLibrary(pack, environment_1.EnvType.Namespace)
405
+ .defineAll(exports.map(exp => exportDefinition(pack, exp, definedAt)));
408
406
  return { level: envInfo.level, current: environment_1.REnvironment.attachBelowGlobal(envInfo.current, namespaceEnv, importsEnv) };
409
407
  }
410
408
  /** A namespace-only load is subsumed by any layer for `pack`; a full attach ignores a mere {@link EnvType.LoadedNamespace}. */
@@ -481,6 +479,46 @@ function attachDeclaredDependencies(env, ctx) {
481
479
  }
482
480
  return built;
483
481
  }
482
+ /** attach the analyzed package's own `NAMESPACE importFrom(...)` symbols (by their bare name) below the global, so a bare imported call resolves to its source package */
483
+ function attachProjectImports(env, ctx) {
484
+ const own = ctx.deps.getDependency('current')?.namespaceInfo;
485
+ if (own === undefined || own.importedPackages.size === 0) {
486
+ return env;
487
+ }
488
+ const layerNamespace = 'current';
489
+ const toDefine = [];
490
+ for (const [pkg, funcs] of own.importedPackages) {
491
+ // an explicit `importFrom(pkg, a, b)` names the symbols directly; `import(pkg)` needs the package's own export list
492
+ let names;
493
+ if (funcs === 'all') {
494
+ const imported = ctx.deps.getDependency(pkg)?.namespaceInfo;
495
+ if (imported === undefined) {
496
+ continue;
497
+ }
498
+ names = (0, flowr_namespace_file_1.getCallables)(imported);
499
+ }
500
+ else {
501
+ names = funcs;
502
+ }
503
+ for (const fn of names) {
504
+ toDefine.push({
505
+ name: identifier_1.Identifier.make(fn, layerNamespace),
506
+ type: identifier_1.ReferenceType.Function,
507
+ nodeId: node_id_1.NodeId.fromPkgFn(pkg, fn),
508
+ definedAt: node_id_1.NodeId.toBuiltIn(pkg)
509
+ });
510
+ }
511
+ }
512
+ if (toDefine.length === 0) {
513
+ return env;
514
+ }
515
+ const layer = new environment_1.Environment(env.current).asLibrary(layerNamespace, environment_1.EnvType.Imports).defineAll(toDefine);
516
+ return { level: env.level, current: environment_1.REnvironment.attachBelowGlobal(env.current, layer, layer) };
517
+ }
518
+ /** attach every project-level environment layer in order: base R namespaces, the project's own `importFrom` symbols, then its declared dependencies */
519
+ function attachProject(env, ctx) {
520
+ return attachDeclaredDependencies(attachProjectImports(attachBaseRNamespaces(env, ctx), ctx), ctx);
521
+ }
484
522
  function recImports(importsEnv, namespaceInfo, ctx, alreadyImportedAll) {
485
523
  for (const imp of namespaceInfo.importedPackages) {
486
524
  const importedDependency = ctx.deps.getDependency(imp[0]);
@@ -496,17 +534,25 @@ function recImports(importsEnv, namespaceInfo, ctx, alreadyImportedAll) {
496
534
  if (alreadyImportedAll.has(importedDependency.name)) {
497
535
  continue;
498
536
  }
537
+ /* collect first and define in one go, as defining one by one copies the (growing) memory every time */
538
+ const toDefine = [];
539
+ const queued = new Set();
499
540
  for (const func of funcToImport) {
500
- if (importsEnv.memory.has(package_1.Package.functionIdentifier(importedDependency.name, func))) {
541
+ const identifier = package_1.Package.functionIdentifier(importedDependency.name, func);
542
+ if (importsEnv.memory.has(identifier) || queued.has(identifier)) {
501
543
  continue;
502
544
  }
503
- importsEnv = importsEnv.define({
504
- name: identifier_1.Identifier.make(package_1.Package.functionIdentifier(importedDependency.name, func), importsEnv.n),
545
+ queued.add(identifier);
546
+ toDefine.push({
547
+ name: identifier_1.Identifier.make(identifier, importsEnv.n),
505
548
  type: identifier_1.ReferenceType.Function,
506
549
  nodeId: node_id_1.NodeId.fromPkgFn(importedDependency.name, func),
507
550
  definedAt: node_id_1.NodeId.toBuiltIn(importedDependency.name)
508
551
  });
509
552
  }
553
+ if (toDefine.length > 0) {
554
+ importsEnv = importsEnv.defineAll(toDefine);
555
+ }
510
556
  if (imp[1] === 'all') {
511
557
  alreadyImportedAll.add(importedDependency.name);
512
558
  }
@@ -0,0 +1,12 @@
1
+ import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
2
+ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
+ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
+ import type { DataflowProcessorInformation } from '../../../../../processor';
5
+ import type { DataflowInformation } from '../../../../../info';
6
+ import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
7
+ /**
8
+ * Processes a built-in 'load' function call by retrieving the names of the variables loaded by the given file.
9
+ * Example: `load(test.rda)` with two variables 'x' and 'y'. processLoadCall adds 'x' and 'y' to the dataflow graph and
10
+ * adds control dependencies between the variables and the loaded file.
11
+ */
12
+ export declare function processLoadCall<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;