@eagleoutice/flowr 2.2.15 → 2.3.0
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 +226 -6
- package/abstract-interpretation/data-frame/absint-info.d.ts +109 -0
- package/abstract-interpretation/data-frame/absint-info.js +31 -0
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +59 -0
- package/abstract-interpretation/data-frame/absint-visitor.js +173 -0
- package/abstract-interpretation/data-frame/domain.d.ts +107 -0
- package/abstract-interpretation/data-frame/domain.js +315 -0
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +17 -0
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +166 -0
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +117 -0
- package/abstract-interpretation/data-frame/mappers/arguments.js +188 -0
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +20 -0
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +34 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +261 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +1219 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +12 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +206 -0
- package/abstract-interpretation/data-frame/resolve-args.d.ts +42 -0
- package/abstract-interpretation/data-frame/resolve-args.js +118 -0
- package/abstract-interpretation/data-frame/semantics.d.ts +213 -0
- package/abstract-interpretation/data-frame/semantics.js +366 -0
- package/abstract-interpretation/data-frame/shape-inference.d.ts +38 -0
- package/abstract-interpretation/data-frame/shape-inference.js +117 -0
- package/benchmark/slicer.d.ts +18 -2
- package/benchmark/slicer.js +143 -5
- package/benchmark/stats/print.js +123 -45
- package/benchmark/stats/size-of.d.ts +7 -0
- package/benchmark/stats/size-of.js +1 -0
- package/benchmark/stats/stats.d.ts +30 -1
- package/benchmark/stats/stats.js +4 -2
- package/benchmark/summarizer/data.d.ts +33 -2
- package/benchmark/summarizer/first-phase/input.js +5 -1
- package/benchmark/summarizer/first-phase/process.d.ts +2 -1
- package/benchmark/summarizer/first-phase/process.js +49 -3
- package/benchmark/summarizer/second-phase/process.js +101 -3
- package/cli/benchmark-app.d.ts +2 -0
- package/cli/benchmark-app.js +5 -1
- package/cli/benchmark-helper-app.d.ts +2 -0
- package/cli/benchmark-helper-app.js +13 -8
- package/cli/common/options.js +4 -0
- package/cli/export-quads-app.js +2 -1
- package/cli/flowr.js +58 -57
- package/cli/repl/commands/repl-cfg.js +13 -13
- package/cli/repl/commands/repl-commands.js +2 -2
- package/cli/repl/commands/repl-dataflow.js +10 -10
- package/cli/repl/commands/repl-execute.d.ts +2 -3
- package/cli/repl/commands/repl-execute.js +4 -4
- package/cli/repl/commands/repl-lineage.js +4 -4
- package/cli/repl/commands/repl-main.d.ts +12 -1
- package/cli/repl/commands/repl-normalize.js +6 -6
- package/cli/repl/commands/repl-parse.js +2 -2
- package/cli/repl/commands/repl-query.js +9 -9
- package/cli/repl/commands/repl-version.js +1 -1
- package/cli/repl/core.d.ts +5 -2
- package/cli/repl/core.js +10 -8
- package/cli/repl/server/connection.d.ts +3 -1
- package/cli/repl/server/connection.js +7 -5
- package/cli/repl/server/server.d.ts +3 -2
- package/cli/repl/server/server.js +4 -2
- package/cli/script-core/statistics-core.d.ts +2 -1
- package/cli/script-core/statistics-core.js +2 -2
- package/cli/script-core/statistics-helper-core.d.ts +2 -1
- package/cli/script-core/statistics-helper-core.js +5 -4
- package/cli/slicer-app.js +4 -2
- package/cli/statistics-app.js +2 -1
- package/cli/statistics-helper-app.js +2 -1
- package/config.d.ts +43 -10
- package/config.js +47 -43
- package/control-flow/cfg-dead-code.js +45 -2
- package/control-flow/cfg-simplification.d.ts +2 -0
- package/control-flow/control-flow-graph.d.ts +2 -0
- package/control-flow/control-flow-graph.js +8 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +5 -3
- package/control-flow/dfg-cfg-guided-visitor.js +15 -4
- package/control-flow/extract-cfg.d.ts +4 -2
- package/control-flow/extract-cfg.js +4 -3
- package/control-flow/semantic-cfg-guided-visitor.d.ts +20 -2
- package/control-flow/semantic-cfg-guided-visitor.js +24 -4
- package/core/pipeline-executor.d.ts +4 -1
- package/core/pipeline-executor.js +6 -5
- package/core/steps/all/core/10-normalize.d.ts +2 -0
- package/core/steps/all/core/10-normalize.js +1 -1
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -1
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -2
- package/core/steps/all/core/20-dataflow.d.ts +2 -1
- package/core/steps/all/core/20-dataflow.js +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +2 -1
- package/core/steps/all/static-slicing/00-slice.js +2 -2
- package/core/steps/pipeline/default-pipelines.d.ts +32 -31
- package/core/steps/pipeline/default-pipelines.js +8 -8
- package/core/steps/pipeline-step.d.ts +2 -1
- package/dataflow/environments/built-in-config.d.ts +3 -3
- package/dataflow/environments/built-in.d.ts +11 -3
- package/dataflow/environments/built-in.js +5 -3
- package/dataflow/environments/default-builtin-config.js +4 -2
- package/dataflow/environments/define.d.ts +2 -1
- package/dataflow/environments/define.js +4 -5
- package/dataflow/environments/remove.d.ts +6 -0
- package/dataflow/environments/remove.js +29 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +7 -2
- package/dataflow/eval/resolve/alias-tracking.js +11 -8
- package/dataflow/eval/resolve/resolve-argument.d.ts +8 -0
- package/dataflow/eval/resolve/resolve-argument.js +118 -0
- package/dataflow/eval/resolve/resolve.d.ts +65 -18
- package/dataflow/eval/resolve/resolve.js +144 -48
- package/dataflow/eval/values/string/string-constants.d.ts +1 -1
- package/dataflow/eval/values/string/string-constants.js +7 -2
- package/dataflow/extractor.d.ts +2 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +11 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +10 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +6 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -15
- 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 +1 -1
- package/dataflow/internal/process/functions/call/common.js +1 -1
- package/dataflow/internal/process/functions/process-parameter.js +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +21 -0
- package/dataflow/origin/dfg-get-symbol-refs.js +50 -0
- package/dataflow/processor.d.ts +5 -0
- package/documentation/doc-util/doc-cfg.js +4 -3
- package/documentation/doc-util/doc-code.d.ts +1 -1
- package/documentation/doc-util/doc-dfg.js +3 -2
- package/documentation/doc-util/doc-functions.d.ts +24 -0
- package/documentation/doc-util/doc-functions.js +65 -0
- package/documentation/doc-util/doc-normalized-ast.js +3 -2
- package/documentation/doc-util/doc-print.d.ts +5 -0
- package/documentation/doc-util/doc-print.js +36 -0
- package/documentation/doc-util/doc-query.js +13 -2
- package/documentation/doc-util/doc-repl.js +2 -1
- package/documentation/doc-util/doc-search.js +3 -2
- package/documentation/doc-util/doc-types.d.ts +28 -6
- package/documentation/doc-util/doc-types.js +89 -45
- package/documentation/print-cfg-wiki.js +6 -7
- package/documentation/print-core-wiki.js +5 -5
- package/documentation/print-dataflow-graph-wiki.js +10 -10
- package/documentation/print-engines-wiki.js +1 -2
- package/documentation/print-faq-wiki.js +8 -2
- package/documentation/print-interface-wiki.js +12 -2
- package/documentation/print-linter-issue.d.ts +1 -0
- package/documentation/print-linter-issue.js +71 -0
- package/documentation/print-linter-wiki.js +223 -34
- package/documentation/print-linting-and-testing-wiki.js +2 -4
- package/documentation/print-normalized-ast-wiki.js +3 -3
- package/documentation/print-query-wiki.js +18 -2
- package/documentation/print-readme.js +24 -1
- package/documentation/print-search-wiki.js +1 -2
- package/linter/linter-executor.d.ts +3 -1
- package/linter/linter-executor.js +3 -2
- package/linter/linter-format.d.ts +67 -7
- package/linter/linter-format.js +12 -1
- package/linter/linter-rules.d.ts +178 -16
- package/linter/linter-rules.js +14 -4
- package/linter/linter-tags.d.ts +80 -0
- package/linter/linter-tags.js +85 -0
- package/linter/rules/absolute-path.d.ts +71 -0
- package/linter/rules/absolute-path.js +177 -0
- package/linter/rules/dataframe-access-validation.d.ts +53 -0
- package/linter/rules/dataframe-access-validation.js +116 -0
- package/linter/rules/deprecated-functions.d.ts +43 -0
- package/linter/rules/deprecated-functions.js +58 -0
- package/linter/rules/{2-file-path-validity.d.ts → file-path-validity.d.ts} +16 -6
- package/linter/rules/{2-file-path-validity.js → file-path-validity.js} +21 -13
- package/linter/rules/naming-convention.d.ts +71 -0
- package/linter/rules/naming-convention.js +168 -0
- package/linter/rules/seeded-randomness.d.ts +65 -0
- package/linter/rules/seeded-randomness.js +122 -0
- package/linter/rules/unused-definition.d.ts +41 -0
- package/linter/rules/unused-definition.js +105 -0
- package/package.json +5 -2
- package/queries/base-query-format.d.ts +2 -0
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.js +2 -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 +2 -2
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -116
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +3 -0
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +46 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +72 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.js +31 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.js +2 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.js +16 -12
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
- package/queries/catalog/search-query/search-query-executor.js +2 -2
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/queries/query.d.ts +76 -16
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +4 -2
- package/r-bridge/lang-4.x/convert-values.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +7 -5
- package/r-bridge/shell.d.ts +3 -2
- package/r-bridge/shell.js +4 -5
- package/search/flowr-search-builder.d.ts +6 -2
- package/search/flowr-search-builder.js +7 -0
- package/search/flowr-search-filters.d.ts +32 -8
- package/search/flowr-search-filters.js +42 -15
- package/search/flowr-search.d.ts +4 -0
- package/search/search-executor/search-enrichers.d.ts +7 -3
- package/search/search-executor/search-enrichers.js +29 -20
- package/search/search-executor/search-generators.js +1 -1
- package/search/search-executor/search-transformer.d.ts +2 -0
- package/search/search-executor/search-transformer.js +10 -1
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +2 -3
- package/statistics/statistics.d.ts +3 -1
- package/statistics/statistics.js +5 -4
- package/util/containers.d.ts +12 -9
- package/util/containers.js +12 -9
- package/util/files.d.ts +8 -2
- package/util/files.js +22 -4
- package/util/objects.d.ts +5 -4
- package/util/r-value.d.ts +23 -0
- package/util/r-value.js +113 -0
- package/util/range.d.ts +5 -1
- package/util/range.js +11 -3
- package/util/text/strings.d.ts +6 -0
- package/util/text/strings.js +35 -0
- package/util/version.js +1 -1
- package/linter/rules/1-deprecated-functions.d.ts +0 -34
- package/linter/rules/1-deprecated-functions.js +0 -54
- package/util/cfg/cfg.d.ts +0 -0
- package/util/cfg/cfg.js +0 -2
|
@@ -2,31 +2,36 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveNode = resolveNode;
|
|
4
4
|
exports.resolveAsVector = resolveAsVector;
|
|
5
|
+
exports.resolveAsSeq = resolveAsSeq;
|
|
6
|
+
exports.resolveAsPlus = resolveAsPlus;
|
|
7
|
+
exports.resolveAsMinus = resolveAsMinus;
|
|
5
8
|
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
6
9
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
7
|
-
const
|
|
10
|
+
const r_value_1 = require("../../../util/r-value");
|
|
8
11
|
const built_in_1 = require("../../environments/built-in");
|
|
9
12
|
const dfg_get_origin_1 = require("../../origin/dfg-get-origin");
|
|
10
13
|
const interval_constants_1 = require("../values/intervals/interval-constants");
|
|
11
14
|
const logical_constants_1 = require("../values/logical/logical-constants");
|
|
12
|
-
const
|
|
15
|
+
const r_value_2 = require("../values/r-value");
|
|
13
16
|
const string_constants_1 = require("../values/string/string-constants");
|
|
14
17
|
const vector_constants_1 = require("../values/vectors/vector-constants");
|
|
15
18
|
const alias_tracking_1 = require("./alias-tracking");
|
|
19
|
+
const scalar_consatnts_1 = require("../values/scalar/scalar-consatnts");
|
|
16
20
|
/**
|
|
17
21
|
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
18
|
-
* you want to resolve the value of
|
|
22
|
+
* you want to resolve the value of an identifier / node
|
|
19
23
|
*
|
|
20
|
-
* This function converts an RNode to its Value, but also
|
|
24
|
+
* This function converts an RNode to its Value, but also recursively resolves
|
|
21
25
|
* aliases and vectors (in case of a vector).
|
|
22
26
|
*
|
|
23
|
-
* @param a
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
+
* @param a - Ast node to resolve
|
|
28
|
+
* @param resolve - Variable resolve mode
|
|
29
|
+
* @param env - Environment to use
|
|
30
|
+
* @param graph - Dataflow Graph to use
|
|
31
|
+
* @param map - Idmap of Dataflow Graph
|
|
27
32
|
* @returns resolved value or top/bottom
|
|
28
33
|
*/
|
|
29
|
-
function resolveNode(a, env, graph, map) {
|
|
34
|
+
function resolveNode(resolve, a, env, graph, map) {
|
|
30
35
|
if (a.type === type_1.RType.String) {
|
|
31
36
|
return (0, string_constants_1.stringFrom)(a.content.str);
|
|
32
37
|
}
|
|
@@ -36,58 +41,149 @@ function resolveNode(a, env, graph, map) {
|
|
|
36
41
|
else if (a.type === type_1.RType.Logical) {
|
|
37
42
|
return a.content.valueOf() ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
|
|
38
43
|
}
|
|
39
|
-
else if (a.type === type_1.RType.FunctionCall
|
|
44
|
+
else if ((a.type === type_1.RType.FunctionCall || a.type === type_1.RType.BinaryOp || a.type === type_1.RType.UnaryOp) && graph) {
|
|
40
45
|
const origin = (0, dfg_get_origin_1.getOriginInDfg)(graph, a.info.id)?.[0];
|
|
41
46
|
if (origin === undefined || origin.type !== 3 /* OriginType.BuiltInFunctionOrigin */) {
|
|
42
|
-
return
|
|
47
|
+
return r_value_2.Top;
|
|
43
48
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
let builtInName;
|
|
50
|
+
if ((0, built_in_1.isBuiltIn)(origin.proc)) {
|
|
51
|
+
builtInName = origin.proc;
|
|
52
|
+
}
|
|
53
|
+
else if (a.type === type_1.RType.FunctionCall && a.named) {
|
|
54
|
+
builtInName = (0, built_in_1.builtInId)(a.functionName.content);
|
|
55
|
+
}
|
|
56
|
+
else if (a.type === type_1.RType.BinaryOp || a.type === type_1.RType.UnaryOp) {
|
|
57
|
+
builtInName = (0, built_in_1.builtInId)(a.operator);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return r_value_2.Top;
|
|
61
|
+
}
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(built_in_1.BuiltInEvalHandlerMapper, builtInName)) {
|
|
63
|
+
const handler = built_in_1.BuiltInEvalHandlerMapper[builtInName];
|
|
64
|
+
return handler(resolve, a, env, graph, map);
|
|
47
65
|
}
|
|
48
66
|
}
|
|
49
|
-
return
|
|
67
|
+
return r_value_2.Top;
|
|
50
68
|
}
|
|
51
69
|
/**
|
|
52
70
|
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
53
|
-
* you want to resolve the value of
|
|
71
|
+
* you want to resolve the value of an identifier / node
|
|
54
72
|
*
|
|
55
|
-
* This function
|
|
56
|
-
*
|
|
57
|
-
* order to construct the value of the vector to resolve by calling {@link resolveIdToValue}
|
|
58
|
-
* or {@link resolveNode}
|
|
73
|
+
* This function resolves a vector function call `c` to a {@link ValueVector}
|
|
74
|
+
* by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
|
|
59
75
|
*
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @param
|
|
76
|
+
* @param resolve - Variable resolve mode
|
|
77
|
+
* @param node - Node of the vector function to resolve
|
|
78
|
+
* @param env - Environment to use
|
|
79
|
+
* @param graph - Dataflow graph
|
|
80
|
+
* @param map - Id map of the dataflow graph
|
|
64
81
|
* @returns ValueVector or Top
|
|
65
82
|
*/
|
|
66
|
-
function resolveAsVector(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
for (const arg of a.arguments) {
|
|
70
|
-
if (arg === r_function_call_1.EmptyArgument) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (arg.value === undefined) {
|
|
74
|
-
return r_value_1.Top;
|
|
75
|
-
}
|
|
76
|
-
if (arg.value.type === type_1.RType.Symbol) {
|
|
77
|
-
const value = (0, alias_tracking_1.resolveIdToValue)(arg.info.id, { environment: env, idMap: map, graph: graph, full: true });
|
|
78
|
-
if ((0, r_value_1.isTop)(value)) {
|
|
79
|
-
return r_value_1.Top;
|
|
80
|
-
}
|
|
81
|
-
values.push(value);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
const val = resolveNode(arg.value, env, graph, map);
|
|
85
|
-
if ((0, r_value_1.isTop)(val)) {
|
|
86
|
-
return r_value_1.Top;
|
|
87
|
-
}
|
|
88
|
-
values.push(val);
|
|
89
|
-
}
|
|
83
|
+
function resolveAsVector(resolve, node, environment, graph, idMap) {
|
|
84
|
+
if (node.type !== type_1.RType.FunctionCall) {
|
|
85
|
+
return r_value_2.Top;
|
|
90
86
|
}
|
|
87
|
+
const resolveInfo = { environment, graph, idMap, full: true, resolve };
|
|
88
|
+
const values = node.arguments.map(arg => arg !== r_function_call_1.EmptyArgument ? (0, alias_tracking_1.resolveIdToValue)(arg.value, resolveInfo) : r_value_2.Top);
|
|
91
89
|
return (0, vector_constants_1.vectorFrom)((0, vector_constants_1.flattenVectorElements)(values));
|
|
92
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
93
|
+
* you want to resolve the value of an identifier / node
|
|
94
|
+
*
|
|
95
|
+
* This function resolves a binary sequence operator `:` to a {@link ValueVector} of {@link ValueNumber}s
|
|
96
|
+
* by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
|
|
97
|
+
*
|
|
98
|
+
* @param resolve - Variable resolve mode
|
|
99
|
+
* @param operator - Node of the sequence operator to resolve
|
|
100
|
+
* @param env - Environment to use
|
|
101
|
+
* @param graph - Dataflow graph
|
|
102
|
+
* @param map - Id map of the dataflow graph
|
|
103
|
+
* @returns ValueVector of ValueNumbers or Top
|
|
104
|
+
*/
|
|
105
|
+
function resolveAsSeq(resolve, operator, environment, graph, idMap) {
|
|
106
|
+
if (operator.type !== type_1.RType.BinaryOp) {
|
|
107
|
+
return r_value_2.Top;
|
|
108
|
+
}
|
|
109
|
+
const resolveInfo = { environment, graph, idMap, full: true, resolve };
|
|
110
|
+
const leftArg = (0, alias_tracking_1.resolveIdToValue)(operator.lhs, resolveInfo);
|
|
111
|
+
const rightArg = (0, alias_tracking_1.resolveIdToValue)(operator.rhs, resolveInfo);
|
|
112
|
+
const leftValue = (0, r_value_1.unliftRValue)(leftArg);
|
|
113
|
+
const rightValue = (0, r_value_1.unliftRValue)(rightArg);
|
|
114
|
+
if ((0, r_value_1.isRNumberValue)(leftValue) && (0, r_value_1.isRNumberValue)(rightValue)) {
|
|
115
|
+
return (0, vector_constants_1.vectorFrom)(createNumberSequence(leftValue, rightValue).map(scalar_consatnts_1.liftScalar));
|
|
116
|
+
}
|
|
117
|
+
return r_value_2.Top;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
121
|
+
* you want to resolve the value of an identifier / node
|
|
122
|
+
*
|
|
123
|
+
* This function resolves a unary plus operator `+` to a {@link ValueNumber} or {@link ValueVector} of ValueNumbers
|
|
124
|
+
* by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
|
|
125
|
+
*
|
|
126
|
+
* @param resolve - Variable resolve mode
|
|
127
|
+
* @param operator - Node of the plus operator to resolve
|
|
128
|
+
* @param env - Environment to use
|
|
129
|
+
* @param graph - Dataflow graph
|
|
130
|
+
* @param map - Id map of the dataflow graph
|
|
131
|
+
* @returns ValueNumber, ValueVector of ValueNumbers, or Top
|
|
132
|
+
*/
|
|
133
|
+
function resolveAsPlus(resolve, operator, environment, graph, idMap) {
|
|
134
|
+
if (operator.type !== type_1.RType.UnaryOp) {
|
|
135
|
+
return r_value_2.Top;
|
|
136
|
+
}
|
|
137
|
+
const resolveInfo = { environment, graph, idMap, full: true, resolve };
|
|
138
|
+
const arg = (0, alias_tracking_1.resolveIdToValue)(operator.operand, resolveInfo);
|
|
139
|
+
const argValue = (0, r_value_1.unliftRValue)(arg);
|
|
140
|
+
if ((0, r_value_1.isRNumberValue)(argValue)) {
|
|
141
|
+
return (0, scalar_consatnts_1.liftScalar)(argValue);
|
|
142
|
+
}
|
|
143
|
+
else if (Array.isArray(argValue) && argValue.every(r_value_1.isRNumberValue)) {
|
|
144
|
+
return (0, vector_constants_1.vectorFrom)(argValue.map(scalar_consatnts_1.liftScalar));
|
|
145
|
+
}
|
|
146
|
+
return r_value_2.Top;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
150
|
+
* you want to resolve the value of an identifier / node
|
|
151
|
+
*
|
|
152
|
+
* This function resolves a unary minus operator `-` to a {@link ValueNumber} or {@link ValueVector} of ValueNumbers
|
|
153
|
+
* by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
|
|
154
|
+
*
|
|
155
|
+
* @param resolve - Variable resolve mode
|
|
156
|
+
* @param operator - Node of the minus operator to resolve
|
|
157
|
+
* @param env - Environment to use
|
|
158
|
+
* @param graph - Dataflow graph
|
|
159
|
+
* @param map - Id map of the dataflow graph
|
|
160
|
+
* @returns ValueNumber, ValueVector of ValueNumbers, or Top
|
|
161
|
+
*/
|
|
162
|
+
function resolveAsMinus(resolve, operator, environment, graph, idMap) {
|
|
163
|
+
if (operator.type !== type_1.RType.UnaryOp) {
|
|
164
|
+
return r_value_2.Top;
|
|
165
|
+
}
|
|
166
|
+
const resolveInfo = { environment, graph, idMap, full: true, resolve };
|
|
167
|
+
const arg = (0, alias_tracking_1.resolveIdToValue)(operator.operand, resolveInfo);
|
|
168
|
+
const argValue = (0, r_value_1.unliftRValue)(arg);
|
|
169
|
+
if ((0, r_value_1.isRNumberValue)(argValue)) {
|
|
170
|
+
return (0, scalar_consatnts_1.liftScalar)({ ...argValue, num: -argValue.num });
|
|
171
|
+
}
|
|
172
|
+
else if (Array.isArray(argValue) && argValue.every(r_value_1.isRNumberValue)) {
|
|
173
|
+
return (0, vector_constants_1.vectorFrom)(argValue.map(element => (0, scalar_consatnts_1.liftScalar)({ ...element, num: -element.num })));
|
|
174
|
+
}
|
|
175
|
+
return r_value_2.Top;
|
|
176
|
+
}
|
|
177
|
+
function createNumberSequence(start, end) {
|
|
178
|
+
const sequence = [];
|
|
179
|
+
const min = Math.min(start.num, end.num);
|
|
180
|
+
const max = Math.max(start.num, end.num);
|
|
181
|
+
for (let i = min; i <= max; i++) {
|
|
182
|
+
sequence.push({ ...start, num: i });
|
|
183
|
+
}
|
|
184
|
+
if (start > end) {
|
|
185
|
+
sequence.reverse();
|
|
186
|
+
}
|
|
187
|
+
return sequence;
|
|
188
|
+
}
|
|
93
189
|
//# sourceMappingURL=resolve.js.map
|
|
@@ -2,7 +2,7 @@ import type { RStringValue } from '../../../../r-bridge/lang-4.x/convert-values'
|
|
|
2
2
|
import type { Lift, Value, ValueString } from '../r-value';
|
|
3
3
|
export declare function stringFrom(str: RStringValue | string): ValueString;
|
|
4
4
|
export declare function liftString(str: Lift<RStringValue>): ValueString;
|
|
5
|
-
export declare function collectStrings(a: Value[]): string[] | undefined;
|
|
5
|
+
export declare function collectStrings(a: Value[], withQuotes?: boolean): string[] | undefined;
|
|
6
6
|
export declare const ValueEmptyString: ValueString<Lift<RStringValue>>;
|
|
7
7
|
export declare const ValueStringTop: ValueString<Lift<RStringValue>>;
|
|
8
8
|
export declare const ValueStringBot: ValueString<Lift<RStringValue>>;
|
|
@@ -21,7 +21,7 @@ function liftString(str) {
|
|
|
21
21
|
value: str
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function collectStrings(a) {
|
|
24
|
+
function collectStrings(a, withQuotes = false) {
|
|
25
25
|
if ((0, general_1.bottomTopGuard)(a)) {
|
|
26
26
|
return undefined;
|
|
27
27
|
}
|
|
@@ -30,7 +30,12 @@ function collectStrings(a) {
|
|
|
30
30
|
if (value.type !== 'string' || !(0, r_value_1.isValue)(value) || !(0, r_value_1.isValue)(value.value)) {
|
|
31
31
|
return undefined;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
if (withQuotes) {
|
|
34
|
+
values.push(`${value.value.quotes}${value.value.str}${value.value.quotes}`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
values.push(value.value.str);
|
|
38
|
+
}
|
|
34
39
|
}
|
|
35
40
|
return values;
|
|
36
41
|
}
|
package/dataflow/extractor.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { DataflowProcessors } from './processor';
|
|
|
3
3
|
import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { RParseRequests } from '../r-bridge/retriever';
|
|
5
5
|
import type { KnownParserType, Parser } from '../r-bridge/parser';
|
|
6
|
+
import type { FlowrConfigOptions } from '../config';
|
|
6
7
|
/**
|
|
7
8
|
* The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
|
|
8
9
|
* Maps every {@link RType} in the normalized AST to a processor.
|
|
@@ -14,4 +15,4 @@ export declare const processors: DataflowProcessors<ParentInformation>;
|
|
|
14
15
|
* (e.g., in the event of a `source` call).
|
|
15
16
|
* For the actual, canonical fold entry point, see {@link processDataflowFor}.
|
|
16
17
|
*/
|
|
17
|
-
export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, request: RParseRequests, completeAst: NormalizedAst<OtherInfo & ParentInformation
|
|
18
|
+
export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, request: RParseRequests, completeAst: NormalizedAst<OtherInfo & ParentInformation>, config: FlowrConfigOptions): DataflowInformation;
|
package/dataflow/extractor.js
CHANGED
|
@@ -80,7 +80,7 @@ function resolveLinkToSideEffects(ast, graph) {
|
|
|
80
80
|
* (e.g., in the event of a `source` call).
|
|
81
81
|
* For the actual, canonical fold entry point, see {@link processDataflowFor}.
|
|
82
82
|
*/
|
|
83
|
-
function produceDataFlowGraph(parser, request, completeAst) {
|
|
83
|
+
function produceDataFlowGraph(parser, request, completeAst, config) {
|
|
84
84
|
let firstRequest;
|
|
85
85
|
const multifile = Array.isArray(request);
|
|
86
86
|
if (multifile) {
|
|
@@ -97,6 +97,7 @@ function produceDataFlowGraph(parser, request, completeAst) {
|
|
|
97
97
|
currentRequest: firstRequest,
|
|
98
98
|
controlDependencies: undefined,
|
|
99
99
|
referenceChain: [firstRequest],
|
|
100
|
+
flowrConfig: config
|
|
100
101
|
};
|
|
101
102
|
let df = (0, processor_1.processDataflowFor)(completeAst.ast, dfData);
|
|
102
103
|
df.graph.sourced.unshift(firstRequest.request === 'file' ? firstRequest.content : '<inline>');
|
|
@@ -13,7 +13,6 @@ const built_in_assignment_1 = require("./built-in-assignment");
|
|
|
13
13
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
14
14
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
15
15
|
const containers_1 = require("../../../../../../util/containers");
|
|
16
|
-
const config_1 = require("../../../../../../config");
|
|
17
16
|
function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
|
|
18
17
|
outInfo.definitionRootNodes.push(rootId);
|
|
19
18
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'table:assign' }).information;
|
|
@@ -30,8 +29,8 @@ function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
|
|
|
30
29
|
* ```
|
|
31
30
|
*/
|
|
32
31
|
function processAccess(name, args, rootId, data, config) {
|
|
33
|
-
if (args.length <
|
|
34
|
-
logger_1.dataflowLogger.warn(`Access ${name.content} has less than
|
|
32
|
+
if (args.length < 1) {
|
|
33
|
+
logger_1.dataflowLogger.warn(`Access ${name.content} has less than 1 argument, skipping`);
|
|
35
34
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'default' }).information;
|
|
36
35
|
}
|
|
37
36
|
const head = args[0];
|
|
@@ -113,9 +112,9 @@ function processNumberBasedAccess(data, name, args, rootId, config, head) {
|
|
|
113
112
|
data.environment.current.memory.set(':=', existing);
|
|
114
113
|
}
|
|
115
114
|
if (head.value && outInfo.definitionRootNodes.length > 0) {
|
|
116
|
-
(0, built_in_assignment_1.markAsAssignment)(fnCall.information, { type: identifier_1.ReferenceType.Variable, name: head.value.lexeme ?? '', nodeId: head.value.info.id, definedAt: rootId, controlDependencies: [] }, outInfo.definitionRootNodes, rootId);
|
|
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, controlDependencies: [] }, outInfo.definitionRootNodes, rootId, data.flowrConfig);
|
|
117
116
|
}
|
|
118
|
-
if (
|
|
117
|
+
if (data.flowrConfig.solver.pointerTracking) {
|
|
119
118
|
referenceAccessedIndices(args, data, fnCall, rootId, true);
|
|
120
119
|
}
|
|
121
120
|
return fnCall;
|
|
@@ -157,7 +156,7 @@ function processStringBasedAccess(args, data, name, rootId, config) {
|
|
|
157
156
|
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: newArgs, rootId, data, forceArgs: config.forceArgs,
|
|
158
157
|
origin: 'builtin:access'
|
|
159
158
|
});
|
|
160
|
-
if (
|
|
159
|
+
if (data.flowrConfig.solver.pointerTracking) {
|
|
161
160
|
referenceAccessedIndices(newArgs, data, fnCall, rootId, false);
|
|
162
161
|
}
|
|
163
162
|
return fnCall;
|
|
@@ -57,7 +57,7 @@ function processApply(name, args, rootId, data, config) {
|
|
|
57
57
|
else if (val.type === type_1.RType.Symbol) {
|
|
58
58
|
functionId = val.info.id;
|
|
59
59
|
if (resolveValue) {
|
|
60
|
-
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: data.environment, idMap: data.completeAst.idMap }));
|
|
60
|
+
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.flowrConfig.solver.variables }));
|
|
61
61
|
if (resolved?.elements.length === 1 && resolved.elements[0].type === 'string') {
|
|
62
62
|
functionName = (0, r_value_1.isValue)(resolved.elements[0].value) ? resolved.elements[0].value.str : undefined;
|
|
63
63
|
}
|
|
@@ -10,6 +10,7 @@ import type { ContainerIndicesCollection } from '../../../../../graph/vertex';
|
|
|
10
10
|
import type { ForceArguments } from '../common';
|
|
11
11
|
import type { REnvironmentInformation } from '../../../../../environments/environment';
|
|
12
12
|
import type { DataflowGraph } from '../../../../../graph/graph';
|
|
13
|
+
import type { FlowrConfigOptions } from '../../../../../../config';
|
|
13
14
|
export interface AssignmentConfiguration extends ForceArguments {
|
|
14
15
|
readonly superAssignment?: boolean;
|
|
15
16
|
readonly swapSourceAndTarget?: boolean;
|
|
@@ -43,9 +44,10 @@ export interface AssignmentToSymbolParameters<OtherInfo> extends AssignmentConfi
|
|
|
43
44
|
* @param nodeToDefine - `x`
|
|
44
45
|
* @param sourceIds - `v`
|
|
45
46
|
* @param rootIdOfAssignment - `<-`
|
|
46
|
-
* @param config -
|
|
47
|
+
* @param config - The flowr config
|
|
48
|
+
* @param assignmentConfig - configuration for the assignment processing
|
|
47
49
|
*/
|
|
48
50
|
export declare function markAsAssignment(information: {
|
|
49
51
|
environment: REnvironmentInformation;
|
|
50
52
|
graph: DataflowGraph;
|
|
51
|
-
}, nodeToDefine: InGraphIdentifierDefinition, sourceIds: readonly NodeId[], rootIdOfAssignment: NodeId, config?: AssignmentConfiguration): void;
|
|
53
|
+
}, nodeToDefine: InGraphIdentifierDefinition, sourceIds: readonly NodeId[], rootIdOfAssignment: NodeId, config: FlowrConfigOptions, assignmentConfig?: AssignmentConfiguration): void;
|
|
@@ -17,7 +17,6 @@ const define_1 = require("../../../../../environments/define");
|
|
|
17
17
|
const edge_1 = require("../../../../../graph/edge");
|
|
18
18
|
const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
|
|
19
19
|
const containers_1 = require("../../../../../../util/containers");
|
|
20
|
-
const config_1 = require("../../../../../../config");
|
|
21
20
|
const named_call_handling_1 = require("../named-call-handling");
|
|
22
21
|
const built_in_1 = require("../../../../../environments/built-in");
|
|
23
22
|
const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
|
|
@@ -216,10 +215,11 @@ function checkTargetReferenceType(source, sourceInfo) {
|
|
|
216
215
|
* @param nodeToDefine - `x`
|
|
217
216
|
* @param sourceIds - `v`
|
|
218
217
|
* @param rootIdOfAssignment - `<-`
|
|
219
|
-
* @param config -
|
|
218
|
+
* @param config - The flowr config
|
|
219
|
+
* @param assignmentConfig - configuration for the assignment processing
|
|
220
220
|
*/
|
|
221
|
-
function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignment, config) {
|
|
222
|
-
if (
|
|
221
|
+
function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignment, config, assignmentConfig) {
|
|
222
|
+
if (config.solver.pointerTracking) {
|
|
223
223
|
let indicesCollection = undefined;
|
|
224
224
|
if (sourceIds.length === 1) {
|
|
225
225
|
// support for tracking indices.
|
|
@@ -235,22 +235,22 @@ function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignme
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
// Indices defined by replacement operation e.g. $<-
|
|
238
|
-
if (
|
|
238
|
+
if (assignmentConfig?.indicesCollection !== undefined) {
|
|
239
239
|
// If there were indices stored in the vertex, then a container was defined
|
|
240
240
|
// and assigned to the index of another container e.g. a$b <- list(c = 1)
|
|
241
241
|
if (indicesCollection) {
|
|
242
|
-
indicesCollection = (0, containers_1.addSubIndicesToLeafIndices)(
|
|
242
|
+
indicesCollection = (0, containers_1.addSubIndicesToLeafIndices)(assignmentConfig.indicesCollection, indicesCollection);
|
|
243
243
|
}
|
|
244
244
|
else {
|
|
245
245
|
// No indices were defined for the vertex e.g. a$b <- 2
|
|
246
|
-
indicesCollection =
|
|
246
|
+
indicesCollection = assignmentConfig.indicesCollection;
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
nodeToDefine.indicesCollection ??= indicesCollection;
|
|
250
250
|
}
|
|
251
|
-
information.environment = (0, define_1.define)(nodeToDefine,
|
|
251
|
+
information.environment = (0, define_1.define)(nodeToDefine, assignmentConfig?.superAssignment, information.environment, config);
|
|
252
252
|
information.graph.setDefinitionOfVertex(nodeToDefine);
|
|
253
|
-
if (!
|
|
253
|
+
if (!assignmentConfig?.quoteSource) {
|
|
254
254
|
for (const sourceId of sourceIds) {
|
|
255
255
|
information.graph.addEdge(nodeToDefine, sourceId, edge_1.EdgeType.DefinedBy);
|
|
256
256
|
}
|
|
@@ -282,10 +282,10 @@ function processAssignmentToSymbol(config) {
|
|
|
282
282
|
{ nodeId: rootId, name: nameOfAssignmentFunction, controlDependencies: data.controlDependencies, type: identifier_1.ReferenceType.Function },
|
|
283
283
|
...sourceArg.unknownReferences, ...sourceArg.in, ...targetArg.in.filter(i => i.nodeId !== target.info.id), ...readFromSourceWritten
|
|
284
284
|
];
|
|
285
|
-
information.environment = (0, overwrite_1.overwriteEnvironment)(
|
|
285
|
+
information.environment = (0, overwrite_1.overwriteEnvironment)(sourceArg.environment, targetArg.environment);
|
|
286
286
|
// install assigned variables in environment
|
|
287
287
|
for (const write of writeNodes) {
|
|
288
|
-
markAsAssignment(information, write, [source.info.id], rootId, config);
|
|
288
|
+
markAsAssignment(information, write, [source.info.id], rootId, data.flowrConfig, config);
|
|
289
289
|
}
|
|
290
290
|
information.graph.addEdge(rootId, targetArg.entryPoint, edge_1.EdgeType.Returns);
|
|
291
291
|
if (quoteSource) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processEvalCall = processEvalCall;
|
|
4
4
|
const info_1 = require("../../../../../info");
|
|
5
|
-
const config_1 = require("../../../../../../config");
|
|
6
5
|
const known_call_handling_1 = require("../known-call-handling");
|
|
7
6
|
const retriever_1 = require("../../../../../../r-bridge/retriever");
|
|
8
7
|
const decorate_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate");
|
|
@@ -31,12 +30,12 @@ function processEvalCall(name, args, rootId, data, config) {
|
|
|
31
30
|
if (config.includeFunctionCall) {
|
|
32
31
|
information.graph.addEdge(rootId, args[0].value.info.id, edge_1.EdgeType.Returns);
|
|
33
32
|
}
|
|
34
|
-
if (!
|
|
33
|
+
if (!data.flowrConfig.solver.evalStrings) {
|
|
35
34
|
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Skipping eval call ${JSON.stringify(evalArgument)} (disabled in config file)`);
|
|
36
35
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
37
36
|
return information;
|
|
38
37
|
}
|
|
39
|
-
const code = resolveEvalToCode(evalArgument.value, data.environment, data.completeAst.idMap);
|
|
38
|
+
const code = resolveEvalToCode(evalArgument.value, data.environment, data.completeAst.idMap, data.flowrConfig);
|
|
40
39
|
if (code) {
|
|
41
40
|
const idGenerator = (0, decorate_1.sourcedDeterministicCountingIdGenerator)(name.lexeme + '::' + rootId, name.location);
|
|
42
41
|
data = {
|
|
@@ -68,7 +67,7 @@ function processEvalCall(name, args, rootId, data, config) {
|
|
|
68
67
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
69
68
|
return information;
|
|
70
69
|
}
|
|
71
|
-
function resolveEvalToCode(evalArgument, env, idMap) {
|
|
70
|
+
function resolveEvalToCode(evalArgument, env, idMap, config) {
|
|
72
71
|
const val = evalArgument;
|
|
73
72
|
if (val.type === type_1.RType.FunctionCall && val.named && val.functionName.content === 'parse') {
|
|
74
73
|
const arg = val.arguments.find(v => v !== r_function_call_1.EmptyArgument && v.name?.content === 'text');
|
|
@@ -80,13 +79,13 @@ function resolveEvalToCode(evalArgument, env, idMap) {
|
|
|
80
79
|
return [arg.value.content.str];
|
|
81
80
|
}
|
|
82
81
|
else if (arg.value?.type === type_1.RType.Symbol) {
|
|
83
|
-
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(arg.value.info.id, { environment: env, idMap: idMap }));
|
|
82
|
+
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(arg.value.info.id, { environment: env, idMap: idMap, resolve: config.solver.variables }));
|
|
84
83
|
if (resolved) {
|
|
85
84
|
return (0, string_constants_1.collectStrings)(resolved.elements);
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
else if (arg.value?.type === type_1.RType.FunctionCall && arg.value.named && ['paste', 'paste0'].includes(arg.value.functionName.content)) {
|
|
89
|
-
return handlePaste(arg.value.arguments, env, idMap, arg.value.functionName.content === 'paste' ? [' '] : ['']);
|
|
88
|
+
return handlePaste(config, arg.value.arguments, env, idMap, arg.value.functionName.content === 'paste' ? [' '] : ['']);
|
|
90
89
|
}
|
|
91
90
|
return undefined;
|
|
92
91
|
}
|
|
@@ -99,7 +98,7 @@ function resolveEvalToCode(evalArgument, env, idMap) {
|
|
|
99
98
|
return undefined;
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
|
-
function getAsString(val, env, idMap) {
|
|
101
|
+
function getAsString(config, val, env, idMap) {
|
|
103
102
|
if (!val) {
|
|
104
103
|
return undefined;
|
|
105
104
|
}
|
|
@@ -107,17 +106,17 @@ function getAsString(val, env, idMap) {
|
|
|
107
106
|
return [val.content.str];
|
|
108
107
|
}
|
|
109
108
|
else if (val.type === type_1.RType.Symbol) {
|
|
110
|
-
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: env, idMap: idMap }));
|
|
109
|
+
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: env, idMap: idMap, resolve: config.solver.variables }));
|
|
111
110
|
if (resolved) {
|
|
112
111
|
return (0, string_constants_1.collectStrings)(resolved.elements);
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
return undefined;
|
|
116
115
|
}
|
|
117
|
-
function handlePaste(args, env, idMap, sepDefault) {
|
|
116
|
+
function handlePaste(config, args, env, idMap, sepDefault) {
|
|
118
117
|
const sepArg = args.find(v => v !== r_function_call_1.EmptyArgument && v.name?.content === 'sep');
|
|
119
118
|
if (sepArg) {
|
|
120
|
-
const res = sepArg !== r_function_call_1.EmptyArgument && sepArg.value ? getAsString(sepArg.value, env, idMap) : undefined;
|
|
119
|
+
const res = sepArg !== r_function_call_1.EmptyArgument && sepArg.value ? getAsString(config, sepArg.value, env, idMap) : undefined;
|
|
121
120
|
if (!res) {
|
|
122
121
|
// sep not resolvable clearly / unknown
|
|
123
122
|
return undefined;
|
|
@@ -126,7 +125,7 @@ function handlePaste(args, env, idMap, sepDefault) {
|
|
|
126
125
|
}
|
|
127
126
|
const allArgs = args
|
|
128
127
|
.filter(v => v !== r_function_call_1.EmptyArgument && v.name?.content !== 'sep' && v.value)
|
|
129
|
-
.map(v => getAsString(v.value, env, idMap));
|
|
128
|
+
.map(v => getAsString(config, v.value, env, idMap));
|
|
130
129
|
if (allArgs.some(assert_1.isUndefined)) {
|
|
131
130
|
return undefined;
|
|
132
131
|
}
|
|
@@ -18,6 +18,7 @@ const built_in_1 = require("../../../../../environments/built-in");
|
|
|
18
18
|
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
19
19
|
const logger_1 = require("../../../../../logger");
|
|
20
20
|
const log_1 = require("../../../../../../util/log");
|
|
21
|
+
const remove_1 = require("../../../../../environments/remove");
|
|
21
22
|
const dotDotDotAccess = /^\.\.\d+$/;
|
|
22
23
|
function linkReadNameToWriteIfPossible(read, environments, listEnvironments, remainingRead, nextGraph) {
|
|
23
24
|
const readName = read.name && dotDotDotAccess.test(read.name) ? '...' : read.name;
|
|
@@ -53,7 +54,7 @@ function processNextExpression(currentElement, environment, listEnvironments, re
|
|
|
53
54
|
linkReadNameToWriteIfPossible(read, environment, listEnvironments, remainingRead, nextGraph);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextGraph) {
|
|
57
|
+
function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextGraph, localDefs) {
|
|
57
58
|
for (const { functionCall, called } of calledEnvs) {
|
|
58
59
|
const callDependencies = nextGraph.getVertex(functionCall, true)?.cds;
|
|
59
60
|
for (const calledFn of called) {
|
|
@@ -79,6 +80,10 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
|
|
|
79
80
|
}
|
|
80
81
|
if (hasUpdate) {
|
|
81
82
|
// we update all definitions to be linked with the corresponding function call
|
|
83
|
+
// we, however, have to ignore expression-local writes!
|
|
84
|
+
if (localDefs.length > 0) {
|
|
85
|
+
environment = (0, remove_1.removeAll)(localDefs, environment);
|
|
86
|
+
}
|
|
82
87
|
inputEnvironment = (0, overwrite_1.overwriteEnvironment)(inputEnvironment, environment, callDependencies);
|
|
83
88
|
}
|
|
84
89
|
}
|
|
@@ -124,7 +129,7 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
124
129
|
environment = exitPoints.length > 0 ? (0, overwrite_1.overwriteEnvironment)(environment, processed.environment) : processed.environment;
|
|
125
130
|
const calledEnvs = (0, linker_1.linkFunctionCalls)(nextGraph, data.completeAst.idMap, processed.graph);
|
|
126
131
|
// if the called function has global redefinitions, we have to keep them within our environment
|
|
127
|
-
environment = updateSideEffectsForCalledFunctions(calledEnvs, environment, nextGraph);
|
|
132
|
+
environment = updateSideEffectsForCalledFunctions(calledEnvs, environment, nextGraph, processed.out);
|
|
128
133
|
for (const { nodeId } of processed.out) {
|
|
129
134
|
listEnvironments.add(nodeId);
|
|
130
135
|
}
|
|
@@ -35,7 +35,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
35
35
|
const headGraph = variable.graph.mergeWith(vector.graph);
|
|
36
36
|
const writtenVariable = [...variable.unknownReferences, ...variable.in];
|
|
37
37
|
for (const write of writtenVariable) {
|
|
38
|
-
headEnvironments = (0, define_1.define)({ ...write, definedAt: name.info.id, type: identifier_1.ReferenceType.Variable }, false, headEnvironments);
|
|
38
|
+
headEnvironments = (0, define_1.define)({ ...write, definedAt: name.info.id, type: identifier_1.ReferenceType.Variable }, false, headEnvironments, data.flowrConfig);
|
|
39
39
|
}
|
|
40
40
|
data = { ...data, environment: headEnvironments };
|
|
41
41
|
const body = (0, processor_1.processDataflowFor)(bodyArg, data);
|
|
@@ -60,8 +60,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
60
60
|
});
|
|
61
61
|
/* mark the last argument as nse */
|
|
62
62
|
nextGraph.addEdge(rootId, body.entryPoint, edge_1.EdgeType.NonStandardEvaluation);
|
|
63
|
-
// as the for-loop always evaluates its
|
|
64
|
-
nextGraph.addEdge(name.info.id, variable.entryPoint, edge_1.EdgeType.Reads);
|
|
63
|
+
// as the for-loop always evaluates its condition
|
|
65
64
|
nextGraph.addEdge(name.info.id, vector.entryPoint, edge_1.EdgeType.Reads);
|
|
66
65
|
return {
|
|
67
66
|
unknownReferences: [],
|
|
@@ -34,7 +34,7 @@ function processIfThenElse(name, args, rootId, data) {
|
|
|
34
34
|
let then;
|
|
35
35
|
let makeThenMaybe = false;
|
|
36
36
|
// we should defer this to the abstract interpretation
|
|
37
|
-
const values = (0, alias_tracking_1.resolveIdToValue)(condArg?.info.id, { environment: data.environment, idMap: data.completeAst.idMap });
|
|
37
|
+
const values = (0, alias_tracking_1.resolveIdToValue)(condArg?.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.flowrConfig.solver.variables });
|
|
38
38
|
const conditionIsAlwaysFalse = (0, general_1.valueSetGuard)(values)?.elements.every(d => d.type === 'logical' && d.value === false) ?? false;
|
|
39
39
|
const conditionIsAlwaysTrue = (0, general_1.valueSetGuard)(values)?.elements.every(d => d.type === 'logical' && d.value === true) ?? false;
|
|
40
40
|
if (!conditionIsAlwaysFalse) {
|
|
@@ -16,7 +16,7 @@ const containers_1 = require("../../../../../../util/containers");
|
|
|
16
16
|
*/
|
|
17
17
|
function processList(name, args, rootId, data) {
|
|
18
18
|
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'builtin:list' });
|
|
19
|
-
if (!
|
|
19
|
+
if (!data.flowrConfig.solver.pointerTracking) {
|
|
20
20
|
return fnCall.information;
|
|
21
21
|
}
|
|
22
22
|
const listArgs = [];
|
|
@@ -67,7 +67,7 @@ function processList(name, args, rootId, data) {
|
|
|
67
67
|
}
|
|
68
68
|
listArgs.push(newIndex);
|
|
69
69
|
}
|
|
70
|
-
if ((0, config_1.isOverPointerAnalysisThreshold)(listArgs.length)) {
|
|
70
|
+
if ((0, config_1.isOverPointerAnalysisThreshold)(data.flowrConfig, listArgs.length)) {
|
|
71
71
|
return fnCall.information;
|
|
72
72
|
}
|
|
73
73
|
const indices = {
|
|
@@ -12,7 +12,6 @@ const graph_1 = require("../../../../../graph/graph");
|
|
|
12
12
|
const edge_1 = require("../../../../../graph/edge");
|
|
13
13
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
14
14
|
const containers_1 = require("../../../../../../util/containers");
|
|
15
|
-
const config_1 = require("../../../../../../config");
|
|
16
15
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
17
16
|
const built_in_access_1 = require("./built-in-access");
|
|
18
17
|
const built_in_1 = require("../../../../../environments/built-in");
|
|
@@ -28,7 +27,7 @@ args, rootId, data, config) {
|
|
|
28
27
|
/* we only get here if <-, <<-, ... or whatever is part of the replacement is not overwritten */
|
|
29
28
|
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Replacement ${name.content} with ${JSON.stringify(args)}, processing`);
|
|
30
29
|
let indices = config.activeIndices;
|
|
31
|
-
if (
|
|
30
|
+
if (data.flowrConfig.solver.pointerTracking) {
|
|
32
31
|
indices ??= constructAccessedIndices(name.content, args);
|
|
33
32
|
}
|
|
34
33
|
/* we assign the first argument by the last for now and maybe mark as maybe!, we can keep the symbol as we now know we have an assignment */
|
|
@@ -79,7 +78,7 @@ args, rootId, data, config) {
|
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
const fa = (0, unpack_argument_1.unpackArgument)(args[0]);
|
|
82
|
-
if (!
|
|
81
|
+
if (!data.flowrConfig.solver.pointerTracking && fa) {
|
|
83
82
|
res = {
|
|
84
83
|
...res,
|
|
85
84
|
in: [...res.in, { name: fa.lexeme, type: identifier_1.ReferenceType.Variable, nodeId: fa.info.id, controlDependencies: data.controlDependencies }]
|