@eagleoutice/flowr 2.17.5 → 2.17.6

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 (357) hide show
  1. package/README.md +13 -51
  2. package/abstract-interpretation/absint-inference.d.ts +4 -4
  3. package/abstract-interpretation/absint-inference.js +11 -11
  4. package/abstract-interpretation/abstract-semantics.d.ts +2 -1
  5. package/abstract-interpretation/branch-paths-interpreter.d.ts +1 -0
  6. package/abstract-interpretation/branch-paths-interpreter.js +60 -0
  7. package/abstract-interpretation/branch-paths.d.ts +60 -0
  8. package/abstract-interpretation/branch-paths.js +120 -0
  9. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +6 -1
  10. package/abstract-interpretation/data-frame/dataframe-semantics.js +60 -1
  11. package/abstract-interpretation/data-frame/semantics.js +4 -10
  12. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
  13. package/cli/repl/core.js +51 -0
  14. package/control-flow/cfg-dead-code.js +12 -7
  15. package/data/packed.d.ts +10 -0
  16. package/data/packed.js +33 -0
  17. package/data/r-base-guards.generated.d.ts +7 -0
  18. package/data/r-base-guards.generated.js +12 -0
  19. package/data/r-datasets.generated.d.ts +4 -0
  20. package/data/r-datasets.generated.js +10 -0
  21. package/data/r-formals.generated.d.ts +4 -0
  22. package/data/r-formals.generated.js +10 -0
  23. package/data/r-group-method-guards.generated.d.ts +3 -0
  24. package/data/r-group-method-guards.generated.js +8 -0
  25. package/dataflow/environments/ambient-effect.d.ts +1000 -0
  26. package/dataflow/environments/ambient-effect.js +234 -0
  27. package/dataflow/environments/ambient-state-name.d.ts +45 -2
  28. package/dataflow/environments/ambient-state-name.js +61 -3
  29. package/dataflow/environments/apply-kill.js +11 -4
  30. package/dataflow/environments/built-in-kinds.d.ts +4 -46
  31. package/dataflow/environments/built-in-kinds.js +6 -2
  32. package/dataflow/environments/built-in-props.d.ts +16 -4
  33. package/dataflow/environments/built-in-props.js +11 -3
  34. package/dataflow/environments/built-in.d.ts +6 -1
  35. package/dataflow/environments/built-in.js +13 -36
  36. package/dataflow/environments/default-builtin-config/base-functions.d.ts +1 -1
  37. package/dataflow/environments/default-builtin-config/base-functions.js +110 -52
  38. package/dataflow/environments/default-builtin-config/base-language.d.ts +1 -1
  39. package/dataflow/environments/default-builtin-config/base-language.js +11 -8
  40. package/dataflow/environments/default-builtin-config/dev-tooling.js +1 -1
  41. package/dataflow/environments/default-builtin-config/file-io.js +6 -4
  42. package/dataflow/environments/default-builtin-config/graphics-devices.d.ts +1 -1
  43. package/dataflow/environments/default-builtin-config/graphics-devices.js +24 -14
  44. package/dataflow/environments/default-builtin-config/guard-builders.d.ts +16 -0
  45. package/dataflow/environments/default-builtin-config/guard-builders.js +29 -0
  46. package/dataflow/environments/default-builtin-config/guards-primitive-lang.d.ts +15 -0
  47. package/dataflow/environments/default-builtin-config/guards-primitive-lang.js +228 -0
  48. package/dataflow/environments/default-builtin-config/guards-primitive-ops.d.ts +11 -0
  49. package/dataflow/environments/default-builtin-config/guards-primitive-ops.js +154 -0
  50. package/dataflow/environments/default-builtin-config/guards.d.ts +9 -0
  51. package/dataflow/environments/default-builtin-config/guards.js +211 -0
  52. package/dataflow/environments/default-builtin-config/index.d.ts +3 -3
  53. package/dataflow/environments/default-builtin-config/index.js +22 -7
  54. package/dataflow/environments/default-builtin-config/media-formats.js +4 -4
  55. package/dataflow/environments/default-builtin-config/package-spatial.js +2 -1
  56. package/dataflow/environments/default-builtin-config/package-tidyverse.js +3 -2
  57. package/dataflow/environments/default-builtin-config/package-utils.d.ts +1 -1
  58. package/dataflow/environments/default-builtin-config/package-utils.js +5 -2
  59. package/dataflow/environments/default-builtin-config/parallel-execution.d.ts +1 -1
  60. package/dataflow/environments/default-builtin-config/parallel-execution.js +3 -1
  61. package/dataflow/environments/default-builtin-config/r-formals.d.ts +13 -0
  62. package/dataflow/environments/default-builtin-config/r-formals.js +110 -0
  63. package/dataflow/environments/default-builtin-config/shared-configs.d.ts +138 -77
  64. package/dataflow/environments/default-builtin-config/shared-configs.js +52 -88
  65. package/dataflow/environments/default-builtin-config/statistics.d.ts +1 -1
  66. package/dataflow/environments/default-builtin-config/statistics.js +4 -1
  67. package/dataflow/environments/diff.js +5 -2
  68. package/dataflow/environments/environment.d.ts +20 -0
  69. package/dataflow/environments/environment.js +39 -4
  70. package/dataflow/environments/group-generics.d.ts +5 -1
  71. package/dataflow/environments/group-generics.js +13 -3
  72. package/dataflow/environments/guard-facts.d.ts +169 -0
  73. package/dataflow/environments/guard-facts.js +26 -0
  74. package/dataflow/environments/identifier.d.ts +9 -1
  75. package/dataflow/environments/identifier.js +5 -0
  76. package/dataflow/environments/pkg-name.d.ts +1 -0
  77. package/dataflow/environments/query-fn-props.d.ts +3 -5
  78. package/dataflow/environments/query-fn-props.js +44 -21
  79. package/dataflow/environments/removal-marker.d.ts +2 -0
  80. package/dataflow/environments/removal-marker.js +5 -0
  81. package/dataflow/eval/resolve/resolve-strings.d.ts +2 -5
  82. package/dataflow/eval/resolve/resolve-strings.js +2 -2
  83. package/dataflow/extractor.js +24 -15
  84. package/dataflow/fn/condition-handlers.d.ts +2 -0
  85. package/dataflow/fn/condition-handlers.js +3 -1
  86. package/dataflow/fn/frame-reflection.d.ts +4 -2
  87. package/dataflow/fn/frame-reflection.js +16 -0
  88. package/dataflow/fn/function-props.js +15 -22
  89. package/dataflow/fn/function-semantics.d.ts +31 -1
  90. package/dataflow/fn/function-semantics.js +15 -0
  91. package/dataflow/fn/guards/built-in-guards.d.ts +112 -0
  92. package/dataflow/fn/guards/built-in-guards.js +199 -0
  93. package/dataflow/fn/guards/call-contracts.d.ts +97 -0
  94. package/dataflow/fn/guards/call-contracts.js +331 -0
  95. package/dataflow/fn/guards/condition-grouping.d.ts +20 -0
  96. package/dataflow/fn/guards/condition-grouping.js +135 -0
  97. package/dataflow/fn/guards/function-guards.d.ts +112 -0
  98. package/dataflow/fn/guards/function-guards.js +1549 -0
  99. package/dataflow/fn/guards/group-method-guards.d.ts +28 -0
  100. package/dataflow/fn/guards/group-method-guards.js +56 -0
  101. package/dataflow/fn/guards/guard-claims.d.ts +125 -0
  102. package/dataflow/fn/guards/guard-claims.js +678 -0
  103. package/dataflow/fn/guards/guard-knowledge.d.ts +41 -0
  104. package/dataflow/fn/guards/guard-knowledge.js +180 -0
  105. package/dataflow/fn/guards/guard-term-syntax.d.ts +9 -0
  106. package/dataflow/fn/guards/guard-term-syntax.js +210 -0
  107. package/dataflow/fn/guards/guard-term.d.ts +136 -0
  108. package/dataflow/fn/guards/guard-term.js +550 -0
  109. package/dataflow/fn/guards/stated-guards.d.ts +13 -0
  110. package/dataflow/fn/guards/stated-guards.js +35 -0
  111. package/dataflow/fn/higher-order-function.d.ts +2 -0
  112. package/dataflow/fn/higher-order-function.js +1 -0
  113. package/dataflow/fn/strict-function.d.ts +4 -0
  114. package/dataflow/fn/strict-function.js +66 -17
  115. package/dataflow/graph/ambient-access.d.ts +4 -1
  116. package/dataflow/graph/ambient-access.js +8 -2
  117. package/dataflow/graph/closure-frames.js +1 -1
  118. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  119. package/dataflow/graph/dataflowgraph-builder.js +2 -2
  120. package/dataflow/graph/df-helper.d.ts +6 -0
  121. package/dataflow/graph/df-helper.js +15 -0
  122. package/dataflow/graph/graph.d.ts +12 -6
  123. package/dataflow/graph/graph.js +21 -28
  124. package/dataflow/info.d.ts +2 -1
  125. package/dataflow/info.js +3 -1
  126. package/dataflow/internal/dispatch-linking.d.ts +3 -1
  127. package/dataflow/internal/dispatch-linking.js +1 -0
  128. package/dataflow/internal/linker.d.ts +2 -0
  129. package/dataflow/internal/linker.js +115 -6
  130. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -1
  131. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +5 -2
  132. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +2 -1
  133. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +19 -57
  134. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +471 -295
  135. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +13 -1
  136. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -0
  137. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +106 -19
  138. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
  139. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +24 -3
  140. package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.d.ts +1 -1
  141. package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.js +33 -11
  142. package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +4 -0
  143. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +4 -4
  144. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +23 -7
  145. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
  146. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +19 -2
  147. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +347 -46
  148. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
  149. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +5 -0
  150. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +110 -16
  151. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +2 -0
  152. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +9 -2
  153. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
  154. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -2
  155. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -0
  156. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +28 -0
  157. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +16 -6
  158. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +6 -1
  159. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +37 -2
  160. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +4 -0
  161. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +19 -1
  162. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
  163. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +55 -11
  164. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
  165. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +11 -10
  166. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -1
  167. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +8 -0
  168. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +64 -7
  169. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +1 -1
  170. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +160 -20
  171. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -3
  172. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +6 -0
  173. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +142 -4
  174. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
  175. package/dataflow/internal/process/functions/call/quoted.js +23 -4
  176. package/dataflow/processor.d.ts +2 -0
  177. package/documentation/data/dfg/doc-ambient.d.ts +4 -0
  178. package/documentation/data/dfg/doc-ambient.js +74 -0
  179. package/documentation/wiki-dataflow-graph.js +10 -4
  180. package/documentation/wiki-linter.js +12 -0
  181. package/documentation/wiki-query.js +112 -1
  182. package/linter/linter-rules.d.ts +41 -1
  183. package/linter/linter-rules.js +5 -1
  184. package/linter/rules/call-contracts.d.ts +40 -0
  185. package/linter/rules/call-contracts.js +56 -0
  186. package/linter/rules/cmd-check/bogus-return.js +1 -1
  187. package/linter/rules/cmd-check/call-arguments.js +5 -6
  188. package/linter/rules/cmd-check/cmd-check-util.d.ts +0 -6
  189. package/linter/rules/cmd-check/cmd-check-util.js +0 -28
  190. package/linter/rules/cmd-check/package-hooks.js +2 -1
  191. package/linter/rules/cmd-check/s-three-method-consistency.js +1 -1
  192. package/linter/rules/interactive-functions.d.ts +30 -0
  193. package/linter/rules/interactive-functions.js +87 -0
  194. package/linter/rules/process-state-in-session.js +1 -1
  195. package/linter/rules/undefined-symbol-util.d.ts +1 -1
  196. package/linter/rules/undefined-symbol-util.js +8 -2
  197. package/linter/rules/undefined-symbol.js +18 -7
  198. package/linter/rules/useless-loop.d.ts +1 -1
  199. package/package.json +1 -1
  200. package/project/context/flowr-analyzer-dependencies-context.js +2 -1
  201. package/project/flowr-analyzer.d.ts +1 -0
  202. package/project/flowr-analyzer.js +5 -5
  203. package/project/sigdb/build.js +14 -4
  204. package/project/sigdb/decode.d.ts +3 -0
  205. package/project/sigdb/decode.js +10 -1
  206. package/project/sigdb/guarded-source.d.ts +6 -0
  207. package/project/sigdb/guarded-source.js +29 -0
  208. package/project/sigdb/reader.d.ts +5 -0
  209. package/project/sigdb/reader.js +27 -1
  210. package/project/sigdb/schema.d.ts +24 -2
  211. package/queries/catalog/absint-query/absint-query-format.d.ts +6 -3
  212. package/queries/catalog/absint-query/absint-query-format.js +57 -2
  213. package/queries/catalog/ambient-access-query/ambient-access-query-format.d.ts +6 -2
  214. package/queries/catalog/ambient-access-query/ambient-access-query-format.js +48 -3
  215. package/queries/catalog/cluster-query/cluster-query-format.d.ts +5 -2
  216. package/queries/catalog/cluster-query/cluster-query-format.js +19 -2
  217. package/queries/catalog/code-clones-query/code-clones-query-format.d.ts +5 -2
  218. package/queries/catalog/code-clones-query/code-clones-query-format.js +34 -2
  219. package/queries/catalog/config-query/config-query-format.d.ts +5 -2
  220. package/queries/catalog/config-query/config-query-format.js +41 -2
  221. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +5 -2
  222. package/queries/catalog/control-flow-query/control-flow-query-format.js +19 -2
  223. package/queries/catalog/data-columns-query/data-columns-query-format.d.ts +72 -0
  224. package/queries/catalog/data-columns-query/data-columns-query-format.js +215 -0
  225. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +5 -2
  226. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +38 -2
  227. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +5 -2
  228. package/queries/catalog/dataflow-query/dataflow-query-format.js +18 -2
  229. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  230. package/queries/catalog/dependencies-query/dependencies-query-format.js +8 -3
  231. package/queries/catalog/dependencies-query/function-info/other-path-functions.js +1 -1
  232. package/queries/catalog/dependencies-query/function-info/tagged-functions.d.ts +11 -0
  233. package/queries/catalog/dependencies-query/function-info/tagged-functions.js +18 -0
  234. package/queries/catalog/dice-query/dice-query-format.d.ts +7 -2
  235. package/queries/catalog/dice-query/dice-query-format.js +34 -2
  236. package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -4
  237. package/queries/catalog/does-call-query/does-call-query-format.js +114 -2
  238. package/queries/catalog/files-query/files-query-format.d.ts +5 -2
  239. package/queries/catalog/files-query/files-query-format.js +45 -2
  240. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +6 -3
  241. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +303 -2
  242. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +8 -4
  243. package/queries/catalog/happens-before-query/happens-before-query-format.js +37 -2
  244. package/queries/catalog/id-map-query/id-map-query-format.d.ts +5 -2
  245. package/queries/catalog/id-map-query/id-map-query-format.js +18 -2
  246. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +5 -2
  247. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +29 -2
  248. package/queries/catalog/inspect-fn-guards-query/inspect-fn-guards-query-format.d.ts +37 -0
  249. package/queries/catalog/inspect-fn-guards-query/inspect-fn-guards-query-format.js +125 -0
  250. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +3 -2
  251. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +54 -2
  252. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -2
  253. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +23 -2
  254. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -2
  255. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +15 -2
  256. package/queries/catalog/linter-query/linter-query-format.d.ts +8 -2
  257. package/queries/catalog/linter-query/linter-query-format.js +69 -4
  258. package/queries/catalog/location-map-query/location-map-query-format.d.ts +7 -3
  259. package/queries/catalog/location-map-query/location-map-query-format.js +70 -2
  260. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +5 -2
  261. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +18 -2
  262. package/queries/catalog/origin-query/origin-query-format.d.ts +6 -3
  263. package/queries/catalog/origin-query/origin-query-format.js +29 -2
  264. package/queries/catalog/project-query/project-query-format.d.ts +6 -3
  265. package/queries/catalog/project-query/project-query-format.js +98 -2
  266. package/queries/catalog/provenance-query/provenance-query-format.d.ts +6 -3
  267. package/queries/catalog/provenance-query/provenance-query-format.js +30 -2
  268. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +9 -2
  269. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +38 -2
  270. package/queries/catalog/search-query/search-query-format.d.ts +5 -2
  271. package/queries/catalog/search-query/search-query-format.js +23 -2
  272. package/queries/catalog/signature-query/signature-query-executor.js +3 -1
  273. package/queries/catalog/signature-query/signature-query-format.d.ts +3 -0
  274. package/queries/catalog/signature-query/signature-query-render.js +23 -0
  275. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +13 -2
  276. package/queries/catalog/static-slice-query/static-slice-query-format.js +55 -2
  277. package/queries/catalog/taint-query/taint-query-format.d.ts +6 -3
  278. package/queries/catalog/taint-query/taint-query-format.js +28 -2
  279. package/queries/query.d.ts +48 -27
  280. package/queries/query.js +6 -4
  281. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +2 -0
  282. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -0
  283. package/r-bridge/shell.js +7 -2
  284. package/reconstruct/reconstruct.js +18 -3
  285. package/slicing/static/removal-slice.js +4 -3
  286. package/slicing/static/slice-call.d.ts +11 -0
  287. package/slicing/static/slice-call.js +43 -2
  288. package/slicing/static/static-slicer.d.ts +2 -0
  289. package/slicing/static/static-slicer.js +137 -21
  290. package/slicing/static/visiting-queue.d.ts +2 -0
  291. package/slicing/static/visiting-queue.js +4 -0
  292. package/util/flowr-version.d.ts +1 -1
  293. package/util/flowr-version.js +2 -2
  294. package/util/objects.d.ts +2 -0
  295. package/util/objects.js +5 -0
  296. package/util/r-datasets.d.ts +27 -0
  297. package/util/r-datasets.js +45 -0
  298. package/util/text/playground-link.d.ts +2 -0
  299. package/util/text/playground-link.js +2 -0
  300. package/queries/catalog/absint-query/absint-query-executor.d.ts +0 -6
  301. package/queries/catalog/absint-query/absint-query-executor.js +0 -61
  302. package/queries/catalog/ambient-access-query/ambient-access-query-executor.d.ts +0 -6
  303. package/queries/catalog/ambient-access-query/ambient-access-query-executor.js +0 -50
  304. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +0 -6
  305. package/queries/catalog/cluster-query/cluster-query-executor.js +0 -21
  306. package/queries/catalog/code-clones-query/code-clones-query-executor.d.ts +0 -6
  307. package/queries/catalog/code-clones-query/code-clones-query-executor.js +0 -38
  308. package/queries/catalog/config-query/config-query-executor.d.ts +0 -6
  309. package/queries/catalog/config-query/config-query-executor.js +0 -45
  310. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +0 -6
  311. package/queries/catalog/control-flow-query/control-flow-query-executor.js +0 -21
  312. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +0 -6
  313. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +0 -40
  314. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +0 -6
  315. package/queries/catalog/dataflow-query/dataflow-query-executor.js +0 -20
  316. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +0 -9
  317. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +0 -18
  318. package/queries/catalog/dice-query/dice-query-executor.d.ts +0 -8
  319. package/queries/catalog/dice-query/dice-query-executor.js +0 -37
  320. package/queries/catalog/does-call-query/does-call-query-executor.d.ts +0 -6
  321. package/queries/catalog/does-call-query/does-call-query-executor.js +0 -116
  322. package/queries/catalog/files-query/files-query-executor.d.ts +0 -6
  323. package/queries/catalog/files-query/files-query-executor.js +0 -47
  324. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +0 -6
  325. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +0 -307
  326. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +0 -7
  327. package/queries/catalog/happens-before-query/happens-before-query-executor.js +0 -40
  328. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +0 -6
  329. package/queries/catalog/id-map-query/id-map-query-executor.js +0 -20
  330. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -6
  331. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +0 -31
  332. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +0 -4
  333. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +0 -58
  334. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +0 -7
  335. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +0 -25
  336. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +0 -7
  337. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +0 -17
  338. package/queries/catalog/linter-query/linter-query-executor.d.ts +0 -9
  339. package/queries/catalog/linter-query/linter-query-executor.js +0 -62
  340. package/queries/catalog/location-map-query/location-map-query-executor.d.ts +0 -7
  341. package/queries/catalog/location-map-query/location-map-query-executor.js +0 -73
  342. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +0 -6
  343. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +0 -20
  344. package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -6
  345. package/queries/catalog/origin-query/origin-query-executor.js +0 -31
  346. package/queries/catalog/project-query/project-query-executor.d.ts +0 -6
  347. package/queries/catalog/project-query/project-query-executor.js +0 -103
  348. package/queries/catalog/provenance-query/provenance-query-executor.d.ts +0 -6
  349. package/queries/catalog/provenance-query/provenance-query-executor.js +0 -33
  350. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +0 -10
  351. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +0 -40
  352. package/queries/catalog/search-query/search-query-executor.d.ts +0 -6
  353. package/queries/catalog/search-query/search-query-executor.js +0 -25
  354. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +0 -14
  355. package/queries/catalog/static-slice-query/static-slice-query-executor.js +0 -59
  356. package/queries/catalog/taint-query/taint-query-executor.d.ts +0 -7
  357. package/queries/catalog/taint-query/taint-query-executor.js +0 -30
@@ -0,0 +1,169 @@
1
+ import type { BrandedIdentifier, BrandedNamespace } from './identifier';
2
+ /** The type of a value as R's `typeof` tells it, as a bitfield, with the three kinds of functions as one and the rest of what R has as {@link RValueType.Other}. */
3
+ export declare enum RValueType {
4
+ Null = 1,
5
+ Logical = 2,
6
+ Integer = 4,
7
+ Double = 8,
8
+ Complex = 16,
9
+ Character = 32,
10
+ Raw = 64,
11
+ List = 128,
12
+ Pairlist = 256,
13
+ Function = 512,
14
+ Environment = 1024,
15
+ Symbol = 2048,
16
+ Language = 4096,
17
+ Expression = 8192,
18
+ /** `S4`, `externalptr`, and the like */
19
+ Other = 16384
20
+ }
21
+ /** a bitfield of {@link RValueType} */
22
+ export type RValueTypes = number;
23
+ /** What R has as a value at all. */
24
+ export declare const AnyType: RValueTypes;
25
+ /** What a predicate over one value says about the type of the value. */
26
+ export interface TypePredicate {
27
+ /** the types it can be true for */
28
+ readonly yes: RValueTypes;
29
+ /** it tells these types and no other, so finding it false rules them out as well, or does so only for a value without a class attribute, as `is.integer` is false for a factor */
30
+ readonly exact?: boolean | 'unclassed';
31
+ /** a value with a class attribute of these types passes as well, like an S4 object holding an environment does for `is.environment` */
32
+ readonly classedToo?: RValueTypes;
33
+ /** true for every value of these types without attributes, other than `NULL` */
34
+ readonly plain?: boolean;
35
+ /** only true for a value with a class attribute, like `is.data.frame` */
36
+ readonly classed?: boolean;
37
+ /** only true for something of length one */
38
+ readonly scalar?: boolean;
39
+ /** being true makes the value usable as a function */
40
+ readonly callable?: boolean;
41
+ }
42
+ /** What not failing says about the argument a checking call was handed. */
43
+ export interface CheckingCall {
44
+ readonly types?: RValueTypes;
45
+ readonly classed?: boolean;
46
+ /** the argument naming the only values allowed */
47
+ readonly choices?: BrandedIdentifier;
48
+ /** without that argument, the default of the formal it was handed states the choices */
49
+ readonly choicesFromDefault?: boolean;
50
+ /** partial matches of the choices also pass */
51
+ readonly partial?: boolean;
52
+ /** a length-one value is all that passes */
53
+ readonly scalar?: boolean;
54
+ /** the arguments that let more through, each with the types it may add; anything else they take (`len`, `lower`) only narrows */
55
+ readonly loosens?: Readonly<Record<BrandedIdentifier, RValueTypes>>;
56
+ /** the arguments that keep it from failing at once, so not even the check itself is a guard, like `add` */
57
+ readonly defers?: readonly BrandedIdentifier[];
58
+ /** failing is all it does when the argument was not given */
59
+ readonly present?: boolean;
60
+ }
61
+ /** A condition R checks of the value bound to a formal, stated as data so that a configuration can change it. */
62
+ export type RCondition =
63
+ /** the predicate holds of the value, or of what `of` reads off it, like `is.null(dim(x))` */
64
+ {
65
+ readonly is: BrandedIdentifier;
66
+ readonly of?: BrandedIdentifier;
67
+ } | {
68
+ readonly not: RCondition;
69
+ } | {
70
+ readonly any: readonly RCondition[];
71
+ } | {
72
+ readonly all: readonly RCondition[];
73
+ }
74
+ /** the length of the value compares to the given one */
75
+ | {
76
+ readonly length: '==' | '<=' | '>=';
77
+ readonly to: number;
78
+ }
79
+ /** the value can be applied as a function, which depends on the functions around */
80
+ | {
81
+ readonly callable: true;
82
+ }
83
+ /** the condition holds of the value bound to another formal of the same call, like `is.null(value)` letting any `x` of `attr<-` through */
84
+ | {
85
+ readonly on: BrandedIdentifier;
86
+ readonly holds: RCondition;
87
+ }
88
+ /** what `of` reads off the value, the outermost reader first, compares to a number, to what is read off another formal, or to what a call without arguments returns */
89
+ | {
90
+ readonly compare: '==' | '<=' | '>=' | '<' | '>';
91
+ readonly of?: readonly BrandedIdentifier[];
92
+ readonly to: number | ROperand;
93
+ };
94
+ /** What a comparison of an {@link RCondition} compares to: what `of` reads off the value of formal `on`, or what calling `call` without arguments returns, like `...length()`. */
95
+ export type ROperand = {
96
+ readonly on: BrandedIdentifier;
97
+ readonly of?: readonly BrandedIdentifier[];
98
+ } | {
99
+ readonly call: BrandedIdentifier;
100
+ };
101
+ /** The R versions something holds for, from `since` on and before `until`, either end open if left out. */
102
+ export interface RVersions {
103
+ readonly since?: string;
104
+ readonly until?: string;
105
+ }
106
+ /** A failure R raises by itself if the value bound to a formal does not pass a condition. */
107
+ export interface RFailure extends RVersions {
108
+ readonly requires: RCondition;
109
+ /** what R says, with `%s` for the value */
110
+ readonly message: string;
111
+ /** a value with a class attribute, or a classed other operand, may bring a method of its own, which lets anything through */
112
+ readonly dispatches?: boolean;
113
+ /** R only looks at the value if another formal passes this, as `TRUE && y` evaluates `y` while `FALSE && y` does not */
114
+ readonly when?: {
115
+ readonly of: BrandedIdentifier;
116
+ readonly holds: RCondition;
117
+ };
118
+ }
119
+ /** What the value a function returns is like, whatever it was handed. */
120
+ export interface ReturnedValue {
121
+ readonly types: RValueTypes;
122
+ /** it is a single value */
123
+ readonly scalar?: boolean;
124
+ /** no element of it is `NA` */
125
+ readonly notNA?: boolean;
126
+ /** it counts something, so it holds whole numbers none of which is negative */
127
+ readonly count?: boolean;
128
+ /** it holds at least one element */
129
+ readonly nonEmpty?: boolean;
130
+ /** for a list, the types each of its elements has, as the columns of a data frame read from a file */
131
+ readonly elements?: RValueTypes;
132
+ /** all of this holds only if the value of this formal has no class attribute, as a method for a classed one may return anything */
133
+ readonly dispatchesOn?: BrandedIdentifier;
134
+ }
135
+ /** What a function has to do with the guards of what calls it, all read off the built-in definitions rather than its name. */
136
+ export interface GuardFacts {
137
+ /** the package providing it, none for what R ships with */
138
+ readonly pkg?: BrandedNamespace;
139
+ /** it tells something about the type of its argument */
140
+ readonly predicate?: TypePredicate;
141
+ /** what it returns, with the types it returns that for, as `typeof` does */
142
+ readonly reads?: Readonly<Record<string, RValueTypes>>;
143
+ /** it reads whole numbers off its argument, which a comparison can bound: always one if `single`, one per element if `elementwise`, and one or none at all (`NULL`) if `nullable`, so `stopifnot` lets the latter pass without bounding anything */
144
+ readonly measures?: 'single' | 'elementwise' | 'nullable';
145
+ /** its not failing says something about its first argument */
146
+ readonly check?: CheckingCall;
147
+ /** it fails unless each of its arguments is a single `TRUE`, as `stopifnot` does elsewhere, with the arguments that are no conditions */
148
+ readonly asserts?: readonly BrandedIdentifier[];
149
+ /** what R fails on for the value of each formal on top of evaluating it, a `callable` condition marking the formal holding what it applies at once */
150
+ readonly asks?: Readonly<Record<BrandedIdentifier, readonly RFailure[]>>;
151
+ /** the formals a call has to hand a value, as R fails on a call without one even though nothing evaluates it */
152
+ readonly required?: readonly BrandedIdentifier[];
153
+ /** it yields one logical, no matter how long its arguments are */
154
+ readonly singleResult?: boolean;
155
+ /** what it returns, or `argument` for the one argument it was handed, as `invisible` returns it; a predicate, a measure, and what {@link GuardFacts.reads} need not state it */
156
+ readonly returns?: ReturnedValue | 'argument';
157
+ /** it does not do anything but compute, whatever else is stated of it */
158
+ readonly computes?: boolean;
159
+ /** the formals a missing formal can be handed to without an error, as the special primitives matching their arguments themselves take it as not given */
160
+ readonly missingOk?: readonly BrandedIdentifier[];
161
+ /** it hands out a frame or writes to one in a way the dataflow does not see */
162
+ readonly opensFrame?: boolean;
163
+ /** what holds instead for some R versions, in place of what is stated above */
164
+ readonly changed?: readonly (RVersions & {
165
+ readonly facts: Omit<GuardFacts, 'changed'>;
166
+ })[];
167
+ }
168
+ /** What is stated about a function by its name alone, see {@link GuardFacts}. */
169
+ export type GuardFactsLookup = (name: BrandedIdentifier) => GuardFacts | undefined;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnyType = exports.RValueType = void 0;
4
+ /** The type of a value as R's `typeof` tells it, as a bitfield, with the three kinds of functions as one and the rest of what R has as {@link RValueType.Other}. */
5
+ var RValueType;
6
+ (function (RValueType) {
7
+ RValueType[RValueType["Null"] = 1] = "Null";
8
+ RValueType[RValueType["Logical"] = 2] = "Logical";
9
+ RValueType[RValueType["Integer"] = 4] = "Integer";
10
+ RValueType[RValueType["Double"] = 8] = "Double";
11
+ RValueType[RValueType["Complex"] = 16] = "Complex";
12
+ RValueType[RValueType["Character"] = 32] = "Character";
13
+ RValueType[RValueType["Raw"] = 64] = "Raw";
14
+ RValueType[RValueType["List"] = 128] = "List";
15
+ RValueType[RValueType["Pairlist"] = 256] = "Pairlist";
16
+ RValueType[RValueType["Function"] = 512] = "Function";
17
+ RValueType[RValueType["Environment"] = 1024] = "Environment";
18
+ RValueType[RValueType["Symbol"] = 2048] = "Symbol";
19
+ RValueType[RValueType["Language"] = 4096] = "Language";
20
+ RValueType[RValueType["Expression"] = 8192] = "Expression";
21
+ /** `S4`, `externalptr`, and the like */
22
+ RValueType[RValueType["Other"] = 16384] = "Other";
23
+ })(RValueType || (exports.RValueType = RValueType = {}));
24
+ /** What R has as a value at all. */
25
+ exports.AnyType = (1 << 15) - 1;
26
+ //# sourceMappingURL=guard-facts.js.map
@@ -2,7 +2,7 @@ import type { AmbientStateName } from './ambient-state-name';
2
2
  import type { AttachedBuiltIn, BuiltInIdentifierConstant, BuiltInIdentifierDefinition } from './built-in';
3
3
  import type { Accessor } from '../../util/accessor';
4
4
  import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
5
- import type { ControlDependency } from '../info';
5
+ import type { ControlDependency, ExitPoint } from '../info';
6
6
  import type { REnvironmentInformation } from './environment';
7
7
  import type { Origin } from '../origin/dfg-get-origin';
8
8
  export { PkgName } from './pkg-name';
@@ -44,6 +44,8 @@ export declare const Identifier: {
44
44
  readonly accessesInternal: (this: void, id: Identifier | undefined) => boolean | undefined;
45
45
  /** Convert the identifier to a **valid R** string representation, this will properly quote namespaces that contain `::` to avoid confusion. */
46
46
  readonly toString: Accessor<Identifier, string>;
47
+ /** {@link Identifier.toString} as R reads it where the base packages R attaches on startup are on the search path: a name of theirs alone, any other qualified. */
48
+ readonly toPreludeString: (this: void, id: Identifier) => string;
47
49
  /** Check if two identifiers match. */
48
50
  readonly matches: (this: void, id: Identifier, target: Identifier, s3?: boolean) => boolean;
49
51
  /** Helper to create a regular expression that matches against an array of {@link Identifier} values. */
@@ -164,6 +166,12 @@ export interface InGraphIdentifierDefinition extends IdentifierReference {
164
166
  readonly iterated?: boolean;
165
167
  /** The ambient state reading this identifier may change, as forcing a promise (`delayedAssign`) whose code writes it does. */
166
168
  readonly forces?: readonly AmbientStateName[];
169
+ /** The variables forcing the promise this identifier binds (`delayedAssign("y", x <- TRUE)`) may write, which a read of it may define. */
170
+ readonly forcedWrites?: readonly NamedInGraphIdentifierDefinition[];
171
+ /** How forcing the promise this identifier binds may leave the function, `delayedAssign("p", return(1))` returning from it, which a read of it may do. */
172
+ readonly forcedExits?: readonly ExitPoint[];
173
+ /** The ambient state forcing the promise this identifier binds reads, which it reads where it is forced. */
174
+ readonly forcedReads?: readonly AmbientStateName[];
167
175
  /** Whether the ambient state is only assumed written, by a body flowR cannot see. */
168
176
  readonly assumed?: true;
169
177
  /** For a registered finalizer, the variable holding the object it is registered for. */
@@ -77,6 +77,11 @@ exports.Identifier = {
77
77
  }
78
78
  return id.includes('::') ? JSON.stringify(id) : id;
79
79
  }),
80
+ /** {@link Identifier.toString} as R reads it where the base packages R attaches on startup are on the search path: a name of theirs alone, any other qualified. */
81
+ toPreludeString(id) {
82
+ const namespace = exports.Identifier.getNamespace(id);
83
+ return namespace === undefined || r_base_packages_1.AttachedBasePackageSet.has(namespace) ? exports.Identifier.getName(id) : exports.Identifier.toString(id);
84
+ },
80
85
  /** Check if two identifiers match. */
81
86
  matches(id, target, s3 = false) {
82
87
  const idName = exports.Identifier.getName(id);
@@ -4,6 +4,7 @@ export declare const enum PkgName {
4
4
  Compiler = "compiler",
5
5
  Graphics = "graphics",
6
6
  GrDevices = "grDevices",
7
+ Grid = "grid",
7
8
  Methods = "methods",
8
9
  Parallel = "parallel",
9
10
  Stats = "stats",
@@ -1,12 +1,8 @@
1
- /**
2
- * `FunctionSemantics` wires the call helpers together and this file sits below it, so `CallProps` is used directly here; reaching for `FunctionSemantics.call.props` would make `src/dataflow/fn/function-semantics.ts` import its own importers.
3
- * @lintIgnore use-instead
4
- */
5
1
  import { type ArgProps, type BuiltInFnInfo, type FnSig, type PropSelector, type SemanticCallTags, type StatedProps, CallProps } from './built-in-props';
6
2
  import type { BuiltIns } from './built-in';
7
3
  import type { BuiltInDefinition, BuiltInDefinitions } from './built-in-config';
8
4
  import type { REnvironmentInformation } from './environment';
9
- import type { BrandedIdentifier, BrandedNamespace } from './identifier';
5
+ import type { BrandedIdentifier, IdentifierDefinition, BrandedNamespace } from './identifier';
10
6
  import { Identifier } from './identifier';
11
7
  import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
12
8
  import type { PackageSignatureSource } from '../../project/sigdb/reader';
@@ -25,6 +21,8 @@ export interface FnPropsSource {
25
21
  /** the package version to ask the signature database for (its latest by default) */
26
22
  readonly version?: string;
27
23
  }
24
+ /** The definitions `name` resolves to as a function in `environment`, each package export replaced by what flowR states about it. */
25
+ export declare function statedFunctions(name: Identifier, environment: REnvironmentInformation): readonly IdentifierDefinition[] | undefined;
28
26
  /** What flowR knows about the function `name`: what the built-in definitions state, filled up with what the signature database knows (see {@link fnInfoFromSignature}). */
29
27
  export declare function queryFnProps(name: Identifier, { environment, builtIns, signatures, version }: FnPropsSource): BuiltInFnInfo | undefined;
30
28
  /** How to ask what flowR states about a built-in, answering every name once. */
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BuiltInIndex = void 0;
4
+ exports.statedFunctions = statedFunctions;
4
5
  exports.queryFnProps = queryFnProps;
5
6
  exports.builtInLookup = builtInLookup;
6
7
  exports.callFnProps = callFnProps;
@@ -13,6 +14,7 @@ exports.builtInNames = builtInNames;
13
14
  * `FunctionSemantics` wires the call helpers together and this file sits below it, so `CallProps` is used directly here; reaching for `FunctionSemantics.call.props` would make `src/dataflow/fn/function-semantics.ts` import its own importers.
14
15
  * @lintIgnore use-instead
15
16
  */
17
+ const strings_1 = require("../../util/text/strings");
16
18
  const built_in_props_1 = require("./built-in-props");
17
19
  const function_semantics_1 = require("../fn/function-semantics");
18
20
  const default_builtin_config_1 = require("./default-builtin-config");
@@ -52,27 +54,33 @@ function withStatedBuiltIns(definitions, environment) {
52
54
  }
53
55
  return replaced ?? definitions;
54
56
  }
57
+ /** The definitions `name` resolves to as a function in `environment`, each package export replaced by what flowR states about it. */
58
+ function statedFunctions(name, environment) {
59
+ const resolved = resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.Function);
60
+ return resolved === undefined ? undefined : withStatedBuiltIns(resolved, environment);
61
+ }
55
62
  function ofDefinitions(definitions) {
56
63
  let sig;
57
64
  let stated = {};
58
65
  let frame;
66
+ let muffles;
59
67
  for (const d of definitions ?? []) {
60
68
  if (d.type !== identifier_1.ReferenceType.BuiltInFunction) {
61
69
  continue;
62
70
  }
63
71
  const info = d.config;
64
72
  sig ??= info?.sig;
73
+ muffles ??= info?.muffles;
65
74
  stated = function_semantics_1.FunctionSemantics.call.props.join(stated, info);
66
75
  frame = info?.frame === undefined ? frame : (frame ?? 0) | info.frame;
67
76
  }
68
- return sig === undefined && frame === undefined && !function_semantics_1.FunctionSemantics.call.props.hasAny(stated) ? undefined : { sig, ...stated, frame };
77
+ return sig === undefined && frame === undefined && !function_semantics_1.FunctionSemantics.call.props.hasAny(stated) ? undefined : { sig, ...stated, frame, ...muffles === undefined ? {} : { muffles } };
69
78
  }
70
79
  /** What flowR knows about the function `name`: what the built-in definitions state, filled up with what the signature database knows (see {@link fnInfoFromSignature}). */
71
80
  function queryFnProps(name, { environment, builtIns, signatures, version }) {
72
81
  let info;
73
82
  if (environment !== undefined) {
74
- const resolved = resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.Function);
75
- const stated = resolved === undefined ? undefined : withStatedBuiltIns(resolved, environment);
83
+ const stated = statedFunctions(name, environment);
76
84
  if (stated?.some(d => d.type !== identifier_1.ReferenceType.BuiltInFunction)) {
77
85
  return undefined;
78
86
  }
@@ -194,27 +202,42 @@ function fnEntry(name, ctx, version) {
194
202
  function nonEmpty(of) {
195
203
  return of !== undefined && of.length > 0 ? of : undefined;
196
204
  }
197
- /** The package an unqualified `name` is answered for. */
205
+ /** The package an unqualified `name` is answered for: a dependency exporting it, else an attached base package, asking only those rather than every package of the database. */
198
206
  function packageExporting(name, ctx) {
199
- let best;
200
- let bestRank = Number.MAX_SAFE_INTEGER;
201
- let pulled;
202
- for (const pkg of ctx.deps.packagesExporting(name)) {
203
- const attached = pkg === "base" /* PkgName.Base */ || r_base_packages_1.AttachedBasePackageSet.has(pkg);
204
- if (!attached) {
205
- pulled ??= new Set(ctx.deps.getDependencies().map(d => d.name));
206
- if (!pulled.has(pkg)) {
207
- continue; // nothing attaches it here, so no call in this project reaches it unqualified
207
+ if (!ctx.deps.hasSignatureDatabase()) {
208
+ return (0, r_base_packages_1.baseRExportOwner)(name);
209
+ }
210
+ /* a `library()` the analysis meets adds a dependency, which may answer a name anew */
211
+ const dependencies = ctx.deps.getDependencies().length;
212
+ let known = ExportingPerContext.get(ctx.deps);
213
+ if (known?.dependencies !== dependencies) {
214
+ known = { dependencies, owners: new Map() };
215
+ ExportingPerContext.set(ctx.deps, known);
216
+ }
217
+ if (!known.owners.has(name)) {
218
+ known.owners.set(name, exportingPackage(name, ctx));
219
+ }
220
+ return known.owners.get(name);
221
+ }
222
+ /** what {@link packageExporting} answered per dependencies context, as long as it has the same number of dependencies */
223
+ const ExportingPerContext = new WeakMap();
224
+ function exportingPackage(name, ctx) {
225
+ const db = (0, signature_db_1.signatureDbOf)(ctx.deps);
226
+ const src = db.sources();
227
+ const mostUsed = (pkgs) => {
228
+ let best;
229
+ for (const pkg of pkgs) {
230
+ if (db.rawFunctionOf(identifier_1.Identifier.make(name, pkg))?.exported === true && (best === undefined || src.downloads(pkg) > src.downloads(best) || (src.downloads(pkg) === src.downloads(best) && (0, strings_1.compareByCodeUnit)(pkg, best) < 0))) {
231
+ best = pkg;
208
232
  }
209
- return pkg; // and nothing outranks a package the code attaches itself
210
- }
211
- const rank = pkg === "base" /* PkgName.Base */ ? 2 : 1;
212
- if (rank < bestRank) {
213
- bestRank = rank;
214
- best = pkg;
215
233
  }
216
- }
217
- return best ?? (0, r_base_packages_1.baseRExportOwner)(name);
234
+ return best;
235
+ };
236
+ const attached = (pkg) => pkg === "base" /* PkgName.Base */ || r_base_packages_1.AttachedBasePackageSet.has(pkg);
237
+ return mostUsed(new Set(ctx.deps.getDependencies().map(d => d.name).filter(p => !attached(p))))
238
+ ?? mostUsed([...r_base_packages_1.AttachedBasePackageSet].filter(p => p !== "base" /* PkgName.Base */))
239
+ ?? mostUsed(["base" /* PkgName.Base */])
240
+ ?? (0, r_base_packages_1.baseRExportOwner)(name);
218
241
  }
219
242
  /** The identifiers a definition registers, with the suffixes of a replacement spelled out. */
220
243
  function builtInNames(definition) {
@@ -1,6 +1,8 @@
1
1
  import type { BrandedIdentifier } from './identifier';
2
2
  /** The reserved name recording that `name` was removed. */
3
3
  export declare function removalMarkerOf(name: BrandedIdentifier): BrandedIdentifier;
4
+ /** The name a {@link removalMarkerOf|marker} records the removal of, or the name itself if it is no marker. */
5
+ export declare function removedNameOf(name: BrandedIdentifier): BrandedIdentifier;
4
6
  /** Records that a {@link removalMarkerOf|marker} was written for `name`; see {@link anyRemovalMarker}. */
5
7
  export declare function noteRemovalMarker(name: BrandedIdentifier): void;
6
8
  /** Whether a removal marker was ever written for `name`, so nothing else pays for looking one up. */
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.removalMarkerOf = removalMarkerOf;
4
+ exports.removedNameOf = removedNameOf;
4
5
  exports.noteRemovalMarker = noteRemovalMarker;
5
6
  exports.anyRemovalMarker = anyRemovalMarker;
6
7
  const removalMarkerPrefix = ' rm-removal:';
@@ -8,6 +9,10 @@ const removalMarkerPrefix = ' rm-removal:';
8
9
  function removalMarkerOf(name) {
9
10
  return (removalMarkerPrefix + name);
10
11
  }
12
+ /** The name a {@link removalMarkerOf|marker} records the removal of, or the name itself if it is no marker. */
13
+ function removedNameOf(name) {
14
+ return name.startsWith(removalMarkerPrefix) ? name.slice(removalMarkerPrefix.length) : name;
15
+ }
11
16
  const removedNames = new Set();
12
17
  /** Records that a {@link removalMarkerOf|marker} was written for `name`; see {@link anyRemovalMarker}. */
13
18
  function noteRemovalMarker(name) {
@@ -44,12 +44,9 @@ export declare const StringFns: {
44
44
  };
45
45
  readonly paste0: {
46
46
  readonly pkg: PkgName.Base;
47
- readonly params: readonly ["...", "sep"];
48
- readonly defaults: {
49
- readonly sep: "";
50
- };
47
+ readonly params: readonly ["..."];
51
48
  readonly ignored: readonly ["collapse"];
52
- readonly fold: (parts: string[], sep: string) => string;
49
+ readonly fold: (parts: string[]) => string;
53
50
  };
54
51
  readonly 'file.path': {
55
52
  readonly pkg: PkgName.Base;
@@ -51,9 +51,9 @@ function format(fmt, parts) {
51
51
  * parameter with a default. The rest take a fixed number of arguments under the names R documents.
52
52
  */
53
53
  exports.StringFns = {
54
- /* the joining calls, which differ only in their separator and what the argument overriding it is called */
54
+ /* the joining calls, `paste0` has no separator, so a `sep` is one more part */
55
55
  paste: { pkg: "base" /* PkgName.Base */, params: ['...', 'sep'], defaults: { sep: ' ' }, ignored: ['collapse'], fold: (parts, sep) => parts.join(sep) },
56
- paste0: { pkg: "base" /* PkgName.Base */, params: ['...', 'sep'], defaults: { sep: '' }, ignored: ['collapse'], fold: (parts, sep) => parts.join(sep) },
56
+ paste0: { pkg: "base" /* PkgName.Base */, params: ['...'], ignored: ['collapse'], fold: (parts) => parts.join('') },
57
57
  'file.path': { pkg: "base" /* PkgName.Base */, params: ['...', 'fsep'], defaults: { fsep: '/' }, fold: (parts, fsep) => parts.join(fsep) },
58
58
  sprintf: { pkg: "base" /* PkgName.Base */, params: ['fmt', '...'], fold: (fmt, parts = []) => format(fmt, parts) },
59
59
  /* the project root stays implicit, so the fold yields the path below it */
@@ -48,6 +48,7 @@ const config_1 = require("../config");
48
48
  const df_helper_1 = require("./graph/df-helper");
49
49
  const built_in_ambient_state_1 = require("./internal/process/functions/call/built-in/built-in-ambient-state");
50
50
  const ambient_state_name_1 = require("./environments/ambient-state-name");
51
+ const ambient_access_1 = require("./graph/ambient-access");
51
52
  const unnamed_call_handling_1 = require("./internal/process/functions/call/unnamed-call-handling");
52
53
  const built_in_proc_name_1 = require("./environments/built-in-proc-name");
53
54
  const built_in_envir_utils_1 = require("./internal/process/functions/call/built-in/built-in-envir-utils");
@@ -453,6 +454,10 @@ function linkResourceReadersToWriters(graph, environment, ctx) {
453
454
  };
454
455
  /* each added edge clears the graph's cached call names, but none of these edges changes what a call targets */
455
456
  const prints = (0, defaultmap_1.memoize)((id) => function_semantics_1.FunctionSemantics.call.props.hasAll((0, query_fn_props_1.callFnProps)(id, { graph, environment }), [built_in_props_1.SemanticCallTag.Prints]));
457
+ const diverts = (id) => {
458
+ const access = graph.ambientAccessOf(id);
459
+ return access !== undefined && ambient_access_1.AmbientAccess.names(access)[ambient_access_1.AmbientAccessKind.Write].some(state => state === ambient_state_name_1.OutputSinks.switched || state === ambient_state_name_1.MessageSinks.switched);
460
+ };
456
461
  let cfg;
457
462
  for (const reader of readers) {
458
463
  let before;
@@ -463,8 +468,8 @@ function linkResourceReadersToWriters(graph, environment, ctx) {
463
468
  before ??= (0, happens_before_1.reachableTo)(cfg ??= new control_flow_graph_1.ControlFlowGraph(graph), [reader.id]);
464
469
  if (before.has(writer.id)) {
465
470
  graph.addEdge(reader.id, writer.id, edge_1.EdgeType.Reads);
466
- /* whatever prints into a diverting writer (`print` after `sink(file)`) writes to the resource as well */
467
- for (const id of df_helper_1.Dataflow.sourcesOf(graph, writer.id, edge_1.EdgeType.Reads).filter(prints)) {
471
+ /* whatever prints into a diverting writer (`print` after `sink(file)`) writes to the resource as well, a writer that diverts nothing (`dir.create`) takes none of it */
472
+ for (const id of diverts(writer.id) ? df_helper_1.Dataflow.sourcesOf(graph, writer.id, edge_1.EdgeType.Reads).filter(prints) : []) {
468
473
  graph.addEdge(reader.id, id, edge_1.EdgeType.Reads);
469
474
  }
470
475
  }
@@ -529,13 +534,14 @@ function separateFileWritesPerCall(graph, environment, ctx) {
529
534
  return { reads, writes };
530
535
  });
531
536
  const readPaths = (0, defaultmap_1.memoize)((id) => fileAccess(id).reads ? pathsOf(id, false, graph, environment, ctx) : undefined);
532
- /* writing to the console (`cat(x)`) names no file, and has no call to tell apart */
533
- const namesFile = (id) => {
537
+ /* writing to the console (`cat(x)`) names no file, but writes into the diversion of the output, whose end reads every call printing */
538
+ const writesFile = (id) => {
534
539
  const vertex = graph.getVertex(id);
535
- return resourceArgs((0, applied_arguments_1.appliedArguments)(graph, vertex), (0, query_fn_props_1.callFnProps)(id, { graph, environment }), true).length > 0;
540
+ return (fileAccess(id).writes && resourceArgs((0, applied_arguments_1.appliedArguments)(graph, vertex), (0, query_fn_props_1.callFnProps)(id, { graph, environment }), true).length > 0)
541
+ || graph.ambientAccessOf(id)?.writes.has(ambient_state_name_1.AmbientStateName.sinkOutput) === true;
536
542
  };
537
543
  const writers = [...graph.verticesOfType(vertex_1.VertexType.FunctionCall)].map(([id]) => id)
538
- .filter(id => graph.edgesFrom(id).values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.SideEffectOnCall)) && !graph.unknownSideEffects.has(id) && fileAccess(id).writes && namesFile(id));
544
+ .filter(id => graph.edgesFrom(id).values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.SideEffectOnCall)) && !graph.unknownSideEffects.has(id) && writesFile(id));
539
545
  const separated = new Set();
540
546
  for (const writer of writers) {
541
547
  const levels = fileWriteLevels(writer, graph, idMap, callContext => pathsOf(writer, true, graph, environment, ctx, callContext));
@@ -649,6 +655,8 @@ function extractDataFlowGraph(parser, completeAst, ctx) {
649
655
  const files = completeAst.ast.files.slice();
650
656
  ctx.files.addConsideredFile(files[0].filePath ? files[0].filePath : flowr_file_1.FlowrFile.INLINE_PATH);
651
657
  const env = ctx.env.makeCleanEnv();
658
+ /* what an earlier program noted on the built-in environment all programs share does not hold for this one */
659
+ environment_1.REnvironment.findBuiltIn(env.current).forgetProgramMarks();
652
660
  env.current.n = ctx.meta.getNamespace();
653
661
  const environment = (0, built_in_library_1.attachProject)(env, ctx);
654
662
  const dfData = {
@@ -659,6 +667,7 @@ function extractDataFlowGraph(parser, completeAst, ctx) {
659
667
  cds: undefined,
660
668
  referenceChain: [files[0].filePath],
661
669
  statementOrder: new Map(),
670
+ unreachable: new Set(),
662
671
  ctx
663
672
  };
664
673
  let df = (0, assert_1.guardNesting)('Dataflow analysis', files[0].filePath, () => (0, processor_1.processDataflowFor)(files[0].root, dfData));
@@ -701,21 +710,21 @@ function extractDataFlowGraph(parser, completeAst, ctx) {
701
710
  const cleanEnvironment = ctx.env.makeCleanEnv();
702
711
  (0, linker_1.separateClosureInstances)(df.graph, name => (0, query_fn_props_1.queryFnProps)(name, { environment: cleanEnvironment }));
703
712
  (0, transitive_side_effects_1.linkPromisesToWritesOfCall)(df.graph, ctx);
713
+ (0, transitive_side_effects_1.linkStatementsAfterCallsOfClosures)(df.graph);
714
+ (0, transitive_side_effects_1.linkStateWritesOfForcedPromises)(df.graph);
715
+ (0, transitive_side_effects_1.linkUsesOfScopedInstances)(df.graph);
704
716
  (0, transitive_side_effects_1.settleConditionalWritesOfCalls)(df.graph, ctx);
705
717
  function_semantics_1.FunctionSemantics.call.quoted.finalize(df.graph, df.environment, completeAst.idMap, () => new control_flow_graph_1.ControlFlowGraph(df.graph));
706
718
  (0, built_in_try_catch_1.linkLateWarningsAsErrors)(df.graph, df.environment, completeAst.idMap);
707
719
  (0, built_in_try_catch_1.linkHandlersToSignalSites)(df.graph, df.environment, dfData);
708
- (0, built_in_try_catch_1.orderRaisingBodies)(df.graph, completeAst.idMap, ctx);
720
+ (0, built_in_try_catch_1.orderRaisingBodies)(df.graph, completeAst.idMap, ctx, df.environment);
709
721
  function_semantics_1.FunctionSemantics.settleJumpsInPromises(df.graph, df.exitPoints, { ctx });
710
722
  function_semantics_1.FunctionSemantics.settleDefinitionsInPromises(df.graph, { ctx });
711
- /* these ask for the qualified names of many calls before they add an edge */
712
- df.graph.sharingTargetWalks(() => {
713
- linkEnvironmentArgumentsWrittenByCallee(df.graph, df.environment);
714
- resolveLinkToSideEffects(df.graph, ctx);
715
- linkResourceReadersToWriters(df.graph, df.environment, ctx);
716
- linkReadsOfDivertedOutput(df.graph, df.environment);
717
- separateFileWritesPerCall(df.graph, df.environment, ctx);
718
- });
723
+ linkEnvironmentArgumentsWrittenByCallee(df.graph, df.environment);
724
+ resolveLinkToSideEffects(df.graph, ctx);
725
+ linkResourceReadersToWriters(df.graph, df.environment, ctx);
726
+ linkReadsOfDivertedOutput(df.graph, df.environment);
727
+ separateFileWritesPerCall(df.graph, df.environment, ctx);
719
728
  return df;
720
729
  }
721
730
  //# sourceMappingURL=extractor.js.map
@@ -4,3 +4,5 @@ import { type BrandedIdentifier } from '../environments/identifier';
4
4
  export declare const ErrorConditionClasses: ReadonlySet<BrandedIdentifier>;
5
5
  /** Whether the arguments written for a condition-handling call name a handler catching an error (matched by name). */
6
6
  export declare function namesAnErrorHandler<Info>(args: readonly PotentiallyEmptyRArgument<Info>[]): boolean;
7
+ /** Classes the session signals on its own (a user interrupt) rather than the code, so a handler of them catches no error the code raises. */
8
+ export declare const SessionConditionClasses: ReadonlySet<BrandedIdentifier>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorConditionClasses = void 0;
3
+ exports.SessionConditionClasses = exports.ErrorConditionClasses = void 0;
4
4
  exports.namesAnErrorHandler = namesAnErrorHandler;
5
5
  const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
6
6
  const identifier_1 = require("../environments/identifier");
@@ -10,4 +10,6 @@ exports.ErrorConditionClasses = new Set(['error', 'simpleError', 'condition']);
10
10
  function namesAnErrorHandler(args) {
11
11
  return args.some(a => r_argument_1.RArgument.isNamed(a) && exports.ErrorConditionClasses.has(identifier_1.Identifier.getName(a.name.content)));
12
12
  }
13
+ /** Classes the session signals on its own (a user interrupt) rather than the code, so a handler of them catches no error the code raises. */
14
+ exports.SessionConditionClasses = new Set(['interrupt']);
13
15
  //# sourceMappingURL=condition-handlers.js.map
@@ -1,9 +1,11 @@
1
1
  import type { DataflowGraph } from '../graph/graph';
2
- import type { DataflowGraphVertexFunctionDefinition } from '../graph/vertex';
2
+ import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexFunctionDefinition } from '../graph/vertex';
3
3
  import type { ArgProps, BuiltInFnInfo } from '../environments/built-in-props';
4
- import type { Identifier } from '../environments/identifier';
4
+ import { Identifier } from '../environments/identifier';
5
5
  /** What flowR states about the built-in a call names, see {@link BuiltInFnInfo}. */
6
6
  export type BuiltInLookup = (name: Identifier) => BuiltInFnInfo | undefined;
7
+ /** Whether the call binds a name beyond its own frame ({@link CallProp.Scope}): `y <<- 1`, `library(x)`, `assign` to an env do; `y <- 1` does not. */
8
+ export declare function bindsOutside(vertex: DataflowGraphVertexFunctionCall, info: BuiltInFnInfo | undefined): boolean;
7
9
  /** What to ask for beyond the definition itself, see {@link reflectiveRolesOf}. */
8
10
  export interface FrameReflectionOptions {
9
11
  /** what flowR states about a built-in, answered once per name */
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bindsOutside = bindsOutside;
3
4
  exports.reflectiveRolesOf = reflectiveRolesOf;
4
5
  const graph_1 = require("../graph/graph");
5
6
  const built_in_proc_name_1 = require("../environments/built-in-proc-name");
@@ -7,8 +8,23 @@ const edge_1 = require("../graph/edge");
7
8
  const df_helper_1 = require("../graph/df-helper");
8
9
  const vertex_1 = require("../graph/vertex");
9
10
  const built_in_props_1 = require("../environments/built-in-props");
11
+ const identifier_1 = require("../environments/identifier");
10
12
  const fixpoint_1 = require("../../util/fixpoint");
11
13
  const monoid_1 = require("../../util/monoid");
14
+ /** the assignments binding in the frame they run in, which is a scope of the function's own */
15
+ const FrameLocalBinders = new Set(['<-', '=', '->', ':=', 'assign']);
16
+ /** Whether the name is a replacement function binding in its own frame (`names(x) <- v`); the `<<-` twin does not. */
17
+ function isFrameLocalReplacement(name) {
18
+ return name.endsWith('<-') && !name.endsWith('<<-');
19
+ }
20
+ /** Whether the call binds a name beyond its own frame ({@link CallProp.Scope}): `y <<- 1`, `library(x)`, `assign` to an env do; `y <- 1` does not. */
21
+ function bindsOutside(vertex, info) {
22
+ const name = identifier_1.Identifier.getName(vertex.name);
23
+ if (!FrameLocalBinders.has(name) && !isFrameLocalReplacement(name)) {
24
+ return true;
25
+ }
26
+ return info?.sig !== undefined && built_in_props_1.FnSig.posWith(built_in_props_1.FnSig.layout(info.sig), vertex.args.length, built_in_props_1.ArgProp.Written).length > 0;
27
+ }
12
28
  /**
13
29
  * What `definition`'s body reaches about its own formals through the frame or call it sits in, as the {@link BuiltInFnInfo#frame} bits of the reflective calls it makes (`0` for none).
14
30
  * @useInstead {@link FunctionSemantics.frameReflection}