@eagleoutice/flowr 2.15.9 → 2.15.10

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 (112) hide show
  1. package/README.md +34 -25
  2. package/abstract-interpretation/absint-inference.d.ts +2 -2
  3. package/abstract-interpretation/absint-inference.js +32 -79
  4. package/benchmark/slicer.d.ts +0 -1
  5. package/benchmark/slicer.js +1 -2
  6. package/cli/repl/commands/repl-signature.js +12 -3
  7. package/config.d.ts +5 -1
  8. package/control-flow/cfg-properties.js +0 -22
  9. package/control-flow/happens-before.d.ts +2 -2
  10. package/control-flow/happens-before.js +29 -19
  11. package/dataflow/environments/apply-kill.js +6 -2
  12. package/dataflow/environments/built-in-config.d.ts +2 -0
  13. package/dataflow/environments/built-in-props.d.ts +7 -1
  14. package/dataflow/environments/built-in-props.js +8 -1
  15. package/dataflow/environments/built-in.d.ts +7 -2
  16. package/dataflow/environments/built-in.js +11 -5
  17. package/dataflow/environments/default-builtin-config.d.ts +386 -8
  18. package/dataflow/environments/default-builtin-config.js +84 -22
  19. package/dataflow/environments/define.d.ts +3 -2
  20. package/dataflow/environments/define.js +4 -3
  21. package/dataflow/environments/deprecation-info.d.ts +45 -0
  22. package/dataflow/environments/deprecation-info.js +13 -0
  23. package/dataflow/environments/environment.d.ts +1 -1
  24. package/dataflow/environments/environment.js +5 -4
  25. package/dataflow/environments/identifier.d.ts +2 -0
  26. package/dataflow/extractor.js +6 -1
  27. package/dataflow/fn/class-declaration.d.ts +0 -11
  28. package/dataflow/fn/class-declaration.js +0 -20
  29. package/dataflow/fn/higher-order-function.d.ts +9 -1
  30. package/dataflow/fn/higher-order-function.js +14 -7
  31. package/dataflow/fn/strict-function.js +8 -3
  32. package/dataflow/graph/graph.d.ts +7 -0
  33. package/dataflow/graph/graph.js +17 -0
  34. package/dataflow/graph/vertex.d.ts +1 -1
  35. package/dataflow/internal/linker.d.ts +3 -0
  36. package/dataflow/internal/linker.js +67 -6
  37. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +113 -0
  38. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +506 -0
  39. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +9 -0
  40. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -0
  41. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +22 -19
  42. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +5 -1
  43. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +21 -14
  44. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
  45. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +22 -2
  46. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -0
  47. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +4 -3
  48. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +19 -3
  49. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +7 -3
  50. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -0
  51. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +4 -2
  52. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +3 -5
  53. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -1
  54. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +8 -0
  55. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -0
  56. package/dataflow/internal/process/functions/call/common.d.ts +3 -1
  57. package/dataflow/internal/process/functions/call/common.js +22 -4
  58. package/dataflow/internal/process/functions/call/deferred.d.ts +6 -0
  59. package/dataflow/internal/process/functions/call/deferred.js +33 -12
  60. package/dataflow/internal/process/functions/call/known-call-handling.js +1 -1
  61. package/dataflow/internal/process/functions/call/named-call-handling.js +15 -0
  62. package/dataflow/internal/process/functions/call/quoted.js +137 -24
  63. package/dataflow/internal/process/process-symbol.js +6 -2
  64. package/documentation/data/faq/faqs.js +3 -3
  65. package/documentation/data/interface/doc-writing-code.js +1 -2
  66. package/documentation/data/server/doc-data-server-messages.js +7 -7
  67. package/documentation/doc-capabilities.js +80 -34
  68. package/documentation/doc-util/doc-query.d.ts +0 -3
  69. package/documentation/doc-util/doc-query.js +4 -3
  70. package/documentation/wiki-analyzer.js +1 -1
  71. package/documentation/wiki-cfg.js +5 -6
  72. package/documentation/wiki-core.js +8 -8
  73. package/documentation/wiki-dataflow-graph.js +10 -11
  74. package/documentation/wiki-interface.js +2 -2
  75. package/documentation/wiki-linting-and-testing.js +3 -3
  76. package/documentation/wiki-overview.js +6 -6
  77. package/documentation/wiki-query.js +9 -101
  78. package/documentation/wiki-signature-database.js +1 -1
  79. package/linter/linter-rules.d.ts +1 -1
  80. package/linter/rules/deprecated-functions.d.ts +1 -45
  81. package/linter/rules/deprecated-functions.js +24 -33
  82. package/package.json +1 -1
  83. package/project/flowr-analyzer.d.ts +2 -0
  84. package/project/flowr-analyzer.js +24 -1
  85. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -2
  86. package/project/plugins/file-plugins/files/flowr-rda-file.js +10 -55
  87. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +2 -1
  88. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +6 -4
  89. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
  90. package/project/sigdb/build.js +4 -0
  91. package/project/sigdb/manifest.d.ts +2 -0
  92. package/project/sigdb/manifest.js +10 -1
  93. package/project/sigdb/reader.js +23 -61
  94. package/project/sigdb/sigdb-download.d.ts +29 -6
  95. package/project/sigdb/sigdb-download.js +212 -64
  96. package/queries/catalog/call-context-query/cascade-action.d.ts +3 -1
  97. package/queries/catalog/call-context-query/cascade-action.js +2 -0
  98. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -0
  99. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -1
  100. package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
  101. package/queries/catalog/origin-query/origin-query-executor.js +2 -2
  102. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
  103. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  104. package/queries/query.d.ts +1 -1
  105. package/r-bridge/data/data.d.ts +21 -14
  106. package/r-bridge/data/data.js +28 -20
  107. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
  108. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +11 -2
  109. package/util/files.d.ts +2 -0
  110. package/util/files.js +3 -1
  111. package/util/mermaid/mermaid.js +6 -2
  112. package/util/version.js +2 -2
@@ -0,0 +1,506 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrintingOptions = exports.AmbientStateName = void 0;
4
+ exports.hidesBody = hidesBody;
5
+ exports.readsAllAmbientState = readsAllAmbientState;
6
+ exports.readsOfOptionsVariable = readsOfOptionsVariable;
7
+ exports.applyAmbientStateAccess = applyAmbientStateAccess;
8
+ exports.applyAmbientStateOfCallee = applyAmbientStateOfCallee;
9
+ exports.linkAmbientStateWithinLoop = linkAmbientStateWithinLoop;
10
+ exports.processAmbientScope = processAmbientScope;
11
+ exports.evaluatesCapturedCode = evaluatesCapturedCode;
12
+ exports.readsOfAutoPrint = readsOfAutoPrint;
13
+ exports.applyAmbientStateOfCalledBuiltIns = applyAmbientStateOfCalledBuiltIns;
14
+ const info_1 = require("../../../../../info");
15
+ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
16
+ const vertex_1 = require("../../../../../graph/vertex");
17
+ const built_in_props_1 = require("../../../../../environments/built-in-props");
18
+ const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
19
+ const r_expression_list_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
20
+ const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
21
+ const identifier_1 = require("../../../../../environments/identifier");
22
+ const define_1 = require("../../../../../environments/define");
23
+ const model_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/model");
24
+ const match_args_1 = require("../../../../../graph/match-args");
25
+ const known_call_handling_1 = require("../known-call-handling");
26
+ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
27
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
28
+ const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
29
+ const edge_1 = require("../../../../../graph/edge");
30
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
31
+ const r_access_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
32
+ const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
33
+ /**
34
+ * Graphics parameters and options, tracked as global pseudo variables (`#...`) so readers link to the calls that set them.
35
+ * Accumulating states only grow: `par(mar = ...)` keeps an earlier `par(mfrow = ...)`.
36
+ */
37
+ exports.AmbientStateName = {
38
+ /** the graphics state (`par`, `layout`, ...) of the active device, which a new device starts afresh */
39
+ graphics: '#graphics',
40
+ /** the graphics states of the other open devices, the active one returns to one of them once it closes */
41
+ otherDevices: '#graphics:other',
42
+ /** the call that opened the active device, and those of the other open devices */
43
+ device: '#device',
44
+ otherDevicesOpenedBy: '#device:other',
45
+ /** the color palette, which, other than the graphics parameters, all devices share */
46
+ palette: '#palette',
47
+ /** every option write, for readers that may read any option (`getOption(k)` with an unknown `k`, library functions) */
48
+ allOptions: '#options',
49
+ /** written by an `options(...)` call whose keys we cannot name, like the common `options(op)` restore */
50
+ unknownOption: '#option:*',
51
+ /** the pseudo variable holding the option `key`; setting the option replaces it */
52
+ option(key) {
53
+ return `#option:${key}`;
54
+ },
55
+ /** whether `name` is one of these pseudo variables */
56
+ is(name) {
57
+ return typeof name === 'string' && name.startsWith('#');
58
+ }
59
+ };
60
+ const Accumulating = new Set([exports.AmbientStateName.graphics, exports.AmbientStateName.otherDevices, exports.AmbientStateName.device, exports.AmbientStateName.otherDevicesOpenedBy, exports.AmbientStateName.palette, exports.AmbientStateName.allOptions, exports.AmbientStateName.unknownOption]);
61
+ /** Whether calling `definition` runs a body flowR cannot see: a library function's, or whatever a parameter is bound to. */
62
+ function hidesBody(definition) {
63
+ return node_id_1.NodeId.isBuiltIn(definition.nodeId) || (0, identifier_1.isReferenceType)(definition.type, identifier_1.ReferenceType.Parameter | identifier_1.ReferenceType.Argument);
64
+ }
65
+ /** A call into code flowR cannot see may read any option and draw on the device. */
66
+ function readsAllAmbientState(res, rootId, data, graphics) {
67
+ return withAccess(res, rootId, data, graphics ? [exports.AmbientStateName.allOptions, exports.AmbientStateName.graphics, exports.AmbientStateName.palette] : [exports.AmbientStateName.allOptions], []);
68
+ }
69
+ /** Adds the reads and writes of the ambient state to what a call does, see {@link AmbientStateName}. */
70
+ function withAccess(res, rootId, data, reads, writes) {
71
+ if (reads.length === 0 && writes.length === 0) {
72
+ return res;
73
+ }
74
+ const cds = data.cds ? [...data.cds] : undefined;
75
+ const readRefs = reads.map(name => ({ nodeId: rootId, name, type: identifier_1.ReferenceType.Variable, cds }));
76
+ /* the writes stay out of `out`: an assignment reads whatever else its source writes (`x <- y <- 3`) */
77
+ return {
78
+ ...res,
79
+ unknownReferences: readRefs.length > 0 ? [...res.unknownReferences, ...readRefs] : res.unknownReferences,
80
+ environment: defineAmbient(res.environment, rootId, cds, writes)
81
+ };
82
+ }
83
+ /** Applies the writes of the call `rootId` to the environment, see {@link withAccess}. */
84
+ function defineAmbient(environment, rootId, cds, writes) {
85
+ for (const write of writes) {
86
+ const name = typeof write === 'string' ? write : write.name;
87
+ const mode = typeof write === 'string' ? undefined : write.mode;
88
+ const accumulates = Accumulating.has(name);
89
+ /* an accumulating state only ever grows, its definitions are maybe so merging environments keeps them all; a reset is definite */
90
+ const def = { nodeId: rootId, name, type: identifier_1.ReferenceType.Variable, definedAt: rootId, cds: accumulates && mode !== 'reset' ? cds ?? [] : cds };
91
+ /* the state is global, wherever the call happens, unless the call scopes it to the current frame */
92
+ environment = (0, define_1.define)(def, mode !== 'local', environment, accumulates && mode === undefined);
93
+ }
94
+ return environment;
95
+ }
96
+ /** Binds `name` (globally) to the given definitions, in addition to what it holds with `keep`, so `#graphics` can become what another state holds. */
97
+ function setAmbient(environment, name, definitions, keep = false) {
98
+ if (definitions.length === 0 && !keep) {
99
+ return { ...environment, current: environment.current.removeAll([{ name }]) };
100
+ }
101
+ for (const [i, def] of definitions.entries()) {
102
+ environment = (0, define_1.define)({ ...def, name }, true, environment, keep || i > 0);
103
+ }
104
+ return environment;
105
+ }
106
+ /** `.Options$digits` (or `.Options[["digits"]]`) reads that option, anything else done with `.Options` reads all of them. */
107
+ function readsOfOptionsVariable(symbol, data) {
108
+ const parent = symbol.info.parent === undefined ? undefined : data.completeAst.idMap.get(symbol.info.parent);
109
+ let key;
110
+ if (r_access_1.RAccess.is(parent) && parent.accessed.info.id === symbol.info.id && (parent.operator === '$' || parent.operator === '[[')) {
111
+ const first = parent.access[0];
112
+ const value = first === r_function_call_1.EmptyArgument ? undefined : first.value;
113
+ key = r_string_1.RString.is(value) ? value.content.str : parent.operator === '$' && r_symbol_1.RSymbol.is(value) ? identifier_1.Identifier.getName(value.content) : undefined;
114
+ }
115
+ const names = key === undefined ? [exports.AmbientStateName.allOptions] : [exports.AmbientStateName.option(key), exports.AmbientStateName.unknownOption];
116
+ return names.map(name => ({ nodeId: symbol.info.id, name, type: identifier_1.ReferenceType.Variable, cds: data.cds }));
117
+ }
118
+ /** Options affecting calls we cannot name (`scipen` changes every number-to-string conversion), so setting one stays an unknown side effect. */
119
+ const GlobalEffectOptions = new Set([
120
+ 'scipen', 'OutDec', 'warn', 'error', 'expressions', 'encoding', 'stringsAsFactors', 'timeout', 'HTTPUserAgent',
121
+ 'download.file.method', 'download.file.extra', 'internet.info', 'warnPartialMatchArgs', 'warnPartialMatchAttr',
122
+ 'warnPartialMatchDollar', 'keep.source', 'keep.parse.data', 'check.bounds', 'CBoundsCheck', 'catch.script.errors',
123
+ 'defaultPackages', 'topLevelEnvironment', 'java.parameters'
124
+ ]);
125
+ /** Options that affect how values are printed and formatted (read by `print`, `format`, and `cat`). */
126
+ exports.PrintingOptions = ['digits', 'width', 'max.print', 'digits.secs', 'useFancyQuotes'];
127
+ /** Wires the {@link AmbientStateAccess} of a call into its dataflow information: reads become unknown references, writes define the pseudo variable globally. */
128
+ function applyAmbientStateAccess(res, args, rootId, data, access) {
129
+ if (args === UnknownArguments) {
130
+ return applyWithUnknownArguments(res, rootId, data, access);
131
+ }
132
+ const reads = [];
133
+ const writes = [];
134
+ switch (access.type) {
135
+ case "read-graphics" /* AmbientStateAccessType.ReadGraphics */:
136
+ reads.push(exports.AmbientStateName.graphics, exports.AmbientStateName.palette);
137
+ break;
138
+ case "set-graphics" /* AmbientStateAccessType.SetGraphics */:
139
+ /* the call returns the previous state */
140
+ reads.push(exports.AmbientStateName.graphics);
141
+ if (args.length === 0 || (access.queryOnUnnamedStrings && isQuery(args))) {
142
+ if (access.queryLinksTo) {
143
+ (0, unknown_side_effect_1.handleUnknownSideEffect)(res.graph, res.environment, rootId, access.queryLinksTo);
144
+ }
145
+ }
146
+ else {
147
+ writes.push(exports.AmbientStateName.graphics);
148
+ }
149
+ break;
150
+ case "set-palette" /* AmbientStateAccessType.SetPalette */:
151
+ reads.push(exports.AmbientStateName.palette);
152
+ if (args.length > 0) {
153
+ writes.push(exports.AmbientStateName.palette);
154
+ }
155
+ break;
156
+ case "read-options" /* AmbientStateAccessType.ReadOptions */: {
157
+ const dispatched = access.dispatchOn === undefined ? undefined : args[access.dispatchOn];
158
+ reads.push(...printingReads(dispatched === undefined || dispatched === r_function_call_1.EmptyArgument ? undefined : dispatched.value, access.dispatchOn !== undefined, access.keys, data));
159
+ break;
160
+ }
161
+ case "get-option" /* AmbientStateAccessType.GetOption */: {
162
+ const first = args.find(a => a !== r_function_call_1.EmptyArgument && (a.name === undefined || identifier_1.Identifier.getName(a.name.content) === 'x'));
163
+ const keys = first === undefined || first === r_function_call_1.EmptyArgument ? undefined : stringsOf(first.value, data);
164
+ if (keys === undefined) {
165
+ reads.push(exports.AmbientStateName.allOptions);
166
+ }
167
+ else {
168
+ reads.push(...keys.map(exports.AmbientStateName.option), exports.AmbientStateName.unknownOption);
169
+ }
170
+ break;
171
+ }
172
+ case "set-options" /* AmbientStateAccessType.SetOptions */:
173
+ return setOptions(res, args, rootId, data);
174
+ case "open-device" /* AmbientStateAccessType.OpenDevice */:
175
+ return deviceAccess(res, rootId, data, 'open');
176
+ case "close-device" /* AmbientStateAccessType.CloseDevice */:
177
+ /* `dev.off(which)` may close a device other than the active one, which keeps its state then */
178
+ return deviceAccess(res, rootId, data, access.all ? 'close-all' : args.length > 0 ? 'switch' : 'close');
179
+ case "switch-device" /* AmbientStateAccessType.SwitchDevice */:
180
+ return deviceAccess(res, rootId, data, 'switch');
181
+ case "evaluate-quoted" /* AmbientStateAccessType.EvaluateQuoted */:
182
+ return evaluatesCapturedCode(res, rootId, data);
183
+ }
184
+ return withAccess(res, rootId, data, reads, writes);
185
+ }
186
+ /** What printing `value` reads: the printing `keys` for a plain value, all options for an unknown one (a tibble reads the pillar options). */
187
+ function printingReads(value, dispatches, keys, data) {
188
+ if (dispatches && (value === undefined || !isPlainValue(value, data))) {
189
+ return [exports.AmbientStateName.allOptions];
190
+ }
191
+ return [...keys.map(exports.AmbientStateName.option), exports.AmbientStateName.unknownOption];
192
+ }
193
+ const PlainValueTypes = new Set(['number', 'string', 'logical', 'interval']);
194
+ /** whether the value at `node` is one of the base types whose printing no package method changes */
195
+ function isPlainValue(node, data) {
196
+ if (model_1.RConstant.is(node)) {
197
+ return true;
198
+ }
199
+ const values = node_value_1.NodeValue.setOf(node.info.id, data)?.elements;
200
+ return values !== undefined && values.length > 0 && values.every(v => typeof v.type === 'string' && PlainValueTypes.has(v.type));
201
+ }
202
+ /** The arguments of a call made on our behalf, like `do.call(par, args)`, which we cannot see. */
203
+ const UnknownArguments = Symbol('unknown-arguments');
204
+ function applyWithUnknownArguments(res, rootId, data, access) {
205
+ switch (access.type) {
206
+ case "set-options" /* AmbientStateAccessType.SetOptions */:
207
+ /* like `options(op)`: it may set anything */
208
+ res.graph.markIdForUnknownSideEffects(rootId);
209
+ return withAccess(res, rootId, data, [exports.AmbientStateName.allOptions], [exports.AmbientStateName.unknownOption, exports.AmbientStateName.allOptions]);
210
+ case "get-option" /* AmbientStateAccessType.GetOption */:
211
+ return withAccess(res, rootId, data, [exports.AmbientStateName.allOptions], []);
212
+ case "set-graphics" /* AmbientStateAccessType.SetGraphics */:
213
+ return withAccess(res, rootId, data, [exports.AmbientStateName.graphics], [exports.AmbientStateName.graphics]);
214
+ case "set-palette" /* AmbientStateAccessType.SetPalette */:
215
+ return withAccess(res, rootId, data, [exports.AmbientStateName.palette], [exports.AmbientStateName.palette]);
216
+ case "read-options" /* AmbientStateAccessType.ReadOptions */:
217
+ return withAccess(res, rootId, data, access.dispatchOn === undefined ? printingReads(undefined, false, access.keys, data) : [exports.AmbientStateName.allOptions], []);
218
+ case "close-device" /* AmbientStateAccessType.CloseDevice */:
219
+ return deviceAccess(res, rootId, data, access.all ? 'close-all' : 'switch');
220
+ default:
221
+ return applyAmbientStateAccess(res, [], rootId, data, access);
222
+ }
223
+ }
224
+ /** Graphics parameters are per device; within a function the open devices are unknown, so a device call only adds. */
225
+ function deviceAccess(res, rootId, data, kind) {
226
+ /* only a switch reads the state; what a closed device holds reaches its file through the plots on it (see LinkToLastPlot) */
227
+ const reads = kind === 'switch' ? [exports.AmbientStateName.graphics] : [];
228
+ if (data.environment.level > 0) {
229
+ return withAccess(res, rootId, data, reads, [exports.AmbientStateName.graphics]);
230
+ }
231
+ const cds = data.cds ? [...data.cds] : undefined;
232
+ const lookup = (name) => resolve_helper_1.Resolve.byName(name, res.environment) ?? [];
233
+ const current = lookup(exports.AmbientStateName.graphics);
234
+ const others = lookup(exports.AmbientStateName.otherDevices);
235
+ const opener = lookup(exports.AmbientStateName.device);
236
+ const otherOpeners = lookup(exports.AmbientStateName.otherDevicesOpenedBy);
237
+ let environment = res.environment;
238
+ const reset = (name) => defineAmbient(environment, rootId, cds, [{ name, mode: 'reset' }]);
239
+ /* a later plot depends on neither the close nor the closed device's state; a device only depends on its close so it does not catch later plots */
240
+ const closes = (openers) => {
241
+ for (const open of openers) {
242
+ res.graph.addEdge(open.nodeId, rootId, edge_1.EdgeType.Reads);
243
+ }
244
+ };
245
+ switch (kind) {
246
+ case 'open':
247
+ environment = setAmbient(environment, exports.AmbientStateName.otherDevices, [...others, ...current]);
248
+ environment = setAmbient(environment, exports.AmbientStateName.otherDevicesOpenedBy, [...otherOpeners, ...opener]);
249
+ environment = reset(exports.AmbientStateName.graphics);
250
+ environment = reset(exports.AmbientStateName.device);
251
+ break;
252
+ case 'close':
253
+ closes(opener);
254
+ environment = setAmbient(environment, exports.AmbientStateName.graphics, others);
255
+ environment = setAmbient(environment, exports.AmbientStateName.device, otherOpeners);
256
+ break;
257
+ case 'close-all':
258
+ closes([...opener, ...otherOpeners]);
259
+ for (const name of [exports.AmbientStateName.graphics, exports.AmbientStateName.otherDevices, exports.AmbientStateName.device, exports.AmbientStateName.otherDevicesOpenedBy]) {
260
+ environment = setAmbient(environment, name, []);
261
+ }
262
+ break;
263
+ case 'switch':
264
+ environment = defineAmbient(environment, rootId, cds, [exports.AmbientStateName.graphics]);
265
+ environment = setAmbient(environment, exports.AmbientStateName.graphics, others, true);
266
+ environment = setAmbient(environment, exports.AmbientStateName.otherDevices, current, true);
267
+ environment = setAmbient(environment, exports.AmbientStateName.device, otherOpeners, true);
268
+ environment = setAmbient(environment, exports.AmbientStateName.otherDevicesOpenedBy, opener, true);
269
+ break;
270
+ }
271
+ return withAccess({ ...res, environment }, rootId, data, reads, []);
272
+ }
273
+ /** 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. */
274
+ function applyAmbientStateOfCallee(res, callId, fn, data) {
275
+ const targets = resolve_helper_1.Resolve.byNameAndType(fn, data.environment, identifier_1.ReferenceType.Function) ?? [];
276
+ res = applyAmbientStateOfTargets(res, targets, UnknownArguments, callId, data);
277
+ const unknown = (targets.length === 0 && data.environment.level === 0) || targets.some(t => t.type !== identifier_1.ReferenceType.BuiltInFunction && hidesBody(t));
278
+ return unknown ? readsAllAmbientState(res, callId, data, true) : res;
279
+ }
280
+ /** applies what the built-ins among `targets` state about the ambient state */
281
+ function applyAmbientStateOfTargets(res, targets, args, callId, data) {
282
+ for (const target of targets) {
283
+ const access = target.type === identifier_1.ReferenceType.BuiltInFunction ? target.config?.ambient : undefined;
284
+ if (access !== undefined) {
285
+ res = applyAmbientStateAccess(res, args, callId, data, access);
286
+ }
287
+ }
288
+ return res;
289
+ }
290
+ function setOptions(res, args, rootId, data) {
291
+ const queried = [];
292
+ const written = [];
293
+ let global = false;
294
+ let unknownKeys = false;
295
+ for (const arg of args) {
296
+ if (arg === r_function_call_1.EmptyArgument) {
297
+ continue;
298
+ }
299
+ if (arg.name !== undefined) {
300
+ const key = identifier_1.Identifier.getName(arg.name.content);
301
+ written.push(exports.AmbientStateName.option(key));
302
+ global ||= GlobalEffectOptions.has(key);
303
+ }
304
+ else if (r_string_1.RString.is(arg.value)) {
305
+ queried.push(arg.value.content.str);
306
+ }
307
+ else {
308
+ /* a list of options we cannot see into, usually restoring what an earlier call returned */
309
+ unknownKeys = true;
310
+ }
311
+ }
312
+ if (global || unknownKeys) {
313
+ /* in every slice, but other than an unknown side effect, setting options leaves the variables alone */
314
+ res.graph.markIdForUnknownSideEffects(rootId);
315
+ }
316
+ /* the call returns the previous values of what it sets, which only matters if that value is used */
317
+ const previous = resultIsUsed(rootId, data) ? written : [];
318
+ const reads = [...queried.map(exports.AmbientStateName.option), ...previous];
319
+ if (args.length === 0 || unknownKeys) {
320
+ reads.push(exports.AmbientStateName.allOptions);
321
+ }
322
+ if (reads.length > 0) {
323
+ reads.push(exports.AmbientStateName.unknownOption);
324
+ }
325
+ const writes = [...written];
326
+ if (unknownKeys) {
327
+ writes.push(exports.AmbientStateName.unknownOption);
328
+ }
329
+ if (writes.length > 0) {
330
+ writes.push(exports.AmbientStateName.allOptions);
331
+ }
332
+ return withAccess(res, rootId, data, reads, writes);
333
+ }
334
+ /** `par()`, `par("mar", "usr")`, and `par(no.readonly = TRUE)` only query the graphics state */
335
+ function isQuery(args) {
336
+ return args.every(a => a === r_function_call_1.EmptyArgument
337
+ || (a.name === undefined ? r_string_1.RString.is(a.value) : identifier_1.Identifier.getName(a.name.content) === 'no.readonly'));
338
+ }
339
+ function stringsOf(value, data) {
340
+ if (value === undefined) {
341
+ return undefined;
342
+ }
343
+ else if (r_string_1.RString.is(value)) {
344
+ return [value.content.str];
345
+ }
346
+ const strings = node_value_1.NodeValue.stringsOf(value.info.id, data);
347
+ return strings === undefined || strings.length === 0 ? undefined : strings;
348
+ }
349
+ /** Whether the call's value may be used: anything but a non-final statement or the script's last statement (the last of a block is its value). */
350
+ function resultIsUsed(rootId, data) {
351
+ const parentId = data.completeAst.idMap.get(rootId)?.info.parent;
352
+ const parent = parentId === undefined ? undefined : data.completeAst.idMap.get(parentId);
353
+ if (parent === undefined || !r_expression_list_1.RExpressionList.is(parent)) {
354
+ return parent !== undefined;
355
+ }
356
+ const isLast = parent.children.at(-1)?.info.id === rootId;
357
+ return isLast && !data.completeAst.ast.files.some(f => f.root.info.id === parent.info.id);
358
+ }
359
+ /** Links state reads in a loop body to the body's own writes of a later iteration; the loops' circular linking only sees uses. */
360
+ function linkAmbientStateWithinLoop(graph, reads, body) {
361
+ for (const r of reads) {
362
+ if (!exports.AmbientStateName.is(r.name)) {
363
+ continue;
364
+ }
365
+ for (const def of resolve_helper_1.Resolve.byName(r.name, body.environment) ?? []) {
366
+ if (body.graph.hasVertex(def.nodeId)) {
367
+ graph.addEdge(r.nodeId, def.nodeId, edge_1.EdgeType.Reads);
368
+ }
369
+ }
370
+ }
371
+ }
372
+ /** The processor for an {@link AmbientScope}. */
373
+ function processAmbientScope(name, args, rootId, data, scope) {
374
+ const bound = match_args_1.MatchArgs.toNames(args, scope.params);
375
+ const code = scope.code === undefined ? undefined : bound.get(scope.code);
376
+ const codeIndex = code === undefined ? -1 : args.findIndex(a => a !== r_function_call_1.EmptyArgument && a.info.id === code.info.id);
377
+ const local = code === undefined && data.environment.level > 0;
378
+ const { writes, unknown } = scopedWrites(scope, args, bound, local);
379
+ const cds = data.cds ? [...data.cds] : undefined;
380
+ const apply = (environment) => scope.state === 'device' ? deviceAccess({ ...info_1.DataflowInformation.initialize(rootId, data), environment }, rootId, data, local ? 'switch' : 'open').environment
381
+ : defineAmbient(environment, rootId, cds, writes);
382
+ const { information } = (0, known_call_handling_1.processKnownFunctionCall)({
383
+ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Default,
384
+ patchData: (d, i) => i === codeIndex ? { ...d, environment: apply(d.environment) } : d
385
+ });
386
+ if (unknown) {
387
+ information.graph.markIdForUnknownSideEffects(rootId);
388
+ }
389
+ if (code === undefined) {
390
+ return { ...information, environment: apply(information.environment) };
391
+ }
392
+ /* afterward, what the scope changed is back to what it was before */
393
+ let environment = information.environment;
394
+ const restored = scope.state === 'device' ? [exports.AmbientStateName.graphics, exports.AmbientStateName.otherDevices, exports.AmbientStateName.device, exports.AmbientStateName.otherDevicesOpenedBy]
395
+ : writes.map(w => typeof w === 'string' ? w : w.name).filter(n => n.startsWith('#option:') && n !== exports.AmbientStateName.unknownOption);
396
+ for (const state of restored) {
397
+ const before = resolve_helper_1.Resolve.byName(state, data.environment);
398
+ /* an option nothing set before keeps the scope's definition, we cannot tell R's default apart */
399
+ if ((before !== undefined && before.length > 0) || (scope.state === 'device' && data.environment.level === 0)) {
400
+ environment = setAmbient(environment, state, before ?? []);
401
+ }
402
+ }
403
+ if (scope.state === 'graphics') {
404
+ /* `with_par` restores the parameters it set, what its code set with `par` stays */
405
+ const kept = (resolve_helper_1.Resolve.byName(exports.AmbientStateName.graphics, environment) ?? []).filter(d => d.nodeId !== rootId);
406
+ environment = setAmbient(environment, exports.AmbientStateName.graphics, kept);
407
+ }
408
+ return { ...information, environment };
409
+ }
410
+ /** what a scope call writes: the options it names, or the graphics state */
411
+ function scopedWrites(scope, args, bound, local) {
412
+ if (scope.state !== 'options') {
413
+ return { writes: [exports.AmbientStateName.graphics], unknown: false };
414
+ }
415
+ const keys = [];
416
+ let unknown = false;
417
+ /* what falls to `...` names options, it is no formal of its own */
418
+ const formals = new Set([...bound.entries()].filter(([param]) => param !== '...').map(([, arg]) => arg.info.id));
419
+ const fromList = (value) => {
420
+ if (r_function_call_1.RFunctionCall.isNamed(value) && ['list', 'c'].includes(identifier_1.Identifier.getName(value.functionName.content))) {
421
+ for (const entry of value.arguments) {
422
+ if (entry === r_function_call_1.EmptyArgument) {
423
+ continue;
424
+ }
425
+ else if (entry.name === undefined) {
426
+ unknown = true;
427
+ }
428
+ else {
429
+ keys.push(identifier_1.Identifier.getName(entry.name.content));
430
+ }
431
+ }
432
+ }
433
+ else if (value !== undefined) {
434
+ unknown = true;
435
+ }
436
+ };
437
+ if (scope.new !== undefined) {
438
+ fromList(bound.get(scope.new)?.value);
439
+ }
440
+ for (const arg of args) {
441
+ if (arg === r_function_call_1.EmptyArgument || formals.has(arg.info.id)) {
442
+ continue;
443
+ }
444
+ if (arg.name !== undefined) {
445
+ keys.push(identifier_1.Identifier.getName(arg.name.content));
446
+ }
447
+ else {
448
+ fromList(arg.value);
449
+ }
450
+ }
451
+ const writes = keys.map(k => local ? { name: exports.AmbientStateName.option(k), mode: 'local' } : exports.AmbientStateName.option(k));
452
+ if (unknown) {
453
+ writes.push(exports.AmbientStateName.unknownOption);
454
+ }
455
+ writes.push(exports.AmbientStateName.allOptions);
456
+ return { writes, unknown: unknown || keys.some(k => GlobalEffectOptions.has(k)) };
457
+ }
458
+ /** Evaluating captured code may access any state; `Quoted.finalize` drops the writes again once the code is known to change none. */
459
+ function evaluatesCapturedCode(res, rootId, data) {
460
+ return withAccess(res, rootId, data, [exports.AmbientStateName.allOptions, exports.AmbientStateName.graphics, exports.AmbientStateName.palette], [exports.AmbientStateName.unknownOption, exports.AmbientStateName.allOptions, exports.AmbientStateName.graphics, exports.AmbientStateName.palette]);
461
+ }
462
+ /** R prints every visible top-level value, which reads the printing options like `print` does. */
463
+ function readsOfAutoPrint(processed, expression, data) {
464
+ if (!autoPrints(expression, processed, data)) {
465
+ return processed;
466
+ }
467
+ return withAccess(processed, expression.info.id, data, printingReads(expression, true, exports.PrintingOptions, data), []);
468
+ }
469
+ /** the processors whose calls return invisibly, although their configuration states no {@link CallProp.Invisible} */
470
+ const InvisibleProcessors = new Set([built_in_proc_name_1.BuiltInProcName.ForLoop, built_in_proc_name_1.BuiltInProcName.WhileLoop, built_in_proc_name_1.BuiltInProcName.RepeatLoop,
471
+ built_in_proc_name_1.BuiltInProcName.Assignment, built_in_proc_name_1.BuiltInProcName.SuperAssignment, built_in_proc_name_1.BuiltInProcName.FunctionDefinition]);
472
+ /** whether the value of the top-level `expression` is visible, so that R prints it, decided on its vertex */
473
+ function autoPrints(expression, processed, data) {
474
+ const vertex = processed.graph.getVertex(expression.info.id);
475
+ if (vertex === undefined || vertex_1.DfgVertex.isFunctionDefinition(vertex)) {
476
+ return false;
477
+ }
478
+ else if (!vertex_1.DfgVertex.isFunctionCall(vertex)) {
479
+ return true;
480
+ }
481
+ else if (Array.isArray(vertex.origin) && vertex.origin.some(o => InvisibleProcessors.has(o))) {
482
+ return false;
483
+ }
484
+ /* `invisible`, `library`, ...: everything this resolves to returns invisibly */
485
+ const targets = resolve_helper_1.Resolve.byNameAndType(vertex.name, data.environment, identifier_1.ReferenceType.Function);
486
+ return targets === undefined || targets.length === 0 || !targets.every(t => t.type === identifier_1.ReferenceType.BuiltInFunction && built_in_props_1.CallProps.hasAny(t.config, built_in_props_1.CallProp.Invisible));
487
+ }
488
+ /** A call through a variable bound to a built-in (`p <- par; p(...)`), only revealed when linking the statement's calls. */
489
+ function applyAmbientStateOfCalledBuiltIns(res, callId, builtIns, before, graph, data) {
490
+ const call = data.completeAst.idMap.get(callId);
491
+ if (!r_function_call_1.RFunctionCall.is(call)) {
492
+ return res;
493
+ }
494
+ const known = res.unknownReferences.length;
495
+ for (const builtIn of builtIns) {
496
+ const targets = node_id_1.NodeId.isBuiltIn(builtIn) ? resolve_helper_1.Resolve.byNameAndType(node_id_1.NodeId.fromBuiltIn(builtIn), before, identifier_1.ReferenceType.Function) : undefined;
497
+ res = applyAmbientStateOfTargets(res, targets ?? [], call.arguments, callId, data);
498
+ }
499
+ for (const read of res.unknownReferences.slice(known)) {
500
+ for (const def of resolve_helper_1.Resolve.byName(read.name, before) ?? []) {
501
+ graph.addEdge(read.nodeId, def.nodeId, edge_1.EdgeType.Reads);
502
+ }
503
+ }
504
+ return res;
505
+ }
506
+ //# sourceMappingURL=built-in-ambient-state.js.map
@@ -18,6 +18,9 @@ const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/
18
18
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
19
19
  const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
20
20
  const r_function_definition_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
21
+ const built_in_ambient_state_1 = require("./built-in-ambient-state");
22
+ const built_in_props_1 = require("../../../../../environments/built-in-props");
23
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
21
24
  /** Resolve the function an argument stands for: a string literal, a symbol, or an inline definition; `undefined` if none. */
22
25
  function resolveFunctionArgument(val, data, opts) {
23
26
  if (opts.unquoteFunction && r_string_1.RString.is(val)) {
@@ -140,6 +143,12 @@ function processApply(name, args, rootId, data, config) {
140
143
  }
141
144
  }
142
145
  else {
146
+ information = (0, built_in_ambient_state_1.applyAmbientStateOfCallee)(information, functionId, functionName, data);
147
+ /* a callee binding names (`do.call("assign", ...)`) does so with arguments we cannot see here; loading a package is handled on its own */
148
+ if (resolve_helper_1.Resolve.byNameAndType(functionName, data.environment, identifier_1.ReferenceType.Function)?.some(t => t.type === identifier_1.ReferenceType.BuiltInFunction
149
+ && built_in_props_1.CallProps.hasAny(t.config, built_in_props_1.CallProp.Scope) && !built_in_props_1.CallProps.hasAny(t.config, built_in_props_1.SemanticCallTag.LoadsPackage))) {
150
+ information.graph.markIdForUnknownSideEffects(rootId);
151
+ }
143
152
  /* identify it as a full-blown function call :) */
144
153
  information.graph.updateToFunctionCall({
145
154
  tag: vertex_1.VertexType.FunctionCall,
@@ -21,6 +21,8 @@ export interface AssignmentConfiguration {
21
21
  readonly replacement?: boolean;
22
22
  /** is the target a variable pointing at the actual name? */
23
23
  readonly targetVariable?: boolean;
24
+ /** appended to a target named by a string (`setReplaceMethod("f", ...)` binds `f<-`) */
25
+ readonly targetSuffix?: string;
24
26
  /** does the call use the old value of its target (e.g. `setNames(x, nm)`), so that the target reads its previous definition? */
25
27
  readonly readTarget?: boolean;
26
28
  readonly mayHaveMoreArgs?: boolean;
@@ -314,7 +314,7 @@ function processAssignmentToString(target, args, name, rootId, data, config, sou
314
314
  const symbol = {
315
315
  type: type_1.RType.Symbol,
316
316
  info: target.info,
317
- content: (0, retriever_1.removeRQuotes)(target.lexeme),
317
+ content: (0, retriever_1.removeRQuotes)(target.lexeme) + (config.targetSuffix ?? ''),
318
318
  lexeme: target.lexeme,
319
319
  location: target.location,
320
320
  };
@@ -421,6 +421,7 @@ function tryRouteDollarEnvAssign(rootId, data, config, target, source, replaceme
421
421
  const newEnvState = (0, define_1.define)(fieldDef, false, envirResolution.envDef.envState);
422
422
  const updatedEnvDef = {
423
423
  ...envirResolution.envDef,
424
+ nodeId: target.accessed.info.id,
424
425
  definedAt: rootId,
425
426
  envState: newEnvState
426
427
  };
@@ -429,7 +430,8 @@ function tryRouteDollarEnvAssign(rootId, data, config, target, source, replaceme
429
430
  level: normalResult.environment.level
430
431
  };
431
432
  normalResult.graph.addEdge(normalResult.entryPoint, target.accessed.info.id, edge_1.EdgeType.Reads);
432
- return { ...normalResult, environment: (0, define_1.define)(updatedEnvDef, false, strippedEnv) };
433
+ const environment = (0, define_1.define)(updatedEnvDef, false, strippedEnv);
434
+ return { ...normalResult, environment: updatedEnvDef.envId === undefined ? environment : (0, built_in_envir_utils_1.rebindHolders)(environment, { ...updatedEnvDef, envState: newEnvState }, newEnvState, rootId) };
433
435
  }
434
436
  /**
435
437
  * When `config.environmentArg` (e.g. `'envir'` for `assign`) resolves to a variable with a tracked
@@ -451,20 +453,13 @@ function tryRouteToCustomEnv(name, args, rootId, data, config) {
451
453
  if (!envirRouting) {
452
454
  return undefined;
453
455
  }
454
- if (envirRouting.stack === 'global') {
455
- const globalResult = processAssignment(name, args, rootId, data, {
456
- ...config,
457
- environmentArg: undefined, // prevent re-entry
458
- superAssignment: true
459
- });
460
- globalResult.graph.addEdge(rootId, envirRouting.envirNodeId, edge_1.EdgeType.Reads);
461
- return globalResult;
456
+ /* run the normal assignment path to get the correct graph structure, the call reads the environment it writes into */
457
+ const global = envirRouting.stack === 'global';
458
+ const normalResult = processAssignment(name, args, rootId, data, { ...config, environmentArg: undefined, superAssignment: global || config.superAssignment });
459
+ normalResult.graph.addEdge(rootId, envirRouting.envirNodeId, edge_1.EdgeType.Reads);
460
+ if (global) {
461
+ return normalResult;
462
462
  }
463
- /* run the normal assignment path to get the correct graph structure */
464
- const normalResult = processAssignment(name, args, rootId, data, {
465
- ...config,
466
- environmentArg: undefined // prevent re-entry
467
- });
468
463
  /* pass rootId as definedAt so only defs made at this call site are routed */
469
464
  return (0, built_in_envir_utils_1.routeWrittenToEnvir)(normalResult, envirRouting, rootId, data.environment, rootId);
470
465
  }
@@ -517,8 +512,10 @@ function processAssignmentToSymbol(config) {
517
512
  value: aliases
518
513
  }]
519
514
  : produceWrittenNodes(rootId, targetArg, referenceType, data, makeMaybe ?? false, aliases);
515
+ let copied;
520
516
  if (data.ctx.config.solver.trackEnvironments) {
521
517
  let envState;
518
+ let envId;
522
519
  let returnsEnvState;
523
520
  const valueEntry = valueEntryPointOf(sourceArg);
524
521
  const stackEnv = (0, built_in_stack_env_1.stackEnvStateFromSource)(sourceArg, data, valueEntry);
@@ -531,8 +528,10 @@ function processAssignmentToSymbol(config) {
531
528
  }
532
529
  else if (r_symbol_1.RSymbol.is(source)) {
533
530
  const defs = resolve_helper_1.Resolve.byNameAndType(source.content, data.environment, identifier_1.ReferenceType.Variable);
534
- envState = defs?.find(identifier_1.hasEnvState)?.envState
535
- ?? (0, built_in_envir_utils_1.findReturnsEnvState)(defs);
531
+ copied = defs?.find(identifier_1.hasEnvState);
532
+ envState = copied?.envState ?? (0, built_in_envir_utils_1.findReturnsEnvState)(defs);
533
+ /* only a copied environment needs an identity, its holders are rebound on every field write */
534
+ envId = copied === undefined ? undefined : copied.envId ?? copied.nodeId;
536
535
  }
537
536
  else {
538
537
  const entryVertex = sourceArg.graph.getVertex(sourceArg.entryPoint);
@@ -552,7 +551,7 @@ function processAssignmentToSymbol(config) {
552
551
  }
553
552
  if (envState) {
554
553
  for (let i = 0; i < writeNodes.length; i++) {
555
- writeNodes[i] = { ...writeNodes[i], envState };
554
+ writeNodes[i] = { ...writeNodes[i], envState, envId };
556
555
  }
557
556
  }
558
557
  else if (returnsEnvState) {
@@ -582,7 +581,8 @@ function processAssignmentToSymbol(config) {
582
581
  }
583
582
  }
584
583
  readTargets.push(...readFromSourceWritten);
585
- information.environment = (0, overwrite_1.overwriteEnvironment)(sourceArg.environment, targetArg.environment);
584
+ /* a quoted source (`delayedAssign`) writes nothing yet, its writes happen where it is forced (see `Deferred`) */
585
+ information.environment = quoteSource ? data.environment : (0, overwrite_1.overwriteEnvironment)(sourceArg.environment, targetArg.environment);
586
586
  if (config.beforeDefine) {
587
587
  information.environment = config.beforeDefine(information);
588
588
  }
@@ -590,6 +590,9 @@ function processAssignmentToSymbol(config) {
590
590
  for (const write of writeNodes) {
591
591
  markAsAssignment(information, write, useSourceIds, rootId, data, config);
592
592
  }
593
+ if (copied?.name !== undefined && copied.envId === undefined && information.environment.current.lookup(identifier_1.Identifier.getName(copied.name))?.includes(copied)) {
594
+ information.environment = (0, define_1.define)({ ...copied, name: copied.name, envId: copied.nodeId }, false, information.environment);
595
+ }
593
596
  information.graph.addEdge(rootId, targetArg.entryPoint, edge_1.EdgeType.Returns);
594
597
  if (quoteSource) {
595
598
  information.graph.addEdge(rootId, source.info.id, edge_1.EdgeType.NonStandardEvaluation);