@eagleoutice/flowr 2.9.12 → 2.9.14
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 +35 -23
- package/abstract-interpretation/absint-visitor.d.ts +1 -1
- package/abstract-interpretation/absint-visitor.js +20 -20
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -2
- package/benchmark/slicer.d.ts +5 -3
- package/benchmark/slicer.js +26 -10
- package/benchmark/stats/print.js +12 -0
- package/benchmark/stats/stats.d.ts +3 -2
- package/benchmark/stats/stats.js +1 -1
- package/benchmark/summarizer/data.d.ts +1 -0
- package/benchmark/summarizer/second-phase/process.js +5 -0
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +1 -0
- package/cli/benchmark-helper-app.d.ts +2 -1
- package/cli/benchmark-helper-app.js +6 -3
- package/cli/common/options.d.ts +8 -0
- package/cli/common/options.js +3 -1
- package/cli/common/scripts-info.d.ts +8 -0
- package/cli/export-quads-app.js +1 -1
- package/cli/flowr.js +3 -3
- package/cli/repl/commands/repl-dataflow.js +5 -5
- package/cli/repl/core.d.ts +3 -3
- package/cli/repl/parser/slice-query-parser.d.ts +1 -1
- package/cli/repl/parser/slice-query-parser.js +2 -2
- package/cli/repl/server/connection.d.ts +2 -2
- package/cli/repl/server/connection.js +2 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/repl/server/messages/message-slice.js +2 -2
- package/cli/repl/server/server.d.ts +2 -2
- package/cli/script-core/statistics-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.js +1 -1
- package/cli/slicer-app.js +2 -2
- package/cli/statistics-app.js +1 -1
- package/cli/statistics-helper-app.js +1 -1
- package/cli/wiki.js +2 -2
- package/config.d.ts +65 -24
- package/config.js +197 -161
- package/control-flow/extract-cfg.js +7 -10
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +43 -43
- package/control-flow/useless-loop.d.ts +1 -1
- package/control-flow/useless-loop.js +3 -3
- package/core/print/dataflow-printer.d.ts +0 -14
- package/core/print/dataflow-printer.js +0 -21
- package/core/steps/all/core/20-dataflow.d.ts +3 -3
- package/core/steps/all/core/20-dataflow.js +3 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +2 -5
- package/core/steps/all/static-slicing/00-slice.js +6 -8
- package/core/steps/pipeline/default-pipelines.d.ts +89 -89
- package/core/steps/pipeline-step.d.ts +2 -2
- package/dataflow/environments/built-in-proc-name.d.ts +83 -0
- package/dataflow/environments/built-in-proc-name.js +88 -0
- package/dataflow/environments/built-in.d.ts +1 -83
- package/dataflow/environments/built-in.js +37 -120
- package/dataflow/environments/default-builtin-config.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.js +75 -75
- package/dataflow/environments/identifier.d.ts +1 -0
- package/dataflow/environments/identifier.js +1 -0
- package/dataflow/eval/resolve/alias-tracking.js +12 -15
- package/dataflow/eval/resolve/resolve.js +2 -2
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/exceptions-of-function.js +2 -2
- package/dataflow/graph/call-graph.d.ts +49 -19
- package/dataflow/graph/call-graph.js +117 -114
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.js +2 -2
- package/dataflow/graph/df-helper.d.ts +132 -0
- package/dataflow/graph/df-helper.js +131 -0
- package/dataflow/graph/diff-dataflow-graph.d.ts +5 -10
- package/dataflow/graph/diff-dataflow-graph.js +3 -28
- package/dataflow/graph/edge.d.ts +1 -0
- package/dataflow/graph/edge.js +1 -0
- package/dataflow/graph/graph-helper.d.ts +55 -0
- package/dataflow/graph/graph-helper.js +105 -0
- package/dataflow/graph/graph.d.ts +6 -1
- package/dataflow/graph/graph.js +14 -9
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/info.d.ts +14 -4
- package/dataflow/info.js +28 -16
- package/dataflow/internal/linker.d.ts +14 -10
- package/dataflow/internal/linker.js +29 -32
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +7 -6
- 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 +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +23 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
- package/dataflow/internal/process/process-uninteresting-leaf.d.ts +1 -1
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -1
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.js +6 -6
- package/documentation/doc-readme.js +2 -2
- package/documentation/doc-util/doc-dfg.d.ts +3 -0
- package/documentation/doc-util/doc-dfg.js +5 -7
- package/documentation/doc-util/doc-normalized-ast.d.ts +0 -6
- package/documentation/doc-util/doc-normalized-ast.js +0 -23
- package/documentation/doc-util/doc-structure.js +3 -3
- package/documentation/doc-util/doc-types.js +3 -3
- package/documentation/wiki-analyzer.js +7 -5
- package/documentation/wiki-core.js +6 -7
- package/documentation/wiki-dataflow-graph.js +15 -13
- package/documentation/wiki-interface.js +8 -6
- package/documentation/wiki-linter.js +6 -5
- package/documentation/wiki-mk/doc-context.js +3 -4
- package/documentation/wiki-normalized-ast.js +5 -4
- package/documentation/wiki-query.js +28 -3
- package/engines.d.ts +2 -2
- package/engines.js +4 -4
- package/linter/linter-rules.d.ts +24 -1
- package/linter/linter-rules.js +3 -1
- package/linter/rules/dataframe-access-validation.js +5 -5
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +7 -3
- package/linter/rules/seeded-randomness.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +35 -0
- package/linter/rules/stop-with-call-arg.js +72 -0
- package/linter/rules/useless-loop.d.ts +1 -1
- package/package.json +3 -1
- package/project/cache/flowr-analyzer-cache.d.ts +1 -1
- package/project/cache/flowr-analyzer-cache.js +1 -1
- package/project/context/flowr-analyzer-context.d.ts +6 -6
- package/project/context/flowr-analyzer-context.js +2 -2
- package/project/context/flowr-analyzer-files-context.d.ts +2 -2
- package/project/context/flowr-analyzer-files-context.js +28 -8
- package/project/flowr-analyzer-builder.d.ts +13 -6
- package/project/flowr-analyzer-builder.js +12 -3
- package/project/flowr-analyzer.d.ts +4 -4
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +2 -2
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
- package/queries/catalog/config-query/config-query-format.d.ts +5 -5
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -2
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
- package/queries/catalog/files-query/files-query-format.d.ts +3 -3
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +3 -3
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -2
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/provenance-query/provenance-query-executor.d.ts +9 -0
- package/queries/catalog/provenance-query/provenance-query-executor.js +37 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +35 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +62 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -4
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -0
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -4
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -3
- package/queries/query.d.ts +27 -19
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +13 -2
- package/r-bridge/lang-4.x/ast/model/model.js +20 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +8 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +13 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -2
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-printer.js +3 -3
- package/search/search-executor/search-enrichers.js +2 -2
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +40 -16
- package/slicing/criterion/parse.js +67 -63
- package/slicing/static/slicer-types.d.ts +2 -3
- package/slicing/static/static-slicer.d.ts +3 -4
- package/slicing/static/static-slicer.js +9 -12
- package/statistics/statistics.d.ts +2 -2
- package/util/diff.d.ts +2 -2
- package/util/mermaid/ast.js +4 -4
- package/util/mermaid/cfg.js +5 -5
- package/util/mermaid/dfg.d.ts +33 -18
- package/util/mermaid/dfg.js +46 -31
- package/util/mermaid/mermaid.d.ts +57 -12
- package/util/mermaid/mermaid.js +74 -67
- package/util/objects.d.ts +12 -0
- package/util/objects.js +28 -0
- package/util/range.d.ts +8 -0
- package/util/range.js +13 -1
- package/util/slice-direction.d.ts +7 -0
- package/util/slice-direction.js +12 -0
- package/util/summarizer.js +1 -1
- package/util/version.js +1 -1
- package/dataflow/graph/invert-dfg.d.ts +0 -6
- package/dataflow/graph/invert-dfg.js +0 -20
- package/dataflow/graph/resolve-graph.d.ts +0 -8
- package/dataflow/graph/resolve-graph.js +0 -59
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { FunctionArgument, type OutgoingEdges } from './graph';
|
|
2
|
-
import { type
|
|
2
|
+
import { type GenericDifferenceInformation } from '../../util/diff';
|
|
3
3
|
import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
|
-
import
|
|
4
|
+
import type { GraphDifferenceReport, GraphDiffContext } from '../../util/diff-graph';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @see {@link diffOfControlFlowGraphs} - for control flow graphs
|
|
6
|
+
* This is the underlying function to calculate the difference based on a given context.
|
|
7
|
+
* Use {@link Dataflow.diff} to calculate the diff of two graphs.
|
|
9
8
|
*/
|
|
10
|
-
export declare function
|
|
11
|
-
/**
|
|
12
|
-
* Checks whether two function argument lists are equal.
|
|
13
|
-
*/
|
|
14
|
-
export declare function equalFunctionArguments(fn: NodeId, a: false | readonly FunctionArgument[], b: false | readonly FunctionArgument[]): boolean;
|
|
9
|
+
export declare function diffDataflowGraph(ctx: GraphDiffContext): void;
|
|
15
10
|
/**
|
|
16
11
|
* Compares two function argument lists and reports differences.
|
|
17
12
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.equalFunctionArguments = equalFunctionArguments;
|
|
3
|
+
exports.diffDataflowGraph = diffDataflowGraph;
|
|
5
4
|
exports.diffFunctionArguments = diffFunctionArguments;
|
|
6
5
|
exports.diffVertices = diffVertices;
|
|
7
6
|
exports.diffEdges = diffEdges;
|
|
@@ -16,20 +15,10 @@ const identifier_1 = require("../environments/identifier");
|
|
|
16
15
|
const diff_2 = require("../environments/diff");
|
|
17
16
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
18
17
|
const info_1 = require("../info");
|
|
19
|
-
const diff_graph_1 = require("../../util/diff-graph");
|
|
20
18
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @see {@link diffOfControlFlowGraphs} - for control flow graphs
|
|
19
|
+
* This is the underlying function to calculate the difference based on a given context.
|
|
20
|
+
* Use {@link Dataflow.diff} to calculate the diff of two graphs.
|
|
24
21
|
*/
|
|
25
|
-
function diffOfDataflowGraphs(left, right, config) {
|
|
26
|
-
if (left.graph === right.graph) {
|
|
27
|
-
return new diff_graph_1.GraphDifferenceReport();
|
|
28
|
-
}
|
|
29
|
-
const ctx = (0, diff_graph_1.initDiffContext)(left, right, config);
|
|
30
|
-
diffDataflowGraph(ctx);
|
|
31
|
-
return ctx.report;
|
|
32
|
-
}
|
|
33
22
|
function diffDataflowGraph(ctx) {
|
|
34
23
|
diffRootVertices(ctx);
|
|
35
24
|
diffVertices(ctx);
|
|
@@ -80,20 +69,6 @@ function diffFunctionArgumentsReferences(fn, a, b, ctx) {
|
|
|
80
69
|
}
|
|
81
70
|
(0, diff_2.diffIdentifierReferences)(a, b, ctx);
|
|
82
71
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Checks whether two function argument lists are equal.
|
|
85
|
-
*/
|
|
86
|
-
function equalFunctionArguments(fn, a, b) {
|
|
87
|
-
const ctx = {
|
|
88
|
-
report: new diff_graph_1.GraphDifferenceReport(),
|
|
89
|
-
leftname: 'left',
|
|
90
|
-
rightname: 'right',
|
|
91
|
-
position: '',
|
|
92
|
-
config: {}
|
|
93
|
-
};
|
|
94
|
-
diffFunctionArguments(fn, a, b, ctx);
|
|
95
|
-
return ctx.report.isEqual();
|
|
96
|
-
}
|
|
97
72
|
/**
|
|
98
73
|
* Compares two function argument lists and reports differences.
|
|
99
74
|
*/
|
package/dataflow/graph/edge.d.ts
CHANGED
package/dataflow/graph/edge.js
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { df2quads } from './quads';
|
|
2
|
+
import type { NamedGraph } from '../../util/diff-graph';
|
|
3
|
+
import { GraphDifferenceReport } from '../../util/diff-graph';
|
|
4
|
+
import type { GenericDiffConfiguration } from '../../util/diff';
|
|
5
|
+
import { DataflowGraph } from './graph';
|
|
6
|
+
import type { REnvironmentInformation } from '../environments/environment';
|
|
7
|
+
import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
8
|
+
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
9
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
10
|
+
/**
|
|
11
|
+
* The underlying functions which work for any graph* like view
|
|
12
|
+
* **Please do not use this object directly but use the helpers**
|
|
13
|
+
* - {@link Dataflow}
|
|
14
|
+
* - {@link CallGraph}
|
|
15
|
+
*/
|
|
16
|
+
export declare const GraphHelper: {
|
|
17
|
+
/** Maps to the mermaid-centric visualization helper for dataflow graphs and their views */
|
|
18
|
+
readonly visualize: {
|
|
19
|
+
/**
|
|
20
|
+
* Mermaid rendering helper for dataflow graphs
|
|
21
|
+
* - {@link DataflowMermaid.url}, {@link DataflowMermaid.raw} - to render the graph as a mermaid graph (e.g., in markdown or the mermaid live editor)
|
|
22
|
+
* - {@link DataflowMermaid.convert} - for the underyling transformation
|
|
23
|
+
* @see {@link DataflowMermaid}
|
|
24
|
+
*/
|
|
25
|
+
readonly mermaid: {
|
|
26
|
+
readonly name: "DataflowMermaid";
|
|
27
|
+
readonly convert: (this: void, config: import("../../util/mermaid/dfg").MermaidGraphConfiguration) => {
|
|
28
|
+
string: string;
|
|
29
|
+
mermaid: import("../../util/mermaid/dfg").MermaidGraph;
|
|
30
|
+
};
|
|
31
|
+
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
32
|
+
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
33
|
+
};
|
|
34
|
+
readonly quads: {
|
|
35
|
+
readonly convert: typeof df2quads;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Compare two dataflow graphs and return a report on the differences.
|
|
40
|
+
* If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
|
|
41
|
+
* @see {@link diffOfControlFlowGraphs} - for control flow graphs
|
|
42
|
+
*/
|
|
43
|
+
readonly diffGraphs: (this: void, left: NamedGraph, right: NamedGraph, config?: Partial<GenericDiffConfiguration>) => GraphDifferenceReport;
|
|
44
|
+
/**
|
|
45
|
+
* Inverts the given dataflow graph by reversing all edges.
|
|
46
|
+
*/
|
|
47
|
+
readonly invertGraph: (this: void, graph: DataflowGraph, cleanEnv: REnvironmentInformation) => DataflowGraph;
|
|
48
|
+
/**
|
|
49
|
+
* Resolves the dataflow graph ids from slicing criterion form to ids.
|
|
50
|
+
* This returns a **new** graph with the resolved ids.
|
|
51
|
+
* The main use-case for this is testing - if you do not know/want to fix the specific id,
|
|
52
|
+
* you can use, e.g. `2@x` as a placeholder for the first x in the second line!
|
|
53
|
+
*/
|
|
54
|
+
readonly resolveGraphCriteria: (graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext, idMap?: AstIdMap) => DataflowGraph;
|
|
55
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphHelper = void 0;
|
|
4
|
+
const dfg_1 = require("../../util/mermaid/dfg");
|
|
5
|
+
const quads_1 = require("./quads");
|
|
6
|
+
const diff_graph_1 = require("../../util/diff-graph");
|
|
7
|
+
const diff_dataflow_graph_1 = require("./diff-dataflow-graph");
|
|
8
|
+
const graph_1 = require("./graph");
|
|
9
|
+
const assert_1 = require("../../util/assert");
|
|
10
|
+
const parse_1 = require("../../slicing/criterion/parse");
|
|
11
|
+
const edge_1 = require("./edge");
|
|
12
|
+
/**
|
|
13
|
+
* The underlying functions which work for any graph* like view
|
|
14
|
+
* **Please do not use this object directly but use the helpers**
|
|
15
|
+
* - {@link Dataflow}
|
|
16
|
+
* - {@link CallGraph}
|
|
17
|
+
*/
|
|
18
|
+
exports.GraphHelper = {
|
|
19
|
+
/** Maps to the mermaid-centric visualization helper for dataflow graphs and their views */
|
|
20
|
+
visualize: {
|
|
21
|
+
/**
|
|
22
|
+
* Mermaid rendering helper for dataflow graphs
|
|
23
|
+
* - {@link DataflowMermaid.url}, {@link DataflowMermaid.raw} - to render the graph as a mermaid graph (e.g., in markdown or the mermaid live editor)
|
|
24
|
+
* - {@link DataflowMermaid.convert} - for the underyling transformation
|
|
25
|
+
* @see {@link DataflowMermaid}
|
|
26
|
+
*/
|
|
27
|
+
mermaid: dfg_1.DataflowMermaid,
|
|
28
|
+
quads: { convert: quads_1.df2quads }
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Compare two dataflow graphs and return a report on the differences.
|
|
32
|
+
* If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
|
|
33
|
+
* @see {@link diffOfControlFlowGraphs} - for control flow graphs
|
|
34
|
+
*/
|
|
35
|
+
diffGraphs(left, right, config) {
|
|
36
|
+
if (left.graph === right.graph) {
|
|
37
|
+
return new diff_graph_1.GraphDifferenceReport();
|
|
38
|
+
}
|
|
39
|
+
const ctx = (0, diff_graph_1.initDiffContext)(left, right, config);
|
|
40
|
+
(0, diff_dataflow_graph_1.diffDataflowGraph)(ctx);
|
|
41
|
+
return ctx.report;
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Inverts the given dataflow graph by reversing all edges.
|
|
45
|
+
*/
|
|
46
|
+
invertGraph(graph, cleanEnv) {
|
|
47
|
+
const invertedGraph = new graph_1.DataflowGraph(graph.idMap);
|
|
48
|
+
for (const [, v] of graph.vertices(true)) {
|
|
49
|
+
invertedGraph.addVertex(v, cleanEnv);
|
|
50
|
+
}
|
|
51
|
+
for (const [from, targets] of graph.edges()) {
|
|
52
|
+
for (const [to, { types }] of targets) {
|
|
53
|
+
invertedGraph.addEdge(to, from, types);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return invertedGraph;
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Resolves the dataflow graph ids from slicing criterion form to ids.
|
|
60
|
+
* This returns a **new** graph with the resolved ids.
|
|
61
|
+
* The main use-case for this is testing - if you do not know/want to fix the specific id,
|
|
62
|
+
* you can use, e.g. `2@x` as a placeholder for the first x in the second line!
|
|
63
|
+
*/
|
|
64
|
+
resolveGraphCriteria(graph, ctx, idMap) {
|
|
65
|
+
const resolveMap = idMap ?? graph.idMap;
|
|
66
|
+
(0, assert_1.guard)(resolveMap !== undefined, 'idMap must be provided to resolve the graph');
|
|
67
|
+
const cache = new Map();
|
|
68
|
+
const resolve = (id) => {
|
|
69
|
+
const cached = cache.get(id);
|
|
70
|
+
if (cached !== undefined) {
|
|
71
|
+
return cached;
|
|
72
|
+
}
|
|
73
|
+
const resolved = parse_1.SingleSlicingCriterion.tryParse(id, resolveMap) ?? id;
|
|
74
|
+
cache.set(id, resolved);
|
|
75
|
+
return resolved;
|
|
76
|
+
};
|
|
77
|
+
const resultGraph = new graph_1.DataflowGraph(resolveMap);
|
|
78
|
+
const roots = graph.rootIds();
|
|
79
|
+
/* recreate vertices */
|
|
80
|
+
for (const [id, vertex] of graph.vertices(true)) {
|
|
81
|
+
resultGraph.addVertex({
|
|
82
|
+
...vertex,
|
|
83
|
+
id: resolve(id)
|
|
84
|
+
}, ctx.env.makeCleanEnv(), roots.has(id));
|
|
85
|
+
}
|
|
86
|
+
/* recreate edges */
|
|
87
|
+
for (const [from, targets] of graph.edges()) {
|
|
88
|
+
for (const [to, info] of targets) {
|
|
89
|
+
for (const type of edge_1.DfEdge.splitTypes(info)) {
|
|
90
|
+
resultGraph.addEdge(resolve(from), resolve(to), type);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const unknown of graph.unknownSideEffects) {
|
|
95
|
+
if (typeof unknown === 'object') {
|
|
96
|
+
resultGraph.markIdForUnknownSideEffects(resolve(unknown.id), unknown.linkTo);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
resultGraph.markIdForUnknownSideEffects(resolve(unknown));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return resultGraph;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=graph-helper.js.map
|
|
@@ -51,6 +51,7 @@ export type FunctionArgument = NamedFunctionArgument | PositionalFunctionArgumen
|
|
|
51
51
|
* @see {@link EmptyArgument} - the marker for empty arguments
|
|
52
52
|
*/
|
|
53
53
|
export declare const FunctionArgument: {
|
|
54
|
+
readonly name: "FunctionArgument";
|
|
54
55
|
/**
|
|
55
56
|
* Checks whether the given argument is a positional argument.
|
|
56
57
|
* @example
|
|
@@ -104,6 +105,9 @@ export declare const FunctionArgument: {
|
|
|
104
105
|
readonly getReference: (this: void, arg: FunctionArgument) => NodeId | undefined;
|
|
105
106
|
/**
|
|
106
107
|
* Checks whether the given argument is a named argument with the specified name.
|
|
108
|
+
* Please note that this only checks whether the name is exactly identical and not whether
|
|
109
|
+
* R's argument matching resolves to the correct argument.
|
|
110
|
+
* For this, please refer to the {@link pMatch} function!
|
|
107
111
|
* @see {@link isNamed}
|
|
108
112
|
*/
|
|
109
113
|
readonly hasName: (this: void, arg: FunctionArgument, name: string | undefined) => arg is NamedFunctionArgument;
|
|
@@ -138,7 +142,8 @@ export type UnknownSideEffect = NodeId | {
|
|
|
138
142
|
};
|
|
139
143
|
/**
|
|
140
144
|
* The dataflow graph holds the dataflow information found within the given AST.
|
|
141
|
-
* We differentiate the directed edges in {@link EdgeType} and the vertices indicated by {@link DataflowGraphVertexArgument}
|
|
145
|
+
* We differentiate the directed edges in {@link EdgeType} and the vertices indicated by {@link DataflowGraphVertexArgument}.
|
|
146
|
+
* The helper object associated with the DFG is {@link Dataflow}.
|
|
142
147
|
*
|
|
143
148
|
* The vertices of the graph are organized in a hierarchical fashion, with a function-definition node containing the node ids of its subgraph.
|
|
144
149
|
* However, all *edges* are hoisted at the top level in the form of an (attributed) adjacency list.
|
package/dataflow/graph/graph.js
CHANGED
|
@@ -13,6 +13,7 @@ const clone_1 = require("../environments/clone");
|
|
|
13
13
|
* @see {@link EmptyArgument} - the marker for empty arguments
|
|
14
14
|
*/
|
|
15
15
|
exports.FunctionArgument = {
|
|
16
|
+
name: 'FunctionArgument',
|
|
16
17
|
/**
|
|
17
18
|
* Checks whether the given argument is a positional argument.
|
|
18
19
|
* @example
|
|
@@ -81,6 +82,9 @@ exports.FunctionArgument = {
|
|
|
81
82
|
},
|
|
82
83
|
/**
|
|
83
84
|
* Checks whether the given argument is a named argument with the specified name.
|
|
85
|
+
* Please note that this only checks whether the name is exactly identical and not whether
|
|
86
|
+
* R's argument matching resolves to the correct argument.
|
|
87
|
+
* For this, please refer to the {@link pMatch} function!
|
|
84
88
|
* @see {@link isNamed}
|
|
85
89
|
*/
|
|
86
90
|
hasName(arg, name) {
|
|
@@ -89,7 +93,8 @@ exports.FunctionArgument = {
|
|
|
89
93
|
};
|
|
90
94
|
/**
|
|
91
95
|
* The dataflow graph holds the dataflow information found within the given AST.
|
|
92
|
-
* We differentiate the directed edges in {@link EdgeType} and the vertices indicated by {@link DataflowGraphVertexArgument}
|
|
96
|
+
* We differentiate the directed edges in {@link EdgeType} and the vertices indicated by {@link DataflowGraphVertexArgument}.
|
|
97
|
+
* The helper object associated with the DFG is {@link Dataflow}.
|
|
93
98
|
*
|
|
94
99
|
* The vertices of the graph are organized in a hierarchical fashion, with a function-definition node containing the node ids of its subgraph.
|
|
95
100
|
* However, all *edges* are hoisted at the top level in the form of an (attributed) adjacency list.
|
|
@@ -402,17 +407,17 @@ class DataflowGraph {
|
|
|
402
407
|
to = node_id_1.NodeId.normalize(to);
|
|
403
408
|
const vertex = this.getVertex(from);
|
|
404
409
|
(0, assert_1.guard)(vertex !== undefined, () => `node must be defined for ${from} to add control dependency`);
|
|
405
|
-
vertex.cds
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
break;
|
|
410
|
+
if (vertex.cds) {
|
|
411
|
+
for (const { id, when: cond } of vertex.cds) {
|
|
412
|
+
if (id === to && when !== cond) {
|
|
413
|
+
return this;
|
|
414
|
+
}
|
|
411
415
|
}
|
|
412
416
|
}
|
|
413
|
-
|
|
414
|
-
vertex.cds
|
|
417
|
+
else {
|
|
418
|
+
vertex.cds = [];
|
|
415
419
|
}
|
|
420
|
+
vertex.cds.push({ id: to, when });
|
|
416
421
|
return this;
|
|
417
422
|
}
|
|
418
423
|
/** Marks the given node as having unknown side effects */
|
|
@@ -3,8 +3,8 @@ 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 { BuiltInProcName } from '../environments/built-in';
|
|
7
6
|
import type { Identifier } from '../environments/identifier';
|
|
7
|
+
import type { BuiltInProcName } from '../environments/built-in-proc-name';
|
|
8
8
|
export declare enum VertexType {
|
|
9
9
|
Value = "value",
|
|
10
10
|
Use = "use",
|
package/dataflow/info.d.ts
CHANGED
|
@@ -125,11 +125,21 @@ export interface DataflowInformation extends DataflowCfgInformation {
|
|
|
125
125
|
graph: DataflowGraph;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
129
|
-
* This is to be used as a "starting point" when processing leaf nodes during the dataflow extraction.
|
|
130
|
-
* @see {@link DataflowInformation}
|
|
128
|
+
* Helper object for {@link DataflowInformation}
|
|
131
129
|
*/
|
|
132
|
-
export declare
|
|
130
|
+
export declare const DataflowInformation: {
|
|
131
|
+
readonly name: "DataflowInformation";
|
|
132
|
+
/**
|
|
133
|
+
* Initializes an empty {@link DataflowInformation} object with the given entry point and data.
|
|
134
|
+
* This is to be used as a "starting point" when processing leaf nodes during the dataflow extraction.
|
|
135
|
+
* @see {@link DataflowInformation}
|
|
136
|
+
*/
|
|
137
|
+
readonly initialize: <T>(this: void, entryPoint: NodeId, data: Pick<DataflowProcessorInformation<T>, "environment" | "completeAst">) => DataflowInformation;
|
|
138
|
+
/**
|
|
139
|
+
* Type guard to check whether the given information is a {@link DataflowInformation}.
|
|
140
|
+
*/
|
|
141
|
+
readonly is: (info: unknown) => info is DataflowInformation;
|
|
142
|
+
};
|
|
133
143
|
/**
|
|
134
144
|
* Checks whether the given control dependencies are exhaustive (i.e. if for every control dependency on a boolean,
|
|
135
145
|
* the list contains a dependency on the `true` and on the `false` case).
|
package/dataflow/info.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataflowInformation = void 0;
|
|
3
4
|
exports.negateControlDependency = negateControlDependency;
|
|
4
5
|
exports.doesExitPointPropagateCalls = doesExitPointPropagateCalls;
|
|
5
6
|
exports.addNonDefaultExitPoints = addNonDefaultExitPoints;
|
|
6
7
|
exports.overwriteExitPoints = overwriteExitPoints;
|
|
7
|
-
exports.initializeCleanDataflowInformation = initializeCleanDataflowInformation;
|
|
8
8
|
exports.happensInEveryBranch = happensInEveryBranch;
|
|
9
9
|
exports.happensInEveryBranchSet = happensInEveryBranchSet;
|
|
10
10
|
exports.alwaysExits = alwaysExits;
|
|
@@ -56,22 +56,34 @@ function overwriteExitPoints(existing, replace) {
|
|
|
56
56
|
return existing.concat(replace);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
* This is to be used as a "starting point" when processing leaf nodes during the dataflow extraction.
|
|
61
|
-
* @see {@link DataflowInformation}
|
|
59
|
+
* Helper object for {@link DataflowInformation}
|
|
62
60
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
exports.DataflowInformation = {
|
|
62
|
+
name: 'DataflowInformation',
|
|
63
|
+
/**
|
|
64
|
+
* Initializes an empty {@link DataflowInformation} object with the given entry point and data.
|
|
65
|
+
* This is to be used as a "starting point" when processing leaf nodes during the dataflow extraction.
|
|
66
|
+
* @see {@link DataflowInformation}
|
|
67
|
+
*/
|
|
68
|
+
initialize(entryPoint, data) {
|
|
69
|
+
return {
|
|
70
|
+
unknownReferences: [],
|
|
71
|
+
in: [],
|
|
72
|
+
out: [],
|
|
73
|
+
environment: data.environment,
|
|
74
|
+
graph: new graph_1.DataflowGraph(undefined),
|
|
75
|
+
entryPoint,
|
|
76
|
+
exitPoints: [{ nodeId: entryPoint, type: 0 /* ExitPointType.Default */ }],
|
|
77
|
+
hooks: []
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Type guard to check whether the given information is a {@link DataflowInformation}.
|
|
82
|
+
*/
|
|
83
|
+
is(info) {
|
|
84
|
+
return typeof info === 'object' && info !== null && 'entryPoint' in info && 'exitPoints' in info && 'hooks' in info;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
75
87
|
/**
|
|
76
88
|
* Checks whether the given control dependencies are exhaustive (i.e. if for every control dependency on a boolean,
|
|
77
89
|
* the list contains a dependency on the `true` and on the `false` case).
|
|
@@ -25,22 +25,26 @@ 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[]>;
|
|
36
28
|
/**
|
|
37
29
|
* Links the given arguments to the given parameters within the given graph by name only.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const parameterSpec = {
|
|
33
|
+
* 'paramName': 'paramId',
|
|
34
|
+
* 'anotherParamName': 'anotherParamId',
|
|
35
|
+
* // we recommend to always add '...' to your specification
|
|
36
|
+
* // this way you can collect all arguments that could not be matched!
|
|
37
|
+
* '...': '...'
|
|
38
|
+
* } as const;
|
|
39
|
+
*
|
|
40
|
+
* const match = pMatch(convertFnArguments(args), parameterSpec);
|
|
41
|
+
* const addParam = match.get('paramId');
|
|
42
|
+
* ```
|
|
38
43
|
* @note
|
|
39
44
|
* To obtain the arguments from a {@link RFunctionCall}[], either use {@link processAllArguments} (also available via {@link processKnownFunctionCall})
|
|
40
45
|
* or convert them with {@link convertFnArguments}.
|
|
41
|
-
* You can use {@link getAllIdsWithTarget} to get all argument ids that map to a given parameter.
|
|
42
46
|
*/
|
|
43
|
-
export declare function pMatch<Targets extends NodeId>(args: readonly FunctionArgument[], params: Record<string, Targets>): Map<
|
|
47
|
+
export declare function pMatch<Targets extends NodeId>(args: readonly FunctionArgument[], params: Record<string, Targets>): Map<Targets, NodeId[]>;
|
|
44
48
|
/**
|
|
45
49
|
* Links a function call with a single target function definition.
|
|
46
50
|
*/
|
|
@@ -3,8 +3,6 @@ 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;
|
|
8
6
|
exports.pMatch = pMatch;
|
|
9
7
|
exports.linkFunctionCallWithSingleTarget = linkFunctionCallWithSingleTarget;
|
|
10
8
|
exports.linkFunctionCalls = linkFunctionCalls;
|
|
@@ -25,10 +23,10 @@ const edge_1 = require("../graph/edge");
|
|
|
25
23
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
26
24
|
const vertex_1 = require("../graph/vertex");
|
|
27
25
|
const resolve_by_name_1 = require("../environments/resolve-by-name");
|
|
28
|
-
const built_in_1 = require("../environments/built-in");
|
|
29
26
|
const prefix_1 = require("../../util/prefix");
|
|
30
27
|
const info_1 = require("../info");
|
|
31
28
|
const unnamed_call_handling_1 = require("./process/functions/call/unnamed-call-handling");
|
|
29
|
+
const built_in_proc_name_1 = require("../environments/built-in-proc-name");
|
|
32
30
|
/**
|
|
33
31
|
* Find all reads within the graph that do not reference a local definition in the graph.
|
|
34
32
|
*/
|
|
@@ -137,38 +135,37 @@ function linkArgumentsOnCall(args, params, graph) {
|
|
|
137
135
|
}
|
|
138
136
|
return maps;
|
|
139
137
|
}
|
|
140
|
-
/**
|
|
141
|
-
* Returns all argument ids that map to the given target parameter id.
|
|
142
|
-
*/
|
|
143
|
-
function getAllIdsWithTarget(maps, target) {
|
|
144
|
-
return maps.entries().filter(([, v]) => v === target).map(([k]) => k).toArray();
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Inverts the argument to parameter map to a parameter to argument map.
|
|
148
|
-
*/
|
|
149
|
-
function invertArgumentMap(maps) {
|
|
150
|
-
const inverted = new Map();
|
|
151
|
-
for (const [arg, param] of maps.entries()) {
|
|
152
|
-
const existing = inverted.get(param);
|
|
153
|
-
if (existing) {
|
|
154
|
-
existing.push(arg);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
inverted.set(param, [arg]);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return inverted;
|
|
161
|
-
}
|
|
162
138
|
/**
|
|
163
139
|
* Links the given arguments to the given parameters within the given graph by name only.
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* const parameterSpec = {
|
|
143
|
+
* 'paramName': 'paramId',
|
|
144
|
+
* 'anotherParamName': 'anotherParamId',
|
|
145
|
+
* // we recommend to always add '...' to your specification
|
|
146
|
+
* // this way you can collect all arguments that could not be matched!
|
|
147
|
+
* '...': '...'
|
|
148
|
+
* } as const;
|
|
149
|
+
*
|
|
150
|
+
* const match = pMatch(convertFnArguments(args), parameterSpec);
|
|
151
|
+
* const addParam = match.get('paramId');
|
|
152
|
+
* ```
|
|
164
153
|
* @note
|
|
165
154
|
* To obtain the arguments from a {@link RFunctionCall}[], either use {@link processAllArguments} (also available via {@link processKnownFunctionCall})
|
|
166
155
|
* or convert them with {@link convertFnArguments}.
|
|
167
|
-
* You can use {@link getAllIdsWithTarget} to get all argument ids that map to a given parameter.
|
|
168
156
|
*/
|
|
169
157
|
function pMatch(args, params) {
|
|
170
158
|
const nameArgMap = new Map(args.filter(graph_1.FunctionArgument.isNamed).map(a => [a.name, a]));
|
|
171
159
|
const maps = new Map();
|
|
160
|
+
function addToMaps(key, value) {
|
|
161
|
+
const e = maps.get(key);
|
|
162
|
+
if (e) {
|
|
163
|
+
e.push(value);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
maps.set(key, [value]);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
172
169
|
const sid = params['...'];
|
|
173
170
|
const paramNames = Object.keys(params);
|
|
174
171
|
// all parameters matched by name
|
|
@@ -178,11 +175,11 @@ function pMatch(args, params) {
|
|
|
178
175
|
const pmatchName = (0, prefix_1.findByPrefixIfUnique)(name, paramNames) ?? name;
|
|
179
176
|
const param = params[pmatchName];
|
|
180
177
|
if (param) {
|
|
181
|
-
|
|
178
|
+
addToMaps(param, argId);
|
|
182
179
|
matchedParameters.add(name);
|
|
183
180
|
}
|
|
184
181
|
else if (sid) {
|
|
185
|
-
|
|
182
|
+
addToMaps(sid, argId);
|
|
186
183
|
}
|
|
187
184
|
}
|
|
188
185
|
const remainingParameter = paramNames.filter(p => !matchedParameters.has(p));
|
|
@@ -195,13 +192,13 @@ function pMatch(args, params) {
|
|
|
195
192
|
const aid = arg.nodeId;
|
|
196
193
|
if (remainingParameter.length <= i) {
|
|
197
194
|
if (sid) {
|
|
198
|
-
|
|
195
|
+
addToMaps(sid, aid);
|
|
199
196
|
}
|
|
200
197
|
continue;
|
|
201
198
|
}
|
|
202
199
|
const param = params[remainingParameter[i]];
|
|
203
200
|
if (param) {
|
|
204
|
-
|
|
201
|
+
addToMaps(param, aid);
|
|
205
202
|
}
|
|
206
203
|
}
|
|
207
204
|
return maps;
|
|
@@ -342,8 +339,8 @@ function getAllFunctionCallTargets(call, graph, environment) {
|
|
|
342
339
|
}
|
|
343
340
|
if (environment !== undefined || info.environment !== undefined) {
|
|
344
341
|
let functionCallDefs = [];
|
|
345
|
-
const refType = info.origin.includes(
|
|
346
|
-
info.origin.includes(
|
|
342
|
+
const refType = info.origin.includes(built_in_proc_name_1.BuiltInProcName.S3Dispatch) ? identifier_1.ReferenceType.S3MethodPrefix :
|
|
343
|
+
info.origin.includes(built_in_proc_name_1.BuiltInProcName.S7Dispatch) ? identifier_1.ReferenceType.S7MethodPrefix : identifier_1.ReferenceType.Function;
|
|
347
344
|
if (info.name !== undefined && !identifier_1.Identifier.getName(info.name).startsWith(unnamed_call_handling_1.UnnamedFunctionCallPrefix)) {
|
|
348
345
|
functionCallDefs = (0, resolve_by_name_1.resolveByName)(info.name, environment ?? info.environment, refType)?.map(d => d.nodeId) ?? [];
|
|
349
346
|
}
|
|
@@ -8,13 +8,13 @@ const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/process
|
|
|
8
8
|
const logger_1 = require("../../../../../logger");
|
|
9
9
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
10
10
|
const edge_1 = require("../../../../../graph/edge");
|
|
11
|
-
const built_in_1 = require("../../../../../environments/built-in");
|
|
12
11
|
const built_in_assignment_1 = require("./built-in-assignment");
|
|
13
12
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
14
13
|
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
14
|
+
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
15
15
|
function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
|
|
16
16
|
outInfo.definitionRootNodes.push(rootId);
|
|
17
|
-
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin:
|
|
17
|
+
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.TableAssignment }).information;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Processes different types of access operations.
|
|
@@ -36,7 +36,7 @@ function processAccess(name, args, rootId, data, config) {
|
|
|
36
36
|
let fnCall;
|
|
37
37
|
if (head === r_function_call_1.EmptyArgument) {
|
|
38
38
|
// in this case we may be within a pipe
|
|
39
|
-
fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin:
|
|
39
|
+
fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: built_in_proc_name_1.BuiltInProcName.Access });
|
|
40
40
|
}
|
|
41
41
|
else if (config.treatIndicesAsString) {
|
|
42
42
|
fnCall = processStringBasedAccess(args, data, name, rootId, config);
|
|
@@ -104,7 +104,7 @@ function processNumberBasedAccess(data, name, args, rootId, config, head) {
|
|
|
104
104
|
name: ':=',
|
|
105
105
|
nodeId: tableAssignId
|
|
106
106
|
}]);
|
|
107
|
-
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin:
|
|
107
|
+
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: built_in_proc_name_1.BuiltInProcName.Access });
|
|
108
108
|
/* recover the environment */
|
|
109
109
|
if (existing !== undefined) {
|
|
110
110
|
data.environment.current.memory.set(':=', existing);
|
|
@@ -156,7 +156,7 @@ function processStringBasedAccess(args, data, name, rootId, config) {
|
|
|
156
156
|
rootId,
|
|
157
157
|
data,
|
|
158
158
|
forceArgs: config.forceArgs,
|
|
159
|
-
origin:
|
|
159
|
+
origin: built_in_proc_name_1.BuiltInProcName.Access
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
//# sourceMappingURL=built-in-access.js.map
|