@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,234 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AmbientVerbInfo = exports.AmbientFamilyInfo = exports.Ambient = exports.AmbientVerb = exports.AmbientPart = void 0;
4
+ exports.withImpliedAmbient = withImpliedAmbient;
5
+ exports.declaresAmbient = declaresAmbient;
6
+ exports.ambientSummaryOf = ambientSummaryOf;
7
+ const built_in_props_1 = require("./built-in-props");
8
+ const ambient_state_name_1 = require("./ambient-state-name");
9
+ const arrays_1 = require("../../util/collections/arrays");
10
+ /** The parts of the global state other than the {@link KeyedState|keyed} ones a built-in may access, see {@link AmbientEffect}. */
11
+ var AmbientPart;
12
+ (function (AmbientPart) {
13
+ /** the graphics devices, one of which is active */
14
+ AmbientPart["Device"] = "device";
15
+ /** the plot on the active device */
16
+ AmbientPart["Plot"] = "plot";
17
+ /** the color palette all devices share */
18
+ AmbientPart["Palette"] = "palette";
19
+ /** the ggplot `last_plot()` returns, which every ggplot that is built or added to becomes */
20
+ AmbientPart["LastPlot"] = "last-plot";
21
+ /** the diversions of the console output, the last of which is active */
22
+ AmbientPart["Sink"] = "sink";
23
+ /** the diversion of messages and warnings */
24
+ AmbientPart["MessageSink"] = "message-sink";
25
+ /** the state of the random number generator */
26
+ AmbientPart["Rng"] = "rng";
27
+ /** the kind of the random number generator */
28
+ AmbientPart["RngKind"] = "rng-kind";
29
+ AmbientPart["WorkingDirectory"] = "wd";
30
+ /** the directories on disk, which every path to a file leads through */
31
+ AmbientPart["Directories"] = "directories";
32
+ /** the files on disk, which the arguments of the {@link AmbientEffect#sig|signature} name */
33
+ AmbientPart["Files"] = "files";
34
+ /** the root `here::here()` builds paths from */
35
+ AmbientPart["ProjectRoot"] = "project-root";
36
+ AmbientPart["LibPaths"] = "lib-paths";
37
+ AmbientPart["Umask"] = "umask";
38
+ /** the finalizers registered, which `gc()` runs */
39
+ AmbientPart["Finalizers"] = "finalizers";
40
+ /** the variable a text connection opened for writing binds */
41
+ AmbientPart["TextConnection"] = "text-connection";
42
+ /** the message of the last error, which `geterrmessage()` returns */
43
+ AmbientPart["ErrorMessage"] = "error-message";
44
+ })(AmbientPart || (exports.AmbientPart = AmbientPart = {}));
45
+ /** What a built-in does to a part of the global state, see {@link AmbientEffect}. */
46
+ var AmbientVerb;
47
+ (function (AmbientVerb) {
48
+ AmbientVerb["Reads"] = "reads";
49
+ /** replaces it */
50
+ AmbientVerb["Writes"] = "writes";
51
+ /** changes it on top of what it was, so it reads it as well: drawing on the plot, drawing a random number */
52
+ AmbientVerb["Adds"] = "adds";
53
+ /** starts it afresh: a new plot */
54
+ AmbientVerb["Resets"] = "resets";
55
+ /** removes the named entries */
56
+ AmbientVerb["Kills"] = "kills";
57
+ /** opens an instance, which becomes the active one */
58
+ AmbientVerb["Opens"] = "opens";
59
+ /** closes the active instance, the one named, or every one */
60
+ AmbientVerb["Closes"] = "closes";
61
+ /** makes another instance the active one */
62
+ AmbientVerb["Switches"] = "switches";
63
+ /** builds an object that does the drawing once printed */
64
+ AmbientVerb["Builds"] = "builds";
65
+ })(AmbientVerb || (exports.AmbientVerb = AmbientVerb = {}));
66
+ /** Shorthands for the {@link AmbientEffect}s, one per part, so a configuration reads `Ambient.plot.adds`. */
67
+ function effectsOf(family) {
68
+ return Object.fromEntries(Object.values(AmbientVerb).map(access => [access, { family, access }]));
69
+ }
70
+ /**
71
+ * The {@link AmbientEffect}s by part and verb, see {@link AmbientEffect}.
72
+ * @helper dataflow
73
+ */
74
+ exports.Ambient = {
75
+ device: effectsOf(AmbientPart.Device),
76
+ plot: effectsOf(AmbientPart.Plot),
77
+ par: effectsOf(ambient_state_name_1.KeyedState.Par),
78
+ palette: effectsOf(AmbientPart.Palette),
79
+ lastPlot: effectsOf(AmbientPart.LastPlot),
80
+ sink: effectsOf(AmbientPart.Sink),
81
+ messageSink: effectsOf(AmbientPart.MessageSink),
82
+ option: effectsOf(ambient_state_name_1.KeyedState.Option),
83
+ env: effectsOf(ambient_state_name_1.KeyedState.Env),
84
+ locale: effectsOf(ambient_state_name_1.KeyedState.Locale),
85
+ searchPath: effectsOf(ambient_state_name_1.KeyedState.SearchPath),
86
+ rng: effectsOf(AmbientPart.Rng),
87
+ rngKind: effectsOf(AmbientPart.RngKind),
88
+ wd: effectsOf(AmbientPart.WorkingDirectory),
89
+ directories: effectsOf(AmbientPart.Directories),
90
+ files: effectsOf(AmbientPart.Files),
91
+ projectRoot: effectsOf(AmbientPart.ProjectRoot),
92
+ libPaths: effectsOf(AmbientPart.LibPaths),
93
+ umask: effectsOf(AmbientPart.Umask),
94
+ finalizers: effectsOf(AmbientPart.Finalizers),
95
+ textConnection: effectsOf(AmbientPart.TextConnection),
96
+ errorMessage: effectsOf(AmbientPart.ErrorMessage),
97
+ /** The effects of `effects` in a flat list. */
98
+ list(effects) {
99
+ return effects === undefined ? [] : 'family' in effects ? [effects] : effects;
100
+ }
101
+ };
102
+ /** A call that reads or writes the files its arguments name accesses the {@link AmbientPart.Files|files on disk} as well. */
103
+ function withFileAccess(config) {
104
+ const { tags, ambient, sig } = config;
105
+ if (!tags?.includes(built_in_props_1.SemanticCallTag.File)) {
106
+ return config;
107
+ }
108
+ const writes = tags.includes(built_in_props_1.SemanticCallTag.Writes);
109
+ const split = writes && tags.includes(built_in_props_1.SemanticCallTag.Reads) && sig !== undefined && built_in_props_1.FnSig.resources(sig, true) !== sig;
110
+ /* reading first, so the files read are the ones written before, not the call's own */
111
+ const verbs = [...split || !writes && tags.includes(built_in_props_1.SemanticCallTag.Reads) ? [AmbientVerb.Reads] : [], ...writes ? [AmbientVerb.Writes] : []];
112
+ const stated = exports.Ambient.list(ambient);
113
+ const isDevice = (verb) => stated.some(a => a.family === AmbientPart.Device && a.access === verb);
114
+ if (verbs.length === 0 || stated.some(a => a.family === AmbientPart.Files && verbs.includes(a.access)) || isDevice(AmbientVerb.Closes)) {
115
+ return config;
116
+ }
117
+ const glob = tags.includes(built_in_props_1.SemanticCallTag.Glob);
118
+ /* appending to a file (`cat(x, file = f, append = TRUE)`) keeps what was written to it before */
119
+ const appends = writes && !verbs.includes(AmbientVerb.Reads) && sig?.some(([name]) => name === 'append') ? [AmbientVerb.Reads] : [];
120
+ return { ...config, ambient: [...stated, ...appends.map(access => ({ family: AmbientPart.Files, access, when: { flag: 'append' }, sig: glob ? undefined : sig })), ...verbs.map(access => ({
121
+ family: AmbientPart.Files, access, numbered: isDevice(AmbientVerb.Opens),
122
+ sig: glob || sig === undefined ? undefined : split ? built_in_props_1.FnSig.resources(sig, access === AmbientVerb.Writes) : sig
123
+ }))] };
124
+ }
125
+ /** A call starting a process hands it every environment variable, a call loading a package looks for it in the library paths, a call printing adds to the diverted output. */
126
+ function withImplicitAccess(config) {
127
+ const { tags, ambient } = config;
128
+ /* what always goes to the message sink, like `message`, does not print to the output sink */
129
+ const printsToMessages = exports.Ambient.list(ambient).some(e => e.family === exports.Ambient.messageSink.adds.family && e.when === undefined && e.unless === undefined);
130
+ const implied = [
131
+ ...tags?.includes(built_in_props_1.SemanticCallTag.Process) ? [exports.Ambient.env.reads] : [],
132
+ ...tags?.includes(built_in_props_1.SemanticCallTag.LoadsPackage) ? [exports.Ambient.libPaths.reads] : [],
133
+ ...tags?.includes(built_in_props_1.SemanticCallTag.Prints) && !printsToMessages ? [exports.Ambient.sink.adds] : []
134
+ ];
135
+ return implied.length === 0 ? config : { ...config, ambient: [...exports.Ambient.list(ambient), ...implied] };
136
+ }
137
+ /** The configuration with the {@link AmbientEffect}s its tags imply added to the ones it states. */
138
+ function withImpliedAmbient(config) {
139
+ return config === undefined ? config : withImplicitAccess(withFileAccess(config));
140
+ }
141
+ /** Whether the configuration declares an {@link AmbientEffect} or a scoped change of the state, which makes the function one touching {@link CallProp.Ambient|ambient state} on a page. */
142
+ function declaresAmbient(config) {
143
+ return config !== undefined && (exports.Ambient.list(config.ambient).length > 0 || config.scope !== undefined);
144
+ }
145
+ /** The words for every part of the global state, the one source the wiki, the signature browser, and these docs share. */
146
+ exports.AmbientFamilyInfo = {
147
+ [AmbientPart.Device]: { label: 'graphics device', noun: 'device', description: 'The graphics devices R draws on, one of which is active: opening one makes it the active one, closing it returns to another, and closing a device writes its file.' },
148
+ [AmbientPart.Plot]: { label: 'plot', noun: 'plot', of: AmbientPart.Device, description: 'What is drawn on the active device: a new plot replaces it, an addon like points draws on top of it, and drawing opens a device if none is open.' },
149
+ [ambient_state_name_1.KeyedState.Par]: { label: 'graphics parameters', noun: 'graphics parameters', of: AmbientPart.Device, description: 'The parameters par sets for the active device, each by its name, which every later base graphics plot on that device picks up.' },
150
+ [AmbientPart.Palette]: { label: 'palette', noun: 'palette', description: 'The color palette all devices share, which a numeric color indexes into.' },
151
+ [AmbientPart.LastPlot]: { label: 'last ggplot', noun: 'last ggplot', description: 'The ggplot last built or added to, which last_plot() returns and ggsave saves by default.' },
152
+ [AmbientPart.Sink]: { label: 'output sink', noun: 'sink', verbs: { [AmbientVerb.Adds]: 'prints to the active' }, description: 'Where the console output goes: sink(file) diverts it on top of a stack, sink() ends the last diversion, which finishes what it wrote.' },
153
+ [AmbientPart.MessageSink]: { label: 'message sink', noun: 'message sink', verbs: { [AmbientVerb.Adds]: 'signals to the active' }, description: 'Where messages and warnings go: sink(con, type = "message") diverts them, sink(type = "message") returns them to the console.' },
154
+ [ambient_state_name_1.KeyedState.Option]: { label: 'options', noun: 'options', description: 'The options options() sets by name, like digits or scipen, which printing and many functions read.' },
155
+ [ambient_state_name_1.KeyedState.Env]: { label: 'environment variables', noun: 'environment variables', description: 'The environment variables of the R process by name, like TZ or LANG, which R and every child process read.' },
156
+ [ambient_state_name_1.KeyedState.Locale]: { label: 'locale', noun: 'locale', description: 'The locale categories like LC_COLLATE, which sorting, formatting, and messages follow.' },
157
+ [ambient_state_name_1.KeyedState.SearchPath]: { label: 'search path', noun: 'search path', description: 'The packages and environments attached, in which R looks up a name the code does not define.' },
158
+ [AmbientPart.Rng]: { label: 'random numbers', noun: 'random number generator', verbs: { [AmbientVerb.Adds]: 'draws from', [AmbientVerb.Writes]: 'seeds' }, description: 'The state of the random number generator, which set.seed sets and every draw advances.' },
159
+ [AmbientPart.RngKind]: { label: 'random number kind', noun: 'generator kind', of: AmbientPart.Rng, description: 'Which random number generator R uses, which RNGkind sets and set.seed keeps unless it is given one.' },
160
+ [AmbientPart.WorkingDirectory]: { label: 'working directory', noun: 'working directory', description: 'The directory relative paths start from, which setwd changes.' },
161
+ [AmbientPart.Directories]: { label: 'directories', noun: 'directories', description: 'The directories on disk, which dir.create, unlink, and file.rename change and every path to a file leads through.' },
162
+ [AmbientPart.Files]: { label: 'files', noun: 'files', description: 'The files on disk, which a call reads or writes by the paths its arguments name.' },
163
+ [AmbientPart.ProjectRoot]: { label: 'project root', noun: 'project root', description: 'The root here::here() builds its paths from, which here::i_am names.' },
164
+ [AmbientPart.LibPaths]: { label: 'library paths', noun: 'library paths', description: 'Where packages are installed and loaded from, which .libPaths(new) changes.' },
165
+ [AmbientPart.Umask]: { label: 'file creation mask', noun: 'file creation mask', description: 'The permissions every new file lacks, which Sys.umask sets.' },
166
+ [AmbientPart.Finalizers]: { label: 'finalizers', noun: 'finalizers', description: 'The functions reg.finalizer registers to run once their object is released, which gc() may run.' },
167
+ [AmbientPart.TextConnection]: { label: 'text connection', noun: 'text connection', description: 'The variable a text connection opened for writing binds, which every write to the connection changes.' },
168
+ [AmbientPart.ErrorMessage]: { label: 'last error message', noun: 'last error message', description: 'The message of the last error, which an error sets and geterrmessage() returns, so code going on after try or tryCatch caught one may read it.' }
169
+ };
170
+ /** The words for every access verb, see {@link AmbientFamilyInfo}. */
171
+ exports.AmbientVerbInfo = {
172
+ [AmbientVerb.Reads]: { label: 'reads', description: 'The call depends on the state, so it links to the calls that set it before.' },
173
+ [AmbientVerb.Writes]: { label: 'writes', description: 'The call replaces the state, so later reads link to it instead of what came before.' },
174
+ [AmbientVerb.Adds]: { label: 'adds to', description: 'The call changes the state on top of what it was, so it reads it and later reads see both.' },
175
+ [AmbientVerb.Resets]: { label: 'starts a new', description: 'The call starts the state anew, so later reads no longer see what came before.' },
176
+ [AmbientVerb.Kills]: { label: 'removes', description: 'The call removes entries, so later reads of them see nothing set.' },
177
+ [AmbientVerb.Opens]: { label: 'opens', description: 'The call opens an instance that becomes the active one, the others keep their state until they are active again.' },
178
+ [AmbientVerb.Closes]: { label: 'closes', description: 'The call ends an instance, which links it to the call that opened it and to everything done with it in between.' },
179
+ [AmbientVerb.Switches]: { label: 'switches', description: 'The call makes another open instance the active one.' },
180
+ [AmbientVerb.Builds]: { label: 'builds an object drawing', description: 'The call builds an object that only draws once it is printed, like a ggplot.' }
181
+ };
182
+ function memberWords(effect) {
183
+ const member = effect.member;
184
+ if (member === undefined) {
185
+ return effect.family === AmbientPart.Files && effect.sig !== undefined ? effect.sig.filter(([, p]) => (p & built_in_props_1.ArgProp.Resource) !== 0).map(([n]) => `named by ${n}`) : [];
186
+ }
187
+ else if (member === 'every') {
188
+ return ['every open one'];
189
+ }
190
+ switch (member.from) {
191
+ case 'constant': return member.keys;
192
+ case 'argument-names': return ['the names of the arguments'];
193
+ case 'unnamed': return ['the unnamed arguments'];
194
+ case 'parameter': return [`named by ${member.names.join(' or ')}${member.fallback === undefined ? '' : `, else ${member.fallback}`}`];
195
+ }
196
+ }
197
+ function conditionWords(condition) {
198
+ if (condition === 'no-arguments') {
199
+ return 'it has no arguments';
200
+ }
201
+ else if (condition === 'query') {
202
+ return 'it only queries';
203
+ }
204
+ else if ('flag' in condition) {
205
+ return `${condition.flag} is TRUE`;
206
+ }
207
+ else if ('calls' in condition) {
208
+ return `${condition.arg} is a call of ${condition.calls.join(' or ')}`;
209
+ }
210
+ else if ('arg' in condition) {
211
+ return `${condition.arg} is ${condition.is.map(v => v === null ? 'missing' : `"${v}"`).join(' or ')}`;
212
+ }
213
+ return `it has arguments besides ${condition.besides.join(', ') || 'none'}`;
214
+ }
215
+ /**
216
+ * The {@link AmbientEffect}s of a built-in, including those its tags imply, grouped by the part they access (a part of the active device under the device)
217
+ * and by verb, with the entries each access names: `graphics device: opens device, reads plot, adds to plot`.
218
+ */
219
+ function ambientSummaryOf(config) {
220
+ const families = new Map();
221
+ for (const effect of exports.Ambient.list(withImpliedAmbient(config)?.ambient)) {
222
+ const words = exports.AmbientFamilyInfo[effect.family];
223
+ const family = words.of ?? effect.family;
224
+ const accesses = families.get(family) ?? new Map();
225
+ families.set(family, accesses);
226
+ const when = [...effect.when === undefined ? [] : [`if ${conditionWords(effect.when)}`], ...effect.unless === undefined ? [] : [`unless ${conditionWords(effect.unless)}`]];
227
+ const key = `${effect.family} ${effect.access} ${when.join()}`;
228
+ const known = accesses.get(key) ?? { part: effect.family, access: effect.access, label: `${words.verbs?.[effect.access] ?? exports.AmbientVerbInfo[effect.access].label} ${words.noun}`, members: [], when };
229
+ accesses.set(key, known);
230
+ known.members = (0, arrays_1.uniqueArrayMerge)(known.members, memberWords(effect));
231
+ }
232
+ return [...families].map(([family, accesses]) => ({ family, label: exports.AmbientFamilyInfo[family].label, accesses: [...accesses.values()] }));
233
+ }
234
+ //# sourceMappingURL=ambient-effect.js.map
@@ -22,11 +22,19 @@ export declare const AmbientStateName: {
22
22
  readonly graphics: "#graphics";
23
23
  /** the graphics states of the other open devices, the active one returns to one of them once it closes */
24
24
  readonly otherDevices: "#graphics:other";
25
- /** the call that opened the active device, and those of the other open devices */
25
+ /** the calls that opened the active device, set it up, and drew on it (a plot or `par` opens a device if none is open), and those of the other open devices, which closing a device links to */
26
26
  readonly device: "#device";
27
27
  readonly otherDevicesOpenedBy: "#device:other";
28
+ /** the call that explicitly opened the active device (`png("a.png")`), and those of the other open devices, which names the file its close writes */
29
+ readonly deviceOpener: "#device:opener";
30
+ readonly otherDeviceOpeners: "#device:opener:other";
28
31
  /** within a function, the call of its body that opened the active device, which only that body knows */
29
32
  readonly deviceOpenedHere: "#device:here";
33
+ /** the calls drawing the plot on the active device: a new plot (`plot`) replaces it, an addon (`points`) reads and adds to it */
34
+ readonly plot: "#plot";
35
+ readonly otherPlots: "#plot:other";
36
+ /** the plot ggplot2's `last_plot()` returns, which building a ggplot (`ggplot`, `+`) replaces and `ggsave` reads; it belongs to no device */
37
+ readonly lastPlot: "#last-plot";
30
38
  /** what is drawn on the active device, which every plot adds to; only written if `semantics.ambient.drawingWritesDevice` is set */
31
39
  readonly canvas: "#canvas";
32
40
  /** the color palette, which, other than the graphics parameters, all devices share */
@@ -37,8 +45,19 @@ export declare const AmbientStateName: {
37
45
  readonly anyFile: "#file:*";
38
46
  /** the working directory `setwd` changes, which every call accessing a file reads to resolve a relative path */
39
47
  readonly workingDirectory: "#wd";
40
- /** whether console output is diverted into a file or connection, as `sink(file)` does and `sink()` undoes */
48
+ /** the directories on disk, which creating, moving, or removing one changes and every call accessing a file reads, as the path may lead through them */
49
+ readonly directories: "#dirs";
50
+ /** where console output goes, the call diverting it into a file or connection (`sink(file)`), and the diversions below it, which `sink()` returns to */
41
51
  readonly sink: "#sink";
52
+ readonly otherSinks: "#sink:other";
53
+ /** the explicit diversion of the console output, and those below it */
54
+ readonly sinkOpener: "#sink:opener";
55
+ readonly otherSinkOpeners: "#sink:opener:other";
56
+ /** the diversion of the output and every call printing into it, and those of the diversions below, which ending it links to */
57
+ readonly sinkOutput: "#sink:output";
58
+ readonly otherSinkOutputs: "#sink:output:other";
59
+ /** within a function, the call of its body that diverted the output */
60
+ readonly sinkOpenedHere: "#sink:here";
42
61
  /** the project root `here::here()` builds its paths from, found from the working directory unless `here::i_am` names it */
43
62
  readonly projectRoot: "#project-root";
44
63
  /** where packages are installed and loaded from, which `.libPaths(new)` changes and every package load reads */
@@ -47,6 +66,8 @@ export declare const AmbientStateName: {
47
66
  readonly umask: "#umask";
48
67
  /** the state of the random number generator, which `set.seed` sets and every draw advances */
49
68
  readonly rng: "#rng";
69
+ /** the message of the last error, which `try` and `tryCatch` may have caught */
70
+ readonly errorMessage: "#error-message";
50
71
  /** the kind of generator, which `set.seed` keeps unless it is given one */
51
72
  readonly rngKind: "#rng:kind";
52
73
  /** the global variable R keeps that state in, so assigning it sets {@link AmbientStateName.rng} as well */
@@ -72,5 +93,27 @@ export declare const AmbientStateName: {
72
93
  /** whether `name` is one of these pseudo variables */
73
94
  readonly is: (this: void, name: Identifier | undefined) => name is AmbientStateName;
74
95
  };
96
+ /**
97
+ * A state of which several instances exist at once, one of them active, like the graphics devices:
98
+ * opening an instance makes it the active one, switching makes another one active, closing it returns to another.
99
+ */
100
+ export interface AmbientFamily {
101
+ /** each state an instance has of its own, with the pseudo variable holding it for the other open instances */
102
+ readonly states: readonly (readonly [active: AmbientStateName, others: AmbientStateName])[];
103
+ /** the state of {@link AmbientFamily#states} holding the calls that opened the active instance and used it */
104
+ readonly used: AmbientStateName;
105
+ /** the state of {@link AmbientFamily#states} only an explicit opening writes, which tells it apart from a use that opened the instance on the fly */
106
+ readonly opened: AmbientStateName;
107
+ /** the state of {@link AmbientFamily#states} a switch to another instance reads */
108
+ readonly switched: AmbientStateName;
109
+ /** within a function, the call of its body that opened the active instance */
110
+ readonly openedHere: AmbientStateName;
111
+ }
112
+ /** The graphics devices, each with its graphics parameters, the calls opening and using it, its current plot, and its explicit opening. */
113
+ export declare const GraphicsDevices: AmbientFamily;
114
+ /** The diversions of the console output, a stack: `sink(file)` pushes one, `sink()` pops it and returns to the one below. */
115
+ export declare const OutputSinks: AmbientFamily;
116
+ /** The diversion of messages, warnings, and errors (`sink(con, type = "message")`), which, other than that of the output, is no stack: `sink(type = "message")` returns to the console. */
117
+ export declare const MessageSinks: AmbientFamily;
75
118
  /** The pseudo variables that only grow, because every write to their state adds to them. */
76
119
  export declare const KeyedAccumulators: readonly AmbientStateName[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeyedAccumulators = exports.AmbientStateName = exports.UnknownKey = exports.KeyedState = void 0;
3
+ exports.KeyedAccumulators = exports.MessageSinks = exports.OutputSinks = exports.GraphicsDevices = exports.AmbientStateName = exports.UnknownKey = exports.KeyedState = void 0;
4
4
  /** The states made of named entries: setting one entry replaces its pseudo variable `#<state>:<key>`, adds to the accumulating `all` of the state, and an entry we cannot name adds to `#<state>:*` instead (`options(op)`, `Sys.setenv(...)`). */
5
5
  var KeyedState;
6
6
  (function (KeyedState) {
@@ -35,11 +35,19 @@ exports.AmbientStateName = {
35
35
  graphics: '#graphics',
36
36
  /** the graphics states of the other open devices, the active one returns to one of them once it closes */
37
37
  otherDevices: '#graphics:other',
38
- /** the call that opened the active device, and those of the other open devices */
38
+ /** the calls that opened the active device, set it up, and drew on it (a plot or `par` opens a device if none is open), and those of the other open devices, which closing a device links to */
39
39
  device: '#device',
40
40
  otherDevicesOpenedBy: '#device:other',
41
+ /** the call that explicitly opened the active device (`png("a.png")`), and those of the other open devices, which names the file its close writes */
42
+ deviceOpener: '#device:opener',
43
+ otherDeviceOpeners: '#device:opener:other',
41
44
  /** within a function, the call of its body that opened the active device, which only that body knows */
42
45
  deviceOpenedHere: '#device:here',
46
+ /** the calls drawing the plot on the active device: a new plot (`plot`) replaces it, an addon (`points`) reads and adds to it */
47
+ plot: '#plot',
48
+ otherPlots: '#plot:other',
49
+ /** the plot ggplot2's `last_plot()` returns, which building a ggplot (`ggplot`, `+`) replaces and `ggsave` reads; it belongs to no device */
50
+ lastPlot: '#last-plot',
43
51
  /** what is drawn on the active device, which every plot adds to; only written if `semantics.ambient.drawingWritesDevice` is set */
44
52
  canvas: '#canvas',
45
53
  /** the color palette, which, other than the graphics parameters, all devices share */
@@ -50,8 +58,19 @@ exports.AmbientStateName = {
50
58
  anyFile: '#file:*',
51
59
  /** the working directory `setwd` changes, which every call accessing a file reads to resolve a relative path */
52
60
  workingDirectory: '#wd',
53
- /** whether console output is diverted into a file or connection, as `sink(file)` does and `sink()` undoes */
61
+ /** the directories on disk, which creating, moving, or removing one changes and every call accessing a file reads, as the path may lead through them */
62
+ directories: '#dirs',
63
+ /** where console output goes, the call diverting it into a file or connection (`sink(file)`), and the diversions below it, which `sink()` returns to */
54
64
  sink: '#sink',
65
+ otherSinks: '#sink:other',
66
+ /** the explicit diversion of the console output, and those below it */
67
+ sinkOpener: '#sink:opener',
68
+ otherSinkOpeners: '#sink:opener:other',
69
+ /** the diversion of the output and every call printing into it, and those of the diversions below, which ending it links to */
70
+ sinkOutput: '#sink:output',
71
+ otherSinkOutputs: '#sink:output:other',
72
+ /** within a function, the call of its body that diverted the output */
73
+ sinkOpenedHere: '#sink:here',
55
74
  /** the project root `here::here()` builds its paths from, found from the working directory unless `here::i_am` names it */
56
75
  projectRoot: '#project-root',
57
76
  /** where packages are installed and loaded from, which `.libPaths(new)` changes and every package load reads */
@@ -60,6 +79,8 @@ exports.AmbientStateName = {
60
79
  umask: '#umask',
61
80
  /** the state of the random number generator, which `set.seed` sets and every draw advances */
62
81
  rng: '#rng',
82
+ /** the message of the last error, which `try` and `tryCatch` may have caught */
83
+ errorMessage: '#error-message',
63
84
  /** the kind of generator, which `set.seed` keeps unless it is given one */
64
85
  rngKind: '#rng:kind',
65
86
  /** the global variable R keeps that state in, so assigning it sets {@link AmbientStateName.rng} as well */
@@ -98,6 +119,43 @@ exports.AmbientStateName = {
98
119
  return typeof name === 'string' && name.startsWith('#');
99
120
  }
100
121
  };
122
+ /** The graphics devices, each with its graphics parameters, the calls opening and using it, its current plot, and its explicit opening. */
123
+ exports.GraphicsDevices = {
124
+ states: [
125
+ [exports.AmbientStateName.graphics, exports.AmbientStateName.otherDevices],
126
+ [exports.AmbientStateName.device, exports.AmbientStateName.otherDevicesOpenedBy],
127
+ [exports.AmbientStateName.plot, exports.AmbientStateName.otherPlots],
128
+ [exports.AmbientStateName.deviceOpener, exports.AmbientStateName.otherDeviceOpeners]
129
+ ],
130
+ used: exports.AmbientStateName.device,
131
+ opened: exports.AmbientStateName.deviceOpener,
132
+ switched: exports.AmbientStateName.graphics,
133
+ openedHere: exports.AmbientStateName.deviceOpenedHere
134
+ };
135
+ /** The diversions of the console output, a stack: `sink(file)` pushes one, `sink()` pops it and returns to the one below. */
136
+ exports.OutputSinks = {
137
+ states: [
138
+ [exports.AmbientStateName.sink, exports.AmbientStateName.otherSinks],
139
+ [exports.AmbientStateName.sinkOpener, exports.AmbientStateName.otherSinkOpeners],
140
+ [exports.AmbientStateName.sinkOutput, exports.AmbientStateName.otherSinkOutputs]
141
+ ],
142
+ used: exports.AmbientStateName.sinkOutput,
143
+ opened: exports.AmbientStateName.sinkOpener,
144
+ switched: exports.AmbientStateName.sink,
145
+ openedHere: exports.AmbientStateName.sinkOpenedHere
146
+ };
147
+ /** The diversion of messages, warnings, and errors (`sink(con, type = "message")`), which, other than that of the output, is no stack: `sink(type = "message")` returns to the console. */
148
+ exports.MessageSinks = {
149
+ states: [
150
+ ['#message-sink', '#message-sink:other'],
151
+ ['#message-sink:opener', '#message-sink:opener:other'],
152
+ ['#message-sink:output', '#message-sink:output:other']
153
+ ],
154
+ used: '#message-sink:output',
155
+ opened: '#message-sink:opener',
156
+ switched: '#message-sink',
157
+ openedHere: '#message-sink:here'
158
+ };
101
159
  /** The pseudo variables that only grow, because every write to their state adds to them. */
102
160
  exports.KeyedAccumulators = Object.values(KeyedState).flatMap(state => [exports.AmbientStateName.allOf(state), exports.AmbientStateName.keyed(state, exports.UnknownKey)]);
103
161
  //# sourceMappingURL=ambient-state-name.js.map
@@ -105,13 +105,14 @@ function weakenAll(env, cds, except) {
105
105
  }
106
106
  env.cache?.clear();
107
107
  }
108
- /** removes every user definition from the current frame (e.g., `rm(list = ls())`), except the re-defined names */
109
- function removeAllInFrame(env, except) {
108
+ /** removes every user definition from the current frame (e.g., `rm(list = ls())`), except the re-defined names, and records the call `killedBy` as the one that removed each */
109
+ function removeAllInFrame(env, except, killedBy) {
110
110
  if (env.builtInEnv) {
111
111
  return;
112
112
  }
113
+ const removed = [];
113
114
  for (const [key, defs] of env.memory) {
114
- if (except?.has(key) || isAmbientState(key) || defs.every(isBuiltInDef)) {
115
+ if (except?.has(key) || isAmbientState(key) || defs.every(isBuiltInDef) || (0, removal_marker_1.removedNameOf)(key) !== key) {
115
116
  continue;
116
117
  }
117
118
  const kept = defs.filter(isBuiltInDef);
@@ -121,6 +122,12 @@ function removeAllInFrame(env, except) {
121
122
  else {
122
123
  env.writableMemory.set(key, kept);
123
124
  }
125
+ removed.push(key);
126
+ }
127
+ if (killedBy !== undefined) {
128
+ for (const key of removed) {
129
+ markRemoval(env, key, [killedBy], undefined);
130
+ }
124
131
  }
125
132
  env.cache?.clear();
126
133
  }
@@ -229,7 +236,7 @@ function applyKillsToFrame(current, kills, mark) {
229
236
  for (const kill of kills) {
230
237
  if (kill.kind === 'all') {
231
238
  if ((0, info_1.happensInEveryBranch)(kill.cds)) {
232
- removeAllInFrame(current, kill.except);
239
+ removeAllInFrame(current, kill.except, kill.killedBy);
233
240
  }
234
241
  else {
235
242
  weakenAll(current, (kill.cds ?? []).map(info_1.negateControlDependency), kill.except);
@@ -1,58 +1,16 @@
1
1
  /** Options that affect how values are printed and formatted (read by `print`, `format`, and `cat`). */
2
2
  export declare const PrintingOptions: readonly string[];
3
+ /** Options that affect how a number turns into text, even outside printing (`paste(1e5)` reads `scipen`, `as.character(1.5)` reads `OutDec`). */
4
+ export declare const NumberFormatOptions: readonly string[];
3
5
  /** The parts of the ambient state with a single value a scoped call (`withr::with_dir`) may change, other than the entries of a {@link KeyedState}. */
4
6
  export declare enum AmbientSingleState {
5
7
  Graphics = "graphics",
6
8
  Device = "device",
9
+ /** the console output, which `capture.output` diverts for its code */
10
+ Sink = "sink",
7
11
  Rng = "rng",
8
12
  WorkingDirectory = "wd"
9
13
  }
10
- /** How a call accesses the {@link AmbientStateName|ambient state}. */
11
- export declare const enum AmbientStateAccessType {
12
- /** `options(...)`: named arguments set options, unnamed strings query them, anything else sets unknown options */
13
- SetOptions = "set-options",
14
- /** `getOption(x)`: reads the option named by the first argument */
15
- GetOption = "get-option",
16
- /** reads the given options, like `cat` reads `digits` (see {@link AmbientStateAccess#dispatchOn} for `print`) */
17
- ReadOptions = "read-options",
18
- /** writes the graphics state, unless all arguments are unnamed strings (see {@link AmbientStateAccess#queryOnUnnamedStrings}) */
19
- SetGraphics = "set-graphics",
20
- /** writes the palette, which all devices share; without arguments it only reads it */
21
- SetPalette = "set-palette",
22
- /** reads the graphics state and the palette, like every plot does */
23
- ReadGraphics = "read-graphics",
24
- /** opens a device, which starts with a fresh graphics state */
25
- OpenDevice = "open-device",
26
- /** closes a device (or all of them), returning to the state of another open device */
27
- CloseDevice = "close-device",
28
- /** makes another open device the active one */
29
- SwitchDevice = "switch-device",
30
- /** sets the state of the random number generator, like `set.seed`, and its kind from the arguments at {@link AmbientStateAccess#kindFrom} on */
31
- SetRng = "set-rng",
32
- /** draws from the random number generator, which reads its state and advances it, like `runif` */
33
- DrawRng = "draw-rng",
34
- /** reads a file, like `read.csv`, so it sees what was written to the files before */
35
- ReadFiles = "read-files",
36
- /** writes a file, like `write.csv` */
37
- WriteFiles = "write-files",
38
- /** `setwd(dir)`: changes the working directory, returning the previous one */
39
- SetWorkingDirectory = "set-working-directory",
40
- /** `getwd()`: reads the working directory */
41
- GetWorkingDirectory = "get-working-directory",
42
- /** `textConnection(object, open)`: opened for writing, it binds the variable `object` names to what is written to it */
43
- OpenTextConnection = "open-text-connection",
44
- /** `reg.finalizer(e, f)`: registers `f` to run once `e` is released */
45
- RegisterFinalizer = "register-finalizer",
46
- /** `gc()`: may run every registered finalizer whose object is released */
47
- RunFinalizers = "run-finalizers",
48
- /** sets entries of a keyed state, like `Sys.setenv(A = "1")` sets the environment variable `A`, see {@link AmbientKeys} */
49
- SetKeyed = "set-keyed",
50
- ReadKeyed = "read-keyed",
51
- /** sets a state without entries, like `sink(file)` diverts the output */
52
- SetState = "set-state",
53
- /** reads a state without entries, like `search()` reads the search path */
54
- ReadState = "read-state"
55
- }
56
14
  /** The escape a quoting function offers, a property of the function: `quote(!!x)` negates, `expr(!!x)` splices. */
57
15
  export declare enum Unquote {
58
16
  /** no escape at all, everything within the argument stays unevaluated */
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  /* The kinds the built-in configuration states, kept free of runtime imports so loading the configuration stays cheap. */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.NamedAccessOperators = exports.Bottom = exports.Top = exports.UnnamedFunctionCallPrefix = exports.KnownHooks = exports.Unquote = exports.AmbientSingleState = exports.PrintingOptions = void 0;
4
+ exports.NamedAccessOperators = exports.Bottom = exports.Top = exports.UnnamedFunctionCallPrefix = exports.KnownHooks = exports.Unquote = exports.AmbientSingleState = exports.NumberFormatOptions = exports.PrintingOptions = void 0;
5
5
  /** Options that affect how values are printed and formatted (read by `print`, `format`, and `cat`). */
6
- exports.PrintingOptions = ['digits', 'width', 'max.print', 'digits.secs', 'useFancyQuotes'];
6
+ exports.PrintingOptions = ['digits', 'width', 'max.print', 'digits.secs', 'useFancyQuotes', 'scipen', 'OutDec'];
7
+ /** Options that affect how a number turns into text, even outside printing (`paste(1e5)` reads `scipen`, `as.character(1.5)` reads `OutDec`). */
8
+ exports.NumberFormatOptions = ['scipen', 'OutDec'];
7
9
  /** The parts of the ambient state with a single value a scoped call (`withr::with_dir`) may change, other than the entries of a {@link KeyedState}. */
8
10
  var AmbientSingleState;
9
11
  (function (AmbientSingleState) {
10
12
  AmbientSingleState["Graphics"] = "graphics";
11
13
  AmbientSingleState["Device"] = "device";
14
+ /** the console output, which `capture.output` diverts for its code */
15
+ AmbientSingleState["Sink"] = "sink";
12
16
  AmbientSingleState["Rng"] = "rng";
13
17
  AmbientSingleState["WorkingDirectory"] = "wd";
14
18
  })(AmbientSingleState || (exports.AmbientSingleState = AmbientSingleState = {}));
@@ -1,4 +1,6 @@
1
- import type { AmbientScope, AmbientStateAccess } from '../internal/process/functions/call/built-in/built-in-ambient-state';
1
+ import type { GuardFacts } from './guard-facts';
2
+ import type { AmbientScope } from '../internal/process/functions/call/built-in/built-in-ambient-state';
3
+ import type { AmbientEffects } from './ambient-effect';
2
4
  import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
3
5
  import type { DecodedFunction } from '../../project/sigdb/decode';
4
6
  import { Ternary } from '../../util/logic';
@@ -40,7 +42,11 @@ export declare enum ArgProp {
40
42
  /** besides its value, the expression as written names a part of the result, like `a` in `data.frame(a)`, which becomes the column `a`; passing `identity(a)` instead changes the name */
41
43
  Deparsed = 65536,
42
44
  /** a {@link ArgProp.Resource} whose default names none, like `file` in `cat(..., file = "")`, which prints to the console, or in `capture.output(..., file = NULL)`; left out, the call accesses no file through it */
43
- Optional = 131072
45
+ Optional = 131072,
46
+ /** a call leaving it out fails, as the body reads it on every way through; only inferred (see {@link FunctionSemantics.guards}) */
47
+ Required = 262144,
48
+ /** a call fails on some of what it could hold, as there are guards on it; only inferred (see {@link FunctionSemantics.guards}) */
49
+ Guarded = 524288
44
50
  }
45
51
  /** The properties of the behavior of a call, as a bitmask. */
46
52
  export declare enum CallProp {
@@ -88,6 +94,8 @@ export declare enum SemanticCallTag {
88
94
  Process = "process",
89
95
  /** asks the user, like `readline` or a file chooser */
90
96
  User = "asks-user",
97
+ /** only does its job in an interactive session: opens a viewer, an editor, or the debugger (`View`, `edit`, `browser`), which a script run by `Rscript` has none of */
98
+ Interactive = "interactive-only",
91
99
  /** hands back what the program was invoked with, as `commandArgs` and the option parsers built on it do */
92
100
  CommandLine = "command-line",
93
101
  /** yields the paths it matches at run time rather than one it was handed (`list.files`, `Sys.glob`); empty is an answer */
@@ -250,19 +258,23 @@ export declare const ArgProps: {
250
258
  };
251
259
  /** Semantics of a built-in that hold no matter which processor handles the call. */
252
260
  export interface BuiltInFnInfo extends StatedProps {
253
- /** how the call reads or writes global state like the graphics parameters, the options, or files, see {@link AmbientStateAccess} */
254
- readonly ambient?: AmbientStateAccess | readonly AmbientStateAccess[];
261
+ /** how the call reads or writes global state like the graphics parameters, the options, or files, see {@link AmbientEffect} */
262
+ readonly ambient?: AmbientEffects;
255
263
  /** the call changes that state for a scope only, see {@link AmbientScope} */
256
264
  readonly scope?: AmbientScope;
257
265
  readonly hasUnknownSideEffects?: boolean | LinkTo<RegExp | string>;
258
266
  /** The condition classes a call signals when every argument it is handed is a constant, like `simpleError`, `error`, and `condition` for `stop("x")`. */
259
267
  readonly signals?: readonly string[];
268
+ /** The condition classes the call muffles while its code runs, like `message` for `suppressMessages(expr)`, which decides where the output of that code goes. */
269
+ readonly muffles?: readonly string[];
260
270
  /** the parameters and what each of their arguments is used for */
261
271
  readonly sig?: FnSig;
262
272
  /** keep the environment on the call vertex, for a later pass to look names up in */
263
273
  readonly keepEnvironment?: boolean;
264
274
  /** What this call lets the function around it reach about its own formals without naming one of them, e.g. `match.call()` ({@link ArgProp.Nse}) or `nargs()` ({@link ArgProp.Presence}); see {@link reflectiveRolesOf}. */
265
275
  readonly frame?: ArgProps;
276
+ /** per name this definition states, what it has to do with the guards of the functions calling it, see {@link GuardFacts} */
277
+ readonly guards?: Readonly<Record<BrandedIdentifier, GuardFacts>>;
266
278
  /** the generics the call may dispatch to on (parts of) its arguments, like `as.character` for `paste` or `format` for the columns `print` shows of a data frame; any method of them may run */
267
279
  readonly dispatches?: string[];
268
280
  }