@eagleoutice/flowr 2.17.1 → 2.17.2
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/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/dataflow/environments/ambient-state-name.d.ts +4 -0
- package/dataflow/environments/ambient-state-name.js +4 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in-props.d.ts +2 -0
- package/dataflow/environments/built-in-props.js +3 -1
- package/dataflow/environments/built-in.d.ts +16 -6
- package/dataflow/environments/built-in.js +45 -4
- package/dataflow/environments/default-builtin-config.d.ts +846 -21
- package/dataflow/environments/default-builtin-config.js +120 -26
- package/dataflow/environments/environment.d.ts +19 -2
- package/dataflow/environments/environment.js +90 -19
- package/dataflow/environments/identifier.d.ts +18 -0
- package/dataflow/environments/query-fn-props.js +4 -3
- package/dataflow/environments/resolve-by-name.js +5 -3
- package/dataflow/eval/resolve/node-value.d.ts +1 -1
- package/dataflow/eval/resolve/node-value.js +2 -2
- package/dataflow/eval/resolve/resolve-argument.js +1 -1
- package/dataflow/extractor.js +20 -4
- package/dataflow/graph/df-helper.d.ts +34 -1
- package/dataflow/graph/df-helper.js +60 -0
- package/dataflow/info.d.ts +2 -0
- package/dataflow/info.js +4 -0
- package/dataflow/internal/linker.js +21 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +3 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +18 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +144 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +10 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +8 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +43 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +67 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +27 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +28 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +134 -88
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +87 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +8 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +23 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +28 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +18 -15
- package/dataflow/internal/process/functions/call/named-call-handling.js +8 -4
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
- package/dataflow/internal/process/functions/call/quoted.js +8 -7
- package/documentation/wiki-dataflow-graph.js +20 -1
- package/linter/rules/undefined-symbol.js +2 -2
- package/package.json +1 -1
- package/project/attached-packages.d.ts +11 -6
- package/project/attached-packages.js +37 -9
- package/queries/catalog/signature-query/signature-query-executor.js +15 -1
- package/queries/catalog/signature-query/signature-query-format.d.ts +3 -2
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/model.js +6 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +12 -1
- package/reconstruct/reconstruct.js +2 -5
- package/search/search-executor/search-enrichers.js +17 -2
- package/search/search-executor/search-generators.js +6 -2
- package/slicing/static/slice-call.d.ts +16 -0
- package/slicing/static/slice-call.js +42 -0
- package/slicing/static/static-slicer.js +6 -0
- package/util/flowr-version.d.ts +1 -1
- package/util/flowr-version.js +2 -2
|
@@ -161,8 +161,9 @@ export interface SignaturePackageView {
|
|
|
161
161
|
readonly coreVersions?: readonly string[];
|
|
162
162
|
readonly dependencies: readonly SignatureDependencyView[];
|
|
163
163
|
/**
|
|
164
|
-
* The packages that end up on the search path together with this one,
|
|
165
|
-
* mistaken for everything `library(<name>)` brings into
|
|
164
|
+
* The packages that end up on the search path together with this one, its `Depends` and a meta-package's core set,
|
|
165
|
+
* and theirs in turn, so that {@link exportsTotal} is not mistaken for everything `library(<name>)` brings into
|
|
166
|
+
* scope. Only what the database states; the analysis itself answers with `Dataflow.library.attaches`.
|
|
166
167
|
*/
|
|
167
168
|
readonly attaches?: readonly string[];
|
|
168
169
|
readonly functions: readonly SignatureFunctionView[];
|
package/r-bridge/data/data.d.ts
CHANGED
|
@@ -227,8 +227,8 @@ export declare const flowrCapabilities: {
|
|
|
227
227
|
readonly name: "Dynamic Search Path";
|
|
228
228
|
readonly id: "dynamic-search-path";
|
|
229
229
|
readonly code: readonly ["search", "searchpaths"];
|
|
230
|
-
readonly supported: "
|
|
231
|
-
readonly description: "_Programmatically inspecting or mutating the search path with `search()`, `searchpaths()`, or detaching by position._
|
|
230
|
+
readonly supported: "partially";
|
|
231
|
+
readonly description: "_Programmatically inspecting or mutating the search path with `search()`, `searchpaths()`, or detaching by position._ `search()` and `searchpaths()` read every `library`, `attach`, and `detach` before them, and `detach`/`unloadNamespace` remove the entry they name, but `search()` itself is not computed as a value.";
|
|
232
232
|
readonly example: string;
|
|
233
233
|
readonly url: [{
|
|
234
234
|
name: string;
|
package/r-bridge/data/data.js
CHANGED
|
@@ -217,8 +217,8 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true, tim
|
|
|
217
217
|
name: 'Dynamic Search Path',
|
|
218
218
|
id: 'dynamic-search-path',
|
|
219
219
|
code: ['search', 'searchpaths'],
|
|
220
|
-
supported: '
|
|
221
|
-
description: '_Programmatically inspecting or mutating the search path with `search()`, `searchpaths()`, or detaching by position._
|
|
220
|
+
supported: 'partially',
|
|
221
|
+
description: '_Programmatically inspecting or mutating the search path with `search()`, `searchpaths()`, or detaching by position._ `search()` and `searchpaths()` read every `library`, `attach`, and `detach` before them, and `detach`/`unloadNamespace` remove the entry they name, but `search()` itself is not computed as a value.',
|
|
222
222
|
example: (0, doc_code_1.codeBlock)('r', 'library(stats)\nn <- search()\nprint(n[2])'),
|
|
223
223
|
url: [RLang('Search path')]
|
|
224
224
|
},
|
|
@@ -161,6 +161,8 @@ export declare const RLoopConstructs: {
|
|
|
161
161
|
* A set of all types of loop constructs in the normalized AST, i.e. for, repeat and while loops.
|
|
162
162
|
*/
|
|
163
163
|
readonly loopConstructTypes: ReadonlySet<RType>;
|
|
164
|
+
/** Whether `id` may run again in the same frame, as part of a loop not left through a function definition. */
|
|
165
|
+
readonly encloses: <OtherInfo>(this: void, id: NodeId, idMap: AstIdMap<OtherInfo & ParentInformation>) => boolean;
|
|
164
166
|
};
|
|
165
167
|
/**
|
|
166
168
|
* As an extension to {@link RLoopConstructs}, this subtype of {@link RNode} includes
|
|
@@ -61,7 +61,12 @@ exports.RLoopConstructs = {
|
|
|
61
61
|
/**
|
|
62
62
|
* A set of all types of loop constructs in the normalized AST, i.e. for, repeat and while loops.
|
|
63
63
|
*/
|
|
64
|
-
loopConstructTypes: new Set([type_1.RType.ForLoop, type_1.RType.RepeatLoop, type_1.RType.WhileLoop])
|
|
64
|
+
loopConstructTypes: new Set([type_1.RType.ForLoop, type_1.RType.RepeatLoop, type_1.RType.WhileLoop]),
|
|
65
|
+
/** Whether `id` may run again in the same frame, as part of a loop not left through a function definition. */
|
|
66
|
+
encloses(id, idMap) {
|
|
67
|
+
const enclosing = exports.RNode.findEnclosing(id, idMap, n => r_function_definition_1.RFunctionDefinition.is(n) || exports.RLoopConstructs.is(n));
|
|
68
|
+
return enclosing !== undefined && !r_function_definition_1.RFunctionDefinition.is(idMap.get(enclosing));
|
|
69
|
+
}
|
|
65
70
|
};
|
|
66
71
|
/**
|
|
67
72
|
* Helper for working with {@link RConstructs} AST nodes.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { AstIdMap } from './decorate';
|
|
1
|
+
import type { AstIdMap, ParentInformation } from './decorate';
|
|
2
2
|
import type { DataflowGraph } from '../../../../../dataflow/graph/graph';
|
|
3
|
+
import { RNode } from '../model';
|
|
3
4
|
import type { BuiltInProcName } from '../../../../../dataflow/environments/built-in-proc-name';
|
|
4
5
|
/**
|
|
5
6
|
* The type of the id assigned to each node. Branded to avoid problematic usages with other string or numeric types.
|
|
@@ -85,6 +86,10 @@ export declare const NodeId: {
|
|
|
85
86
|
* @see {@link NodeId.recoverContent} - for what a call or a use stands for rather than how it is written
|
|
86
87
|
*/
|
|
87
88
|
readonly recoverName: (this: void, id: NodeId, idMap?: AstIdMap) => string | undefined;
|
|
89
|
+
/** The id of the call the dataflow graph makes up for an anonymous function a call runs (`lapply(x, function(v) v)`, a `tryCatch` handler). */
|
|
90
|
+
readonly anonymousCall: (this: void, functionId: NodeId) => NodeId;
|
|
91
|
+
/** The node `id` belongs to; for a made-up {@link NodeId.anonymousCall} the anonymous function it calls. */
|
|
92
|
+
readonly nodeOf: <Info>(this: void, id: NodeId, idMap: AstIdMap<Info> | undefined) => RNode<Info & ParentInformation> | undefined;
|
|
88
93
|
/**
|
|
89
94
|
* The name the {@link RNode|node} the id belongs to binds or reads, without the backticks or quotes R lets it be
|
|
90
95
|
* written in (`"x"` and `x` in backticks both name `x`), which is how the environments know it.
|
|
@@ -11,6 +11,8 @@ function startsNumeric(id) {
|
|
|
11
11
|
const c = id.charCodeAt(0);
|
|
12
12
|
return c >= 48 && c <= 57 /* 0-9 */ || c === 45 /* - */ || c === 43 /* + */ || c === 46;
|
|
13
13
|
}
|
|
14
|
+
/** see {@link NodeId.anonymousCall} */
|
|
15
|
+
const AnonymousCallPrefix = 'anon-';
|
|
14
16
|
/**
|
|
15
17
|
* What a {@link NodeId} is: the identity of a node within one analysis, plus the built-in and `pkg::fn`
|
|
16
18
|
* names encoded as one, and the ways to read a name back out of it.
|
|
@@ -116,7 +118,16 @@ exports.NodeId = {
|
|
|
116
118
|
* @see {@link NodeId.recoverContent} - for what a call or a use stands for rather than how it is written
|
|
117
119
|
*/
|
|
118
120
|
recoverName(id, idMap) {
|
|
119
|
-
return
|
|
121
|
+
return exports.NodeId.nodeOf(id, idMap)?.lexeme;
|
|
122
|
+
},
|
|
123
|
+
/** The id of the call the dataflow graph makes up for an anonymous function a call runs (`lapply(x, function(v) v)`, a `tryCatch` handler). */
|
|
124
|
+
anonymousCall(functionId) {
|
|
125
|
+
return AnonymousCallPrefix + String(functionId);
|
|
126
|
+
},
|
|
127
|
+
/** The node `id` belongs to; for a made-up {@link NodeId.anonymousCall} the anonymous function it calls. */
|
|
128
|
+
nodeOf(id, idMap) {
|
|
129
|
+
const node = idMap?.get(id);
|
|
130
|
+
return node !== undefined || typeof id !== 'string' || !id.startsWith(AnonymousCallPrefix) ? node : idMap?.get(exports.NodeId.normalize(id.slice(AnonymousCallPrefix.length)));
|
|
120
131
|
},
|
|
121
132
|
/**
|
|
122
133
|
* The name the {@link RNode|node} the id belongs to binds or reads, without the backticks or quotes R lets it be
|
|
@@ -402,11 +402,8 @@ function reconstructFunctionCall(call, functionName, args, configuration) {
|
|
|
402
402
|
}
|
|
403
403
|
if (!selected) {
|
|
404
404
|
const f = args.filter(a => a !== r_function_call_1.EmptyArgument && a.length !== 0);
|
|
405
|
-
if (f.length === 0) {
|
|
406
|
-
return
|
|
407
|
-
}
|
|
408
|
-
else if (f.length === 1) {
|
|
409
|
-
return f[0];
|
|
405
|
+
if (f.length <= 1 || (call.infixSpecial !== true && functionName.length === 0)) {
|
|
406
|
+
return f.flat();
|
|
410
407
|
}
|
|
411
408
|
}
|
|
412
409
|
if (call.infixSpecial === true) {
|
|
@@ -13,6 +13,11 @@ const identify_link_to_last_call_relation_1 = require("../../queries/catalog/cal
|
|
|
13
13
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
14
14
|
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
15
15
|
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
16
|
+
/** The search element of the node `id` belongs to (see {@link NodeId.nodeOf}), `undefined` if there is none. */
|
|
17
|
+
function elementOf(id, idMap) {
|
|
18
|
+
const node = node_id_1.NodeId.nodeOf(id, idMap);
|
|
19
|
+
return node === undefined ? undefined : { node };
|
|
20
|
+
}
|
|
16
21
|
/**
|
|
17
22
|
* An enumeration that stores the names of the available enrichments that can be applied to a set of search elements.
|
|
18
23
|
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
@@ -44,6 +49,13 @@ function collectAliveNodes(ast, reachable) {
|
|
|
44
49
|
alive.add(node.info.id);
|
|
45
50
|
}
|
|
46
51
|
}
|
|
52
|
+
/* a node the analysis made up for a call (the variables `load` restores) is no code of its own, it runs with the call */
|
|
53
|
+
for (const [id, node] of ast.idMap) {
|
|
54
|
+
const parent = node.info.parent === undefined || !alive.has(node.info.parent) ? undefined : ast.idMap.get(node.info.parent);
|
|
55
|
+
if (parent !== undefined && !alive.has(id) && !model_1.RNode.directChildren(parent).includes(node)) {
|
|
56
|
+
alive.add(id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
47
59
|
return alive;
|
|
48
60
|
}
|
|
49
61
|
/**
|
|
@@ -132,7 +144,7 @@ exports.Enrichments = {
|
|
|
132
144
|
// user-code node, so surface it as a built-in identifier (see `onlyBuiltin` above)
|
|
133
145
|
return qualifyIdentifier([o], node_id_1.NodeId.recoverName(o.id, n.idMap)) ?? String(o.id);
|
|
134
146
|
}
|
|
135
|
-
return
|
|
147
|
+
return elementOf(o.id, n.idMap);
|
|
136
148
|
case 3 /* OriginType.BuiltInFunctionOrigin */: {
|
|
137
149
|
/* an alias (`s <- system; s()`) calls the built-in it is linked to rather than its own name */
|
|
138
150
|
const linked = node_id_1.NodeId.isBuiltIn(o.proc) ? node_id_1.NodeId.toPkgFn(o.proc)?.[1] ?? node_id_1.NodeId.fromBuiltIn(o.proc) : undefined;
|
|
@@ -177,7 +189,10 @@ exports.Enrichments = {
|
|
|
177
189
|
type: 'link-to-last-call',
|
|
178
190
|
});
|
|
179
191
|
for (const lastCall of lastCalls) {
|
|
180
|
-
|
|
192
|
+
const linked = elementOf(lastCall, n.idMap);
|
|
193
|
+
if (linked !== undefined) {
|
|
194
|
+
content.linkedIds.push(linked);
|
|
195
|
+
}
|
|
181
196
|
}
|
|
182
197
|
}
|
|
183
198
|
}
|
|
@@ -4,6 +4,7 @@ exports.generators = exports.searchLogger = void 0;
|
|
|
4
4
|
exports.getGenerator = getGenerator;
|
|
5
5
|
const flowr_search_1 = require("../flowr-search");
|
|
6
6
|
const parse_1 = require("../../slicing/criterion/parse");
|
|
7
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
7
8
|
const assert_1 = require("../../util/assert");
|
|
8
9
|
const range_1 = require("../../util/range");
|
|
9
10
|
const query_1 = require("../../queries/query");
|
|
@@ -90,8 +91,11 @@ async function generateFromQuery(input, args) {
|
|
|
90
91
|
}
|
|
91
92
|
const nodes = new Set();
|
|
92
93
|
const queryDef = query_1.SupportedQueries[query];
|
|
93
|
-
for (const
|
|
94
|
-
|
|
94
|
+
for (const id of (queryDef.flattenInvolvedNodes?.(content, args.from, args.certainty) ?? [])) {
|
|
95
|
+
const node = node_id_1.NodeId.nodeOf(id, idMap);
|
|
96
|
+
if (node !== undefined) {
|
|
97
|
+
nodes.add({ node });
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
100
|
nodesByQuery.set(query, nodes);
|
|
97
101
|
}
|
|
@@ -8,6 +8,7 @@ import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
|
8
8
|
import type { DataflowInformation } from '../../dataflow/info';
|
|
9
9
|
import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
10
10
|
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
11
|
+
import { FnSig } from '../../dataflow/environments/built-in-props';
|
|
11
12
|
/**
|
|
12
13
|
* Returns the function call targets (definitions) by the given caller
|
|
13
14
|
*/
|
|
@@ -33,3 +34,18 @@ export declare function sliceReachesFunctionInterface(fnDefId: NodeId, graph: Da
|
|
|
33
34
|
export declare function includeCalleesOfDefinition(fnDefId: NodeId, graph: DataflowGraph, queue: VisitingQueue, baseEnvironment: REnvironmentInformation, baseEnvFingerprint: Fingerprint): NodeId[];
|
|
34
35
|
/** Returns true if we found at least one return edge */
|
|
35
36
|
export declare function handleReturns(from: NodeId, queue: VisitingQueue, currentEdges: ReadonlyOutgoingEdges, baseEnvFingerprint: Fingerprint, baseEnvironment: REnvironmentInformation): boolean;
|
|
37
|
+
/** What decides whether a call runs code elsewhere: the role of each argument, and whether it evaluates code (`eval`) at all. */
|
|
38
|
+
interface DeferringInfo {
|
|
39
|
+
readonly sig?: FnSig;
|
|
40
|
+
readonly evaluates: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The built-in call that decides when, where or whether the code at `id` runs: the closest call it is an argument
|
|
44
|
+
* of that quotes it or calls it (`on.exit(expr)`, `do.call("f", args)`, `delayedAssign(x, expr)`), up to the
|
|
45
|
+
* function it is defined in. Without that call, the code would run in the order of the caller. A call capturing
|
|
46
|
+
* its argument for another call to evaluate is left to the evaluation of captured code, as that one drops it
|
|
47
|
+
* where the captured code is run in place.
|
|
48
|
+
* @param sigs - the signatures of the calls met on the way, filled as they are asked for
|
|
49
|
+
*/
|
|
50
|
+
export declare function deferringCall(id: NodeId, info: DataflowInformation, idMap: AstIdMap, sigs: Map<NodeId, DeferringInfo>): NodeId | undefined;
|
|
51
|
+
export {};
|
|
@@ -5,6 +5,7 @@ exports.sliceForCall = sliceForCall;
|
|
|
5
5
|
exports.sliceReachesFunctionInterface = sliceReachesFunctionInterface;
|
|
6
6
|
exports.includeCalleesOfDefinition = includeCalleesOfDefinition;
|
|
7
7
|
exports.handleReturns = handleReturns;
|
|
8
|
+
exports.deferringCall = deferringCall;
|
|
8
9
|
const assert_1 = require("../../util/assert");
|
|
9
10
|
const fingerprint_1 = require("./fingerprint");
|
|
10
11
|
const linker_1 = require("../../dataflow/internal/linker");
|
|
@@ -19,6 +20,11 @@ const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
|
19
20
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
20
21
|
const built_in_proc_name_1 = require("../../dataflow/environments/built-in-proc-name");
|
|
21
22
|
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
23
|
+
const built_in_props_1 = require("../../dataflow/environments/built-in-props");
|
|
24
|
+
const query_fn_props_1 = require("../../dataflow/environments/query-fn-props");
|
|
25
|
+
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
26
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
27
|
+
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
22
28
|
const NoCallTargets = new Set();
|
|
23
29
|
const linkedByGraph = new WeakMap();
|
|
24
30
|
function linkedFunctionsOf(defs, graph) {
|
|
@@ -163,4 +169,40 @@ function handleReturns(from, queue, currentEdges, baseEnvFingerprint, baseEnviro
|
|
|
163
169
|
}
|
|
164
170
|
return true;
|
|
165
171
|
}
|
|
172
|
+
/** What a call states of an argument it does not evaluate where and when it stands: quoted, or called as a function. */
|
|
173
|
+
const RunsElsewhere = built_in_props_1.ArgProp.Nse | built_in_props_1.ArgProp.Callee;
|
|
174
|
+
/** A promise the call does not force may run any number of times, or never, as with `replicate(n, expr)`. */
|
|
175
|
+
function runsElsewhere(prop) {
|
|
176
|
+
return (prop & RunsElsewhere) !== 0 || (prop & (built_in_props_1.ArgProp.Value | built_in_props_1.ArgProp.Forced)) === built_in_props_1.ArgProp.Value;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The built-in call that decides when, where or whether the code at `id` runs: the closest call it is an argument
|
|
180
|
+
* of that quotes it or calls it (`on.exit(expr)`, `do.call("f", args)`, `delayedAssign(x, expr)`), up to the
|
|
181
|
+
* function it is defined in. Without that call, the code would run in the order of the caller. A call capturing
|
|
182
|
+
* its argument for another call to evaluate is left to the evaluation of captured code, as that one drops it
|
|
183
|
+
* where the captured code is run in place.
|
|
184
|
+
* @param sigs - the signatures of the calls met on the way, filled as they are asked for
|
|
185
|
+
*/
|
|
186
|
+
function deferringCall(id, info, idMap, sigs) {
|
|
187
|
+
for (let child = idMap.get(id), parent = child && model_1.RNode.directParent(child, idMap); child !== undefined && parent !== undefined && !r_function_definition_1.RFunctionDefinition.is(parent); child = parent, parent = model_1.RNode.directParent(parent, idMap)) {
|
|
188
|
+
if (!r_argument_1.RArgument.is(child) || !r_function_call_1.RFunctionCall.is(parent)) {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
const call = parent.info.id;
|
|
192
|
+
let known = sigs.get(call);
|
|
193
|
+
if (known === undefined) {
|
|
194
|
+
const props = (0, query_fn_props_1.callFnProps)(call, info);
|
|
195
|
+
known = { sig: props?.sig, evaluates: props?.tags?.includes(built_in_props_1.SemanticCallTag.Eval) === true };
|
|
196
|
+
sigs.set(call, known);
|
|
197
|
+
}
|
|
198
|
+
/* quoted code the dataflow evaluates in place needs neither the quote nor the evaluating call */
|
|
199
|
+
if (vertex_1.DfgVertex.hasOrigin(info.graph.getVertex(call), built_in_proc_name_1.BuiltInProcName.Quote)) {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
if (known.evaluates || (known.sig !== undefined && runsElsewhere(built_in_props_1.FnSig.propAt(built_in_props_1.FnSig.layout(known.sig), parent.arguments.indexOf(child))))) {
|
|
203
|
+
return call;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
166
208
|
//# sourceMappingURL=slice-call.js.map
|
|
@@ -45,6 +45,7 @@ function staticSlice(options) {
|
|
|
45
45
|
const basePrint = ctx.env.getCleanEnvFingerprint();
|
|
46
46
|
const queue = new visiting_queue_1.VisitingQueue(options.threshold ?? 75, cache, graph, ctx.gas.scope(options.gas), [emptyEnv, basePrint]);
|
|
47
47
|
const enclosingHandled = new Set();
|
|
48
|
+
const callSigs = new Map();
|
|
48
49
|
/* the unknown side effects every slice keeps are seeds as well, so what they reach is not cut off as running too late */
|
|
49
50
|
const effects = [...graph.unknownSideEffects].filter((id) => typeof id !== 'object');
|
|
50
51
|
const missesSeeds = sliceGraph === undefined ? outsideSeedRun([...ids, ...effects], idMap, direction, graph) : undefined;
|
|
@@ -119,6 +120,11 @@ function staticSlice(options) {
|
|
|
119
120
|
queue.add(cd.id, baseEnvironment, baseEnvFingerprint, false);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
123
|
+
/* code a call quotes or calls runs where and when that call says, so the call stays with it */
|
|
124
|
+
const deferring = (0, slice_call_1.deferringCall)(id, info, idMap, callSigs);
|
|
125
|
+
if (deferring !== undefined) {
|
|
126
|
+
enqueue(deferring, baseEnvironment, baseEnvFingerprint);
|
|
127
|
+
}
|
|
122
128
|
/* a call or a definition within a promise runs only when the promise is forced, within captured code only when it is evaluated */
|
|
123
129
|
if (vertex_1.DfgVertex.isFunctionCall(currentVertex) || vertex_1.DfgVertex.isVariableDefinition(currentVertex)) {
|
|
124
130
|
const dependencies = function_semantics_1.FunctionSemantics.promiseDependencies(id, graph);
|
package/util/flowr-version.d.ts
CHANGED
package/util/flowr-version.js
CHANGED
|
@@ -8,9 +8,9 @@ exports.flowrVersion = flowrVersion;
|
|
|
8
8
|
*/
|
|
9
9
|
const semver_1 = require("semver");
|
|
10
10
|
// this is automatically replaced with the current version by release-it
|
|
11
|
-
const version = '2.17.
|
|
11
|
+
const version = '2.17.2';
|
|
12
12
|
// this is automatically replaced with the release date by release-it (scripts/bump-version.ts)
|
|
13
|
-
exports.versionDate = '2026-11-
|
|
13
|
+
exports.versionDate = '2026-11-05T14:04:12Z';
|
|
14
14
|
/**
|
|
15
15
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
16
16
|
*/
|