@eagleoutice/flowr 2.8.6 → 2.8.8
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 +20 -20
- package/abstract-interpretation/absint-visitor.d.ts +20 -68
- package/abstract-interpretation/absint-visitor.js +44 -54
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +0 -9
- package/abstract-interpretation/data-frame/dataframe-domain.js +1 -14
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +1 -1
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +2 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +5 -2
- package/abstract-interpretation/data-frame/shape-inference.d.ts +15 -7
- package/abstract-interpretation/data-frame/shape-inference.js +20 -17
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/abstract-domain.js +1 -2
- package/abstract-interpretation/domains/product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/product-domain.js +1 -1
- package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +3 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +6 -0
- package/abstract-interpretation/normalized-ast-fold.d.ts +2 -1
- package/abstract-interpretation/normalized-ast-fold.js +8 -1
- package/cli/repl/commands/repl-query.js +7 -9
- package/cli/wiki.d.ts +2 -1
- package/cli/wiki.js +2 -0
- package/control-flow/cfg-dead-code.js +3 -0
- package/control-flow/extract-cfg.js +27 -7
- package/control-flow/semantic-cfg-guided-visitor.d.ts +57 -4
- package/control-flow/semantic-cfg-guided-visitor.js +89 -28
- package/control-flow/useless-loop.d.ts +2 -1
- package/control-flow/useless-loop.js +13 -6
- package/dataflow/environments/built-in-config.d.ts +6 -5
- package/dataflow/environments/built-in.d.ts +107 -34
- package/dataflow/environments/built-in.js +115 -39
- package/dataflow/environments/default-builtin-config.d.ts +113 -67
- package/dataflow/environments/default-builtin-config.js +71 -66
- package/dataflow/environments/diff.js +2 -2
- package/dataflow/environments/environment.js +7 -7
- package/dataflow/environments/identifier.d.ts +4 -2
- package/dataflow/environments/identifier.js +2 -0
- package/dataflow/environments/reference-to-maybe.d.ts +2 -2
- package/dataflow/environments/reference-to-maybe.js +11 -11
- package/dataflow/environments/resolve-by-name.js +17 -6
- package/dataflow/eval/resolve/alias-tracking.js +1 -1
- package/dataflow/eval/resolve/resolve.js +6 -6
- package/dataflow/eval/values/intervals/interval-constants.js +3 -3
- package/dataflow/eval/values/scalar/{scalar-consatnts.d.ts → scalar-constants.d.ts} +2 -2
- package/dataflow/eval/values/scalar/{scalar-consatnts.js → scalar-constants.js} +3 -3
- package/dataflow/eval/values/sets/set-constants.d.ts +4 -2
- package/dataflow/eval/values/sets/set-constants.js +4 -2
- package/dataflow/extractor.js +1 -1
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/exceptions-of-function.js +3 -3
- package/dataflow/graph/call-graph.js +2 -2
- package/dataflow/graph/dataflowgraph-builder.d.ts +4 -4
- package/dataflow/graph/dataflowgraph-builder.js +14 -14
- package/dataflow/graph/diff-dataflow-graph.js +3 -3
- package/dataflow/graph/graph.d.ts +1 -1
- package/dataflow/graph/graph.js +4 -4
- package/dataflow/graph/vertex.d.ts +3 -3
- package/dataflow/info.d.ts +3 -3
- package/dataflow/info.js +11 -11
- package/dataflow/internal/linker.d.ts +9 -0
- package/dataflow/internal/linker.js +33 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +16 -12
- 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 +11 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +11 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +0 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +39 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +12 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +36 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +18 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +67 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +18 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +103 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +8 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +13 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +7 -6
- package/dataflow/internal/process/functions/call/common.js +7 -7
- package/dataflow/internal/process/functions/call/known-call-handling.js +7 -8
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -2
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -6
- package/dataflow/internal/process/functions/process-argument.js +2 -2
- package/dataflow/internal/process/functions/process-parameter.js +3 -3
- package/dataflow/internal/process/process-symbol.js +3 -3
- package/dataflow/internal/process/process-uninteresting-leaf.d.ts +3 -1
- package/dataflow/internal/process/process-uninteresting-leaf.js +3 -1
- package/dataflow/internal/process/process-value.d.ts +1 -1
- package/dataflow/internal/process/process-value.js +4 -4
- package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
- package/dataflow/processor.d.ts +1 -1
- package/documentation/doc-util/doc-structure.js +1 -1
- package/documentation/doc-util/doc-types.d.ts +10 -3
- package/documentation/doc-util/doc-types.js +110 -33
- package/documentation/wiki-absint.d.ts +6 -0
- package/documentation/wiki-absint.js +149 -0
- package/documentation/wiki-dataflow-graph.js +11 -10
- package/documentation/wiki-interface.js +2 -1
- package/documentation/wiki-mk/doc-context.d.ts +3 -3
- package/documentation/wiki-mk/doc-context.js +2 -2
- package/documentation/wiki-mk/doc-maker.js +2 -2
- package/documentation/wiki-normalized-ast.d.ts +9 -0
- package/documentation/wiki-normalized-ast.js +40 -52
- package/linter/linter-rules.d.ts +1 -1
- package/linter/rules/seeded-randomness.js +5 -4
- package/linter/rules/useless-loop.d.ts +3 -3
- package/package.json +3 -3
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +4 -0
- package/queries/catalog/dependencies-query/dependencies-query-format.js +5 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +82 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +3 -2
- package/queries/catalog/df-shape-query/df-shape-query-format.js +3 -3
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +1 -1
- package/r-bridge/data/data.d.ts +6 -1
- package/r-bridge/data/data.js +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +7 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +19 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +7 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +2 -1
- package/r-bridge/lang-4.x/convert-values.d.ts +5 -0
- package/search/flowr-search-filters.d.ts +2 -2
- package/slicing/static/static-slicer.js +2 -2
- package/util/mermaid/cfg.d.ts +10 -3
- package/util/mermaid/cfg.js +39 -10
- package/util/mermaid/dfg.js +5 -5
- package/util/simple-df/dfg-view.js +1 -1
- package/util/text/ansi.d.ts +4 -0
- package/util/text/ansi.js +7 -0
- package/util/version.js +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type Lift, type Value, type ValueSet, Top } from '../r-value';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a value set from the given elements.
|
|
4
|
+
* @see {@link isSet} - to check whether a value is a set
|
|
4
5
|
*/
|
|
5
6
|
export declare function setFrom<V extends Value[]>(...elements: V): Lift<ValueSet<Value[]>>;
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Checks, whether the given value is a set.
|
|
9
|
+
* @see {@link setFrom} - to create sets
|
|
8
10
|
*/
|
|
9
11
|
export declare function isSet<V extends Value>(element: V): boolean;
|
|
10
12
|
export declare const ValueEmptySet: Lift<ValueSet<Value[]>>;
|
|
@@ -11,7 +11,8 @@ function flattenSetElements(s) {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Creates a value set from the given elements.
|
|
15
|
+
* @see {@link isSet} - to check whether a value is a set
|
|
15
16
|
*/
|
|
16
17
|
function setFrom(...elements) {
|
|
17
18
|
const vals = elements.flatMap(e => {
|
|
@@ -23,7 +24,8 @@ function setFrom(...elements) {
|
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
+
* Checks, whether the given value is a set.
|
|
28
|
+
* @see {@link setFrom} - to create sets
|
|
27
29
|
*/
|
|
28
30
|
function isSet(element) {
|
|
29
31
|
return element.type === 'set';
|
package/dataflow/extractor.js
CHANGED
|
@@ -114,7 +114,7 @@ function produceDataFlowGraph(parser, completeAst, ctx) {
|
|
|
114
114
|
completeAst,
|
|
115
115
|
environment: ctx.env.makeCleanEnv(),
|
|
116
116
|
processors: ctx.config.solver.instrument.dataflowExtractors?.(exports.processors, ctx) ?? exports.processors,
|
|
117
|
-
|
|
117
|
+
cds: undefined,
|
|
118
118
|
referenceChain: [files[0].filePath],
|
|
119
119
|
ctx
|
|
120
120
|
};
|
|
@@ -3,7 +3,7 @@ import type { CallGraph } from '../graph/call-graph';
|
|
|
3
3
|
import type { ControlDependency } from '../info';
|
|
4
4
|
export interface ExceptionPoint {
|
|
5
5
|
id: NodeId;
|
|
6
|
-
cds?: readonly ControlDependency[]
|
|
6
|
+
cds?: readonly ControlDependency[];
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Collect exception sources of a function in the call graph.
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.calculateExceptionsOfFunction = calculateExceptionsOfFunction;
|
|
4
4
|
const vertex_1 = require("../graph/vertex");
|
|
5
5
|
const built_in_1 = require("../environments/built-in");
|
|
6
|
-
const CatchHandlers = new Set([
|
|
6
|
+
const CatchHandlers = new Set([built_in_1.BuiltInProcName.Try]);
|
|
7
7
|
/**
|
|
8
8
|
* Collect exception sources of a function in the call graph.
|
|
9
9
|
* This returns the `NodeId`s of functions that may throw exceptions when called by the given function.
|
|
@@ -28,8 +28,8 @@ function calculateExceptionsOfFunction(id, graph) {
|
|
|
28
28
|
}
|
|
29
29
|
if (vtx.tag === vertex_1.VertexType.FunctionDefinition) {
|
|
30
30
|
for (const e of vtx.exitPoints.filter(e => e.type === 4 /* ExitPointType.Error */)) {
|
|
31
|
-
if (!collectedExceptions.
|
|
32
|
-
collectedExceptions.push({ id: e.nodeId, cds: e.
|
|
31
|
+
if (!collectedExceptions.some(x => x.id === e.nodeId)) {
|
|
32
|
+
collectedExceptions.push({ id: e.nodeId, cds: e.cds });
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -95,7 +95,7 @@ function computeCallGraph(graph) {
|
|
|
95
95
|
return result;
|
|
96
96
|
}
|
|
97
97
|
function processCds(vtx, graph, result, state) {
|
|
98
|
-
for (const tar of vtx.
|
|
98
|
+
for (const tar of vtx.cds ?? []) {
|
|
99
99
|
const targetVtx = graph.getVertex(tar.id, true);
|
|
100
100
|
if (targetVtx) {
|
|
101
101
|
processUnknown(targetVtx, undefined, graph, result, state);
|
|
@@ -186,7 +186,7 @@ function processCall(vtx, from, graph, result, state) {
|
|
|
186
186
|
tag: vertex_1.VertexType.FunctionCall,
|
|
187
187
|
name: name.lexeme,
|
|
188
188
|
onlyBuiltin: false,
|
|
189
|
-
origin: [
|
|
189
|
+
origin: [built_in_1.BuiltInProcName.Function],
|
|
190
190
|
args: []
|
|
191
191
|
}, oriVtx.environment);
|
|
192
192
|
}
|
|
@@ -37,7 +37,7 @@ export declare class DataflowGraphBuilder<Vertex extends DataflowGraphVertexInfo
|
|
|
37
37
|
}, info?: {
|
|
38
38
|
environment?: REnvironmentInformation;
|
|
39
39
|
builtInEnvironment?: IEnvironment;
|
|
40
|
-
|
|
40
|
+
cds?: ControlDependency[];
|
|
41
41
|
readParams?: [NodeId, boolean][];
|
|
42
42
|
}, asRoot?: boolean): this;
|
|
43
43
|
/**
|
|
@@ -55,7 +55,7 @@ export declare class DataflowGraphBuilder<Vertex extends DataflowGraphVertexInfo
|
|
|
55
55
|
onlyBuiltIn?: boolean;
|
|
56
56
|
environment?: REnvironmentInformation;
|
|
57
57
|
builtInEnvironment?: IEnvironment;
|
|
58
|
-
|
|
58
|
+
cds?: ControlDependency[];
|
|
59
59
|
origin?: FunctionOriginInformation[];
|
|
60
60
|
link?: DataflowGraphVertexAstLink;
|
|
61
61
|
omitArgs?: boolean;
|
|
@@ -71,7 +71,7 @@ export declare class DataflowGraphBuilder<Vertex extends DataflowGraphVertexInfo
|
|
|
71
71
|
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
72
72
|
*/
|
|
73
73
|
defineVariable(id: NodeId, name?: string, info?: {
|
|
74
|
-
|
|
74
|
+
cds?: ControlDependency[];
|
|
75
75
|
definedBy?: NodeId[];
|
|
76
76
|
}, asRoot?: boolean): this;
|
|
77
77
|
/**
|
|
@@ -91,7 +91,7 @@ export declare class DataflowGraphBuilder<Vertex extends DataflowGraphVertexInfo
|
|
|
91
91
|
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
92
92
|
*/
|
|
93
93
|
constant(id: NodeId, options?: {
|
|
94
|
-
|
|
94
|
+
cds?: ControlDependency[];
|
|
95
95
|
}, asRoot?: boolean): this;
|
|
96
96
|
private edgeHelper;
|
|
97
97
|
private queryHelper;
|
|
@@ -54,14 +54,14 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
54
54
|
...subflow,
|
|
55
55
|
entryPoint: (0, node_id_1.normalizeIdToNumberIfPossible)(subflow.entryPoint),
|
|
56
56
|
graph: new Set([...subflow.graph].map(node_id_1.normalizeIdToNumberIfPossible)),
|
|
57
|
-
out: subflow.out.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId),
|
|
58
|
-
in: subflow.in.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId),
|
|
59
|
-
unknownReferences: subflow.unknownReferences.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId),
|
|
57
|
+
out: subflow.out.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId), cds: o.cds?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) })),
|
|
58
|
+
in: subflow.in.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId), cds: o.cds?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) })),
|
|
59
|
+
unknownReferences: subflow.unknownReferences.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId), cds: o.cds?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) })),
|
|
60
60
|
hooks: subflow.hooks ?? []
|
|
61
61
|
},
|
|
62
|
-
exitPoints: exitPoints.map(e => typeof e === 'object' ? ({ ...e, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(e.nodeId),
|
|
63
|
-
({ nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(e), type: 0 /* ExitPointType.Default */,
|
|
64
|
-
|
|
62
|
+
exitPoints: exitPoints.map(e => typeof e === 'object' ? ({ ...e, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(e.nodeId), cds: e.cds?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) }) :
|
|
63
|
+
({ nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(e), type: 0 /* ExitPointType.Default */, cds: undefined })),
|
|
64
|
+
cds: info?.cds?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
|
|
65
65
|
environment: info?.environment,
|
|
66
66
|
}, asRoot);
|
|
67
67
|
}
|
|
@@ -80,11 +80,11 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
80
80
|
tag: vertex_1.VertexType.FunctionCall,
|
|
81
81
|
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
82
82
|
name,
|
|
83
|
-
args: args.map(a => a === r_function_call_1.EmptyArgument ? r_function_call_1.EmptyArgument : { ...a, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(a.nodeId),
|
|
83
|
+
args: args.map(a => a === r_function_call_1.EmptyArgument ? r_function_call_1.EmptyArgument : { ...a, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(a.nodeId), cds: undefined }),
|
|
84
84
|
environment: (info?.onlyBuiltIn || onlyBuiltInAuto) ? undefined : info?.environment ?? this.defaultEnvironment,
|
|
85
|
-
|
|
85
|
+
cds: info?.cds?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
|
|
86
86
|
onlyBuiltin: info?.onlyBuiltIn ?? onlyBuiltInAuto ?? false,
|
|
87
|
-
origin: info?.origin ?? [(0, default_builtin_config_1.getDefaultProcessor)(name) ??
|
|
87
|
+
origin: info?.origin ?? [(0, default_builtin_config_1.getDefaultProcessor)(name) ?? built_in_1.BuiltInProcName.Function],
|
|
88
88
|
link: info?.link
|
|
89
89
|
}, asRoot);
|
|
90
90
|
if (!info?.omitArgs) {
|
|
@@ -116,7 +116,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
else if (!this.hasVertex(arg.nodeId, true)) {
|
|
119
|
-
this.use(arg.nodeId, arg.name, { cds: arg.
|
|
119
|
+
this.use(arg.nodeId, arg.name, { cds: arg.cds });
|
|
120
120
|
this.argument(id, arg.nodeId);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -134,7 +134,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
134
134
|
tag: vertex_1.VertexType.VariableDefinition,
|
|
135
135
|
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
136
136
|
name,
|
|
137
|
-
|
|
137
|
+
cds: info?.cds?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
|
|
138
138
|
}, asRoot);
|
|
139
139
|
if (info?.definedBy) {
|
|
140
140
|
for (const def of info.definedBy) {
|
|
@@ -156,11 +156,11 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
156
156
|
tag: vertex_1.VertexType.Use,
|
|
157
157
|
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
158
158
|
name,
|
|
159
|
-
|
|
159
|
+
cds: undefined,
|
|
160
160
|
environment: undefined
|
|
161
161
|
}, {
|
|
162
162
|
...info,
|
|
163
|
-
|
|
163
|
+
cds: info?.cds?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) }))
|
|
164
164
|
}), asRoot);
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
@@ -174,7 +174,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
174
174
|
return this.addVertexWithDefaultEnv({
|
|
175
175
|
tag: vertex_1.VertexType.Value,
|
|
176
176
|
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
177
|
-
|
|
177
|
+
cds: options?.cds?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
|
|
178
178
|
environment: undefined
|
|
179
179
|
}, asRoot);
|
|
180
180
|
}
|
|
@@ -130,7 +130,7 @@ function diffFunctionArguments(fn, a, b, ctx) {
|
|
|
130
130
|
if (aArg.name !== bArg.name) {
|
|
131
131
|
ctx.report.addComment(`${ctx.position}In argument #${i} (of ${ctx.leftname}, unnamed) the name differs: ${aArg.name} vs ${bArg.name}.`);
|
|
132
132
|
}
|
|
133
|
-
(0, info_1.diffControlDependencies)(aArg.
|
|
133
|
+
(0, info_1.diffControlDependencies)(aArg.cds, bArg.cds, { ...ctx, position: `${ctx.position}In argument #${i} (of ${ctx.leftname}, unnamed) the control dependency differs: ${JSON.stringify(aArg.cds)} vs ${JSON.stringify(bArg.cds)}.` });
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
}
|
|
@@ -168,7 +168,7 @@ function diffVertices(ctx) {
|
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
(0, info_1.diffControlDependencies)(lInfo.
|
|
171
|
+
(0, info_1.diffControlDependencies)(lInfo.cds, rInfo.cds, { ...ctx, position: `Vertex ${id} differs in cds. ` });
|
|
172
172
|
if (lInfo.origin !== undefined || rInfo.origin !== undefined) {
|
|
173
173
|
// compare arrays
|
|
174
174
|
const equalArrays = lInfo.origin && rInfo.origin && (0, arrays_1.arrayEqual)(lInfo.origin, rInfo.origin);
|
|
@@ -216,7 +216,7 @@ function diffVertices(ctx) {
|
|
|
216
216
|
if (a.type !== b.type || a.nodeId !== b.nodeId) {
|
|
217
217
|
return false;
|
|
218
218
|
}
|
|
219
|
-
(0, info_1.diffControlDependencies)(a.
|
|
219
|
+
(0, info_1.diffControlDependencies)(a.cds, b.cds, { ...ctx, position: '' });
|
|
220
220
|
return true;
|
|
221
221
|
})) {
|
|
222
222
|
ctx.report.addComment(`Vertex ${id} differs in exit points. ${ctx.leftname}: ${JSON.stringify(lInfo.exitPoints, json_1.jsonReplacer)} vs ${ctx.rightname}: ${JSON.stringify(rInfo.exitPoints, json_1.jsonReplacer)}`, { tag: 'vertex', id });
|
|
@@ -105,7 +105,7 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
105
105
|
private vertexInformation;
|
|
106
106
|
/** All edges in the complete graph (including those nested in function definition) */
|
|
107
107
|
private edgeInformation;
|
|
108
|
-
private types;
|
|
108
|
+
private readonly types;
|
|
109
109
|
toJSON(): DataflowGraphJson;
|
|
110
110
|
/**
|
|
111
111
|
* Get the {@link DataflowGraphVertexInfo} attached to a node as well as all outgoing edges.
|
package/dataflow/graph/graph.js
CHANGED
|
@@ -302,7 +302,7 @@ class DataflowGraph {
|
|
|
302
302
|
const vertex = this.getVertex(reference.nodeId, true);
|
|
303
303
|
(0, assert_1.guard)(vertex !== undefined, () => `node must be defined for ${JSON.stringify(reference)} to set reference`);
|
|
304
304
|
if (vertex.tag === vertex_1.VertexType.FunctionDefinition || vertex.tag === vertex_1.VertexType.VariableDefinition) {
|
|
305
|
-
vertex.
|
|
305
|
+
vertex.cds = reference.cds;
|
|
306
306
|
}
|
|
307
307
|
else {
|
|
308
308
|
this.vertexInformation.set(reference.nodeId, { ...vertex, tag: vertex_1.VertexType.VariableDefinition });
|
|
@@ -327,17 +327,17 @@ class DataflowGraph {
|
|
|
327
327
|
to = to ? (0, node_id_1.normalizeIdToNumberIfPossible)(to) : undefined;
|
|
328
328
|
const vertex = this.getVertex(from, true);
|
|
329
329
|
(0, assert_1.guard)(vertex !== undefined, () => `node must be defined for ${from} to add control dependency`);
|
|
330
|
-
vertex.
|
|
330
|
+
vertex.cds ??= [];
|
|
331
331
|
if (to) {
|
|
332
332
|
let hasControlDependency = false;
|
|
333
|
-
for (const { id, when: cond } of vertex.
|
|
333
|
+
for (const { id, when: cond } of vertex.cds) {
|
|
334
334
|
if (id === to && when !== cond) {
|
|
335
335
|
hasControlDependency = true;
|
|
336
336
|
break;
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
if (!hasControlDependency) {
|
|
340
|
-
vertex.
|
|
340
|
+
vertex.cds.push({ id: to, when });
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
return this;
|
|
@@ -3,7 +3,7 @@ import type { DataflowFunctionFlowInformation, FunctionArgument } from './graph'
|
|
|
3
3
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import type { REnvironmentInformation } from '../environments/environment';
|
|
5
5
|
import type { ControlDependency, ExitPoint } from '../info';
|
|
6
|
-
import type {
|
|
6
|
+
import type { BuiltInProcName } from '../environments/built-in';
|
|
7
7
|
export declare enum VertexType {
|
|
8
8
|
Value = "value",
|
|
9
9
|
Use = "use",
|
|
@@ -137,7 +137,7 @@ interface DataflowGraphVertexBase extends MergeableRecord {
|
|
|
137
137
|
/**
|
|
138
138
|
* @see {@link ControlDependency} - the collection of control dependencies which have an influence on whether the vertex is executed.
|
|
139
139
|
*/
|
|
140
|
-
|
|
140
|
+
cds: ControlDependency[] | undefined;
|
|
141
141
|
/**
|
|
142
142
|
* this attribute links a vertex to indices (pointer links) it may be affected by or related to
|
|
143
143
|
*/
|
|
@@ -209,7 +209,7 @@ export interface DataflowGraphVertexFunctionCall extends DataflowGraphVertexBase
|
|
|
209
209
|
origin: FunctionOriginInformation[] | 'unnamed';
|
|
210
210
|
}
|
|
211
211
|
/** Describes the processor responsible for a function call */
|
|
212
|
-
export type FunctionOriginInformation =
|
|
212
|
+
export type FunctionOriginInformation = BuiltInProcName;
|
|
213
213
|
/**
|
|
214
214
|
* Arguments required to construct a vertex which represents the definition of a variable in the {@link DataflowGraph|dataflow graph}.
|
|
215
215
|
* @see {@link isVariableDefinitionVertex} - to check if a vertex is a variable definition vertex
|
package/dataflow/info.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface ExitPoint {
|
|
|
63
63
|
* (e.g., if the `return` is contained within an `if` statement).
|
|
64
64
|
* @see {@link happensInEveryBranch} - to check whether control dependencies are exhaustive
|
|
65
65
|
*/
|
|
66
|
-
readonly
|
|
66
|
+
readonly cds?: ControlDependency[];
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Adds all non-default exit points to the existing list and updates the `invertExitCds` accordingly.
|
|
@@ -131,13 +131,13 @@ export declare function initializeCleanDataflowInformation<T>(entryPoint: NodeId
|
|
|
131
131
|
* the list contains a dependency on the `true` and on the `false` case).
|
|
132
132
|
* @see {@link happensInEveryBranchSet} - for the set-based version
|
|
133
133
|
*/
|
|
134
|
-
export declare function happensInEveryBranch(
|
|
134
|
+
export declare function happensInEveryBranch(cds: readonly ControlDependency[] | undefined): boolean;
|
|
135
135
|
/**
|
|
136
136
|
* Checks whether the given control dependencies are exhaustive (i.e. if for every control dependency on a boolean,
|
|
137
137
|
* the list contains a dependency on the `true` and on the `false` case).
|
|
138
138
|
* @see {@link happensInEveryBranch} - for the array-based version
|
|
139
139
|
*/
|
|
140
|
-
export declare function happensInEveryBranchSet(
|
|
140
|
+
export declare function happensInEveryBranchSet(cds: ReadonlySet<ControlDependency> | undefined): boolean;
|
|
141
141
|
/**
|
|
142
142
|
* Checks whether the given dataflow information always exits (i.e., if there is a non-default exit point in every branch).
|
|
143
143
|
* @see {@link ExitPoint} - for the different types of exit points
|
package/dataflow/info.js
CHANGED
|
@@ -37,7 +37,7 @@ function addNonDefaultExitPoints(existing, invertExitCds, activeCds, add) {
|
|
|
37
37
|
if (toAdd.length === 0) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
const invertedCds = toAdd.flatMap(e => e.
|
|
40
|
+
const invertedCds = toAdd.flatMap(e => e.cds?.filter(icd => !activeCds?.some(e => e.id === icd.id && e.when === icd.when)).map(negateControlDependency)).filter(assert_1.isNotUndefined);
|
|
41
41
|
existing.push(...toAdd);
|
|
42
42
|
for (const icd of invertedCds) {
|
|
43
43
|
if (!invertExitCds.some(e => e.id === icd.id && e.when === icd.when)) {
|
|
@@ -49,8 +49,8 @@ function addNonDefaultExitPoints(existing, invertExitCds, activeCds, add) {
|
|
|
49
49
|
* Overwrites the existing exit points with the given ones, taking care of cds.
|
|
50
50
|
*/
|
|
51
51
|
function overwriteExitPoints(existing, replace) {
|
|
52
|
-
const replaceCds = replace.flatMap(e => e.
|
|
53
|
-
if (replaceCds.length === 0 || replaceCds.
|
|
52
|
+
const replaceCds = replace.flatMap(e => e.cds);
|
|
53
|
+
if (replaceCds.length === 0 || replaceCds.includes(undefined) || happensInEveryBranch(replaceCds.filter(e => e !== undefined))) {
|
|
54
54
|
return replace;
|
|
55
55
|
}
|
|
56
56
|
return existing.concat(replace);
|
|
@@ -77,14 +77,14 @@ function initializeCleanDataflowInformation(entryPoint, data) {
|
|
|
77
77
|
* the list contains a dependency on the `true` and on the `false` case).
|
|
78
78
|
* @see {@link happensInEveryBranchSet} - for the set-based version
|
|
79
79
|
*/
|
|
80
|
-
function happensInEveryBranch(
|
|
80
|
+
function happensInEveryBranch(cds) {
|
|
81
81
|
/* this happens only when we have no idea and require more analysis */
|
|
82
|
-
return
|
|
82
|
+
return cds === undefined || (cds.length !== 0 && coversSet(cds));
|
|
83
83
|
}
|
|
84
|
-
function coversSet(
|
|
84
|
+
function coversSet(cds) {
|
|
85
85
|
const trues = new Set();
|
|
86
86
|
const falses = new Set();
|
|
87
|
-
for (const { id, when } of
|
|
87
|
+
for (const { id, when } of cds) {
|
|
88
88
|
if (when) {
|
|
89
89
|
trues.add(id);
|
|
90
90
|
}
|
|
@@ -99,8 +99,8 @@ function coversSet(controlDependencies) {
|
|
|
99
99
|
* the list contains a dependency on the `true` and on the `false` case).
|
|
100
100
|
* @see {@link happensInEveryBranch} - for the array-based version
|
|
101
101
|
*/
|
|
102
|
-
function happensInEveryBranchSet(
|
|
103
|
-
return
|
|
102
|
+
function happensInEveryBranchSet(cds) {
|
|
103
|
+
return cds === undefined || (cds.size !== 0 && coversSet(cds));
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Checks whether the given dataflow information always exits (i.e., if there is a non-default exit point in every branch).
|
|
@@ -110,10 +110,10 @@ function alwaysExits(data) {
|
|
|
110
110
|
let cds = [];
|
|
111
111
|
for (const e of data.exitPoints) {
|
|
112
112
|
if (e.type !== 0 /* ExitPointType.Default */) {
|
|
113
|
-
if (e.
|
|
113
|
+
if (e.cds === undefined) {
|
|
114
114
|
return true;
|
|
115
115
|
}
|
|
116
|
-
cds = cds.concat(e.
|
|
116
|
+
cds = cds.concat(e.cds);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
return happensInEveryBranch(cds);
|
|
@@ -25,11 +25,20 @@ export declare function produceNameSharedIdMap(references: IdentifierReference[]
|
|
|
25
25
|
* If you just want to match by name, use {@link pMatch}.
|
|
26
26
|
*/
|
|
27
27
|
export declare function linkArgumentsOnCall(args: readonly FunctionArgument[], params: readonly RParameter<ParentInformation>[], graph: DataflowGraph): Map<NodeId, NodeId>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns all argument ids that map to the given target parameter id.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getAllIdsWithTarget<Targets extends NodeId>(maps: Map<NodeId, Targets>, target: Targets): NodeId[];
|
|
32
|
+
/**
|
|
33
|
+
* Inverts the argument to parameter map to a parameter to argument map.
|
|
34
|
+
*/
|
|
35
|
+
export declare function invertArgumentMap<Targets extends NodeId>(maps: Map<NodeId, Targets>): Map<Targets, NodeId[]>;
|
|
28
36
|
/**
|
|
29
37
|
* Links the given arguments to the given parameters within the given graph by name only.
|
|
30
38
|
* @note
|
|
31
39
|
* To obtain the arguments from a {@link RFunctionCall}[], either use {@link processAllArguments} (also available via {@link processKnownFunctionCall})
|
|
32
40
|
* or convert them with {@link convertFnArguments}.
|
|
41
|
+
* You can use {@link getAllIdsWithTarget} to get all argument ids that map to a given parameter.
|
|
33
42
|
*/
|
|
34
43
|
export declare function pMatch<Targets extends NodeId>(args: readonly FunctionArgument[], params: Record<string, Targets>): Map<NodeId, Targets>;
|
|
35
44
|
/**
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.findNonLocalReads = findNonLocalReads;
|
|
4
4
|
exports.produceNameSharedIdMap = produceNameSharedIdMap;
|
|
5
5
|
exports.linkArgumentsOnCall = linkArgumentsOnCall;
|
|
6
|
+
exports.getAllIdsWithTarget = getAllIdsWithTarget;
|
|
7
|
+
exports.invertArgumentMap = invertArgumentMap;
|
|
6
8
|
exports.pMatch = pMatch;
|
|
7
9
|
exports.linkFunctionCallWithSingleTarget = linkFunctionCallWithSingleTarget;
|
|
8
10
|
exports.linkFunctionCalls = linkFunctionCalls;
|
|
@@ -131,11 +133,34 @@ function linkArgumentsOnCall(args, params, graph) {
|
|
|
131
133
|
}
|
|
132
134
|
return maps;
|
|
133
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Returns all argument ids that map to the given target parameter id.
|
|
138
|
+
*/
|
|
139
|
+
function getAllIdsWithTarget(maps, target) {
|
|
140
|
+
return maps.entries().filter(([, v]) => v === target).map(([k]) => k).toArray();
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Inverts the argument to parameter map to a parameter to argument map.
|
|
144
|
+
*/
|
|
145
|
+
function invertArgumentMap(maps) {
|
|
146
|
+
const inverted = new Map();
|
|
147
|
+
for (const [arg, param] of maps.entries()) {
|
|
148
|
+
const existing = inverted.get(param);
|
|
149
|
+
if (existing) {
|
|
150
|
+
existing.push(arg);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
inverted.set(param, [arg]);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return inverted;
|
|
157
|
+
}
|
|
134
158
|
/**
|
|
135
159
|
* Links the given arguments to the given parameters within the given graph by name only.
|
|
136
160
|
* @note
|
|
137
161
|
* To obtain the arguments from a {@link RFunctionCall}[], either use {@link processAllArguments} (also available via {@link processKnownFunctionCall})
|
|
138
162
|
* or convert them with {@link convertFnArguments}.
|
|
163
|
+
* You can use {@link getAllIdsWithTarget} to get all argument ids that map to a given parameter.
|
|
139
164
|
*/
|
|
140
165
|
function pMatch(args, params) {
|
|
141
166
|
const nameArgMap = new Map(args.filter(graph_1.isNamedArgument).map(a => [a.name, a]));
|
|
@@ -150,6 +175,7 @@ function pMatch(args, params) {
|
|
|
150
175
|
const param = params[pmatchName];
|
|
151
176
|
if (param) {
|
|
152
177
|
maps.set(argId, param);
|
|
178
|
+
matchedParameters.add(name);
|
|
153
179
|
}
|
|
154
180
|
else if (sid) {
|
|
155
181
|
maps.set(argId, sid);
|
|
@@ -297,7 +323,7 @@ function getAllFunctionCallTargets(call, graph, environment) {
|
|
|
297
323
|
return [];
|
|
298
324
|
}
|
|
299
325
|
if (info.name !== undefined && (environment !== undefined || info.environment !== undefined)) {
|
|
300
|
-
const functionCallDefs = (0, resolve_by_name_1.resolveByName)(info.name, environment ?? info.environment, identifier_1.ReferenceType.Function)?.map(d => d.nodeId) ?? [];
|
|
326
|
+
const functionCallDefs = (0, resolve_by_name_1.resolveByName)(info.name, environment ?? info.environment, info.origin.includes(built_in_1.BuiltInProcName.S3Dispatch) ? identifier_1.ReferenceType.S3MethodPrefix : identifier_1.ReferenceType.Function)?.map(d => d.nodeId) ?? [];
|
|
301
327
|
for (const [target, outgoingEdge] of outgoingEdges.entries()) {
|
|
302
328
|
if ((0, edge_1.edgeIncludesType)(outgoingEdge.types, edge_1.EdgeType.Calls)) {
|
|
303
329
|
functionCallDefs.push(target);
|
|
@@ -375,7 +401,7 @@ function linkInputs(referencesToLinkAgainstEnvironment, environmentInformation,
|
|
|
375
401
|
if (probableTarget === undefined) {
|
|
376
402
|
log_1.log.trace(`found no target for ${bodyInput.name}`);
|
|
377
403
|
if (maybeForRemaining) {
|
|
378
|
-
bodyInput.
|
|
404
|
+
bodyInput.cds ??= [];
|
|
379
405
|
}
|
|
380
406
|
givenInputs.push(bodyInput);
|
|
381
407
|
}
|
|
@@ -430,17 +456,17 @@ function linkCircularRedefinitionsWithinALoop(graph, openIns, outgoing) {
|
|
|
430
456
|
*/
|
|
431
457
|
function reapplyLoopExitPoints(exits, references) {
|
|
432
458
|
// just apply the cds of all exit points not already present
|
|
433
|
-
const exitCds = new Set(exits.flatMap(e => e.
|
|
459
|
+
const exitCds = new Set(exits.flatMap(e => e.cds).filter(assert_1.isNotUndefined));
|
|
434
460
|
for (const ref of references) {
|
|
435
461
|
for (const cd of exitCds) {
|
|
436
462
|
const { id: cId, when: cWhen } = cd;
|
|
437
|
-
if (ref.
|
|
438
|
-
if (!ref.
|
|
439
|
-
ref.
|
|
463
|
+
if (ref.cds) {
|
|
464
|
+
if (!ref.cds?.find(c => c.id === cId && c.when === cWhen)) {
|
|
465
|
+
ref.cds.push({ ...cd, byIteration: true });
|
|
440
466
|
}
|
|
441
467
|
}
|
|
442
468
|
else {
|
|
443
|
-
ref.
|
|
469
|
+
ref.cds = [{ ...cd, byIteration: true }];
|
|
444
470
|
}
|
|
445
471
|
}
|
|
446
472
|
}
|
|
@@ -15,7 +15,7 @@ const containers_1 = require("../../../../../../util/containers");
|
|
|
15
15
|
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
16
16
|
function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
|
|
17
17
|
outInfo.definitionRootNodes.push(rootId);
|
|
18
|
-
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin:
|
|
18
|
+
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_1.BuiltInProcName.TableAssignment }).information;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Processes different types of access operations.
|
|
@@ -37,16 +37,16 @@ function processAccess(name, args, rootId, data, config) {
|
|
|
37
37
|
let fnCall;
|
|
38
38
|
if (head === r_function_call_1.EmptyArgument) {
|
|
39
39
|
// in this case we may be within a pipe
|
|
40
|
-
fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin:
|
|
40
|
+
fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: built_in_1.BuiltInProcName.Access });
|
|
41
41
|
}
|
|
42
|
-
else if (
|
|
42
|
+
else if (config.treatIndicesAsString) {
|
|
43
|
+
fnCall = processStringBasedAccess(args, data, name, rootId, config);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
43
46
|
/* within an access operation which treats its fields, we redefine the table assignment ':=' as a trigger if this is to be treated as a definition */
|
|
44
47
|
// do we have a local definition that needs to be recovered?
|
|
45
48
|
fnCall = processNumberBasedAccess(data, name, args, rootId, config, head);
|
|
46
49
|
}
|
|
47
|
-
else {
|
|
48
|
-
fnCall = processStringBasedAccess(args, data, name, rootId, config);
|
|
49
|
-
}
|
|
50
50
|
const info = fnCall.information;
|
|
51
51
|
if (head !== r_function_call_1.EmptyArgument) {
|
|
52
52
|
info.graph.addEdge(name.info.id, fnCall.processedArguments[0]?.entryPoint ?? head.info.id, edge_1.EdgeType.Returns);
|
|
@@ -100,19 +100,18 @@ function processNumberBasedAccess(data, name, args, rootId, config, head) {
|
|
|
100
100
|
data.environment.current.memory.set(':=', [{
|
|
101
101
|
type: identifier_1.ReferenceType.BuiltInFunction,
|
|
102
102
|
definedAt: tableAssignId,
|
|
103
|
-
|
|
103
|
+
cds: undefined,
|
|
104
104
|
processor: (name, args, rootId, data) => tableAssignmentProcessor(name, args, rootId, data, outInfo),
|
|
105
|
-
config: {},
|
|
106
105
|
name: ':=',
|
|
107
106
|
nodeId: tableAssignId
|
|
108
107
|
}]);
|
|
109
|
-
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin:
|
|
108
|
+
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: built_in_1.BuiltInProcName.Access });
|
|
110
109
|
/* recover the environment */
|
|
111
110
|
if (existing !== undefined) {
|
|
112
111
|
data.environment.current.memory.set(':=', existing);
|
|
113
112
|
}
|
|
114
113
|
if (head.value && outInfo.definitionRootNodes.length > 0) {
|
|
115
|
-
(0, built_in_assignment_1.markAsAssignment)(fnCall.information, { type: identifier_1.ReferenceType.Variable, name: head.value.lexeme ?? '', nodeId: head.value.info.id, definedAt: rootId,
|
|
114
|
+
(0, built_in_assignment_1.markAsAssignment)(fnCall.information, { type: identifier_1.ReferenceType.Variable, name: head.value.lexeme ?? '', nodeId: head.value.info.id, definedAt: rootId, cds: [] }, outInfo.definitionRootNodes, rootId, data);
|
|
116
115
|
}
|
|
117
116
|
if (data.ctx.config.solver.pointerTracking) {
|
|
118
117
|
referenceAccessedIndices(args, data, fnCall, rootId, true);
|
|
@@ -156,8 +155,13 @@ function symbolArgumentsToStrings(args, firstIndexInclusive = 1, lastIndexInclus
|
|
|
156
155
|
*/
|
|
157
156
|
function processStringBasedAccess(args, data, name, rootId, config) {
|
|
158
157
|
const newArgs = symbolArgumentsToStrings(args);
|
|
159
|
-
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
160
|
-
|
|
158
|
+
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
159
|
+
name,
|
|
160
|
+
args: newArgs,
|
|
161
|
+
rootId,
|
|
162
|
+
data,
|
|
163
|
+
forceArgs: config.forceArgs,
|
|
164
|
+
origin: built_in_1.BuiltInProcName.Access
|
|
161
165
|
});
|
|
162
166
|
if (data.ctx.config.solver.pointerTracking) {
|
|
163
167
|
referenceAccessedIndices(newArgs, data, fnCall, rootId, false);
|
|
@@ -18,6 +18,6 @@ export interface BuiltInApplyConfiguration extends MergeableRecord {
|
|
|
18
18
|
readonly resolveValue?: boolean;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Process an apply call like `vapply` or `mapply`.
|
|
22
22
|
*/
|
|
23
23
|
export declare function processApply<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: BuiltInApplyConfiguration): DataflowInformation;
|