@eagleoutice/flowr 2.9.10 → 2.9.12
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 +48 -50
- package/abstract-interpretation/absint-visitor.js +2 -1
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/normalized-ast-fold.d.ts +2 -2
- package/abstract-interpretation/normalized-ast-fold.js +4 -3
- package/benchmark/slicer.js +5 -5
- package/benchmark/summarizer/first-phase/process.js +4 -4
- package/cli/repl/commands/repl-normalize.js +2 -2
- package/cli/repl/core.js +2 -2
- package/config.js +1 -1
- package/control-flow/control-flow-graph.d.ts +1 -1
- package/control-flow/control-flow-graph.js +1 -2
- package/control-flow/extract-cfg.js +4 -3
- package/dataflow/cluster.js +12 -8
- package/dataflow/environments/built-in.d.ts +2 -15
- package/dataflow/environments/built-in.js +11 -31
- package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +2 -1
- package/dataflow/eval/resolve/resolve.js +4 -3
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/exceptions-of-function.js +2 -1
- package/dataflow/graph/call-graph.d.ts +1 -1
- package/dataflow/graph/call-graph.js +4 -3
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.js +21 -21
- package/dataflow/graph/graph.d.ts +4 -4
- package/dataflow/graph/graph.js +27 -22
- package/dataflow/graph/quads.js +4 -7
- package/dataflow/internal/linker.d.ts +2 -2
- package/dataflow/internal/linker.js +15 -14
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -1
- package/dataflow/internal/process/functions/call/argument/make-argument.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -5
- 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 +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +3 -3
- 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 +2 -1
- 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.js +3 -3
- package/dataflow/internal/process/functions/call/common.d.ts +1 -1
- package/dataflow/internal/process/functions/call/common.js +43 -35
- package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/process-argument.js +3 -3
- package/dataflow/internal/process/functions/process-parameter.js +2 -2
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-origin.js +2 -2
- package/documentation/doc-util/doc-types.js +1 -1
- package/documentation/wiki-cfg.js +3 -3
- package/documentation/wiki-dataflow-graph.js +86 -31
- package/documentation/wiki-engine.js +18 -0
- package/documentation/wiki-mk/doc-context.d.ts +52 -11
- package/documentation/wiki-mk/doc-context.js +20 -13
- package/documentation/wiki-normalized-ast.d.ts +1 -1
- package/documentation/wiki-normalized-ast.js +9 -6
- package/linter/linter-format.d.ts +10 -0
- package/linter/linter-format.js +15 -0
- package/linter/rules/absolute-path.js +3 -3
- package/linter/rules/file-path-validity.js +1 -1
- package/package.json +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +5 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +8 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +4 -5
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +6 -5
- package/queries/catalog/dependencies-query/function-info/library-functions.js +2 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +9 -1
- package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -0
- package/queries/catalog/does-call-query/does-call-query-executor.js +3 -3
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +1 -1
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
- package/queries/query-print.d.ts +1 -1
- package/queries/query-print.js +4 -3
- package/r-bridge/lang-4.x/ast/model/model.d.ts +151 -4
- package/r-bridge/lang-4.x/ast/model/model.js +249 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +13 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +19 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +26 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +36 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +48 -13
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +21 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +11 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +23 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +32 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +19 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +26 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +12 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +20 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +26 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +12 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +11 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +17 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +22 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +22 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +45 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +57 -16
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +12 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +15 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +21 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +21 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +22 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +21 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +14 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +39 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +52 -9
- package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +8 -7
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +6 -13
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +4 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +2 -2
- package/r-bridge/lang-4.x/convert-values.d.ts +14 -5
- package/r-bridge/lang-4.x/convert-values.js +76 -72
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -2
- package/r-bridge/roxygen2/roxygen-parse.js +1 -1
- package/r-bridge/shell-executor.js +1 -1
- package/reconstruct/auto-select/magic-comments.js +4 -4
- package/reconstruct/reconstruct.js +2 -1
- package/search/search-executor/search-generators.js +2 -2
- package/slicing/criterion/filters/all-variables.js +1 -1
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/criterion/parse.js +5 -3
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +2 -2
- package/statistics/features/supported/assignments/assignments.js +2 -2
- package/statistics/features/supported/control-flow/control-flow.js +2 -2
- package/statistics/features/supported/data-access/data-access.js +4 -3
- package/statistics/features/supported/defined-functions/defined-functions.js +9 -8
- package/statistics/features/supported/expression-list/statistics-expression-list.js +2 -2
- package/statistics/features/supported/loops/loops.js +6 -5
- package/statistics/features/supported/used-functions/used-functions.js +2 -2
- package/statistics/features/supported/variables/variables.js +8 -8
- package/util/mermaid/ast.js +2 -2
- package/util/mermaid/cfg.js +3 -4
- package/util/mermaid/dfg.d.ts +9 -1
- package/util/mermaid/dfg.js +13 -9
- package/util/quads.js +14 -6
- package/util/range.d.ts +3 -0
- package/util/range.js +3 -0
- package/util/simple-df/dfg-ascii.js +1 -1
- package/util/version.js +1 -1
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +0 -10
- package/r-bridge/lang-4.x/ast/model/collect.js +0 -25
|
@@ -16,8 +16,8 @@ import { processExpressionList } from '../internal/process/functions/call/built-
|
|
|
16
16
|
import { processGet } from '../internal/process/functions/call/built-in/built-in-get';
|
|
17
17
|
import type { AstIdMap, ParentInformation, RNodeWithParent } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
18
18
|
import { type RFunctionArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
19
|
-
import
|
|
20
|
-
import type
|
|
19
|
+
import { RSymbol } from '../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
20
|
+
import { type BuiltIn, NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
21
21
|
import { processLibrary } from '../internal/process/functions/call/built-in/built-in-library';
|
|
22
22
|
import { processSourceCall } from '../internal/process/functions/call/built-in/built-in-source';
|
|
23
23
|
import type { ForceArguments } from '../internal/process/functions/call/common';
|
|
@@ -42,19 +42,6 @@ import { processS3Dispatch } from '../internal/process/functions/call/built-in/b
|
|
|
42
42
|
import { processRecall } from '../internal/process/functions/call/built-in/built-in-recall';
|
|
43
43
|
import { processS7NewGeneric } from '../internal/process/functions/call/built-in/built-in-s-seven-new-generic';
|
|
44
44
|
import { processS7Dispatch } from '../internal/process/functions/call/built-in/built-in-s-seven-dispatch';
|
|
45
|
-
export type BuiltIn = `built-in:${string}`;
|
|
46
|
-
/**
|
|
47
|
-
* Generate a built-in id for the given name
|
|
48
|
-
*/
|
|
49
|
-
export declare function builtInId<T extends string>(name: T): `built-in:${T}`;
|
|
50
|
-
/**
|
|
51
|
-
* Checks whether the given name is a built-in identifier
|
|
52
|
-
*/
|
|
53
|
-
export declare function isBuiltIn(name: NodeId | string): name is BuiltIn;
|
|
54
|
-
/**
|
|
55
|
-
* Drops the `built-in:` prefix from the given built-in name
|
|
56
|
-
*/
|
|
57
|
-
export declare function dropBuiltInPrefix<T extends string>(name: `built-in:${T}`): T;
|
|
58
45
|
export type BuiltInIdentifierProcessor = <OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>) => DataflowInformation;
|
|
59
46
|
export type BuiltInIdentifierProcessorWithConfig<Config> = <OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: Config) => DataflowInformation;
|
|
60
47
|
export interface BuiltInIdentifierDefinition extends IdentifierReference {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuiltIns = exports.BuiltInEvalHandlerMapper = exports.BuiltInProcessorMapper = exports.BuiltInProcName = void 0;
|
|
4
|
-
exports.builtInId = builtInId;
|
|
5
|
-
exports.isBuiltIn = isBuiltIn;
|
|
6
|
-
exports.dropBuiltInPrefix = dropBuiltInPrefix;
|
|
7
4
|
const known_call_handling_1 = require("../internal/process/functions/call/known-call-handling");
|
|
8
5
|
const built_in_access_1 = require("../internal/process/functions/call/built-in/built-in-access");
|
|
9
6
|
const built_in_if_then_else_1 = require("../internal/process/functions/call/built-in/built-in-if-then-else");
|
|
@@ -21,6 +18,8 @@ const built_in_function_definition_1 = require("../internal/process/functions/ca
|
|
|
21
18
|
const built_in_expression_list_1 = require("../internal/process/functions/call/built-in/built-in-expression-list");
|
|
22
19
|
const built_in_get_1 = require("../internal/process/functions/call/built-in/built-in-get");
|
|
23
20
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
21
|
+
const r_symbol_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
22
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
24
23
|
const edge_1 = require("../graph/edge");
|
|
25
24
|
const built_in_library_1 = require("../internal/process/functions/call/built-in/built-in-library");
|
|
26
25
|
const built_in_source_1 = require("../internal/process/functions/call/built-in/built-in-source");
|
|
@@ -30,7 +29,6 @@ const built_in_vector_1 = require("../internal/process/functions/call/built-in/b
|
|
|
30
29
|
const built_in_rm_1 = require("../internal/process/functions/call/built-in/built-in-rm");
|
|
31
30
|
const built_in_eval_1 = require("../internal/process/functions/call/built-in/built-in-eval");
|
|
32
31
|
const vertex_1 = require("../graph/vertex");
|
|
33
|
-
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
34
32
|
const unknown_side_effect_1 = require("../graph/unknown-side-effect");
|
|
35
33
|
const resolve_1 = require("../eval/resolve/resolve");
|
|
36
34
|
const built_in_stop_if_not_1 = require("../internal/process/functions/call/built-in/built-in-stop-if-not");
|
|
@@ -41,25 +39,7 @@ const built_in_s_three_dispatch_1 = require("../internal/process/functions/call/
|
|
|
41
39
|
const built_in_recall_1 = require("../internal/process/functions/call/built-in/built-in-recall");
|
|
42
40
|
const built_in_s_seven_new_generic_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-new-generic");
|
|
43
41
|
const built_in_s_seven_dispatch_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-dispatch");
|
|
44
|
-
|
|
45
|
-
* Generate a built-in id for the given name
|
|
46
|
-
*/
|
|
47
|
-
function builtInId(name) {
|
|
48
|
-
return `built-in:${name}`;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Checks whether the given name is a built-in identifier
|
|
52
|
-
*/
|
|
53
|
-
function isBuiltIn(name) {
|
|
54
|
-
return String(name).startsWith('built-in:');
|
|
55
|
-
}
|
|
56
|
-
const builtInPrefixLength = 'built-in:'.length;
|
|
57
|
-
/**
|
|
58
|
-
* Drops the `built-in:` prefix from the given built-in name
|
|
59
|
-
*/
|
|
60
|
-
function dropBuiltInPrefix(name) {
|
|
61
|
-
return name.slice(builtInPrefixLength);
|
|
62
|
-
}
|
|
42
|
+
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
63
43
|
function defaultBuiltInProcessor(name, args, rootId, data, { returnsNthArgument, useAsProcessor = BuiltInProcName.Default, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall }) {
|
|
64
44
|
const { information: res, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs, origin: useAsProcessor });
|
|
65
45
|
if (returnsNthArgument !== undefined) {
|
|
@@ -90,11 +70,11 @@ function defaultBuiltInProcessor(name, args, rootId, data, { returnsNthArgument,
|
|
|
90
70
|
const rhs = arg.value;
|
|
91
71
|
let fnName;
|
|
92
72
|
let fnId;
|
|
93
|
-
if (
|
|
73
|
+
if (r_string_1.RString.is(rhs)) {
|
|
94
74
|
fnName = rhs.content.str;
|
|
95
75
|
fnId = rhs.info.id;
|
|
96
76
|
}
|
|
97
|
-
else if (
|
|
77
|
+
else if (r_symbol_1.RSymbol.is(rhs)) {
|
|
98
78
|
fnName = rhs.content;
|
|
99
79
|
fnId = rhs.info.id;
|
|
100
80
|
}
|
|
@@ -120,14 +100,14 @@ function defaultBuiltInProcessor(name, args, rootId, data, { returnsNthArgument,
|
|
|
120
100
|
return res;
|
|
121
101
|
}
|
|
122
102
|
function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = BuiltInProcName.Default, forceArgs }) {
|
|
123
|
-
const { information
|
|
124
|
-
const g =
|
|
103
|
+
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs, origin: useAsProcessor });
|
|
104
|
+
const g = information.graph;
|
|
125
105
|
for (const arg of processedArguments) {
|
|
126
106
|
if (arg) {
|
|
127
107
|
g.addEdge(rootId, arg.entryPoint, edge_1.EdgeType.Reads);
|
|
128
108
|
}
|
|
129
109
|
}
|
|
130
|
-
return
|
|
110
|
+
return information;
|
|
131
111
|
}
|
|
132
112
|
/**
|
|
133
113
|
* This contains all names of built-in function handlers and origins
|
|
@@ -259,7 +239,7 @@ class BuiltIns {
|
|
|
259
239
|
registerBuiltInConstant({ names, value, assumePrimitive }) {
|
|
260
240
|
for (const name of names) {
|
|
261
241
|
const n = identifier_1.Identifier.getName(name);
|
|
262
|
-
const id =
|
|
242
|
+
const id = node_id_1.NodeId.toBuiltIn(n);
|
|
263
243
|
const d = [{
|
|
264
244
|
type: identifier_1.ReferenceType.BuiltInConstant,
|
|
265
245
|
definedAt: id,
|
|
@@ -280,7 +260,7 @@ class BuiltIns {
|
|
|
280
260
|
(0, assert_1.guard)(mappedProcessor !== undefined, () => `Processor for ${processor} is undefined! Please pass a valid builtin name ${JSON.stringify(Object.keys(exports.BuiltInProcessorMapper))}!`);
|
|
281
261
|
for (const name of names) {
|
|
282
262
|
const n = identifier_1.Identifier.getName(name);
|
|
283
|
-
const id =
|
|
263
|
+
const id = node_id_1.NodeId.toBuiltIn(n);
|
|
284
264
|
const d = [{
|
|
285
265
|
type: identifier_1.ReferenceType.BuiltInFunction,
|
|
286
266
|
definedAt: id,
|
|
@@ -303,7 +283,7 @@ class BuiltIns {
|
|
|
303
283
|
for (const assignment of names) {
|
|
304
284
|
for (const suffix of suffixes) {
|
|
305
285
|
const effectiveName = `${identifier_1.Identifier.getName(assignment)}${suffix}`;
|
|
306
|
-
const id =
|
|
286
|
+
const id = node_id_1.NodeId.toBuiltIn(effectiveName);
|
|
307
287
|
const d = [{
|
|
308
288
|
type: identifier_1.ReferenceType.BuiltInFunction,
|
|
309
289
|
definedAt: id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VariableResolve } from '../../../config';
|
|
2
2
|
import type { AstIdMap, RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
|
-
import {
|
|
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 { Identifier } from '../../environments/identifier';
|
|
6
6
|
import type { DataflowGraph } from '../../graph/graph';
|
|
@@ -20,6 +20,7 @@ const general_1 = require("../values/general");
|
|
|
20
20
|
const r_value_1 = require("../values/r-value");
|
|
21
21
|
const set_constants_1 = require("../values/sets/set-constants");
|
|
22
22
|
const resolve_1 = require("./resolve");
|
|
23
|
+
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
23
24
|
const AliasHandler = {
|
|
24
25
|
[vertex_1.VertexType.Value]: (sourceId) => [sourceId],
|
|
25
26
|
[vertex_1.VertexType.Use]: getUseAlias,
|
|
@@ -292,7 +293,7 @@ function trackAliasesInGraph(id, graph, ctx, idMap) {
|
|
|
292
293
|
if (target === undefined) {
|
|
293
294
|
continue;
|
|
294
295
|
}
|
|
295
|
-
if (
|
|
296
|
+
if (model_1.RLoopConstructs.is(target)) {
|
|
296
297
|
forceTop = true;
|
|
297
298
|
break;
|
|
298
299
|
}
|
|
@@ -18,6 +18,7 @@ const vector_constants_1 = require("../values/vectors/vector-constants");
|
|
|
18
18
|
const alias_tracking_1 = require("./alias-tracking");
|
|
19
19
|
const scalar_constants_1 = require("../values/scalar/scalar-constants");
|
|
20
20
|
const identifier_1 = require("../../environments/identifier");
|
|
21
|
+
const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
21
22
|
/**
|
|
22
23
|
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
23
24
|
* you want to resolve the value of an identifier / node
|
|
@@ -46,14 +47,14 @@ function resolveNode({ resolve, node, ctx, blocked, environment, graph, idMap })
|
|
|
46
47
|
return r_value_2.Top;
|
|
47
48
|
}
|
|
48
49
|
let builtInName;
|
|
49
|
-
if (
|
|
50
|
+
if (node_id_1.NodeId.isBuiltIn(origin.proc)) {
|
|
50
51
|
builtInName = origin.proc;
|
|
51
52
|
}
|
|
52
53
|
else if (nt === type_1.RType.FunctionCall && node.named) {
|
|
53
|
-
builtInName =
|
|
54
|
+
builtInName = node_id_1.NodeId.toBuiltIn(identifier_1.Identifier.getName(node.functionName.content));
|
|
54
55
|
}
|
|
55
56
|
else if (nt === type_1.RType.BinaryOp || nt === type_1.RType.UnaryOp) {
|
|
56
|
-
builtInName =
|
|
57
|
+
builtInName = node_id_1.NodeId.toBuiltIn(node.operator);
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
59
60
|
return r_value_2.Top;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
2
|
import type { CallGraph } from '../graph/call-graph';
|
|
3
3
|
import type { ControlDependency } from '../info';
|
|
4
4
|
export interface ExceptionPoint {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateExceptionsOfFunction = calculateExceptionsOfFunction;
|
|
4
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
4
5
|
const vertex_1 = require("../graph/vertex");
|
|
5
6
|
const built_in_1 = require("../environments/built-in");
|
|
6
7
|
const CatchHandlers = new Set([built_in_1.BuiltInProcName.Try]);
|
|
@@ -35,7 +36,7 @@ function calculateExceptionsOfFunction(id, graph, knownThrower = {}) {
|
|
|
35
36
|
if (!vtx) {
|
|
36
37
|
continue;
|
|
37
38
|
}
|
|
38
|
-
if (
|
|
39
|
+
if (node_id_1.NodeId.isBuiltIn(currentId)) {
|
|
39
40
|
continue;
|
|
40
41
|
}
|
|
41
42
|
if (vtx.tag === vertex_1.VertexType.FunctionDefinition) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataflowGraph } from './graph';
|
|
2
2
|
import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexFunctionDefinition } from './vertex';
|
|
3
|
-
import
|
|
3
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import { DefaultMap } from '../../util/collections/defaultmap';
|
|
5
5
|
/**
|
|
6
6
|
* A call graph is a dataflow graph where all vertices are function calls.
|
|
@@ -6,6 +6,7 @@ exports.dropTransitiveEdges = dropTransitiveEdges;
|
|
|
6
6
|
exports.computeCallGraph = computeCallGraph;
|
|
7
7
|
const graph_1 = require("./graph");
|
|
8
8
|
const vertex_1 = require("./vertex");
|
|
9
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
9
10
|
const linker_1 = require("../internal/linker");
|
|
10
11
|
const edge_1 = require("./edge");
|
|
11
12
|
const built_in_1 = require("../environments/built-in");
|
|
@@ -176,7 +177,7 @@ function processCall(vtx, from, graph, result, state) {
|
|
|
176
177
|
let addedTarget = false;
|
|
177
178
|
let addedBiTarget = false;
|
|
178
179
|
for (const tar of tars) {
|
|
179
|
-
if (
|
|
180
|
+
if (node_id_1.NodeId.isBuiltIn(tar)) {
|
|
180
181
|
result.addEdge(vid, tar, edge_1.EdgeType.Calls);
|
|
181
182
|
addedTarget = true;
|
|
182
183
|
addedBiTarget = true;
|
|
@@ -193,7 +194,7 @@ function processCall(vtx, from, graph, result, state) {
|
|
|
193
194
|
for (const origs of vtx.origin) {
|
|
194
195
|
if (origs.startsWith('builtin:')) {
|
|
195
196
|
addedTarget = true;
|
|
196
|
-
result.addEdge(vid,
|
|
197
|
+
result.addEdge(vid, node_id_1.NodeId.toBuiltIn(origs.substring('builtin:'.length)), edge_1.EdgeType.Calls);
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
}
|
|
@@ -237,7 +238,7 @@ function processUnknown(vtx, from, graph, result, state) {
|
|
|
237
238
|
return;
|
|
238
239
|
case vertex_1.VertexType.FunctionDefinition:
|
|
239
240
|
if (from) {
|
|
240
|
-
result.addEdge(from,
|
|
241
|
+
result.addEdge(from, node_id_1.NodeId.toBuiltIn('function'), edge_1.EdgeType.Calls);
|
|
241
242
|
}
|
|
242
243
|
return;
|
|
243
244
|
default:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
2
|
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
3
|
import { type DataflowFunctionFlowInformation, DataflowGraph, FunctionArgument } from './graph';
|
|
4
4
|
import { type IEnvironment, type REnvironmentInformation } from '../environments/environment';
|
|
@@ -48,21 +48,21 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
48
48
|
defineFunction(id, exitPoints, subflow, info, asRoot = true) {
|
|
49
49
|
return this.addVertexWithDefaultEnv({
|
|
50
50
|
tag: vertex_1.VertexType.FunctionDefinition,
|
|
51
|
-
id:
|
|
51
|
+
id: node_id_1.NodeId.normalize(id),
|
|
52
52
|
params: Object.fromEntries(info?.readParams ?? []),
|
|
53
53
|
subflow: {
|
|
54
54
|
...subflow,
|
|
55
|
-
entryPoint:
|
|
56
|
-
graph: new Set([...subflow.graph].map(node_id_1.
|
|
57
|
-
out: subflow.out.map(o => ({ ...o, nodeId:
|
|
58
|
-
in: subflow.in.map(o => ({ ...o, nodeId:
|
|
59
|
-
unknownReferences: subflow.unknownReferences.map(o => ({ ...o, nodeId:
|
|
55
|
+
entryPoint: node_id_1.NodeId.normalize(subflow.entryPoint),
|
|
56
|
+
graph: new Set([...subflow.graph].map(node_id_1.NodeId.normalize)),
|
|
57
|
+
out: subflow.out.map(o => ({ ...o, nodeId: node_id_1.NodeId.normalize(o.nodeId), cds: o.cds?.map(c => ({ ...c, id: node_id_1.NodeId.normalize(c.id) })) })),
|
|
58
|
+
in: subflow.in.map(o => ({ ...o, nodeId: node_id_1.NodeId.normalize(o.nodeId), cds: o.cds?.map(c => ({ ...c, id: node_id_1.NodeId.normalize(c.id) })) })),
|
|
59
|
+
unknownReferences: subflow.unknownReferences.map(o => ({ ...o, nodeId: node_id_1.NodeId.normalize(o.nodeId), cds: o.cds?.map(c => ({ ...c, id: node_id_1.NodeId.normalize(c.id) })) })),
|
|
60
60
|
hooks: subflow.hooks ?? [],
|
|
61
61
|
},
|
|
62
62
|
mode: info?.mode,
|
|
63
|
-
exitPoints: exitPoints.map(e => typeof e === 'object' ? ({ ...e, nodeId:
|
|
64
|
-
({ nodeId:
|
|
65
|
-
cds: info?.cds?.map(c => ({ ...c, id:
|
|
63
|
+
exitPoints: exitPoints.map(e => typeof e === 'object' ? ({ ...e, nodeId: node_id_1.NodeId.normalize(e.nodeId), cds: e.cds?.map(c => ({ ...c, id: node_id_1.NodeId.normalize(c.id) })) }) :
|
|
64
|
+
({ nodeId: node_id_1.NodeId.normalize(e), type: 0 /* ExitPointType.Default */, cds: undefined })),
|
|
65
|
+
cds: info?.cds?.map(c => ({ ...c, id: node_id_1.NodeId.normalize(c.id) })),
|
|
66
66
|
environment: info?.environment,
|
|
67
67
|
}, asRoot);
|
|
68
68
|
}
|
|
@@ -76,14 +76,14 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
76
76
|
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
77
77
|
*/
|
|
78
78
|
call(id, name, args, info, asRoot = true) {
|
|
79
|
-
const onlyBuiltInAuto = info?.reads?.length === 1 &&
|
|
79
|
+
const onlyBuiltInAuto = info?.reads?.length === 1 && node_id_1.NodeId.isBuiltIn(info?.reads[0]);
|
|
80
80
|
this.addVertexWithDefaultEnv({
|
|
81
81
|
tag: vertex_1.VertexType.FunctionCall,
|
|
82
|
-
id:
|
|
82
|
+
id: node_id_1.NodeId.normalize(id),
|
|
83
83
|
name,
|
|
84
|
-
args: args.map(a => a === r_function_call_1.EmptyArgument ? r_function_call_1.EmptyArgument : { ...a, nodeId:
|
|
84
|
+
args: args.map(a => a === r_function_call_1.EmptyArgument ? r_function_call_1.EmptyArgument : { ...a, nodeId: node_id_1.NodeId.normalize(a.nodeId), cds: undefined }),
|
|
85
85
|
environment: (info?.onlyBuiltIn || onlyBuiltInAuto) ? undefined : info?.environment ?? this.defaultEnvironment,
|
|
86
|
-
cds: info?.cds?.map(c => ({ ...c, id:
|
|
86
|
+
cds: info?.cds?.map(c => ({ ...c, id: node_id_1.NodeId.normalize(c.id) })),
|
|
87
87
|
onlyBuiltin: info?.onlyBuiltIn ?? onlyBuiltInAuto ?? false,
|
|
88
88
|
origin: info?.origin ?? [(0, default_builtin_config_1.getDefaultProcessor)(name) ?? built_in_1.BuiltInProcName.Function],
|
|
89
89
|
link: info?.link
|
|
@@ -133,9 +133,9 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
133
133
|
defineVariable(id, name, info, asRoot = true) {
|
|
134
134
|
this.addVertexWithDefaultEnv({
|
|
135
135
|
tag: vertex_1.VertexType.VariableDefinition,
|
|
136
|
-
id:
|
|
136
|
+
id: node_id_1.NodeId.normalize(id),
|
|
137
137
|
name,
|
|
138
|
-
cds: info?.cds?.map(c => ({ ...c, id:
|
|
138
|
+
cds: info?.cds?.map(c => ({ ...c, id: node_id_1.NodeId.normalize(c.id) })),
|
|
139
139
|
}, asRoot);
|
|
140
140
|
if (info?.definedBy) {
|
|
141
141
|
for (const def of info.definedBy) {
|
|
@@ -155,13 +155,13 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
155
155
|
use(id, name, info, asRoot = true) {
|
|
156
156
|
return this.addVertexWithDefaultEnv((0, objects_1.deepMergeObject)({
|
|
157
157
|
tag: vertex_1.VertexType.Use,
|
|
158
|
-
id:
|
|
158
|
+
id: node_id_1.NodeId.normalize(id),
|
|
159
159
|
name,
|
|
160
160
|
cds: undefined,
|
|
161
161
|
environment: undefined
|
|
162
162
|
}, {
|
|
163
163
|
...info,
|
|
164
|
-
cds: info?.cds?.map(c => ({ ...c, id:
|
|
164
|
+
cds: info?.cds?.map(c => ({ ...c, id: node_id_1.NodeId.normalize(c.id) }))
|
|
165
165
|
}), asRoot);
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
@@ -174,8 +174,8 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
174
174
|
constant(id, options, asRoot = true) {
|
|
175
175
|
return this.addVertexWithDefaultEnv({
|
|
176
176
|
tag: vertex_1.VertexType.Value,
|
|
177
|
-
id:
|
|
178
|
-
cds: options?.cds?.map(c => ({ ...c, id:
|
|
177
|
+
id: node_id_1.NodeId.normalize(id),
|
|
178
|
+
cds: options?.cds?.map(c => ({ ...c, id: node_id_1.NodeId.normalize(c.id) })),
|
|
179
179
|
environment: undefined
|
|
180
180
|
}, asRoot);
|
|
181
181
|
}
|
|
@@ -186,7 +186,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
186
186
|
}
|
|
187
187
|
return this;
|
|
188
188
|
}
|
|
189
|
-
return this.addEdge(
|
|
189
|
+
return this.addEdge(node_id_1.NodeId.normalize(from), node_id_1.NodeId.normalize(to), type);
|
|
190
190
|
}
|
|
191
191
|
async queryHelper(from, to, data, type) {
|
|
192
192
|
let fromId;
|
|
@@ -344,7 +344,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
344
344
|
* this is just an easier variant in case you working with a lot of functions this saves you a lot of `false` flags.
|
|
345
345
|
*/
|
|
346
346
|
overwriteRootIds(ids) {
|
|
347
|
-
this.rootVertices = new Set(ids.map(node_id_1.
|
|
347
|
+
this.rootVertices = new Set(ids.map(node_id_1.NodeId.normalize));
|
|
348
348
|
return this;
|
|
349
349
|
}
|
|
350
350
|
}
|
|
@@ -3,7 +3,7 @@ import type { DataflowInformation } from '../info';
|
|
|
3
3
|
import { type DataflowGraphVertexArgument, type DataflowGraphVertexFunctionCall, type DataflowGraphVertexInfo } from './vertex';
|
|
4
4
|
import { EmptyArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
5
|
import type { BrandedIdentifier, IdentifierDefinition, IdentifierReference } from '../environments/identifier';
|
|
6
|
-
import {
|
|
6
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import { type REnvironmentInformation } from '../environments/environment';
|
|
8
8
|
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
9
9
|
import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
@@ -91,9 +91,9 @@ export declare const FunctionArgument: {
|
|
|
91
91
|
readonly isEmpty: (this: void, arg: unknown) => arg is typeof EmptyArgument;
|
|
92
92
|
/**
|
|
93
93
|
* Checks whether the given argument is not an empty argument.
|
|
94
|
-
* @see {@link isEmpty}
|
|
94
|
+
* @see {@link FunctionArgument.isEmpty}
|
|
95
95
|
*/
|
|
96
|
-
readonly isNotEmpty: (this: void, arg:
|
|
96
|
+
readonly isNotEmpty: <T>(this: void, arg: T) => arg is Exclude<T, typeof EmptyArgument>;
|
|
97
97
|
/**
|
|
98
98
|
* Returns the reference of a non-empty argument.
|
|
99
99
|
* @example
|
|
@@ -262,7 +262,7 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
262
262
|
*/
|
|
263
263
|
updateToFunctionCall(info: DataflowGraphVertexFunctionCall): void;
|
|
264
264
|
/** If you do not pass the `to` node, this will just mark the node as maybe */
|
|
265
|
-
addControlDependency(from: NodeId, to
|
|
265
|
+
addControlDependency(from: NodeId, to: NodeId, when?: boolean): this;
|
|
266
266
|
/** Marks the given node as having unknown side effects */
|
|
267
267
|
markIdForUnknownSideEffects(id: NodeId, target?: LinkTo<RegExp | string>): this;
|
|
268
268
|
/**
|
package/dataflow/graph/graph.js
CHANGED
|
@@ -61,7 +61,7 @@ exports.FunctionArgument = {
|
|
|
61
61
|
},
|
|
62
62
|
/**
|
|
63
63
|
* Checks whether the given argument is not an empty argument.
|
|
64
|
-
* @see {@link isEmpty}
|
|
64
|
+
* @see {@link FunctionArgument.isEmpty}
|
|
65
65
|
*/
|
|
66
66
|
isNotEmpty(arg) {
|
|
67
67
|
return arg !== r_function_call_1.EmptyArgument;
|
|
@@ -292,11 +292,10 @@ class DataflowGraph {
|
|
|
292
292
|
if (fromId === toId) {
|
|
293
293
|
return this;
|
|
294
294
|
}
|
|
295
|
-
/* we now that we pass all required arguments */
|
|
296
|
-
const edge = { types: type };
|
|
297
295
|
const existingFrom = this.edgeInformation.get(fromId);
|
|
298
296
|
const edgeInFrom = existingFrom?.get(toId);
|
|
299
297
|
if (edgeInFrom === undefined) {
|
|
298
|
+
const edge = { types: type };
|
|
300
299
|
if (existingFrom === undefined) {
|
|
301
300
|
this.edgeInformation.set(fromId, new Map([[toId, edge]]));
|
|
302
301
|
}
|
|
@@ -373,8 +372,9 @@ class DataflowGraph {
|
|
|
373
372
|
vertex.cds = reference.cds;
|
|
374
373
|
}
|
|
375
374
|
else {
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
const oldTag = vertex.tag;
|
|
376
|
+
vertex.tag = vertex_1.VertexType.VariableDefinition;
|
|
377
|
+
this.types.set(oldTag, (this.types.get(oldTag) ?? []).filter(id => id !== reference.nodeId));
|
|
378
378
|
this.types.set(vertex_1.VertexType.VariableDefinition, (this.types.get(vertex_1.VertexType.VariableDefinition) ?? []).concat([reference.nodeId]));
|
|
379
379
|
}
|
|
380
380
|
}
|
|
@@ -383,43 +383,48 @@ class DataflowGraph {
|
|
|
383
383
|
* @param info - The information about the new function call node
|
|
384
384
|
*/
|
|
385
385
|
updateToFunctionCall(info) {
|
|
386
|
-
const
|
|
386
|
+
const infoId = info.id;
|
|
387
|
+
const vertex = this.getVertex(infoId);
|
|
387
388
|
(0, assert_1.guard)(vertex !== undefined && (vertex.tag === vertex_1.VertexType.Use || vertex.tag === vertex_1.VertexType.Value), () => `node must be a use or value node for ${JSON.stringify(info.id)} to update it to a function call but is ${vertex?.tag}`);
|
|
388
389
|
const previousTag = vertex.tag;
|
|
389
|
-
this.vertexInformation.set(
|
|
390
|
-
this.types.set(previousTag, (this.types.get(previousTag) ?? []).filter(id => id !==
|
|
391
|
-
|
|
390
|
+
this.vertexInformation.set(infoId, { ...vertex, ...info, tag: vertex_1.VertexType.FunctionCall });
|
|
391
|
+
this.types.set(previousTag, (this.types.get(previousTag) ?? []).filter(id => id !== infoId));
|
|
392
|
+
const g = this.types.get(vertex_1.VertexType.FunctionCall);
|
|
393
|
+
if (g) {
|
|
394
|
+
g.push(infoId);
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
this.types.set(vertex_1.VertexType.FunctionCall, [infoId]);
|
|
398
|
+
}
|
|
392
399
|
}
|
|
393
400
|
/** If you do not pass the `to` node, this will just mark the node as maybe */
|
|
394
401
|
addControlDependency(from, to, when) {
|
|
395
|
-
to =
|
|
402
|
+
to = node_id_1.NodeId.normalize(to);
|
|
396
403
|
const vertex = this.getVertex(from);
|
|
397
404
|
(0, assert_1.guard)(vertex !== undefined, () => `node must be defined for ${from} to add control dependency`);
|
|
398
405
|
vertex.cds ??= [];
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
break;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
if (!hasControlDependency) {
|
|
408
|
-
vertex.cds.push({ id: to, when });
|
|
406
|
+
let hasControlDependency = false;
|
|
407
|
+
for (const { id, when: cond } of vertex.cds) {
|
|
408
|
+
if (id === to && when !== cond) {
|
|
409
|
+
hasControlDependency = true;
|
|
410
|
+
break;
|
|
409
411
|
}
|
|
410
412
|
}
|
|
413
|
+
if (!hasControlDependency) {
|
|
414
|
+
vertex.cds.push({ id: to, when });
|
|
415
|
+
}
|
|
411
416
|
return this;
|
|
412
417
|
}
|
|
413
418
|
/** Marks the given node as having unknown side effects */
|
|
414
419
|
markIdForUnknownSideEffects(id, target) {
|
|
415
420
|
if (target) {
|
|
416
421
|
this._unknownSideEffects.add({
|
|
417
|
-
id:
|
|
422
|
+
id: node_id_1.NodeId.normalize(id),
|
|
418
423
|
linkTo: typeof target.callName === 'string' ? { ...target, callName: new RegExp(target.callName) } : target
|
|
419
424
|
});
|
|
420
425
|
return this;
|
|
421
426
|
}
|
|
422
|
-
this._unknownSideEffects.add(
|
|
427
|
+
this._unknownSideEffects.add(node_id_1.NodeId.normalize(id));
|
|
423
428
|
return this;
|
|
424
429
|
}
|
|
425
430
|
/**
|
package/dataflow/graph/quads.js
CHANGED
|
@@ -10,13 +10,10 @@ const edge_1 = require("./edge");
|
|
|
10
10
|
*/
|
|
11
11
|
function df2quads(graph, config) {
|
|
12
12
|
return (0, quads_1.graph2quads)({
|
|
13
|
-
rootIds:
|
|
14
|
-
vertices: graph.vertices(true)
|
|
15
|
-
.map(([
|
|
16
|
-
|
|
17
|
-
id
|
|
18
|
-
})).toArray(),
|
|
19
|
-
edges: graph.edges().flatMap(([fromId, targets]) => [...targets].map(([toId, info]) => ({
|
|
13
|
+
rootIds: Array.from(graph.rootIds()),
|
|
14
|
+
vertices: Array.from(graph.vertices(true)
|
|
15
|
+
.map(([, v]) => v)),
|
|
16
|
+
edges: graph.edges().flatMap(([fromId, targets]) => Array.from(targets).map(([toId, info]) => ({
|
|
20
17
|
from: fromId,
|
|
21
18
|
to: toId,
|
|
22
19
|
type: Array.from(edge_1.DfEdge.typesToNames(info)),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DefaultMap } from '../../util/collections/defaultmap';
|
|
2
|
-
import {
|
|
2
|
+
import type { BuiltIn } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
4
|
import { Identifier, type IdentifierReference } from '../environments/identifier';
|
|
4
5
|
import { type DataflowGraph, FunctionArgument } from '../graph/graph';
|
|
5
6
|
import type { RParameter } from '../../r-bridge/lang-4.x/ast/model/nodes/r-parameter';
|
|
6
7
|
import type { AstIdMap, ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
8
|
import { type DataflowGraphVertexFunctionCall, type DataflowGraphVertexFunctionDefinition, type DataflowGraphVertexInfo } from '../graph/vertex';
|
|
8
|
-
import { type BuiltIn } from '../environments/built-in';
|
|
9
9
|
import type { REnvironmentInformation } from '../environments/environment';
|
|
10
10
|
import type { ExitPoint } from '../info';
|
|
11
11
|
export type NameIdMap = DefaultMap<Identifier, IdentifierReference[]>;
|