@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
@@ -2,8 +2,9 @@ import type { REnvironmentInformation } from './environment';
2
2
  import { Identifier, type IdentifierDefinition } from './identifier';
3
3
  /**
4
4
  * Define an identifier in the environment, possibly as a super assignment.
5
- * This recalculates the level
5
+ * This recalculates the level.
6
+ * With `append`, a super assignment keeps the definitions the name already has instead of replacing them.
6
7
  */
7
8
  export declare function define(definition: IdentifierDefinition & {
8
9
  name: Identifier;
9
- }, superAssign: boolean | undefined, { level, current }: REnvironmentInformation): REnvironmentInformation;
10
+ }, superAssign: boolean | undefined, { level, current }: REnvironmentInformation, append?: boolean): REnvironmentInformation;
@@ -4,10 +4,11 @@ exports.define = define;
4
4
  const identifier_1 = require("./identifier");
5
5
  /**
6
6
  * Define an identifier in the environment, possibly as a super assignment.
7
- * This recalculates the level
7
+ * This recalculates the level.
8
+ * With `append`, a super assignment keeps the definitions the name already has instead of replacing them.
8
9
  */
9
- function define(definition, superAssign, { level, current }) {
10
- const newEnv = superAssign ? current.defineSuper(definition) : current.define(definition);
10
+ function define(definition, superAssign, { level, current }, append = false) {
11
+ const newEnv = superAssign ? current.defineSuper(definition, append) : current.define(definition);
11
12
  return {
12
13
  level: identifier_1.Identifier.getNamespace(definition.name) === undefined ? level : recalculateLevel(newEnv),
13
14
  current: newEnv,
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Information about an argument of a function that should be flagged as deprecated if it is called with this argument
3
+ *
4
+ * Used in {@link DeprecatedFunctionInformation} to mark a function argument as deprecated under certain conditions
5
+ */
6
+ export interface DeprecatedArgumentInformation {
7
+ /** Index of the argument */
8
+ readonly argIdx?: number;
9
+ /** Name of the argument */
10
+ readonly argName?: string;
11
+ /** Only mark this argument as deprecated, if a specific value was provided */
12
+ readonly ifValue?: RegExp | string;
13
+ /** Suggested replacement for this argument */
14
+ readonly replacedBy?: string;
15
+ /** The version since this argument is deprecated */
16
+ readonly sinceVersion?: string;
17
+ /** The state of deprecation {@link DeprecationState}, i.e. is the argument completely removed, or are there better alternatives */
18
+ readonly state?: DeprecationState;
19
+ }
20
+ /**
21
+ * Information about a deprecated function
22
+ *
23
+ * Used in {@link DeprecatedFunctionsConfig.conditionally} to mark a function as deprecated under certain conditions
24
+ */
25
+ export interface DeprecatedFunctionInformation {
26
+ /**
27
+ * Mark specific arguments as deprecated
28
+ * If only whenArgs is provided, and not sinceVersion, the function is only marked as deprecated, if the argument is provided.
29
+ */
30
+ readonly whenArgs?: DeprecatedArgumentInformation[];
31
+ /** Suggested replacement for this function */
32
+ readonly replacedBy?: string;
33
+ /** The version since this function is deprecated, if version is provided the entire function will be marked as deprecated, if the version range matches */
34
+ readonly sinceVersion?: string;
35
+ /** Lifecycle State {@link DeprecationState}, i.e. is the function completely removed, or are there better alternatives */
36
+ readonly state?: DeprecationState;
37
+ }
38
+ export declare enum DeprecationState {
39
+ /** A better alternative is available, but the function is kept (softer alternative to deprecated) {@link https://lifecycle.r-lib.org/articles/stages.html#superseded} */
40
+ Superseded = "superseded",
41
+ /** A better alternative is available, and the function is marked for removal {@link https://lifecycle.r-lib.org/articles/stages.html#deprecated} */
42
+ Deprecated = "deprecated",
43
+ /** No longer works and is removed and replaced by another function {@link https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Defunct} */
44
+ Defunct = "defunct"
45
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeprecationState = void 0;
4
+ var DeprecationState;
5
+ (function (DeprecationState) {
6
+ /** A better alternative is available, but the function is kept (softer alternative to deprecated) {@link https://lifecycle.r-lib.org/articles/stages.html#superseded} */
7
+ DeprecationState["Superseded"] = "superseded";
8
+ /** A better alternative is available, and the function is marked for removal {@link https://lifecycle.r-lib.org/articles/stages.html#deprecated} */
9
+ DeprecationState["Deprecated"] = "deprecated";
10
+ /** No longer works and is removed and replaced by another function {@link https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Defunct} */
11
+ DeprecationState["Defunct"] = "defunct";
12
+ })(DeprecationState || (exports.DeprecationState = DeprecationState = {}));
13
+ //# sourceMappingURL=deprecation-info.js.map
@@ -1,5 +1,5 @@
1
1
  import type { BuiltInMemory } from './built-in';
2
- import type { BrandedIdentifier, IdentifierDefinition } from './identifier';
2
+ import type { BrandedIdentifier, IdentifierDefinition, ReferenceType } from './identifier';
3
3
  import { Identifier } from './identifier';
4
4
  import type { ControlDependency } from '../info';
5
5
  import { Frame } from './frame-memory';
@@ -49,8 +49,10 @@ export declare class Environment implements IEnvironment {
49
49
  private frame;
50
50
  cache?: Map<Identifier, IdentifierDefinition[]>;
51
51
  /** what a resolution found below this frame, by target and name; only frames nothing writes keep one */
52
- tailCache?: Map<string, readonly IdentifierDefinition[] | undefined>;
52
+ tailCache?: Map<ReferenceType, Map<string, readonly IdentifierDefinition[] | undefined>>;
53
53
  builtInEnv?: true;
54
+ /** set on the built-in environment once a definition below binds a promise or a text connection, which reads then look for */
55
+ forcing?: true;
54
56
  /** {@link memory} is shared with a clone; writing needs {@link writableMemory} to unshare it first */
55
57
  private sharedMemory?;
56
58
  /** {@link parent} is shared with the environment this was cloned from; writing through it needs {@link writableParent} */
@@ -87,12 +89,11 @@ export declare class Environment implements IEnvironment {
87
89
  adoptMap(map: MemoryView): void;
88
90
  /** Takes `frame` as the bindings, owned outright unless `shared`, where a write has to fork it first. */
89
91
  private adoptFrame;
90
- /** What a merge writes its result into: {@link Frame.forWrite} overlays a big frame instead of copying it, so the cost follows what the merge changes, not what it keeps. */
91
- private mergedFrame;
92
92
  /** {@link memory} ready to be written to. Every write goes through here, since {@link clone} shares the frame. */
93
93
  get writableMemory(): Frame;
94
94
  /** Clones this, sharing {@link memory} until either side writes; the cost is the same for a frame of any size. */
95
95
  clone(recurseParents: boolean): Environment;
96
+ private derive;
96
97
  /** Define a new identifier definition within this environment. */
97
98
  define(definition: IdentifierDefinition & {
98
99
  name: Identifier;
@@ -106,11 +107,12 @@ export declare class Environment implements IEnvironment {
106
107
  private defineInNamespace;
107
108
  defineSuper(definition: IdentifierDefinition & {
108
109
  name: Identifier;
109
- }): Environment;
110
+ }, append?: boolean): Environment;
110
111
  /** Definitions within `other` replace those here by name; if all of `other`'s are maybe, they are appended instead (turning existing ones maybe too). Always recurses parents. */
111
112
  overwrite(other: Environment | undefined, applyCds?: readonly ControlDependency[]): Environment;
112
113
  /** Adds all writes of `other` to this environment (`other`'s operations *might* happen). Always recurses parents. */
113
114
  append(other: Environment | undefined): Environment;
115
+ private merge;
114
116
  /**
115
117
  * The environment a merge with `other` settles on without touching either memory, `undefined` if the
116
118
  * memories have to be merged. Package blocks are always unioned, never overwritten or appended to.
@@ -10,11 +10,11 @@ exports.builtInEnvJsonReplacer = builtInEnvJsonReplacer;
10
10
  const json_1 = require("../../util/json");
11
11
  const removal_marker_1 = require("./removal-marker");
12
12
  const identifier_1 = require("./identifier");
13
- const assert_1 = require("../../util/assert");
14
13
  const info_1 = require("../info");
15
14
  const append_1 = require("./append");
16
15
  const frame_memory_1 = require("./frame-memory");
17
16
  const log_1 = require("../../util/log");
17
+ const defaultmap_1 = require("../../util/collections/defaultmap");
18
18
  var EnvType;
19
19
  (function (EnvType) {
20
20
  EnvType["Namespace"] = "ns";
@@ -45,6 +45,8 @@ class Environment {
45
45
  /** what a resolution found below this frame, by target and name; only frames nothing writes keep one */
46
46
  tailCache;
47
47
  builtInEnv;
48
+ /** set on the built-in environment once a definition below binds a promise or a text connection, which reads then look for */
49
+ forcing;
48
50
  /** {@link memory} is shared with a clone; writing needs {@link writableMemory} to unshare it first */
49
51
  sharedMemory;
50
52
  /** {@link parent} is shared with the environment this was cloned from; writing through it needs {@link writableParent} */
@@ -126,12 +128,6 @@ class Environment {
126
128
  this.sharedMemory = shared ? true : undefined;
127
129
  this.tailCache = undefined;
128
130
  }
129
- /** What a merge writes its result into: {@link Frame.forWrite} overlays a big frame instead of copying it, so the cost follows what the merge changes, not what it keeps. */
130
- mergedFrame() {
131
- /* the result may keep this frame as its base, so a later write here has to fork */
132
- this.sharedMemory = true;
133
- return this.frame.forWrite();
134
- }
135
131
  /** {@link memory} ready to be written to. Every write goes through here, since {@link clone} shares the frame. */
136
132
  get writableMemory() {
137
133
  this.tailCache = undefined;
@@ -146,18 +142,22 @@ class Environment {
146
142
  if (this.builtInEnv) {
147
143
  return this; // do not clone the built-in environment
148
144
  }
149
- const clone = new Environment(this.parent, this.builtInEnv, this.frame);
150
- clone.c = this.c;
151
- clone.n = this.n;
152
- clone.t = this.t;
153
- clone.globalEnv = this.globalEnv;
154
- clone.superMemory = this.superMemory;
145
+ const clone = this.derive(this.parent, this.frame);
155
146
  clone.sharedMemory = this.sharedMemory = true;
156
147
  if (recurseParents && !this.parent.builtInEnv) {
157
148
  clone.sharedParent = true;
158
149
  }
159
150
  return clone;
160
151
  }
152
+ derive(parent, frame) {
153
+ const env = new Environment(parent, undefined, frame);
154
+ env.c = this.c;
155
+ env.n = this.n;
156
+ env.t = this.t;
157
+ env.globalEnv = this.globalEnv;
158
+ env.superMemory = this.superMemory;
159
+ return env;
160
+ }
161
161
  /** Define a new identifier definition within this environment. */
162
162
  define(definition) {
163
163
  const [name, ns] = identifier_1.Identifier.toArray(definition.name);
@@ -193,31 +193,14 @@ class Environment {
193
193
  if (definition.cds !== undefined) {
194
194
  definition = { ...definition, cds: definition.cds.slice() };
195
195
  }
196
- // When there are defined indices, merge the definitions
197
- if (definition.cds === undefined) {
198
- this.writableMemory.set(name, [definition]);
199
- }
200
- else {
201
- const existing = this.lookup(name);
202
- const inGraphDefinition = definition;
203
- if (existing !== undefined &&
204
- inGraphDefinition.cds === undefined) {
205
- this.writableMemory.set(name, [inGraphDefinition]);
206
- }
207
- else if (existing === undefined || definition.cds === undefined) {
208
- this.writableMemory.set(name, [definition]);
209
- }
210
- else {
211
- /* the array may be shared with clones, so replace instead of push */
212
- this.writableMemory.set(name, [...existing, definition]);
213
- }
214
- }
196
+ /* a maybe definition joins the existing ones; the array may be shared with clones, so replace instead of push */
197
+ const existing = definition.cds === undefined ? undefined : this.lookup(name);
198
+ this.writableMemory.set(name, existing === undefined ? [definition] : [...existing, definition]);
215
199
  }
216
200
  defineInNamespace(definition, ns) {
217
201
  if (this.n === ns) {
218
202
  return this.define(definition);
219
203
  }
220
- // navigate to parent until either before built-in or matching namespace
221
204
  const newEnvironment = this.clone(false);
222
205
  let current = newEnvironment;
223
206
  /* the match has to be re-checked after every step: a post-condition on `current.n` would end the loop on
@@ -230,7 +213,6 @@ class Environment {
230
213
  return newEnvironment;
231
214
  }
232
215
  else if (current.parent && !current.parent.builtInEnv) {
233
- // clone parent
234
216
  current.parent = current.parent.clone(false);
235
217
  current = current.parent;
236
218
  }
@@ -238,14 +220,13 @@ class Environment {
238
220
  break;
239
221
  }
240
222
  }
241
- // we did not find the namespace, so we inject a new environment here
242
223
  log_1.log.warn(`Defining ${identifier_1.Identifier.getName(definition.name)} in namespace ${ns}, which did not exist yet in the environment chain => create (r should fail or we miss attachment).`);
243
224
  const env = new Environment(current.parent);
244
225
  env.n = ns;
245
226
  current.parent = env.define(definition);
246
227
  return newEnvironment;
247
228
  }
248
- defineSuper(definition) {
229
+ defineSuper(definition, append = false) {
249
230
  const [name, ns] = identifier_1.Identifier.toArray(definition.name);
250
231
  /* isolate the cds from the originating reference, see {@link define} */
251
232
  if (definition.cds !== undefined) {
@@ -256,35 +237,32 @@ class Environment {
256
237
  newEnvironment.parent = newEnvironment.parent.defineInNamespace(definition, ns);
257
238
  return newEnvironment;
258
239
  }
240
+ /* `<<-` binds in the closest enclosing frame that holds the name, which for an emptied frame is what
241
+ * it stood in for when the closure was created (see {@link superMemory}) */
242
+ const holdsName = (env) => env.lookup(name) !== undefined || env.superMemory?.has(name) === true;
259
243
  let current = newEnvironment;
260
- let last = undefined;
261
- let found = false;
262
- do {
263
- /* `<<-` binds in the closest enclosing frame that holds the name, which for an emptied frame is what
264
- * it stood in for when the closure was created (see {@link superMemory}) */
265
- if (current.lookup(name) !== undefined || current.superMemory?.has(name)) {
266
- current.writableMemory.set(name, [definition]);
267
- found = true;
268
- break;
269
- }
270
- // `<<-` falls back to the global env, never an attached package below it
271
- if (current.globalEnv) {
272
- current.writableMemory.set(name, [definition]);
273
- found = true;
274
- break;
275
- }
276
- last = current;
244
+ // `<<-` falls back to the global env, never an attached package below it
245
+ while (!holdsName(current) && !current.globalEnv) {
246
+ const last = current;
277
247
  current.parent = current.parent.clone(false);
278
248
  current = current.parent;
279
- } while (!current.builtInEnv);
280
- if (!found) {
281
- (0, assert_1.guard)(last !== undefined, () => `Could not find global scope for ${name}`);
282
- last.writableMemory.set(name, [definition]);
249
+ if (current.builtInEnv) {
250
+ current = last;
251
+ break;
252
+ }
283
253
  }
254
+ current.writableMemory.set(name, append ? [...current.lookup(name) ?? [], definition] : [definition]);
284
255
  return newEnvironment;
285
256
  }
286
257
  /** Definitions within `other` replace those here by name; if all of `other`'s are maybe, they are appended instead (turning existing ones maybe too). Always recurses parents. */
287
258
  overwrite(other, applyCds) {
259
+ return this.merge(other, false, applyCds);
260
+ }
261
+ /** Adds all writes of `other` to this environment (`other`'s operations *might* happen). Always recurses parents. */
262
+ append(other) {
263
+ return this.merge(other, true);
264
+ }
265
+ merge(other, append, applyCds) {
288
266
  if (!other || this === other) {
289
267
  return this;
290
268
  }
@@ -294,79 +272,39 @@ class Environment {
294
272
  }
295
273
  /* nothing on the other side leaves these bindings as the result, so they are shared rather than merged */
296
274
  const keep = other.memory.size === 0;
297
- const frame = keep ? this.frame : this.mergedFrame();
298
- if (keep) {
299
- this.sharedMemory = true;
300
- }
275
+ const frame = keep ? this.frame : this.frame.forWrite();
276
+ /* the result may keep this frame as its base, so a later write here has to fork */
277
+ this.sharedMemory = true;
301
278
  for (const [key, values] of other.memory) {
302
- const hasMaybe = applyCds === undefined ? values.length === 0 || values.some(v => v.cds !== undefined) : true;
303
- if (hasMaybe) {
304
- const old = frame.get(key);
305
- if (!old && applyCds === undefined) {
306
- frame.set(key, values);
307
- continue;
308
- }
279
+ /* an overwrite by definite definitions replaces the old ones, so they are not even looked up */
280
+ const hasMaybe = values.length === 0 || values.some(v => v.cds !== undefined);
281
+ const joinsOld = append || applyCds !== undefined || hasMaybe;
282
+ const old = joinsOld ? frame.get(key) : undefined;
283
+ if (old === undefined && applyCds === undefined) {
284
+ frame.set(key, values);
285
+ }
286
+ else if (append) {
287
+ frame.set(key, (0, append_1.uniqueMergeValuesInDefinitions)(old ?? [], values));
288
+ }
289
+ else {
309
290
  // we need to make a copy to avoid side effects for old reference in other environments
310
291
  const updated = old?.slice() ?? [];
311
292
  for (const v of values) {
312
- const { nodeId, definedAt } = v;
313
- if (updated.some(o => o.nodeId === nodeId && o.definedAt === definedAt)) {
293
+ if (updated.some(o => o.nodeId === v.nodeId && o.definedAt === v.definedAt)) {
314
294
  continue;
315
295
  }
316
296
  if (applyCds === undefined) {
317
297
  updated.push(v);
318
298
  }
319
299
  else {
320
- updated.push({
321
- ...v,
322
- cds: v.cds ? applyCds.concat(v.cds) : applyCds.slice()
323
- });
300
+ updated.push({ ...v, cds: v.cds ? applyCds.concat(v.cds) : applyCds.slice() });
324
301
  }
325
302
  }
326
303
  frame.set(key, updated);
327
304
  }
328
- else {
329
- frame.set(key, values);
330
- }
331
- }
332
- const out = new Environment(this.parent.overwrite(other.parent, applyCds));
333
- out.c = this.c;
334
- out.n = this.n;
335
- out.t = this.t;
336
- out.globalEnv = this.globalEnv;
337
- out.superMemory = this.superMemory ?? other.superMemory;
338
- out.adoptFrame(frame, keep);
339
- return out;
340
- }
341
- /** Adds all writes of `other` to this environment (`other`'s operations *might* happen). Always recurses parents. */
342
- append(other) {
343
- if (!other || this === other) {
344
- return this;
345
- }
346
- const shortcut = this.mergeShortcut(other);
347
- if (shortcut !== undefined) {
348
- return shortcut;
349
- }
350
- const keep = other.memory.size === 0;
351
- const frame = keep ? this.frame : this.mergedFrame();
352
- if (keep) {
353
- this.sharedMemory = true;
354
- }
355
- for (const [key, value] of other.memory) {
356
- const old = frame.get(key);
357
- if (old) {
358
- frame.set(key, (0, append_1.uniqueMergeValuesInDefinitions)(old, value));
359
- }
360
- else {
361
- frame.set(key, value);
362
- }
363
305
  }
364
- const out = new Environment(this.parent.append(other.parent));
365
- out.c = this.c;
366
- out.n = this.n;
367
- out.t = this.t;
368
- out.globalEnv = this.globalEnv;
369
- out.superMemory = this.superMemory ?? other.superMemory;
306
+ const out = this.derive(append ? this.parent.append(other.parent) : this.parent.overwrite(other.parent, applyCds));
307
+ out.superMemory ??= other.superMemory;
370
308
  out.adoptFrame(frame, keep);
371
309
  return out;
372
310
  }
@@ -406,14 +344,10 @@ class Environment {
406
344
  * Keyed by type and then by name, rather than by a `t:n` string built for every layer of every merge.
407
345
  */
408
346
  const order = [];
409
- const merged = new Map();
347
+ const merged = new defaultmap_1.DefaultMap(() => new Map());
410
348
  for (const layers of thisLayers.length > otherLayers.length ? [thisLayers, otherLayers] : [otherLayers, thisLayers]) {
411
349
  for (const layer of layers) {
412
- let byName = merged.get(layer.t);
413
- if (byName === undefined) {
414
- byName = new Map();
415
- merged.set(layer.t, byName);
416
- }
350
+ const byName = merged.get(layer.t);
417
351
  const existing = byName.get(layer.n);
418
352
  if (existing === undefined) {
419
353
  const cloned = layer.clone(false);
@@ -178,9 +178,9 @@ export declare const Identifier: {
178
178
  * ```
179
179
  */
180
180
  export declare class IdentifierView {
181
- /** The underlying identifier; use it whenever you need the plain representation back. */
182
181
  readonly raw: Identifier;
183
- constructor(id: Identifier);
182
+ /** @param raw - the underlying identifier; use it whenever you need the plain representation back */
183
+ constructor(raw: Identifier);
184
184
  /** the name part, so the `fn` of a `pkg::fn` */
185
185
  get name(): BrandedIdentifier;
186
186
  /** the namespace part, `undefined` for a name written without one */
@@ -339,6 +339,7 @@ export declare const enum PkgName {
339
339
  Soda = "SoDA",
340
340
  Sourcetools = "sourcetools",
341
341
  Sqldf = "sqldf",
342
+ Stargazer = "stargazer",
342
343
  Stars = "stars",
343
344
  Stringmagic = "stringmagic",
344
345
  Stringr = "stringr",
@@ -347,6 +348,7 @@ export declare const enum PkgName {
347
348
  Sys = "sys",
348
349
  Tcltk = "tcltk",
349
350
  Terra = "terra",
351
+ Texreg = "texreg",
350
352
  Testthat = "testthat",
351
353
  Tibble = "tibble",
352
354
  TidyR = "tidyr",
@@ -477,6 +479,8 @@ export interface InGraphIdentifierDefinition extends IdentifierReference {
477
479
  * Use this to resolve variables assigned via `assign(name, val, envir=<this var>)`.
478
480
  */
479
481
  readonly envState?: REnvironmentInformation;
482
+ /** Names the environment object {@link envState} tracks, so that every variable aliasing it sees the same writes. */
483
+ readonly envId?: NodeId;
480
484
  /**
481
485
  * If this is a function that returns a tracked environment, stores the envState
482
486
  * that the function returns (best-effort: only set when statically detectable).
@@ -31,12 +31,7 @@ exports.Identifier = {
31
31
  if ((0, strings_1.startAndEndsWith)(name, '`')) {
32
32
  name = name.slice(1, -1);
33
33
  }
34
- if (namespace) {
35
- return [name, namespace, internal];
36
- }
37
- else {
38
- return name;
39
- }
34
+ return namespace ? [name, namespace, internal] : name;
40
35
  },
41
36
  /**
42
37
  * Fast-path factory: returns the tuple as-is with no allocation or runtime checks.
@@ -74,13 +69,7 @@ exports.Identifier = {
74
69
  * ```
75
70
  */
76
71
  fromAllIn(namespaces, names) {
77
- const ids = [];
78
- for (const namespace of namespaces) {
79
- for (const name of names) {
80
- ids.push([name, namespace]);
81
- }
82
- }
83
- return ids;
72
+ return namespaces.flatMap(namespace => names.map((name) => [name, namespace]));
84
73
  },
85
74
  /**
86
75
  * Verify whether an unknown element has a valid identifier shape!
@@ -89,15 +78,10 @@ exports.Identifier = {
89
78
  if (typeof id === 'string') {
90
79
  return true;
91
80
  }
92
- if (Array.isArray(id)) {
93
- if (id.length === 2) {
94
- return typeof id[0] === 'string' && typeof id[1] === 'string';
95
- }
96
- else if (id.length === 3) {
97
- return typeof id[0] === 'string' && typeof id[1] === 'string' && typeof id[2] === 'boolean';
98
- }
81
+ if (!Array.isArray(id) || typeof id[0] !== 'string' || typeof id[1] !== 'string') {
82
+ return false;
99
83
  }
100
- return false;
84
+ return id.length === 2 || (id.length === 3 && typeof id[2] === 'boolean');
101
85
  },
102
86
  /**
103
87
  * Parse an identifier from its string representation,
@@ -143,17 +127,9 @@ exports.Identifier = {
143
127
  return undefined;
144
128
  }
145
129
  else if (Array.isArray(id)) {
146
- if (id[1].includes('::')) {
147
- return `${JSON.stringify(id[1])}${id[2] ? ':::' : '::'}${id[0]}`;
148
- }
149
- return `${id[1]}${id[2] ? ':::' : '::'}${id[0]}`;
150
- }
151
- else {
152
- if (id.includes('::')) {
153
- return JSON.stringify(id);
154
- }
155
- return id;
130
+ return `${id[1].includes('::') ? JSON.stringify(id[1]) : id[1]}${id[2] ? ':::' : '::'}${id[0]}`;
156
131
  }
132
+ return id.includes('::') ? JSON.stringify(id) : id;
157
133
  }),
158
134
  /**
159
135
  * Check if two identifiers match.
@@ -166,22 +142,20 @@ exports.Identifier = {
166
142
  const idName = exports.Identifier.getName(id);
167
143
  const targetName = exports.Identifier.getName(target);
168
144
  if (idName !== targetName) {
169
- return s3 ? targetName.startsWith(idName + '.') : false;
145
+ return s3 && targetName.startsWith(idName + '.');
170
146
  }
171
147
  const idNs = exports.Identifier.getNamespace(id);
172
148
  if (idNs === undefined) {
173
149
  return true;
174
150
  }
175
- const targetNs = exports.Identifier.getNamespace(target);
176
- if (idNs !== targetNs) {
151
+ if (idNs !== exports.Identifier.getNamespace(target)) {
177
152
  return false;
178
153
  }
179
- const idInternal = exports.Identifier.accessesInternal(id);
180
- if (idInternal === true) {
154
+ if (exports.Identifier.accessesInternal(id) === true) {
181
155
  return true;
182
156
  }
183
157
  /* an omitted flag is the same as an explicit `false`, `pkg::fn` written either way is one identifier */
184
- return (idInternal ?? false) === (exports.Identifier.accessesInternal(target) ?? false);
158
+ return exports.Identifier.accessesInternal(target) !== true;
185
159
  },
186
160
  /** The text as a regex matches it literally: `[`, `$` and `.` name functions in R, they are not pattern syntax. */
187
161
  quote(text) {
@@ -212,34 +186,19 @@ exports.Identifier = {
212
186
  * Functor over the name of the identifier
213
187
  */
214
188
  mapName(id, fn) {
215
- if (Array.isArray(id)) {
216
- return [fn(id[0]), id[1], id[2]];
217
- }
218
- else {
219
- return fn(id);
220
- }
189
+ return Array.isArray(id) ? [fn(id[0]), id[1], id[2]] : fn(id);
221
190
  },
222
191
  /**
223
192
  * Functor over the namespace of the identifier
224
193
  */
225
194
  mapNamespace(id, fn) {
226
- if (Array.isArray(id)) {
227
- return [id[0], fn(id[1]), id[2]];
228
- }
229
- else {
230
- return id;
231
- }
195
+ return Array.isArray(id) ? [id[0], fn(id[1]), id[2]] : id;
232
196
  },
233
197
  /**
234
198
  * Convert the identifier to its array representation
235
199
  */
236
200
  toArray(id) {
237
- if (Array.isArray(id)) {
238
- return [id[0], id[1], id[2]];
239
- }
240
- else {
241
- return [id, undefined, undefined];
242
- }
201
+ return Array.isArray(id) ? [id[0], id[1], id[2]] : [id, undefined, undefined];
243
202
  },
244
203
  /**
245
204
  * The package-qualified identifier of a call, resolved in order of decreasing certainty:
@@ -272,20 +231,15 @@ exports.Identifier = {
272
231
  sawUserDefinition = true;
273
232
  }
274
233
  }
275
- if (name === undefined) {
276
- return undefined;
277
- }
278
- if (exports.Identifier.getNamespace(name) !== undefined) {
234
+ if (name === undefined || exports.Identifier.getNamespace(name) !== undefined) {
279
235
  return name;
280
236
  }
281
- if (qualifyBaseR && !sawUserDefinition) {
282
- const bare = exports.Identifier.getName(name);
283
- const owner = (0, r_base_packages_1.baseRExportOwner)(bare);
284
- if (owner !== undefined) {
285
- return exports.Identifier.make(bare, owner);
286
- }
237
+ if (!qualifyBaseR || sawUserDefinition) {
238
+ return undefined;
287
239
  }
288
- return undefined;
240
+ const bare = exports.Identifier.getName(name);
241
+ const owner = (0, r_base_packages_1.baseRExportOwner)(bare);
242
+ return owner === undefined ? undefined : exports.Identifier.make(bare, owner);
289
243
  },
290
244
  /**
291
245
  * Wraps the identifier in an {@link IdentifierView|view} offering property access (`id.name`, `id.namespace`)
@@ -309,10 +263,10 @@ exports.Identifier = {
309
263
  * ```
310
264
  */
311
265
  class IdentifierView {
312
- /** The underlying identifier; use it whenever you need the plain representation back. */
313
266
  raw;
314
- constructor(id) {
315
- this.raw = id;
267
+ /** @param raw - the underlying identifier; use it whenever you need the plain representation back */
268
+ constructor(raw) {
269
+ this.raw = raw;
316
270
  }
317
271
  /** the name part, so the `fn` of a `pkg::fn` */
318
272
  get name() {
@@ -1,9 +1,18 @@
1
1
  import type { IdentifierDefinition, IdentifierReference } from './identifier';
2
+ import { Identifier, ReferenceType } from './identifier';
2
3
  import type { DataflowGraph } from '../graph/graph';
4
+ import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
5
  import type { ControlDependency } from '../info';
4
6
  import type { REnvironmentInformation } from './environment';
5
7
  /** copy of the definition with the given cds attached, marking it as maybe */
6
8
  export declare function withAppliedCds(definition: IdentifierDefinition, defaultCd: readonly ControlDependency[] | undefined): IdentifierDefinition;
9
+ /**
10
+ * Attaches the given control dependencies to the definition made by `nodeId` within the environment chain.
11
+ * Definitions of the same name made elsewhere survive whenever the conditional definition does not happen.
12
+ * Copy-on-write: definitions are replaced, never mutated in place, so previously cloned
13
+ * environments (e.g., snapshots stored in the dataflow graph) keep their state.
14
+ */
15
+ export declare function applyCdsToDefinitions(environments: REnvironmentInformation, name: Identifier, type: ReferenceType, definitions: readonly IdentifierDefinition[], nodeId: NodeId, defaultCd: readonly ControlDependency[] | undefined): void;
7
16
  /**
8
17
  * Marks the reference as maybe (i.e., as controlled by a set of {@link IdentifierReference#cds|control dependencies}).
9
18
  * With `includeDefs`, the cds are also attached (copy-on-write) to the definition the reference