@eagleoutice/flowr 2.16.6 → 2.16.8

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 (321) hide show
  1. package/README.md +21 -15
  2. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +2 -0
  3. package/abstract-interpretation/data-frame/dataframe-semantics.js +3 -1
  4. package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -7
  5. package/abstract-interpretation/data-frame/resolve-args.js +2 -11
  6. package/cli/repl/commands/repl-cfg.js +5 -19
  7. package/cli/repl/commands/repl-code-command.d.ts +10 -0
  8. package/cli/repl/commands/repl-code-command.js +18 -0
  9. package/cli/repl/commands/repl-dataflow.js +34 -59
  10. package/cli/repl/commands/repl-normalize.js +24 -41
  11. package/cli/repl/commands/repl-query.js +10 -17
  12. package/config.js +3 -3
  13. package/control-flow/cfg-dead-code.js +15 -2
  14. package/control-flow/useless-loop.js +1 -2
  15. package/data/r-base-packages.generated.d.ts +1 -1
  16. package/data/r-base-packages.generated.js +3 -3
  17. package/dataflow/environments/ambient-state-name.d.ts +80 -0
  18. package/dataflow/environments/ambient-state-name.js +113 -0
  19. package/dataflow/environments/built-in-eval-name.d.ts +3 -1
  20. package/dataflow/environments/built-in-eval-name.js +2 -0
  21. package/dataflow/environments/built-in-props.d.ts +27 -7
  22. package/dataflow/environments/built-in-props.js +59 -44
  23. package/dataflow/environments/built-in.d.ts +5 -2
  24. package/dataflow/environments/built-in.js +22 -5
  25. package/dataflow/environments/default-builtin-config.d.ts +538 -14
  26. package/dataflow/environments/default-builtin-config.js +189 -123
  27. package/dataflow/environments/environment.d.ts +7 -1
  28. package/dataflow/environments/environment.js +19 -1
  29. package/dataflow/environments/identifier.d.ts +12 -1
  30. package/dataflow/environments/reference-to-maybe.js +1 -6
  31. package/dataflow/eval/resolve/alias-tracking.d.ts +13 -3
  32. package/dataflow/eval/resolve/alias-tracking.js +66 -37
  33. package/dataflow/eval/resolve/resolve-argument.d.ts +4 -2
  34. package/dataflow/eval/resolve/resolve-argument.js +23 -11
  35. package/dataflow/eval/resolve/resolve.d.ts +5 -0
  36. package/dataflow/eval/resolve/resolve.js +25 -3
  37. package/dataflow/eval/values/r-value.d.ts +4 -2
  38. package/dataflow/eval/values/r-value.js +3 -1
  39. package/dataflow/eval/values/string/string-constants.d.ts +7 -1
  40. package/dataflow/eval/values/string/string-constants.js +38 -36
  41. package/dataflow/extractor.js +105 -2
  42. package/dataflow/fn/argument-roles.js +22 -8
  43. package/dataflow/fn/function-semantics.d.ts +3 -2
  44. package/dataflow/fn/strict-function.js +13 -2
  45. package/dataflow/graph/dataflowgraph-builder.d.ts +4 -4
  46. package/dataflow/graph/df-helper.d.ts +14 -1
  47. package/dataflow/graph/df-helper.js +37 -4
  48. package/dataflow/graph/graph.d.ts +6 -0
  49. package/dataflow/graph/graph.js +9 -10
  50. package/dataflow/graph/vertex.d.ts +1 -1
  51. package/dataflow/hooks.d.ts +1 -1
  52. package/dataflow/info.d.ts +3 -3
  53. package/dataflow/internal/linker.d.ts +4 -1
  54. package/dataflow/internal/linker.js +12 -8
  55. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +41 -0
  56. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +88 -0
  57. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +21 -46
  58. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +125 -158
  59. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -1
  60. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +35 -9
  61. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +10 -1
  62. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -1
  63. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +6 -1
  64. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +1 -1
  65. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -2
  66. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +7 -0
  67. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +21 -12
  68. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  69. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +8 -1
  70. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -1
  71. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +5 -0
  72. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -2
  73. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -12
  74. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  75. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +6 -0
  76. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +43 -7
  79. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +11 -0
  80. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -4
  81. package/dataflow/internal/process/functions/call/common.js +3 -4
  82. package/dataflow/internal/process/functions/call/deferred.d.ts +3 -2
  83. package/dataflow/internal/process/functions/call/deferred.js +17 -9
  84. package/dataflow/internal/process/functions/call/quoted.js +1 -1
  85. package/dataflow/processor.d.ts +1 -1
  86. package/documentation/doc-capabilities.js +3 -2
  87. package/documentation/doc-readme.js +1 -2
  88. package/documentation/doc-util/doc-dfg.js +2 -2
  89. package/documentation/doc-util/doc-query.d.ts +3 -1
  90. package/documentation/doc-util/doc-query.js +4 -4
  91. package/documentation/wiki-create-linting-rules.js +1 -1
  92. package/documentation/wiki-linter.js +16 -206
  93. package/documentation/wiki-linting-and-testing.js +31 -64
  94. package/documentation/wiki-query.js +41 -0
  95. package/index.d.ts +1 -0
  96. package/index.js +5 -1
  97. package/linter/linter-format.d.ts +6 -0
  98. package/linter/linter-format.js +10 -0
  99. package/linter/linter-rules.d.ts +155 -103
  100. package/linter/linter-rules.js +2 -0
  101. package/linter/linter-util.d.ts +23 -0
  102. package/linter/linter-util.js +58 -0
  103. package/linter/rules/absolute-path.d.ts +2 -2
  104. package/linter/rules/absolute-path.js +1 -4
  105. package/linter/rules/cmd-check/bogus-return.d.ts +2 -2
  106. package/linter/rules/cmd-check/bogus-return.js +3 -7
  107. package/linter/rules/cmd-check/call-arguments.d.ts +2 -2
  108. package/linter/rules/cmd-check/class-string-comparison.d.ts +2 -2
  109. package/linter/rules/cmd-check/class-string-comparison.js +3 -7
  110. package/linter/rules/cmd-check/cmd-check-util.d.ts +8 -9
  111. package/linter/rules/cmd-check/cmd-check-util.js +14 -26
  112. package/linter/rules/cmd-check/compiled-code.d.ts +8 -3
  113. package/linter/rules/cmd-check/compiled-code.js +3 -13
  114. package/linter/rules/cmd-check/dependency-declaration.d.ts +2 -2
  115. package/linter/rules/cmd-check/dependency-declaration.js +6 -7
  116. package/linter/rules/cmd-check/description-metadata.d.ts +4 -4
  117. package/linter/rules/cmd-check/documentation-mismatch.d.ts +2 -2
  118. package/linter/rules/cmd-check/documentation-mismatch.js +4 -11
  119. package/linter/rules/cmd-check/file-checks.d.ts +19 -6
  120. package/linter/rules/cmd-check/file-checks.js +13 -5
  121. package/linter/rules/cmd-check/foreign-function-calls.d.ts +2 -2
  122. package/linter/rules/cmd-check/global-environment-modification.d.ts +2 -2
  123. package/linter/rules/cmd-check/global-environment-modification.js +3 -2
  124. package/linter/rules/cmd-check/namespace-tampering.d.ts +2 -2
  125. package/linter/rules/cmd-check/namespace-tampering.js +9 -9
  126. package/linter/rules/cmd-check/non-ascii-code.d.ts +2 -2
  127. package/linter/rules/cmd-check/package-data.d.ts +11 -5
  128. package/linter/rules/cmd-check/package-data.js +5 -12
  129. package/linter/rules/cmd-check/package-files.js +4 -10
  130. package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
  131. package/linter/rules/cmd-check/package-hooks.js +10 -8
  132. package/linter/rules/cmd-check/package-metafiles.d.ts +8 -3
  133. package/linter/rules/cmd-check/package-metafiles.js +3 -12
  134. package/linter/rules/cmd-check/package-runtime.d.ts +18 -5
  135. package/linter/rules/cmd-check/package-runtime.js +64 -20
  136. package/linter/rules/cmd-check/package-structure.d.ts +11 -5
  137. package/linter/rules/cmd-check/package-structure.js +4 -12
  138. package/linter/rules/cmd-check/rd-files.d.ts +8 -3
  139. package/linter/rules/cmd-check/rd-files.js +4 -14
  140. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +2 -2
  141. package/linter/rules/cmd-check/s-three-method-consistency.js +3 -4
  142. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +2 -2
  143. package/linter/rules/dataframe-access-validation.d.ts +2 -2
  144. package/linter/rules/dataframe-access-validation.js +5 -8
  145. package/linter/rules/dead-code.d.ts +5 -4
  146. package/linter/rules/dead-code.js +25 -14
  147. package/linter/rules/deprecated-functions.d.ts +3 -3
  148. package/linter/rules/deprecated-functions.js +16 -23
  149. package/linter/rules/file-path-validity.d.ts +2 -2
  150. package/linter/rules/file-path-validity.js +3 -6
  151. package/linter/rules/function-finder-util.d.ts +3 -3
  152. package/linter/rules/function-finder-util.js +7 -14
  153. package/linter/rules/namespace-access.d.ts +2 -2
  154. package/linter/rules/namespace-access.js +6 -9
  155. package/linter/rules/naming-convention.d.ts +2 -2
  156. package/linter/rules/naming-convention.js +1 -4
  157. package/linter/rules/network-functions.d.ts +3 -3
  158. package/linter/rules/no-leaked-credentials.d.ts +2 -2
  159. package/linter/rules/no-leaked-credentials.js +1 -4
  160. package/linter/rules/overwritten-file.d.ts +38 -0
  161. package/linter/rules/overwritten-file.js +102 -0
  162. package/linter/rules/problematic-inputs.d.ts +16 -6
  163. package/linter/rules/problematic-inputs.js +78 -34
  164. package/linter/rules/roxygen-arguments.d.ts +2 -2
  165. package/linter/rules/roxygen-arguments.js +1 -4
  166. package/linter/rules/seeded-randomness.d.ts +3 -3
  167. package/linter/rules/seeded-randomness.js +6 -23
  168. package/linter/rules/software-has-license.d.ts +2 -2
  169. package/linter/rules/software-has-license.js +1 -4
  170. package/linter/rules/software-has-tests.d.ts +2 -2
  171. package/linter/rules/software-has-tests.js +1 -4
  172. package/linter/rules/stop-with-call-arg.d.ts +2 -2
  173. package/linter/rules/stop-with-call-arg.js +4 -11
  174. package/linter/rules/syntactically-valid.d.ts +4 -2
  175. package/linter/rules/syntactically-valid.js +29 -10
  176. package/linter/rules/unclosed-connection.d.ts +2 -2
  177. package/linter/rules/unclosed-connection.js +1 -4
  178. package/linter/rules/undefined-symbol.d.ts +2 -2
  179. package/linter/rules/undefined-symbol.js +25 -22
  180. package/linter/rules/unescaped-arguments.d.ts +2 -2
  181. package/linter/rules/unescaped-arguments.js +1 -4
  182. package/linter/rules/unused-definition.d.ts +2 -2
  183. package/linter/rules/unused-definition.js +37 -25
  184. package/linter/rules/unused-import.d.ts +2 -2
  185. package/linter/rules/unused-import.js +9 -14
  186. package/linter/rules/useless-loop.d.ts +7 -6
  187. package/linter/rules/useless-loop.js +4 -8
  188. package/package.json +5 -3
  189. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  190. package/project/cache/flowr-analyzer-cache.js +15 -11
  191. package/project/context/flowr-analyzer-files-context.d.ts +3 -0
  192. package/project/context/flowr-analyzer-files-context.js +6 -0
  193. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +6 -1
  194. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +35 -0
  195. package/project/plugins/file-plugins/files/flowr-namespace-file.js +2 -1
  196. package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +26 -0
  197. package/project/plugins/file-plugins/files/flowr-rsession-file.js +44 -0
  198. package/project/plugins/file-plugins/files/r-session.d.ts +20 -0
  199. package/project/plugins/file-plugins/files/r-session.js +58 -0
  200. package/project/plugins/file-plugins/files/recorded-runs.d.ts +18 -0
  201. package/project/plugins/file-plugins/files/recorded-runs.js +8 -0
  202. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.d.ts +20 -0
  203. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.js +28 -0
  204. package/project/plugins/plugin-registry.d.ts +2 -1
  205. package/project/plugins/plugin-registry.js +2 -0
  206. package/project/sigdb/spec-query.d.ts +73 -0
  207. package/project/sigdb/spec-query.js +339 -0
  208. package/queries/base-query-format.d.ts +1 -1
  209. package/queries/base-query-format.js +2 -2
  210. package/queries/catalog/absint-query/absint-query-executor.js +3 -6
  211. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -0
  212. package/queries/catalog/call-context-query/call-context-query-executor.js +113 -73
  213. package/queries/catalog/call-graph-query/call-graph-query-executor.js +2 -3
  214. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -3
  215. package/queries/catalog/config-query/config-query-format.d.ts +0 -1
  216. package/queries/catalog/config-query/config-query-format.js +1 -2
  217. package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
  218. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -4
  219. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +0 -1
  220. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -2
  221. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -3
  222. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +7 -0
  223. package/queries/catalog/dependencies-query/dependencies-query-executor.js +72 -42
  224. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +24 -6
  225. package/queries/catalog/dependencies-query/dependencies-query-format.js +108 -3
  226. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -1
  227. package/queries/catalog/dependencies-query/function-info/read-functions.js +6 -6
  228. package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -7
  229. package/queries/catalog/dependencies-query/implicit-echo.js +21 -7
  230. package/queries/catalog/dice-query/dice-query-executor.js +2 -3
  231. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -3
  232. package/queries/catalog/files-query/files-query-executor.js +2 -3
  233. package/queries/catalog/function-info-query/function-info-query-executor.js +2 -1
  234. package/queries/catalog/function-info-query/function-info-query-format.d.ts +0 -2
  235. package/queries/catalog/function-info-query/function-info-query-format.js +1 -2
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +3 -2
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +0 -2
  238. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -2
  239. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -3
  240. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +0 -1
  241. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -2
  242. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -3
  243. package/queries/catalog/id-map-query/id-map-query-format.d.ts +0 -1
  244. package/queries/catalog/id-map-query/id-map-query-format.js +1 -2
  245. package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -4
  246. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -1
  247. package/queries/catalog/input-sources-query/simple-input-classifier.js +60 -13
  248. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -3
  249. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +2 -3
  250. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +2 -1
  251. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -2
  252. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -7
  253. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -9
  254. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +8 -33
  255. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +3 -2
  256. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +1 -7
  257. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -7
  258. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +8 -31
  259. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  260. package/queries/catalog/location-map-query/location-map-query-executor.js +2 -3
  261. package/queries/catalog/location-map-query/location-map-query-format.d.ts +0 -1
  262. package/queries/catalog/location-map-query/location-map-query-format.js +1 -2
  263. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -3
  264. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +0 -1
  265. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -2
  266. package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -5
  267. package/queries/catalog/origin-query/origin-query-executor.js +3 -11
  268. package/queries/catalog/project-query/project-query-executor.js +23 -7
  269. package/queries/catalog/project-query/project-query-format.d.ts +5 -0
  270. package/queries/catalog/project-query/project-query-format.js +20 -2
  271. package/queries/catalog/provenance-query/provenance-query-executor.js +2 -3
  272. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -3
  273. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +0 -1
  274. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -2
  275. package/queries/catalog/search-query/search-query-executor.js +2 -3
  276. package/queries/catalog/signature-query/signature-query-executor.js +39 -0
  277. package/queries/catalog/signature-query/signature-query-format.d.ts +7 -1
  278. package/queries/catalog/signature-query/signature-query-format.js +15 -1
  279. package/queries/catalog/signature-query/signature-query-render.js +2 -1
  280. package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -3
  281. package/queries/query-function-property.d.ts +28 -0
  282. package/queries/query-function-property.js +48 -0
  283. package/queries/query-meta.d.ts +3 -0
  284. package/queries/query-meta.js +8 -0
  285. package/queries/query.d.ts +13 -18
  286. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
  287. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +4 -3
  288. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
  289. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +9 -0
  290. package/r-bridge/lang-4.x/ast/model/syntax-version.d.ts +8 -0
  291. package/r-bridge/lang-4.x/ast/model/syntax-version.js +49 -0
  292. package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
  293. package/r-bridge/lang-4.x/ast/model/type.js +3 -0
  294. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +4 -1
  295. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.js +1 -0
  296. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +1 -1
  297. package/reconstruct/reconstruct.js +35 -1
  298. package/search/search-executor/search-generators.js +1 -1
  299. package/slicing/static/fingerprint.js +7 -3
  300. package/slicing/static/static-slicer.js +6 -0
  301. package/util/assert.js +2 -2
  302. package/util/collections/arrays.d.ts +4 -0
  303. package/util/collections/arrays.js +11 -0
  304. package/util/collections/defaultmap.d.ts +5 -1
  305. package/util/collections/defaultmap.js +6 -1
  306. package/util/files.js +26 -5
  307. package/util/flowr-version.d.ts +10 -0
  308. package/util/flowr-version.js +20 -0
  309. package/util/glob.js +6 -4
  310. package/util/r-regex.d.ts +6 -0
  311. package/util/r-regex.js +17 -0
  312. package/util/text/args.d.ts +5 -0
  313. package/util/text/args.js +28 -22
  314. package/util/text/name-rank.d.ts +2 -0
  315. package/util/text/name-rank.js +3 -1
  316. package/util/text/regex.d.ts +10 -0
  317. package/util/text/regex.js +29 -0
  318. package/util/version.d.ts +1 -6
  319. package/util/version.js +6 -14
  320. package/documentation/doc-util/doc-functions.d.ts +0 -24
  321. package/documentation/doc-util/doc-functions.js +0 -65
@@ -42,7 +42,7 @@ interface DataflowGraphVertexBase extends MergeableRecord {
42
42
  /**
43
43
  * @see {@link ControlDependency} - the collection of control dependencies which have an influence on whether the vertex is executed.
44
44
  */
45
- cds: ControlDependency[] | undefined;
45
+ cds: readonly ControlDependency[] | undefined;
46
46
  /**
47
47
  * Describes the collection of AST vertices that contributed to this vertex.
48
48
  * For example, this is useful with replacement operators, telling you which assignment operator caused them
@@ -13,7 +13,7 @@ export interface HookInformation {
13
13
  /** The id of the function definition which is added by the hook */
14
14
  id: NodeId;
15
15
  /** Control dependencies under which the hook was registered */
16
- cds?: ControlDependency[];
16
+ cds?: readonly ControlDependency[];
17
17
  /** Whether the hook is added on top of existing ones (true) or replaces them (false) */
18
18
  add?: boolean;
19
19
  /** Whether the hook is executed after existing ones (true) or before (false) */
@@ -102,14 +102,14 @@ export interface ExitPoint {
102
102
  * (e.g., if the `return` is contained within an `if` statement).
103
103
  * @see {@link happensInEveryBranch} - to check whether control dependencies are exhaustive
104
104
  */
105
- readonly cds?: ControlDependency[];
105
+ readonly cds?: readonly ControlDependency[];
106
106
  }
107
107
  /** `exit` leaving through the construct `rootId`, which keeps the jump it stands for. */
108
108
  export declare function leaveThrough(exit: ExitPoint, rootId: NodeId): ExitPoint;
109
109
  /**
110
110
  * Adds all non-default exit points to the existing list and updates the `invertExitCds` accordingly.
111
111
  */
112
- export declare function addNonDefaultExitPoints(existing: ExitPoint[], invertExitCds: ControlDependency[], activeCds: ControlDependency[] | undefined, add: readonly ExitPoint[]): void;
112
+ export declare function addNonDefaultExitPoints(existing: ExitPoint[], invertExitCds: ControlDependency[], activeCds: readonly ControlDependency[] | undefined, add: readonly ExitPoint[]): void;
113
113
  /**
114
114
  * Overwrites the existing exit points with the given ones, taking care of cds:
115
115
  * the existing ones stay if the replacements only happen in some branches.
@@ -246,5 +246,5 @@ export declare function diffControlDependency<Report extends WriteableDifference
246
246
  /**
247
247
  * Calculates the difference between two lists of control dependencies.
248
248
  */
249
- export declare function diffControlDependencies<Report extends WriteableDifferenceReport>(a: ControlDependency[] | undefined, b: ControlDependency[] | undefined, info: GenericDifferenceInformation<Report>): void;
249
+ export declare function diffControlDependencies<Report extends WriteableDifferenceReport>(a: readonly ControlDependency[] | undefined, b: readonly ControlDependency[] | undefined, info: GenericDifferenceInformation<Report>): void;
250
250
  export {};
@@ -83,7 +83,10 @@ export declare const ClosureRefs: {
83
83
  };
84
84
  /** The field an access names, if it is written out: `x$f`, `x[["f"]]`, or `x[[2]]`, which is how a list records its positional entries. */
85
85
  export declare function accessedFieldName(fieldNode: RNode<ParentInformation> | undefined, treatIndicesAsString: boolean | undefined): string | undefined;
86
- /** Links the access at `accessId` to the `fieldDefs` it reaches; a function held in a field is what the access returns. */
86
+ /**
87
+ * Links the access at `accessId` to the `fieldDefs` it reaches; a function held in a field is what the access returns,
88
+ * and so may be a field of unknown kind, like the `read.csv` of `assign("f", read.csv, envir = e)`.
89
+ */
87
90
  export declare function linkFieldReads(graph: DataflowGraph, accessId: NodeId, fieldDefs: readonly IdentifierDefinition[] | undefined, returnsFunctions: boolean): void;
88
91
  /**
89
92
  * An access `x$f` written where `x` was still open reads the field of whatever `x` is bound to once that binding is
@@ -73,7 +73,7 @@ function findNonLocalReads(graph, ignores = new Set()) {
73
73
  }
74
74
  }
75
75
  if (!linked || nonLocal) {
76
- nonLocalReads.push({ nodeId, name: node_id_1.NodeId.recoverName(nodeId, graph.idMap), type });
76
+ nonLocalReads.push({ nodeId, name: node_id_1.NodeId.recoverBareName(nodeId, graph.idMap), type });
77
77
  }
78
78
  }
79
79
  }
@@ -147,7 +147,7 @@ function linkFunctionCallWithSingleTarget(graph, { subflow: fnSubflow, exitPoint
147
147
  for (const captured of df_helper_1.Dataflow.targetsOf(graph, node, edge_1.EdgeType.Reads)) {
148
148
  const frame = fnSubflow.graph.has(captured) ? undefined : model_1.RNode.findEnclosing(captured, idMap, r_function_definition_1.RFunctionDefinition.is);
149
149
  const owner = frame === undefined ? undefined : graph.getVertex(frame);
150
- const name = node_id_1.NodeId.recoverName(captured, idMap);
150
+ const name = node_id_1.NodeId.recoverBareName(captured, idMap);
151
151
  const envState = vertex_2.DfgVertex.isFunctionDefinition(owner) && name !== undefined ? resolve_helper_1.Resolve.byName(name, owner.subflow.environment)?.filter(identifier_1.hasEnvState).find(d => d.nodeId === captured)?.envState : undefined;
152
152
  if (envState !== undefined) {
153
153
  linkFieldWritesOnCall(graph, id, fnId, node, captured, envState, idMap);
@@ -322,7 +322,8 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
322
322
  let followTargets;
323
323
  /* a list handed on as a whole (a loop, an apply) yields its entries, an access the entry it names */
324
324
  const handedBack = !viaAccess && vertex_2.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.List) ? edge_1.EdgeType.Returns | edge_1.EdgeType.Argument : edge_1.EdgeType.Returns;
325
- const returnedTo = vertex_2.DfgVertex.isFunctionCall(vertex) ? cid : call;
325
+ /* only a call into a body binds parameters, a built-in hands back what it is given in the same context */
326
+ const returnedTo = vertex_2.DfgVertex.isFunctionCall(vertex) && !vertex.onlyBuiltin ? cid : call;
326
327
  for (const [target, e] of dataflowGraph.edgesFrom(cid)) {
327
328
  if (edge_1.DfEdge.includesType(e, handedBack)) {
328
329
  hasReturnEdge = true;
@@ -455,7 +456,7 @@ function addControlDependency(holder, cd) {
455
456
  if (holder.cds?.some(c => c.id === cd.id)) {
456
457
  return false;
457
458
  }
458
- (holder.cds ??= []).push(cd);
459
+ holder.cds = [...holder.cds ?? [], cd];
459
460
  return true;
460
461
  }
461
462
  /**
@@ -507,14 +508,17 @@ function accessedFieldName(fieldNode, treatIndicesAsString) {
507
508
  return r_number_1.RNumber.is(fieldNode) && !fieldNode.content.complexNumber && Number.isInteger(fieldNode.content.num) && fieldNode.content.num > 0
508
509
  ? String(fieldNode.content.num) : undefined;
509
510
  }
510
- /** Links the access at `accessId` to the `fieldDefs` it reaches; a function held in a field is what the access returns. */
511
+ /**
512
+ * Links the access at `accessId` to the `fieldDefs` it reaches; a function held in a field is what the access returns,
513
+ * and so may be a field of unknown kind, like the `read.csv` of `assign("f", read.csv, envir = e)`.
514
+ */
511
515
  function linkFieldReads(graph, accessId, fieldDefs, returnsFunctions) {
512
516
  for (const fd of fieldDefs ?? []) {
513
517
  graph.addEdge(accessId, fd.nodeId, edge_1.EdgeType.Reads);
514
518
  if (fd.definedAt !== undefined && fd.definedAt !== fd.nodeId) {
515
519
  graph.addEdge(accessId, fd.definedAt, edge_1.EdgeType.Reads);
516
520
  }
517
- if (returnsFunctions && fd.type === identifier_1.ReferenceType.Function) {
521
+ if (returnsFunctions && (fd.type & (identifier_1.ReferenceType.Function | identifier_1.ReferenceType.Unknown)) !== 0) {
518
522
  graph.addEdge(accessId, fd.nodeId, edge_1.EdgeType.Returns);
519
523
  }
520
524
  }
@@ -573,11 +577,11 @@ function factoryOf(closure, graph, known, idMap) {
573
577
  return undefined;
574
578
  }
575
579
  else if (vertex_2.DfgVertex.isVariableDefinition(vertex)) {
576
- locals.add(node_id_1.NodeId.recoverName(node, idMap) ?? '');
580
+ locals.add(node_id_1.NodeId.recoverBareName(node, idMap) ?? '');
577
581
  }
578
582
  }
579
583
  for (const param of Object.keys(factory.params)) {
580
- locals.add(node_id_1.NodeId.recoverName(node_id_1.NodeId.normalize(param), idMap) ?? '');
584
+ locals.add(node_id_1.NodeId.recoverBareName(node_id_1.NodeId.normalize(param), idMap) ?? '');
581
585
  }
582
586
  return { factory: factory.id, locals };
583
587
  }
@@ -0,0 +1,41 @@
1
+ import type { DataflowProcessorInformation } from '../../../../../processor';
2
+ import type { ParentInformation, RNodeWithParent } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
+ import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
4
+ import { type KeyedState } from '../../../../../environments/ambient-state-name';
5
+ /**
6
+ * Where a call names the entries of a {@link KeyedState} it sets, declared in the built-in configuration.
7
+ * An entry we cannot name is the {@link UnknownKey}.
8
+ */
9
+ export type AmbientKeys = {
10
+ /**
11
+ * The names of the named arguments, like `Sys.setenv(A = "1")` sets `A`. An unnamed argument stands for entries
12
+ * we cannot name (`par(op)`) unless it is a string, which only queries (`par("mar")`).
13
+ */
14
+ readonly from: 'argument-names';
15
+ /** arguments to leave out, like `par(no.readonly = TRUE)` */
16
+ readonly ignore?: readonly string[];
17
+ } | {
18
+ /** the call always sets this entry, like `Sys.setLanguage` sets `LANGUAGE` */
19
+ readonly from: 'constant';
20
+ readonly key: string;
21
+ } | {
22
+ /** the entries a parameter names, like `Sys.setlocale(category = "LC_ALL")` or `detach(package:dplyr)` */
23
+ readonly from: 'parameter';
24
+ /** the formals of the function, for matching the arguments */
25
+ readonly signature: readonly string[];
26
+ /** the parameters to take the entries from, the first one given wins (`attach(what, name = "x")` is `x`) */
27
+ readonly names: readonly string[];
28
+ /** the entry set if none of the parameters is given */
29
+ readonly fallback?: string;
30
+ /**
31
+ * The parameter is quoted, so a symbol or string is the name itself (`library(dplyr)`) instead of a variable to look up.
32
+ * A parameter name states the flag that switches to looking up its value (`library(pkg, character.only = TRUE)`).
33
+ */
34
+ readonly quoted?: boolean | string;
35
+ };
36
+ /** The strings the value at `value` may have, `undefined` if we do not know. */
37
+ export declare function stringValuesOf<OtherInfo>(value: RNodeWithParent<OtherInfo> | undefined, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): string[] | undefined;
38
+ /** The entries the call with the arguments `args` names, see {@link AmbientKeys}. */
39
+ export declare function keysOf<OtherInfo>(keys: AmbientKeys, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], data: DataflowProcessorInformation<OtherInfo & ParentInformation>): string[];
40
+ /** The pseudo variables a write to the given entries of `state` defines: the entries and what every write to the state adds to. No entry has an empty name. */
41
+ export declare function keyedWrites(state: KeyedState, given: readonly string[]): string[];
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringValuesOf = stringValuesOf;
4
+ exports.keysOf = keysOf;
5
+ exports.keyedWrites = keyedWrites;
6
+ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
7
+ const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
8
+ const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
9
+ const r_binary_op_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
10
+ const identifier_1 = require("../../../../../environments/identifier");
11
+ const match_args_1 = require("../../../../../graph/match-args");
12
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
13
+ const ambient_state_name_1 = require("../../../../../environments/ambient-state-name");
14
+ /** The strings the value at `value` may have, `undefined` if we do not know. */
15
+ function stringValuesOf(value, data) {
16
+ if (value === undefined) {
17
+ return undefined;
18
+ }
19
+ else if (r_string_1.RString.is(value)) {
20
+ return [value.content.str];
21
+ }
22
+ const strings = node_value_1.NodeValue.stringsOf(value.info.id, data);
23
+ return strings === undefined || strings.length === 0 ? undefined : strings;
24
+ }
25
+ /** What a quoted argument names: `dplyr`, `"dplyr"`, and `package:dplyr`. */
26
+ function quotedName(node) {
27
+ if (r_symbol_1.RSymbol.is(node)) {
28
+ return identifier_1.Identifier.getName(node.content);
29
+ }
30
+ else if (r_string_1.RString.is(node)) {
31
+ return node.content.str;
32
+ }
33
+ else if (r_binary_op_1.RBinaryOp.is(node) && node.operator === ':') {
34
+ const [namespace, name] = [quotedName(node.lhs), quotedName(node.rhs)];
35
+ return namespace === undefined || name === undefined ? undefined : `${namespace}:${name}`;
36
+ }
37
+ return undefined;
38
+ }
39
+ /** Whether the value at `node` is `TRUE`: `'yes'`, `'no'` (also if there is no flag), or `'maybe'`. */
40
+ function flagValue(node, data) {
41
+ const values = node === undefined ? [] : node_value_1.NodeValue.setOf(node.info.id, data)?.elements;
42
+ if (node === undefined) {
43
+ return 'no';
44
+ }
45
+ else if (values === undefined || values.length === 0 || values.some(v => v.type !== 'logical' || typeof v.value !== 'boolean')) {
46
+ return 'maybe';
47
+ }
48
+ const isTrue = values.map(v => v.type === 'logical' && v.value === true);
49
+ return isTrue.every(Boolean) ? 'yes' : isTrue.some(Boolean) ? 'maybe' : 'no';
50
+ }
51
+ function parameterKeys(keys, args, data) {
52
+ const bound = match_args_1.MatchArgs.toNames(args, keys.signature);
53
+ const value = keys.names.map(n => bound.get(n)?.value).find(v => v !== undefined);
54
+ if (value === undefined) {
55
+ return keys.fallback === undefined ? [] : [keys.fallback];
56
+ }
57
+ /* whether the argument is looked up as a value, which the flag switches on for a quoted one */
58
+ const looksUp = typeof keys.quoted === 'string' ? flagValue(bound.get(keys.quoted)?.value, data) : keys.quoted ? 'no' : 'yes';
59
+ const name = looksUp === 'yes' ? undefined : quotedName(value);
60
+ const values = looksUp === 'no' && name !== undefined ? [] : stringValuesOf(value, data) ?? [ambient_state_name_1.UnknownKey];
61
+ return name === undefined ? values : [name, ...values];
62
+ }
63
+ /** The entries the call with the arguments `args` names, see {@link AmbientKeys}. */
64
+ function keysOf(keys, args, data) {
65
+ switch (keys.from) {
66
+ case 'constant':
67
+ return [keys.key];
68
+ case 'argument-names':
69
+ return args.flatMap(a => {
70
+ if (a === r_function_call_1.EmptyArgument) {
71
+ return [];
72
+ }
73
+ else if (a.name !== undefined) {
74
+ const name = identifier_1.Identifier.getName(a.name.content);
75
+ return keys.ignore?.includes(name) ? [] : [name];
76
+ }
77
+ return r_string_1.RString.is(a.value) ? [] : [ambient_state_name_1.UnknownKey];
78
+ });
79
+ case 'parameter':
80
+ return parameterKeys(keys, args, data);
81
+ }
82
+ }
83
+ /** The pseudo variables a write to the given entries of `state` defines: the entries and what every write to the state adds to. No entry has an empty name. */
84
+ function keyedWrites(state, given) {
85
+ const keys = given.filter(k => k !== '');
86
+ return keys.length === 0 ? [] : [...new Set([...keys.map(k => ambient_state_name_1.AmbientStateName.keyed(state, k)), ambient_state_name_1.AmbientStateName.allOf(state)])];
87
+ }
88
+ //# sourceMappingURL=built-in-ambient-keys.js.map
@@ -10,57 +10,16 @@ import { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
10
10
  import type { LinkTo } from '../../../../../../queries/catalog/call-context-query/call-context-query-format';
11
11
  import type { DataflowGraph } from '../../../../../graph/graph';
12
12
  import { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
13
- /**
14
- * Graphics parameters and options, tracked as global pseudo variables (`#...`) so readers link to the calls that set them.
15
- * Accumulating states only grow: `par(mar = ...)` keeps an earlier `par(mfrow = ...)`.
16
- */
17
- export declare const AmbientStateName: {
18
- /** the graphics state (`par`, `layout`, ...) of the active device, which a new device starts afresh */
19
- readonly graphics: "#graphics";
20
- /** the graphics states of the other open devices, the active one returns to one of them once it closes */
21
- readonly otherDevices: "#graphics:other";
22
- /** the call that opened the active device, and those of the other open devices */
23
- readonly device: "#device";
24
- readonly otherDevicesOpenedBy: "#device:other";
25
- /** the color palette, which, other than the graphics parameters, all devices share */
26
- readonly palette: "#palette";
27
- /** the files on disk, which every call writing a file adds to and every call reading a file we cannot name reads */
28
- readonly files: "#files";
29
- /** written by a call writing a file we cannot name, which every call reading a file reads */
30
- readonly anyFile: "#file:*";
31
- /** the working directory `setwd` changes, which every call accessing a file reads to resolve a relative path */
32
- readonly workingDirectory: "#wd";
33
- /** the state of the random number generator, which `set.seed` sets and every draw advances */
34
- readonly rng: "#rng";
35
- /** the kind of generator, which `set.seed` keeps unless it is given one */
36
- readonly rngKind: "#rng:kind";
37
- /** the global variable R keeps that state in, so assigning it sets {@link AmbientStateName.rng} as well */
38
- readonly rngVariable: ".Random.seed";
39
- /** every option write, for readers that may read any option (`getOption(k)` with an unknown `k`, library functions) */
40
- readonly allOptions: "#options";
41
- /** written by an `options(...)` call whose keys we cannot name, like the common `options(op)` restore */
42
- readonly unknownOption: "#option:*";
43
- /** written along with the option `warn` when it may turn warnings into errors (`warn >= 2`), see {@link errorsOfWarnings} */
44
- readonly warnsAsErrors: "#warn-error";
45
- /** the finalizers registered (`reg.finalizer`) and the removals that may release their objects, which `gc()` may run */
46
- readonly finalizers: "#finalizers";
47
- /** marks `name` as bound to a text connection opened for writing, whose writes change it */
48
- readonly textConnection: (this: void, name: string) => string;
49
- /** the file named `stem` (`data` for `out/data.csv`), so a read of a named file only sees writes that may hit it */
50
- readonly file: (this: void, stem: string) => string;
51
- /** the pseudo variable holding the option `key`; setting the option replaces it */
52
- readonly option: (this: void, key: string) => string;
53
- /** whether `name` is one of these pseudo variables */
54
- readonly is: (this: void, name: Identifier | undefined) => name is string;
55
- };
13
+ import { KeyedState } from '../../../../../environments/ambient-state-name';
14
+ import { type AmbientKeys } from './built-in-ambient-keys';
56
15
  /** Whether calling `definition` runs a body flowR cannot see: a library function's, or whatever a parameter is bound to. */
57
16
  export declare function hidesBody(definition: IdentifierDefinition): boolean;
58
17
  /** A call into code flowR cannot see may read any option, draw random numbers (with `draws` advancing the generator), and with `graphics` draw on the device. */
59
18
  export declare function readsAllAmbientState<OtherInfo>(res: DataflowInformation, rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, graphics: boolean, draws?: boolean): DataflowInformation;
60
19
  /** What an assignment writes beyond its target: only a global `.Random.seed` sets {@link AmbientStateName.rng}. */
61
- export declare function ambientWritesOfAssignment(environment: REnvironmentInformation, target: Identifier, rootId: NodeId, cds: ControlDependency[] | undefined, global: boolean): REnvironmentInformation;
20
+ export declare function ambientWritesOfAssignment(environment: REnvironmentInformation, target: Identifier, rootId: NodeId, cds: readonly ControlDependency[] | undefined, global: boolean): REnvironmentInformation;
62
21
  /** Rebinding or removing the names (all of them if `undefined`) may release an object a finalizer is registered for. */
63
- export declare function ambientWritesOfRelease(environment: REnvironmentInformation, names: readonly Identifier[] | undefined, rootId: NodeId, cds: ControlDependency[] | undefined): REnvironmentInformation;
22
+ export declare function ambientWritesOfRelease(environment: REnvironmentInformation, names: readonly Identifier[] | undefined, rootId: NodeId, cds: readonly ControlDependency[] | undefined): REnvironmentInformation;
64
23
  /** Ambient writes stay out of `out` (see {@link withAccess}), so a part that only maybe runs marks its writes as maybe in `target` here. */
65
24
  export declare function makeAmbientWritesMaybe(after: REnvironmentInformation, before: REnvironmentInformation, target: REnvironmentInformation, cds: readonly ControlDependency[]): void;
66
25
  /** The states written in `after` that `before` does not hold, as by a promise (`delayedAssign`) whose writes only happen once a read forces it. */
@@ -112,7 +71,11 @@ export declare const enum AmbientStateAccessType {
112
71
  /** `reg.finalizer(e, f)`: registers `f` to run once `e` is released */
113
72
  RegisterFinalizer = "register-finalizer",
114
73
  /** `gc()`: may run every registered finalizer whose object is released */
115
- RunFinalizers = "run-finalizers"
74
+ RunFinalizers = "run-finalizers",
75
+ /** sets entries of a keyed state, like `Sys.setenv(A = "1")` sets the environment variable `A`, see {@link AmbientKeys} */
76
+ SetKeyed = "set-keyed",
77
+ /** sets a state without entries, like `sink(file)` diverts the output */
78
+ SetState = "set-state"
116
79
  }
117
80
  /** An {@link AmbientStateAccessType} together with what refines it for some of the types. */
118
81
  export type AmbientStateAccess = {
@@ -138,10 +101,22 @@ export type AmbientStateAccess = {
138
101
  readonly type: AmbientStateAccessType.CloseDevice;
139
102
  /** `graphics.off()` closes every device */
140
103
  readonly all?: boolean;
104
+ } | {
105
+ readonly type: AmbientStateAccessType.SetKeyed;
106
+ readonly state: KeyedState;
107
+ readonly keys: AmbientKeys;
108
+ } | {
109
+ readonly type: AmbientStateAccessType.SetState;
110
+ /** the pseudo variable the call sets, like {@link AmbientStateName.sink} */
111
+ readonly state: string;
112
+ /** `Sys.umask()` only queries the state */
113
+ readonly queryWithoutArguments?: boolean;
141
114
  } | {
142
115
  readonly type: AmbientStateAccessType.SetGraphics;
143
116
  /** `par()` and `par("mar")` only query the state */
144
117
  readonly queryOnUnnamedStrings?: boolean;
118
+ /** the parameters the call sets, which each have a pseudo variable of their own, see {@link KeyedState.Par} */
119
+ readonly keys?: AmbientKeys;
145
120
  /** a query also reads what the last plot left behind (`par("usr")`), linked like an unknown side effect */
146
121
  readonly queryLinksTo?: LinkTo<RegExp | string>;
147
122
  };