@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.
- package/README.md +34 -25
- package/abstract-interpretation/absint-inference.d.ts +2 -2
- package/abstract-interpretation/absint-inference.js +32 -79
- package/benchmark/slicer.d.ts +0 -1
- package/benchmark/slicer.js +1 -2
- package/cli/repl/commands/repl-signature.js +12 -3
- package/config.d.ts +5 -1
- package/control-flow/cfg-properties.js +0 -22
- package/control-flow/happens-before.d.ts +2 -2
- package/control-flow/happens-before.js +29 -19
- package/dataflow/environments/apply-kill.js +6 -2
- package/dataflow/environments/built-in-config.d.ts +2 -0
- package/dataflow/environments/built-in-props.d.ts +7 -1
- package/dataflow/environments/built-in-props.js +8 -1
- package/dataflow/environments/built-in.d.ts +7 -2
- package/dataflow/environments/built-in.js +11 -5
- package/dataflow/environments/default-builtin-config.d.ts +386 -8
- package/dataflow/environments/default-builtin-config.js +84 -22
- package/dataflow/environments/define.d.ts +3 -2
- package/dataflow/environments/define.js +4 -3
- package/dataflow/environments/deprecation-info.d.ts +45 -0
- package/dataflow/environments/deprecation-info.js +13 -0
- package/dataflow/environments/environment.d.ts +1 -1
- package/dataflow/environments/environment.js +5 -4
- package/dataflow/environments/identifier.d.ts +2 -0
- package/dataflow/extractor.js +6 -1
- package/dataflow/fn/class-declaration.d.ts +0 -11
- package/dataflow/fn/class-declaration.js +0 -20
- package/dataflow/fn/higher-order-function.d.ts +9 -1
- package/dataflow/fn/higher-order-function.js +14 -7
- package/dataflow/fn/strict-function.js +8 -3
- package/dataflow/graph/graph.d.ts +7 -0
- package/dataflow/graph/graph.js +17 -0
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/internal/linker.d.ts +3 -0
- package/dataflow/internal/linker.js +67 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +113 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +506 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +22 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +21 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +22 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +19 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +3 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +8 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -0
- package/dataflow/internal/process/functions/call/common.d.ts +3 -1
- package/dataflow/internal/process/functions/call/common.js +22 -4
- package/dataflow/internal/process/functions/call/deferred.d.ts +6 -0
- package/dataflow/internal/process/functions/call/deferred.js +33 -12
- package/dataflow/internal/process/functions/call/known-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +15 -0
- package/dataflow/internal/process/functions/call/quoted.js +137 -24
- package/dataflow/internal/process/process-symbol.js +6 -2
- package/documentation/data/faq/faqs.js +3 -3
- package/documentation/data/interface/doc-writing-code.js +1 -2
- package/documentation/data/server/doc-data-server-messages.js +7 -7
- package/documentation/doc-capabilities.js +80 -34
- package/documentation/doc-util/doc-query.d.ts +0 -3
- package/documentation/doc-util/doc-query.js +4 -3
- package/documentation/wiki-analyzer.js +1 -1
- package/documentation/wiki-cfg.js +5 -6
- package/documentation/wiki-core.js +8 -8
- package/documentation/wiki-dataflow-graph.js +10 -11
- package/documentation/wiki-interface.js +2 -2
- package/documentation/wiki-linting-and-testing.js +3 -3
- package/documentation/wiki-overview.js +6 -6
- package/documentation/wiki-query.js +9 -101
- package/documentation/wiki-signature-database.js +1 -1
- package/linter/linter-rules.d.ts +1 -1
- package/linter/rules/deprecated-functions.d.ts +1 -45
- package/linter/rules/deprecated-functions.js +24 -33
- package/package.json +1 -1
- package/project/flowr-analyzer.d.ts +2 -0
- package/project/flowr-analyzer.js +24 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -2
- package/project/plugins/file-plugins/files/flowr-rda-file.js +10 -55
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +2 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +6 -4
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- package/project/sigdb/build.js +4 -0
- package/project/sigdb/manifest.d.ts +2 -0
- package/project/sigdb/manifest.js +10 -1
- package/project/sigdb/reader.js +23 -61
- package/project/sigdb/sigdb-download.d.ts +29 -6
- package/project/sigdb/sigdb-download.js +212 -64
- package/queries/catalog/call-context-query/cascade-action.d.ts +3 -1
- package/queries/catalog/call-context-query/cascade-action.js +2 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -1
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +2 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/query.d.ts +1 -1
- package/r-bridge/data/data.d.ts +21 -14
- package/r-bridge/data/data.js +28 -20
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +11 -2
- package/util/files.d.ts +2 -0
- package/util/files.js +3 -1
- package/util/mermaid/mermaid.js +6 -2
- package/util/version.js +2 -2
|
@@ -5,9 +5,9 @@ import { type ControlFlowGraph } from './control-flow-graph';
|
|
|
5
5
|
* Determines if node `a` happens before node `b` in the control flow graph.
|
|
6
6
|
*/
|
|
7
7
|
export declare function happensBefore(cfg: ControlFlowGraph, a: NodeId, b: NodeId): Ternary;
|
|
8
|
+
/** Whether one of the `candidates` always happens before `b`; one walk back from `b` settles all candidates at once. */
|
|
9
|
+
export declare function someAlwaysBefore(cfg: ControlFlowGraph, candidates: ReadonlySet<NodeId>, b: NodeId): boolean;
|
|
8
10
|
/** Every node reachable from one of `from`, the seeds included: `happensBefore(cfg, from_i, to)` is not {@link Ternary#Never} for some seed exactly when `to` is in here. */
|
|
9
11
|
export declare function reachableFrom(cfg: ControlFlowGraph, from: Iterable<NodeId>): ReadonlySet<NodeId>;
|
|
10
12
|
/** @see {@link reachableFrom} - the other direction */
|
|
11
13
|
export declare function reachableTo(cfg: ControlFlowGraph, to: Iterable<NodeId>): ReadonlySet<NodeId>;
|
|
12
|
-
/** Whether a node that may be evaluated before `to` satisfies `test`, stopping at the first that does; `to` itself is not tested. */
|
|
13
|
-
export declare function someReachableTo(cfg: ControlFlowGraph, to: NodeId, test: (id: NodeId) => boolean): boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.happensBefore = happensBefore;
|
|
4
|
+
exports.someAlwaysBefore = someAlwaysBefore;
|
|
4
5
|
exports.reachableFrom = reachableFrom;
|
|
5
6
|
exports.reachableTo = reachableTo;
|
|
6
|
-
exports.someReachableTo = someReachableTo;
|
|
7
7
|
const logic_1 = require("../util/logic");
|
|
8
8
|
const control_flow_graph_1 = require("./control-flow-graph");
|
|
9
9
|
/**
|
|
@@ -34,6 +34,34 @@ function happensBefore(cfg, a, b) {
|
|
|
34
34
|
}
|
|
35
35
|
return logic_1.Ternary.Never;
|
|
36
36
|
}
|
|
37
|
+
/** Whether one of the `candidates` always happens before `b`; one walk back from `b` settles all candidates at once. */
|
|
38
|
+
function someAlwaysBefore(cfg, candidates, b) {
|
|
39
|
+
const visited = new Set();
|
|
40
|
+
const met = new Set();
|
|
41
|
+
const stack = [[b, undefined]];
|
|
42
|
+
while (stack.length > 0) {
|
|
43
|
+
const [current, cd] = stack.pop();
|
|
44
|
+
let useCd = cd;
|
|
45
|
+
if (current !== b && candidates.has(current) && !met.has(current)) {
|
|
46
|
+
if (!cd) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
met.add(current);
|
|
50
|
+
}
|
|
51
|
+
if (visited.has(current)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
else if (cd && (current === cd || visited.has(cd))) {
|
|
55
|
+
useCd = undefined;
|
|
56
|
+
}
|
|
57
|
+
visited.add(current);
|
|
58
|
+
for (const [id, t] of cfg.ingoingEdges(current) ?? []) {
|
|
59
|
+
const joinsAt = control_flow_graph_1.CfgEdge.isControlDependency(t) ? control_flow_graph_1.CfgEdge.unpackCause(t) : useCd;
|
|
60
|
+
stack.push([id, useCd ?? joinsAt]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
37
65
|
function closure(seeds, step) {
|
|
38
66
|
const seen = new Set(seeds);
|
|
39
67
|
const stack = [...seen];
|
|
@@ -55,22 +83,4 @@ function reachableFrom(cfg, from) {
|
|
|
55
83
|
function reachableTo(cfg, to) {
|
|
56
84
|
return closure(to, id => cfg.predecessors(id));
|
|
57
85
|
}
|
|
58
|
-
/** Whether a node that may be evaluated before `to` satisfies `test`, stopping at the first that does; `to` itself is not tested. */
|
|
59
|
-
function someReachableTo(cfg, to, test) {
|
|
60
|
-
const seen = new Set([to]);
|
|
61
|
-
const stack = [to];
|
|
62
|
-
while (stack.length > 0) {
|
|
63
|
-
for (const previous of cfg.predecessors(stack.pop())) {
|
|
64
|
-
if (seen.has(previous)) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
else if (test(previous)) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
seen.add(previous);
|
|
71
|
-
stack.push(previous);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
86
|
//# sourceMappingURL=happens-before.js.map
|
|
@@ -64,6 +64,10 @@ function cancelRevivedKills(kills, writes) {
|
|
|
64
64
|
}
|
|
65
65
|
return remaining;
|
|
66
66
|
}
|
|
67
|
+
/** the options and graphics state flowR keeps as `#...` variables, which `rm(list = ls())` does not touch in R */
|
|
68
|
+
function isAmbientState(key) {
|
|
69
|
+
return key.startsWith('#');
|
|
70
|
+
}
|
|
67
71
|
function isBuiltInDef(d) {
|
|
68
72
|
return d.type === identifier_1.ReferenceType.BuiltInFunction || d.type === identifier_1.ReferenceType.BuiltInConstant;
|
|
69
73
|
}
|
|
@@ -88,7 +92,7 @@ function weakenAll(env, cds, except) {
|
|
|
88
92
|
return;
|
|
89
93
|
}
|
|
90
94
|
for (const [key, defs] of env.memory) {
|
|
91
|
-
if (except?.has(key)) {
|
|
95
|
+
if (except?.has(key) || isAmbientState(key)) {
|
|
92
96
|
continue;
|
|
93
97
|
}
|
|
94
98
|
if (defs.some(d => !isBuiltInDef(d))) {
|
|
@@ -103,7 +107,7 @@ function removeAllInFrame(env, except) {
|
|
|
103
107
|
return;
|
|
104
108
|
}
|
|
105
109
|
for (const [key, defs] of env.memory) {
|
|
106
|
-
if (except?.has(key) || defs.every(isBuiltInDef)) {
|
|
110
|
+
if (except?.has(key) || isAmbientState(key) || defs.every(isBuiltInDef)) {
|
|
107
111
|
continue;
|
|
108
112
|
}
|
|
109
113
|
const kept = defs.filter(isBuiltInDef);
|
|
@@ -3,6 +3,7 @@ import type { BuiltInEvalName } from './built-in-eval-name';
|
|
|
3
3
|
import { BuiltIns } from './built-in';
|
|
4
4
|
import type { Identifier } from './identifier';
|
|
5
5
|
import type { BuiltInFnInfo } from './built-in-props';
|
|
6
|
+
import type { DeprecatedFunctionInformation } from './deprecation-info';
|
|
6
7
|
export interface BaseBuiltInDefinition {
|
|
7
8
|
/** The type of the built-in configuration */
|
|
8
9
|
readonly type: string;
|
|
@@ -33,6 +34,7 @@ export interface BuiltInFunctionDefinition<BuiltInProcessor extends keyof typeof
|
|
|
33
34
|
readonly processor: BuiltInProcessor;
|
|
34
35
|
readonly config?: ConfigOfProcessor<BuiltInProcessor> & BuiltInFnInfo & {
|
|
35
36
|
libFn?: boolean;
|
|
37
|
+
deprInfo?: DeprecatedFunctionInformation;
|
|
36
38
|
};
|
|
37
39
|
/** the value solver to use when folding a call to this function to a constant, see {@link BuiltInEvalHandlerMapper} */
|
|
38
40
|
readonly evalHandler?: BuiltInEvalName;
|
|
@@ -149,7 +149,13 @@ export declare enum SemanticCallTag {
|
|
|
149
149
|
/** produces raw HTML or JavaScript, such as `shiny::HTML` */
|
|
150
150
|
Html = "html",
|
|
151
151
|
/** produces raw JavaScript code, such as `shinyjs::runjs` */
|
|
152
|
-
JavaScript = "javascript"
|
|
152
|
+
JavaScript = "javascript",
|
|
153
|
+
/** loads a package's namespace (running its `.onLoad`), like `library` or `loadNamespace` */
|
|
154
|
+
LoadsPackage = "loads-package",
|
|
155
|
+
/** puts a package's exports on the search path, so their bare names resolve, like `library` or `attachNamespace` */
|
|
156
|
+
AttachesPackage = "attaches-package",
|
|
157
|
+
/** answers whether a package is available, like `require`, `requireNamespace`, or `find.package` */
|
|
158
|
+
ChecksPackage = "checks-package"
|
|
153
159
|
}
|
|
154
160
|
/** a bitfield of {@link ArgProp} */
|
|
155
161
|
export type ArgProps = number;
|
|
@@ -157,6 +157,12 @@ var SemanticCallTag;
|
|
|
157
157
|
SemanticCallTag["Html"] = "html";
|
|
158
158
|
/** produces raw JavaScript code, such as `shinyjs::runjs` */
|
|
159
159
|
SemanticCallTag["JavaScript"] = "javascript";
|
|
160
|
+
/** loads a package's namespace (running its `.onLoad`), like `library` or `loadNamespace` */
|
|
161
|
+
SemanticCallTag["LoadsPackage"] = "loads-package";
|
|
162
|
+
/** puts a package's exports on the search path, so their bare names resolve, like `library` or `attachNamespace` */
|
|
163
|
+
SemanticCallTag["AttachesPackage"] = "attaches-package";
|
|
164
|
+
/** answers whether a package is available, like `require`, `requireNamespace`, or `find.package` */
|
|
165
|
+
SemanticCallTag["ChecksPackage"] = "checks-package";
|
|
160
166
|
})(SemanticCallTag || (exports.SemanticCallTag = SemanticCallTag = {}));
|
|
161
167
|
/**
|
|
162
168
|
* The properties that say where a definition comes from rather than what it does. A bare
|
|
@@ -211,7 +217,8 @@ exports.PropagatedProps = getPropMask([
|
|
|
211
217
|
SemanticCallTag.Random, SemanticCallTag.File, SemanticCallTag.TempFile, SemanticCallTag.Network,
|
|
212
218
|
SemanticCallTag.Process, SemanticCallTag.User, SemanticCallTag.CommandLine, SemanticCallTag.Graphics,
|
|
213
219
|
SemanticCallTag.Database, SemanticCallTag.Reads, SemanticCallTag.Writes, SemanticCallTag.Prints,
|
|
214
|
-
SemanticCallTag.Eval, SemanticCallTag.Html, SemanticCallTag.JavaScript
|
|
220
|
+
SemanticCallTag.Eval, SemanticCallTag.Html, SemanticCallTag.JavaScript, SemanticCallTag.LoadsPackage, SemanticCallTag.AttachesPackage,
|
|
221
|
+
SemanticCallTag.ChecksPackage
|
|
215
222
|
]);
|
|
216
223
|
/** Checks whether a {@link PropSelector} is a bitfield of {@link CallProp}s */
|
|
217
224
|
function isCallProp(selector) {
|
|
@@ -28,6 +28,7 @@ import { processList } from '../internal/process/functions/call/built-in/built-i
|
|
|
28
28
|
import { processVector } from '../internal/process/functions/call/built-in/built-in-vector';
|
|
29
29
|
import { processRm } from '../internal/process/functions/call/built-in/built-in-rm';
|
|
30
30
|
import { processEvalCall } from '../internal/process/functions/call/built-in/built-in-eval';
|
|
31
|
+
import { type AmbientScope, type AmbientStateAccess } from '../internal/process/functions/call/built-in/built-in-ambient-state';
|
|
31
32
|
import type { Value } from '../eval/values/r-value';
|
|
32
33
|
import type { ResolveInfo } from '../eval/resolve/alias-tracking';
|
|
33
34
|
import { resolveAsSeq, resolveAsVector } from '../eval/resolve/resolve';
|
|
@@ -85,6 +86,10 @@ export interface DefaultBuiltInProcessorConfiguration extends BuiltInFnInfo {
|
|
|
85
86
|
*/
|
|
86
87
|
readonly keepArgumentOut?: boolean;
|
|
87
88
|
readonly hasUnknownSideEffects?: boolean | LinkTo<RegExp | string>;
|
|
89
|
+
/** how the call reads or writes global state like the graphics parameters or the options, see {@link AmbientStateAccess} */
|
|
90
|
+
readonly ambient?: AmbientStateAccess;
|
|
91
|
+
/** the call changes that state for a scope only, see {@link AmbientScope} */
|
|
92
|
+
readonly scope?: AmbientScope;
|
|
88
93
|
/** record mapping the actual function name called to the arguments that should be treated as function calls */
|
|
89
94
|
readonly treatAsFnCall?: Record<string, readonly string[]>;
|
|
90
95
|
/** Mark the given arguments as {@link EdgeType.NonStandardEvaluation|non-standard-evaluated}, like `quote`. */
|
|
@@ -106,8 +111,8 @@ export interface BuiltInEvalHandlerArgs extends ResolveInfo {
|
|
|
106
111
|
node: RNodeWithParent;
|
|
107
112
|
}
|
|
108
113
|
export type BuiltInEvalHandler = (args: BuiltInEvalHandlerArgs) => Value;
|
|
109
|
-
declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, readAllArguments, cfg, alternativeArgsFrom, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
|
|
110
|
-
declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, markArgsAsNSE: nse, markArgsAsMasked: masked, sig }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'markArgsAsNSE' | 'markArgsAsMasked' | 'sig'>): DataflowInformation;
|
|
114
|
+
declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, readAllArguments, cfg, alternativeArgsFrom, hasUnknownSideEffects, ambient, scope, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
|
|
115
|
+
declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, markArgsAsNSE: nse, markArgsAsMasked: masked, sig, ambient }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'markArgsAsNSE' | 'markArgsAsMasked' | 'sig' | 'ambient'>): DataflowInformation;
|
|
111
116
|
export declare const BuiltInProcessorMapper: {
|
|
112
117
|
readonly "builtin:acc": typeof processAccess;
|
|
113
118
|
readonly "builtin:app": typeof processApply;
|
|
@@ -31,6 +31,7 @@ const built_in_rm_1 = require("../internal/process/functions/call/built-in/built
|
|
|
31
31
|
const built_in_eval_1 = require("../internal/process/functions/call/built-in/built-in-eval");
|
|
32
32
|
const vertex_1 = require("../graph/vertex");
|
|
33
33
|
const unknown_side_effect_1 = require("../graph/unknown-side-effect");
|
|
34
|
+
const built_in_ambient_state_1 = require("../internal/process/functions/call/built-in/built-in-ambient-state");
|
|
34
35
|
const resolve_1 = require("../eval/resolve/resolve");
|
|
35
36
|
const resolve_strings_1 = require("../eval/resolve/resolve-strings");
|
|
36
37
|
const resolve_operators_1 = require("../eval/resolve/resolve-operators");
|
|
@@ -87,7 +88,10 @@ function dataArgumentSymbols(args, sig) {
|
|
|
87
88
|
}
|
|
88
89
|
return symbols;
|
|
89
90
|
}
|
|
90
|
-
function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, readAllArguments, cfg, alternativeArgsFrom, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }) {
|
|
91
|
+
function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, readAllArguments, cfg, alternativeArgsFrom, hasUnknownSideEffects, ambient, scope, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }) {
|
|
92
|
+
if (scope !== undefined) {
|
|
93
|
+
return (0, built_in_ambient_state_1.processAmbientScope)(name, args, rootId, data, scope);
|
|
94
|
+
}
|
|
91
95
|
/* a signature states per argument what the individual options state for all of them at once */
|
|
92
96
|
const layout = sig !== undefined ? function_semantics_1.FunctionSemantics.call.signature.layout(sig) : undefined;
|
|
93
97
|
if (layout !== undefined) {
|
|
@@ -95,13 +99,15 @@ function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = bu
|
|
|
95
99
|
}
|
|
96
100
|
const nsePositions = nsePositionsOf(nse, args.length);
|
|
97
101
|
let lastEnv = data.environment;
|
|
102
|
+
/* `evalq(expr)` runs `expr` right here, in the frame it is called from */
|
|
103
|
+
const inPlace = args.length === 1 && identifier_1.Identifier.getName(name.content) === 'evalq';
|
|
98
104
|
const { information: res, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
99
105
|
name, args, rootId, data, sig, alternativeArgsFrom,
|
|
100
106
|
origin: useAsProcessor,
|
|
101
107
|
nonFunction: dataArgumentSymbols(args, sig),
|
|
102
108
|
/* an unevaluated argument must not read the current frame, so it is analyzed in a clean env like `quote` */
|
|
103
109
|
patchData: nsePositions === undefined ? undefined : (d, index) => {
|
|
104
|
-
if (nsePositions.has(index)) {
|
|
110
|
+
if (nsePositions.has(index) && !inPlace) {
|
|
105
111
|
lastEnv = d.environment;
|
|
106
112
|
return { ...d, environment: (0, scoping_1.cleanEnvOf)(d.environment) };
|
|
107
113
|
}
|
|
@@ -182,7 +188,7 @@ function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = bu
|
|
|
182
188
|
exitPoints.push({ type: cfg, nodeId: rootId, cds: data.cds });
|
|
183
189
|
res.exitPoints = exitPoints;
|
|
184
190
|
}
|
|
185
|
-
return res;
|
|
191
|
+
return ambient === undefined ? res : (0, built_in_ambient_state_1.applyAmbientStateAccess)(res, args, rootId, data, ambient);
|
|
186
192
|
}
|
|
187
193
|
/** The argument positions {@link markArgumentsAsNonStandardEvaluation} would mark as quoted. */
|
|
188
194
|
function nsePositionsOf(which, count) {
|
|
@@ -217,7 +223,7 @@ function dropQuotedReferences(res, processedArguments, nsePositions, lastEnv) {
|
|
|
217
223
|
res.environment = lastEnv;
|
|
218
224
|
}
|
|
219
225
|
}
|
|
220
|
-
function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, markArgsAsNSE: nse, markArgsAsMasked: masked, sig }) {
|
|
226
|
+
function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, markArgsAsNSE: nse, markArgsAsMasked: masked, sig, ambient }) {
|
|
221
227
|
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
222
228
|
name, args, rootId, data, sig, origin: useAsProcessor, nonFunction: dataArgumentSymbols(args, sig)
|
|
223
229
|
});
|
|
@@ -229,7 +235,7 @@ function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsPro
|
|
|
229
235
|
}
|
|
230
236
|
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(g, rootId, processedArguments, nse);
|
|
231
237
|
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(g, rootId, processedArguments, masked, { kind: known_call_handling_1.NseKind.DataMasked });
|
|
232
|
-
return information;
|
|
238
|
+
return ambient === undefined ? information : (0, built_in_ambient_state_1.applyAmbientStateAccess)(information, args, rootId, data, ambient);
|
|
233
239
|
}
|
|
234
240
|
exports.BuiltInProcessorMapper = {
|
|
235
241
|
[built_in_proc_name_1.BuiltInProcName.Access]: built_in_access_1.processAccess,
|