@eagleoutice/flowr 2.15.9 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/README.md +47 -41
  2. package/abstract-interpretation/absint-inference.d.ts +2 -2
  3. package/abstract-interpretation/absint-inference.js +32 -79
  4. package/abstract-interpretation/data-frame/arguments.js +11 -7
  5. package/benchmark/slicer.d.ts +0 -1
  6. package/benchmark/slicer.js +1 -2
  7. package/cli/repl/commands/repl-signature.js +12 -3
  8. package/config.d.ts +5 -1
  9. package/control-flow/cfg-properties.js +0 -22
  10. package/control-flow/happens-before.d.ts +7 -2
  11. package/control-flow/happens-before.js +55 -31
  12. package/control-flow/useless-loop.d.ts +1 -1
  13. package/control-flow/useless-loop.js +29 -42
  14. package/dataflow/environments/apply-kill.js +6 -2
  15. package/dataflow/environments/built-in-config.d.ts +2 -0
  16. package/dataflow/environments/built-in-props.d.ts +16 -1
  17. package/dataflow/environments/built-in-props.js +33 -20
  18. package/dataflow/environments/built-in.d.ts +8 -3
  19. package/dataflow/environments/built-in.js +52 -82
  20. package/dataflow/environments/default-builtin-config.d.ts +551 -21
  21. package/dataflow/environments/default-builtin-config.js +121 -45
  22. package/dataflow/environments/define.d.ts +3 -2
  23. package/dataflow/environments/define.js +4 -3
  24. package/dataflow/environments/deprecation-info.d.ts +45 -0
  25. package/dataflow/environments/deprecation-info.js +13 -0
  26. package/dataflow/environments/environment.d.ts +7 -5
  27. package/dataflow/environments/environment.js +55 -121
  28. package/dataflow/environments/identifier.d.ts +6 -2
  29. package/dataflow/environments/identifier.js +23 -69
  30. package/dataflow/environments/reference-to-maybe.d.ts +9 -0
  31. package/dataflow/environments/reference-to-maybe.js +23 -51
  32. package/dataflow/environments/resolve-by-name.js +37 -76
  33. package/dataflow/eval/resolve/resolve-argument.d.ts +3 -1
  34. package/dataflow/eval/resolve/resolve-argument.js +61 -64
  35. package/dataflow/eval/resolve/resolve-working-directory.d.ts +8 -2
  36. package/dataflow/eval/resolve/resolve-working-directory.js +12 -20
  37. package/dataflow/eval/resolve/resolve.d.ts +4 -0
  38. package/dataflow/eval/resolve/resolve.js +23 -14
  39. package/dataflow/extractor.js +180 -58
  40. package/dataflow/fn/class-declaration.d.ts +8 -13
  41. package/dataflow/fn/class-declaration.js +95 -116
  42. package/dataflow/fn/exceptions-of-function.js +68 -37
  43. package/dataflow/fn/frame-reflection.d.ts +12 -4
  44. package/dataflow/fn/frame-reflection.js +51 -41
  45. package/dataflow/fn/function-props.js +15 -33
  46. package/dataflow/fn/function-semantics.d.ts +11 -3
  47. package/dataflow/fn/function-semantics.js +6 -0
  48. package/dataflow/fn/higher-order-function.d.ts +9 -1
  49. package/dataflow/fn/higher-order-function.js +27 -24
  50. package/dataflow/fn/strict-function.d.ts +13 -0
  51. package/dataflow/fn/strict-function.js +291 -123
  52. package/dataflow/graph/call-graph.d.ts +7 -6
  53. package/dataflow/graph/call-graph.js +35 -46
  54. package/dataflow/graph/graph.d.ts +13 -1
  55. package/dataflow/graph/graph.js +74 -66
  56. package/dataflow/graph/vertex.d.ts +1 -1
  57. package/dataflow/info.d.ts +8 -1
  58. package/dataflow/info.js +24 -30
  59. package/dataflow/internal/control-flow.d.ts +31 -4
  60. package/dataflow/internal/control-flow.js +61 -39
  61. package/dataflow/internal/linker.d.ts +17 -8
  62. package/dataflow/internal/linker.js +286 -213
  63. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +179 -0
  64. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +874 -0
  65. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +3 -1
  66. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +60 -48
  67. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
  68. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +135 -198
  69. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +7 -9
  70. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +5 -1
  71. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +21 -14
  72. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
  73. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
  74. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +141 -146
  75. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +56 -24
  76. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +292 -253
  77. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +30 -32
  79. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +68 -67
  80. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +91 -129
  81. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -3
  82. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +16 -12
  83. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +4 -4
  84. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -35
  85. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -0
  86. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +8 -3
  87. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +5 -3
  88. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +13 -31
  89. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +1 -1
  90. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +42 -119
  91. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -3
  92. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +21 -21
  93. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -0
  94. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +93 -102
  95. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -3
  96. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +173 -114
  97. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -3
  98. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +23 -26
  99. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
  100. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +34 -9
  101. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +1 -1
  102. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +119 -93
  103. package/dataflow/internal/process/functions/call/common.d.ts +4 -4
  104. package/dataflow/internal/process/functions/call/common.js +49 -71
  105. package/dataflow/internal/process/functions/call/deferred.d.ts +12 -2
  106. package/dataflow/internal/process/functions/call/deferred.js +81 -63
  107. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -2
  108. package/dataflow/internal/process/functions/call/known-call-handling.js +65 -68
  109. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +3 -5
  110. package/dataflow/internal/process/functions/call/named-call-handling.js +48 -19
  111. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
  112. package/dataflow/internal/process/functions/call/quoted.js +257 -154
  113. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +17 -38
  114. package/dataflow/internal/process/functions/process-parameter.js +25 -32
  115. package/dataflow/internal/process/process-symbol.js +4 -3
  116. package/dataflow/internal/program-order.d.ts +26 -0
  117. package/dataflow/internal/program-order.js +49 -0
  118. package/documentation/data/faq/faqs.js +3 -3
  119. package/documentation/data/interface/doc-writing-code.js +1 -2
  120. package/documentation/data/server/doc-data-server-messages.js +7 -7
  121. package/documentation/doc-capabilities.js +80 -34
  122. package/documentation/doc-util/doc-query.d.ts +0 -3
  123. package/documentation/doc-util/doc-query.js +4 -3
  124. package/documentation/wiki-analyzer.js +1 -1
  125. package/documentation/wiki-cfg.js +5 -6
  126. package/documentation/wiki-core.js +8 -8
  127. package/documentation/wiki-dataflow-graph.js +10 -11
  128. package/documentation/wiki-interface.js +2 -2
  129. package/documentation/wiki-linting-and-testing.js +3 -3
  130. package/documentation/wiki-overview.js +6 -6
  131. package/documentation/wiki-query.js +9 -101
  132. package/documentation/wiki-setup.js +23 -0
  133. package/documentation/wiki-signature-database.js +1 -1
  134. package/linter/linter-rules.d.ts +18 -9
  135. package/linter/rules/absolute-path.js +63 -87
  136. package/linter/rules/deprecated-functions.d.ts +1 -45
  137. package/linter/rules/deprecated-functions.js +24 -33
  138. package/linter/rules/file-path-validity.d.ts +4 -2
  139. package/linter/rules/file-path-validity.js +114 -80
  140. package/linter/rules/namespace-access.js +21 -33
  141. package/linter/rules/naming-convention.d.ts +1 -1
  142. package/linter/rules/naming-convention.js +60 -48
  143. package/linter/rules/network-functions.js +11 -7
  144. package/linter/rules/no-leaked-credentials.js +15 -18
  145. package/linter/rules/problematic-inputs.d.ts +2 -1
  146. package/linter/rules/problematic-inputs.js +39 -59
  147. package/linter/rules/roxygen-arguments.d.ts +9 -4
  148. package/linter/rules/roxygen-arguments.js +29 -48
  149. package/linter/rules/seeded-randomness.d.ts +7 -4
  150. package/linter/rules/seeded-randomness.js +128 -89
  151. package/linter/rules/stop-with-call-arg.d.ts +4 -2
  152. package/linter/rules/stop-with-call-arg.js +25 -22
  153. package/linter/rules/unclosed-connection.js +31 -24
  154. package/linter/rules/undefined-symbol.d.ts +4 -6
  155. package/linter/rules/undefined-symbol.js +58 -75
  156. package/linter/rules/unescaped-arguments.js +18 -44
  157. package/linter/rules/unused-definition.d.ts +6 -0
  158. package/linter/rules/unused-definition.js +105 -145
  159. package/linter/rules/unused-import.d.ts +3 -0
  160. package/linter/rules/unused-import.js +25 -43
  161. package/package.json +5 -2
  162. package/project/flowr-analyzer.d.ts +2 -0
  163. package/project/flowr-analyzer.js +28 -1
  164. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -2
  165. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +8 -12
  166. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -2
  167. package/project/plugins/file-plugins/files/flowr-rda-file.js +10 -55
  168. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +7 -5
  169. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +34 -56
  170. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +2 -1
  171. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +22 -45
  172. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
  173. package/project/sigdb/build.js +4 -0
  174. package/project/sigdb/manifest.d.ts +2 -0
  175. package/project/sigdb/manifest.js +10 -1
  176. package/project/sigdb/reader.js +23 -61
  177. package/project/sigdb/sigdb-download.d.ts +29 -6
  178. package/project/sigdb/sigdb-download.js +212 -64
  179. package/queries/base-query-format.js +1 -2
  180. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  181. package/queries/catalog/call-context-query/cascade-action.d.ts +3 -1
  182. package/queries/catalog/call-context-query/cascade-action.js +2 -0
  183. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -0
  184. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  185. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
  186. package/queries/catalog/dataflow-query/dataflow-query-format.js +4 -7
  187. package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -114
  188. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +5 -9
  189. package/queries/catalog/dependencies-query/function-info/library-functions.js +6 -0
  190. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  191. package/queries/catalog/dependencies-query/function-info/write-functions.js +7 -3
  192. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +4 -4
  193. package/queries/catalog/input-sources-query/simple-input-classifier.js +192 -301
  194. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -1
  195. package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
  196. package/queries/catalog/origin-query/origin-query-executor.js +2 -2
  197. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
  198. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  199. package/queries/query.d.ts +1 -1
  200. package/r-bridge/data/data.d.ts +21 -14
  201. package/r-bridge/data/data.js +28 -20
  202. package/r-bridge/lang-4.x/ast/model/model.d.ts +3 -1
  203. package/r-bridge/lang-4.x/ast/model/model.js +19 -43
  204. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  205. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
  206. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -12
  207. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  208. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  209. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  210. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  211. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  212. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  213. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  214. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  215. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  216. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  217. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  218. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  219. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  220. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  221. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  222. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  223. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  224. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  225. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  226. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
  227. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +11 -2
  228. package/r-bridge/roxygen2/roxygen-parse.js +28 -42
  229. package/r-bridge/shell.js +6 -0
  230. package/search/search-executor/search-enrichers.js +25 -37
  231. package/slicing/static/slice-call.d.ts +4 -3
  232. package/slicing/static/slice-call.js +56 -88
  233. package/slicing/static/static-slicer.js +115 -79
  234. package/slicing/static/visiting-queue.d.ts +4 -6
  235. package/slicing/static/visiting-queue.js +9 -13
  236. package/util/files.d.ts +2 -0
  237. package/util/files.js +3 -1
  238. package/util/mermaid/mermaid.js +6 -2
  239. package/util/proc.js +2 -1
  240. package/util/r-base-packages.d.ts +2 -0
  241. package/util/r-base-packages.js +23 -13
  242. package/util/text/playground-link.d.ts +12 -3
  243. package/util/text/playground-link.js +18 -27
  244. package/util/version.js +4 -10
@@ -0,0 +1,179 @@
1
+ import type { DataflowProcessorInformation } from '../../../../../processor';
2
+ import { type ControlDependency, DataflowInformation, type ExitPoint } from '../../../../../info';
3
+ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
4
+ import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
+ import { type FnSig } from '../../../../../environments/built-in-props';
6
+ import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ import { Identifier, type IdentifierDefinition, type IdentifierReference, type InGraphIdentifierDefinition } from '../../../../../environments/identifier';
8
+ import { type REnvironmentInformation } from '../../../../../environments/environment';
9
+ import { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
10
+ import type { LinkTo } from '../../../../../../queries/catalog/call-context-query/call-context-query-format';
11
+ import type { DataflowGraph } from '../../../../../graph/graph';
12
+ import { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
13
+ /**
14
+ * Graphics parameters and options, tracked as global pseudo variables (`#...`) so readers link to the calls that set them.
15
+ * Accumulating states only grow: `par(mar = ...)` keeps an earlier `par(mfrow = ...)`.
16
+ */
17
+ export declare const AmbientStateName: {
18
+ /** the graphics state (`par`, `layout`, ...) of the active device, which a new device starts afresh */
19
+ readonly graphics: "#graphics";
20
+ /** the graphics states of the other open devices, the active one returns to one of them once it closes */
21
+ readonly otherDevices: "#graphics:other";
22
+ /** the call that opened the active device, and those of the other open devices */
23
+ readonly device: "#device";
24
+ readonly otherDevicesOpenedBy: "#device:other";
25
+ /** the color palette, which, other than the graphics parameters, all devices share */
26
+ readonly palette: "#palette";
27
+ /** the files on disk, which every call writing a file adds to and every call reading a file we cannot name reads */
28
+ readonly files: "#files";
29
+ /** written by a call writing a file we cannot name, which every call reading a file reads */
30
+ readonly anyFile: "#file:*";
31
+ /** the state of the random number generator, which `set.seed` sets and every draw advances */
32
+ readonly rng: "#rng";
33
+ /** the kind of generator, which `set.seed` keeps unless it is given one */
34
+ readonly rngKind: "#rng:kind";
35
+ /** the global variable R keeps that state in, so assigning it sets {@link AmbientStateName.rng} as well */
36
+ readonly rngVariable: ".Random.seed";
37
+ /** every option write, for readers that may read any option (`getOption(k)` with an unknown `k`, library functions) */
38
+ readonly allOptions: "#options";
39
+ /** written by an `options(...)` call whose keys we cannot name, like the common `options(op)` restore */
40
+ readonly unknownOption: "#option:*";
41
+ /** written along with the option `warn` when it may turn warnings into errors (`warn >= 2`), see {@link errorsOfWarnings} */
42
+ readonly warnsAsErrors: "#warn-error";
43
+ /** the finalizers registered (`reg.finalizer`) and the removals that may release their objects, which `gc()` may run */
44
+ readonly finalizers: "#finalizers";
45
+ /** marks `name` as bound to a text connection opened for writing, whose writes change it */
46
+ readonly textConnection: (this: void, name: string) => string;
47
+ /** the file named `stem` (`data` for `out/data.csv`), so a read of a named file only sees writes that may hit it */
48
+ readonly file: (this: void, stem: string) => string;
49
+ /** the pseudo variable holding the option `key`; setting the option replaces it */
50
+ readonly option: (this: void, key: string) => string;
51
+ /** whether `name` is one of these pseudo variables */
52
+ readonly is: (this: void, name: Identifier | undefined) => name is string;
53
+ };
54
+ /** Whether calling `definition` runs a body flowR cannot see: a library function's, or whatever a parameter is bound to. */
55
+ export declare function hidesBody(definition: IdentifierDefinition): boolean;
56
+ /** A call into code flowR cannot see may read any option, draw random numbers (with `draws` advancing the generator), and with `graphics` draw on the device. */
57
+ export declare function readsAllAmbientState<OtherInfo>(res: DataflowInformation, rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, graphics: boolean, draws?: boolean): DataflowInformation;
58
+ /** What an assignment writes beyond its target: only a global `.Random.seed` sets {@link AmbientStateName.rng}. */
59
+ export declare function ambientWritesOfAssignment(environment: REnvironmentInformation, target: Identifier, rootId: NodeId, cds: ControlDependency[] | undefined, global: boolean): REnvironmentInformation;
60
+ /** Rebinding or removing the names (all of them if `undefined`) may release an object a finalizer is registered for. */
61
+ export declare function ambientWritesOfRelease(environment: REnvironmentInformation, names: readonly Identifier[] | undefined, rootId: NodeId, cds: ControlDependency[] | undefined): REnvironmentInformation;
62
+ /** Ambient writes stay out of `out` (see {@link withAccess}), so a part that only maybe runs marks its writes as maybe in `target` here. */
63
+ export declare function makeAmbientWritesMaybe(after: REnvironmentInformation, before: REnvironmentInformation, target: REnvironmentInformation, cds: readonly ControlDependency[]): void;
64
+ /** The states written in `after` that `before` does not hold, as by a promise (`delayedAssign`) whose writes only happen once a read forces it. */
65
+ export declare function ambientWritesBetween(after: REnvironmentInformation, before: REnvironmentInformation): string[];
66
+ /** Notes that a definition binds a promise or a text connection, which reads have to look for from now on. */
67
+ export declare function markForcing(environment: REnvironmentInformation): void;
68
+ /** Whether a definition seen so far binds a promise or a text connection, see {@link markForcing}. */
69
+ export declare function mayForce(environment: REnvironmentInformation): boolean;
70
+ /** The state a symbol reads, plus the maybe-writes of forcing a promise bound to it. */
71
+ export declare function ambientAccessOfSymbol<OtherInfo>(res: DataflowInformation, symbol: RSymbol<OtherInfo & ParentInformation>, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
72
+ /** {@link optionsVariableReads} as references. */
73
+ export declare function readsOfOptionsVariable<OtherInfo>(symbol: RSymbol<OtherInfo & ParentInformation>, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): IdentifierReference[];
74
+ /** Options that affect how values are printed and formatted (read by `print`, `format`, and `cat`). */
75
+ export declare const PrintingOptions: readonly string[];
76
+ /** How a call accesses the {@link AmbientStateName|ambient state}. */
77
+ export declare const enum AmbientStateAccessType {
78
+ /** `options(...)`: named arguments set options, unnamed strings query them, anything else sets unknown options */
79
+ SetOptions = "set-options",
80
+ /** `getOption(x)`: reads the option named by the first argument */
81
+ GetOption = "get-option",
82
+ /** reads the given options, like `cat` reads `digits` (see {@link AmbientStateAccess#dispatchOn} for `print`) */
83
+ ReadOptions = "read-options",
84
+ /** writes the graphics state, unless all arguments are unnamed strings (see {@link AmbientStateAccess#queryOnUnnamedStrings}) */
85
+ SetGraphics = "set-graphics",
86
+ /** writes the palette, which all devices share; without arguments it only reads it */
87
+ SetPalette = "set-palette",
88
+ /** reads the graphics state and the palette, like every plot does */
89
+ ReadGraphics = "read-graphics",
90
+ /** opens a device, which starts with a fresh graphics state */
91
+ OpenDevice = "open-device",
92
+ /** closes a device (or all of them), returning to the state of another open device */
93
+ CloseDevice = "close-device",
94
+ /** makes another open device the active one */
95
+ SwitchDevice = "switch-device",
96
+ /** evaluates its unevaluated argument, like `evalq`, see {@link evaluatesCapturedCode} */
97
+ EvaluateQuoted = "evaluate-quoted",
98
+ /** sets the state of the random number generator, like `set.seed`, and its kind from the arguments at {@link AmbientStateAccess#kindFrom} on */
99
+ SetRng = "set-rng",
100
+ /** draws from the random number generator, which reads its state and advances it, like `runif` */
101
+ DrawRng = "draw-rng",
102
+ /** reads a file, like `read.csv`, so it sees what was written to the files before */
103
+ ReadFiles = "read-files",
104
+ /** writes a file, like `write.csv` */
105
+ WriteFiles = "write-files",
106
+ /** `textConnection(object, open)`: opened for writing, it binds the variable `object` names to what is written to it */
107
+ OpenTextConnection = "open-text-connection",
108
+ /** `reg.finalizer(e, f)`: registers `f` to run once `e` is released */
109
+ RegisterFinalizer = "register-finalizer",
110
+ /** `gc()`: may run every registered finalizer whose object is released */
111
+ RunFinalizers = "run-finalizers"
112
+ }
113
+ /** An {@link AmbientStateAccessType} together with what refines it for some of the types. */
114
+ export type AmbientStateAccess = {
115
+ readonly type: AmbientStateAccessType.SetOptions | AmbientStateAccessType.GetOption | AmbientStateAccessType.ReadGraphics | AmbientStateAccessType.SetPalette | AmbientStateAccessType.OpenDevice | AmbientStateAccessType.SwitchDevice | AmbientStateAccessType.DrawRng | AmbientStateAccessType.OpenTextConnection | AmbientStateAccessType.RegisterFinalizer | AmbientStateAccessType.RunFinalizers;
116
+ } | {
117
+ readonly type: AmbientStateAccessType.ReadFiles | AmbientStateAccessType.WriteFiles;
118
+ /** the signature whose {@link ArgProp.Resource} arguments name the files, absent if they do not name them exactly (like a glob) */
119
+ readonly sig?: FnSig;
120
+ } | {
121
+ readonly type: AmbientStateAccessType.SetRng;
122
+ /** the position from which on (unnamed) arguments, and every argument named other than `seed`, set the kind of generator */
123
+ readonly kindFrom?: number;
124
+ } | {
125
+ readonly type: AmbientStateAccessType.ReadOptions;
126
+ readonly keys: readonly string[];
127
+ /** the argument `print(x)` dispatches on: a package method may read any option unless the value is plain */
128
+ readonly dispatchOn?: number;
129
+ } | {
130
+ readonly type: AmbientStateAccessType.EvaluateQuoted;
131
+ } | {
132
+ readonly type: AmbientStateAccessType.CloseDevice;
133
+ /** `graphics.off()` closes every device */
134
+ readonly all?: boolean;
135
+ } | {
136
+ readonly type: AmbientStateAccessType.SetGraphics;
137
+ /** `par()` and `par("mar")` only query the state */
138
+ readonly queryOnUnnamedStrings?: boolean;
139
+ /** a query also reads what the last plot left behind (`par("usr")`), linked like an unknown side effect */
140
+ readonly queryLinksTo?: LinkTo<RegExp | string>;
141
+ };
142
+ /** Wires the {@link AmbientStateAccess} of a call into its dataflow information: reads become unknown references, writes define the pseudo variable globally. */
143
+ export declare function applyAmbientStateAccess<OtherInfo>(res: DataflowInformation, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[] | UnknownArguments, rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, access: AmbientStateAccess | readonly AmbientStateAccess[]): DataflowInformation;
144
+ /** The arguments of a call made on our behalf, like `do.call(par, args)`, which we cannot see. */
145
+ declare const UnknownArguments: unique symbol;
146
+ type UnknownArguments = typeof UnknownArguments;
147
+ /** A call to `fn` made on our behalf (`do.call(fn, args)`, `sapply(x, fn)`): it accesses the state as `fn` does, or reads all of it if `fn` is opaque. */
148
+ export declare function applyAmbientStateOfCallee<OtherInfo>(res: DataflowInformation, callId: NodeId, fn: Identifier, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
149
+ /** The (maybe) writes of the call `callId` to the built-in `target` through a parameter, like `g <- function(f, ...) f(...); g(options, digits = 3)`. */
150
+ export declare function writesOfHiddenBuiltIn(target: IdentifierDefinition, callId: NodeId): (InGraphIdentifierDefinition & {
151
+ name: string;
152
+ })[];
153
+ /** The states the call to the built-in `target` through a parameter reads, see {@link writesOfHiddenBuiltIn}. */
154
+ export declare function readsOfHiddenBuiltIn(target: IdentifierDefinition): string[];
155
+ /** Links state reads in a loop body to the body's own writes of a later iteration and returns them, as the first iteration reads what is there before the loop. */
156
+ export declare function linkAmbientStateWithinLoop(graph: DataflowGraph, reads: readonly IdentifierReference[], body: DataflowInformation): IdentifierReference[];
157
+ /** A scoped state change (`withr`, `rlang`): `with_*` undoes it after its code, `local_*` when the calling function returns. */
158
+ export interface AmbientScope {
159
+ readonly state: 'options' | 'graphics' | 'device' | 'rng';
160
+ /** the formals in order, used to bind the arguments */
161
+ readonly params: readonly string[];
162
+ /** the formal evaluated with the change in effect, absent for the `local_*` variants */
163
+ readonly code?: string;
164
+ /** the formal holding a list of the new values (`list(digits = 3)`), other named arguments are values too */
165
+ readonly new?: string;
166
+ }
167
+ /** The processor for an {@link AmbientScope}. */
168
+ export declare function processAmbientScope<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, scope: AmbientScope): DataflowInformation;
169
+ /** Evaluating captured code may access any state; `Quoted.finalize` drops the writes again once the code is known to change none. */
170
+ export declare function evaluatesCapturedCode<OtherInfo>(res: DataflowInformation, rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
171
+ /** R prints every visible top-level value (see {@link autoPrints}) by an implicit `print`, which reads the options the configured `print` reads for that value. */
172
+ export declare function readsOfAutoPrint<OtherInfo>(processed: DataflowInformation, expression: RNode<OtherInfo & ParentInformation>, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
173
+ /** whether the value of the top-level `expression` is visible, so that R prints it, decided on its vertex */
174
+ export declare function autoPrints<OtherInfo>(expression: RNode<OtherInfo & ParentInformation>, processed: DataflowInformation, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): boolean;
175
+ /** A call through a variable bound to a built-in (`p <- par; p(...)`), only revealed when linking the statement's calls. */
176
+ export declare function applyAmbientStateOfCalledBuiltIns<OtherInfo>(res: DataflowInformation, callId: NodeId, builtIns: readonly NodeId[], before: REnvironmentInformation, graph: DataflowGraph, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
177
+ /** With `warn >= 2` R turns warnings into errors, so whatever may warn in `block` is a maybe error exit reading the options that may set `warn`. */
178
+ export declare function errorsOfWarnings<OtherInfo>(block: RNode<OtherInfo & ParentInformation>, after: REnvironmentInformation, graph: DataflowGraph, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): ExitPoint[];
179
+ export {};