@eagleoutice/flowr 2.9.9 → 2.9.11
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 +57 -54
- package/abstract-interpretation/absint-visitor.d.ts +16 -14
- package/abstract-interpretation/absint-visitor.js +93 -47
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
- package/abstract-interpretation/data-frame/shape-inference.d.ts +2 -5
- package/abstract-interpretation/data-frame/shape-inference.js +4 -5
- package/abstract-interpretation/domains/abstract-domain.d.ts +4 -4
- package/abstract-interpretation/domains/abstract-domain.js +8 -8
- package/abstract-interpretation/domains/mapped-abstract-domain.d.ts +12 -5
- package/abstract-interpretation/domains/mapped-abstract-domain.js +47 -23
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +30 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +130 -4
- 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/cfg-simplification.d.ts +1 -0
- package/control-flow/cfg-simplification.js +1 -0
- 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 +34 -15
- package/control-flow/semantic-cfg-guided-visitor.js +1 -0
- package/dataflow/cluster.js +1 -1
- package/dataflow/environments/built-in.d.ts +6 -15
- package/dataflow/environments/built-in.js +25 -33
- package/dataflow/environments/default-builtin-config.d.ts +4 -8
- package/dataflow/environments/default-builtin-config.js +8 -5
- package/dataflow/environments/reference-to-maybe.d.ts +8 -0
- package/dataflow/environments/reference-to-maybe.js +46 -3
- package/dataflow/eval/resolve/alias-tracking.d.ts +2 -2
- package/dataflow/eval/resolve/alias-tracking.js +6 -6
- package/dataflow/eval/resolve/resolve.js +12 -10
- 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 +5 -5
- package/dataflow/graph/graph.js +36 -32
- package/dataflow/graph/unknown-side-effect.js +3 -1
- package/dataflow/info.d.ts +4 -0
- package/dataflow/info.js +2 -2
- package/dataflow/internal/linker.d.ts +4 -4
- package/dataflow/internal/linker.js +59 -33
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -1
- package/dataflow/internal/process/functions/call/argument/make-argument.js +3 -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-for-loop.js +15 -6
- 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-repeat-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +22 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +22 -19
- 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/call/known-call-handling.js +0 -2
- 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-absint.js +7 -8
- package/documentation/wiki-cfg.js +3 -3
- package/documentation/wiki-mk/doc-context.d.ts +8 -0
- package/documentation/wiki-mk/doc-context.js +4 -0
- 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/dead-code.js +1 -1
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/seeded-randomness.js +1 -1
- package/linter/rules/unused-definition.js +1 -1
- package/package.json +7 -7
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +9 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +12 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
- 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/df-shape-query/df-shape-query-format.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.js +3 -3
- 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/decorate.js +23 -17
- 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/role.d.ts +18 -17
- 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 +33 -15
- 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 +6 -5
- 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 +3 -3
- package/util/mermaid/cfg.js +3 -4
- package/util/mermaid/dfg.d.ts +1 -1
- package/util/mermaid/dfg.js +13 -12
- 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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StateAbstractDomain = void 0;
|
|
3
|
+
exports.MutableStateAbstractDomain = exports.StateAbstractDomain = void 0;
|
|
4
|
+
const lattice_1 = require("./lattice");
|
|
4
5
|
const mapped_abstract_domain_1 = require("./mapped-abstract-domain");
|
|
5
6
|
/**
|
|
6
7
|
* A state abstract domain as mapping of AST node IDs of a program to abstract values of an abstract domain.
|
|
@@ -9,12 +10,137 @@ const mapped_abstract_domain_1 = require("./mapped-abstract-domain");
|
|
|
9
10
|
* @see {@link NodeId} for the node IDs of the AST nodes
|
|
10
11
|
*/
|
|
11
12
|
class StateAbstractDomain extends mapped_abstract_domain_1.MappedAbstractDomain {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
_isBottom;
|
|
14
|
+
constructor(value, bottom) {
|
|
15
|
+
super(value);
|
|
16
|
+
if (bottom || value.values().some(entry => entry.isBottom())) {
|
|
17
|
+
this._isBottom = true;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
create(value, bottom) {
|
|
21
|
+
return new StateAbstractDomain(value, bottom ?? this._isBottom);
|
|
14
22
|
}
|
|
15
|
-
static
|
|
23
|
+
static top() {
|
|
16
24
|
return new StateAbstractDomain(new Map());
|
|
17
25
|
}
|
|
26
|
+
get(key, ignoreBottom) {
|
|
27
|
+
return this._isBottom && !ignoreBottom ? super.get(key)?.bottom() : super.get(key);
|
|
28
|
+
}
|
|
29
|
+
set(key, value) {
|
|
30
|
+
if (value.isBottom()) {
|
|
31
|
+
this._isBottom = true;
|
|
32
|
+
}
|
|
33
|
+
super.set(key, value);
|
|
34
|
+
}
|
|
35
|
+
bottom() {
|
|
36
|
+
return this.create(this.value, true);
|
|
37
|
+
}
|
|
38
|
+
top() {
|
|
39
|
+
return this.create(new Map());
|
|
40
|
+
}
|
|
41
|
+
equals(other) {
|
|
42
|
+
if (this._isBottom !== other._isBottom) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return super.equals(other);
|
|
46
|
+
}
|
|
47
|
+
leq(other) {
|
|
48
|
+
if (this._isBottom) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
else if (other._isBottom) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return super.leq(other);
|
|
55
|
+
}
|
|
56
|
+
join(other) {
|
|
57
|
+
if (this._isBottom) {
|
|
58
|
+
return other.create(other.value);
|
|
59
|
+
}
|
|
60
|
+
else if (other._isBottom) {
|
|
61
|
+
return this.create(this.value);
|
|
62
|
+
}
|
|
63
|
+
return super.join(other);
|
|
64
|
+
}
|
|
65
|
+
meet(other) {
|
|
66
|
+
const result = super.meet(other);
|
|
67
|
+
result._isBottom = this._isBottom || other._isBottom;
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
widen(other) {
|
|
71
|
+
if (this._isBottom) {
|
|
72
|
+
return other.create(other.value);
|
|
73
|
+
}
|
|
74
|
+
else if (other._isBottom) {
|
|
75
|
+
return this.create(this.value);
|
|
76
|
+
}
|
|
77
|
+
return super.widen(other);
|
|
78
|
+
}
|
|
79
|
+
narrow(other) {
|
|
80
|
+
const result = super.narrow(other);
|
|
81
|
+
result._isBottom = this._isBottom || other._isBottom;
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
concretize(limit) {
|
|
85
|
+
if (this._isBottom) {
|
|
86
|
+
return new Set();
|
|
87
|
+
}
|
|
88
|
+
else if (this.value.size === 0) {
|
|
89
|
+
return lattice_1.Top;
|
|
90
|
+
}
|
|
91
|
+
return super.concretize(limit);
|
|
92
|
+
}
|
|
93
|
+
abstract(concrete) {
|
|
94
|
+
if (concrete === lattice_1.Top) {
|
|
95
|
+
return this.top();
|
|
96
|
+
}
|
|
97
|
+
else if (concrete.size === 0) {
|
|
98
|
+
return this.create(new Map(), true);
|
|
99
|
+
}
|
|
100
|
+
return super.abstract(concrete);
|
|
101
|
+
}
|
|
102
|
+
toJson() {
|
|
103
|
+
if (this._isBottom) {
|
|
104
|
+
return lattice_1.BottomSymbol;
|
|
105
|
+
}
|
|
106
|
+
else if (this.value.size === 0) {
|
|
107
|
+
return lattice_1.TopSymbol;
|
|
108
|
+
}
|
|
109
|
+
return super.toJson();
|
|
110
|
+
}
|
|
111
|
+
toString() {
|
|
112
|
+
if (this._isBottom) {
|
|
113
|
+
return lattice_1.BottomSymbol;
|
|
114
|
+
}
|
|
115
|
+
else if (this.value.size === 0) {
|
|
116
|
+
return lattice_1.TopSymbol;
|
|
117
|
+
}
|
|
118
|
+
return super.toString();
|
|
119
|
+
}
|
|
120
|
+
isTop() {
|
|
121
|
+
return this.value.size === 0;
|
|
122
|
+
}
|
|
123
|
+
isBottom() {
|
|
124
|
+
return this._isBottom ?? false;
|
|
125
|
+
}
|
|
126
|
+
isValue() {
|
|
127
|
+
return !this._isBottom;
|
|
128
|
+
}
|
|
18
129
|
}
|
|
19
130
|
exports.StateAbstractDomain = StateAbstractDomain;
|
|
131
|
+
/**
|
|
132
|
+
* A mutable version of the {@link StateAbstractDomain} with {@link MutableStateAbstractDomain#set|`set`} and {@link MutableStateAbstractDomain#remove|`remove`}.
|
|
133
|
+
*/
|
|
134
|
+
class MutableStateAbstractDomain extends StateAbstractDomain {
|
|
135
|
+
create(value) {
|
|
136
|
+
return new MutableStateAbstractDomain(value);
|
|
137
|
+
}
|
|
138
|
+
set(key, value) {
|
|
139
|
+
super.set(key, value);
|
|
140
|
+
}
|
|
141
|
+
remove(key) {
|
|
142
|
+
super.remove(key);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.MutableStateAbstractDomain = MutableStateAbstractDomain;
|
|
20
146
|
//# sourceMappingURL=state-abstract-domain.js.map
|
|
@@ -12,7 +12,7 @@ import type { RPipe } from '../r-bridge/lang-4.x/ast/model/nodes/r-pipe';
|
|
|
12
12
|
import type { RUnaryOp } from '../r-bridge/lang-4.x/ast/model/nodes/r-unary-op';
|
|
13
13
|
import type { RParameter } from '../r-bridge/lang-4.x/ast/model/nodes/r-parameter';
|
|
14
14
|
import type { RArgument } from '../r-bridge/lang-4.x/ast/model/nodes/r-argument';
|
|
15
|
-
import
|
|
15
|
+
import { RAccess } from '../r-bridge/lang-4.x/ast/model/nodes/r-access';
|
|
16
16
|
import type { RLogical } from '../r-bridge/lang-4.x/ast/model/nodes/r-logical';
|
|
17
17
|
import type { RBreak } from '../r-bridge/lang-4.x/ast/model/nodes/r-break';
|
|
18
18
|
import type { RComment } from '../r-bridge/lang-4.x/ast/model/nodes/r-comment';
|
|
@@ -21,7 +21,7 @@ import type { RNumber } from '../r-bridge/lang-4.x/ast/model/nodes/r-number';
|
|
|
21
21
|
import type { RLineDirective } from '../r-bridge/lang-4.x/ast/model/nodes/r-line-directive';
|
|
22
22
|
import type { RString } from '../r-bridge/lang-4.x/ast/model/nodes/r-string';
|
|
23
23
|
import type { RSymbol } from '../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
24
|
-
import
|
|
24
|
+
import { RProject } from '../r-bridge/lang-4.x/ast/model/nodes/r-project';
|
|
25
25
|
type FoldOfType<T extends RType, Returns = void, Info = NoInfo> = (node: Extract<RNode<Info>, {
|
|
26
26
|
type: T;
|
|
27
27
|
}>) => Returns;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DefaultNormalizedAstFold = void 0;
|
|
4
4
|
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
5
5
|
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
6
|
+
const r_access_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-access");
|
|
6
7
|
const r_project_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
7
8
|
/**
|
|
8
9
|
* Default implementation of a fold over the normalized AST (using the classic fold traversal).
|
|
@@ -65,12 +66,12 @@ class DefaultNormalizedAstFold {
|
|
|
65
66
|
if (Array.isArray(nodes)) {
|
|
66
67
|
const n = nodes;
|
|
67
68
|
return this.concatAll(n.filter(n => n && n !== r_function_call_1.EmptyArgument)
|
|
68
|
-
.map(node =>
|
|
69
|
+
.map(node => r_project_1.RProject.is(node) ?
|
|
69
70
|
this.concatAll(node.files.map(f => this.foldSingle(f.root))) :
|
|
70
71
|
this.foldSingle(node)));
|
|
71
72
|
}
|
|
72
73
|
else if (nodes) {
|
|
73
|
-
if (
|
|
74
|
+
if (r_project_1.RProject.is(nodes)) {
|
|
74
75
|
return this.concatAll(nodes.files.map(f => this.foldSingle(f.root)));
|
|
75
76
|
}
|
|
76
77
|
return this.foldSingle(nodes);
|
|
@@ -87,7 +88,7 @@ class DefaultNormalizedAstFold {
|
|
|
87
88
|
}
|
|
88
89
|
foldRAccess(access) {
|
|
89
90
|
let accessed = this.foldSingle(access.accessed);
|
|
90
|
-
if (
|
|
91
|
+
if (r_access_1.RAccess.isIndex(access)) {
|
|
91
92
|
accessed = this.concat(accessed, this.fold(access.access));
|
|
92
93
|
}
|
|
93
94
|
return accessed;
|
package/benchmark/slicer.js
CHANGED
|
@@ -16,8 +16,6 @@ const strings_1 = require("../util/text/strings");
|
|
|
16
16
|
const default_pipelines_1 = require("../core/steps/pipeline/default-pipelines");
|
|
17
17
|
const retriever_1 = require("../r-bridge/retriever");
|
|
18
18
|
const collect_all_1 = require("../slicing/criterion/collect-all");
|
|
19
|
-
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
20
|
-
const visitor_1 = require("../r-bridge/lang-4.x/ast/model/processing/visitor");
|
|
21
19
|
const size_of_1 = require("./stats/size-of");
|
|
22
20
|
const shell_1 = require("../r-bridge/shell");
|
|
23
21
|
const tree_sitter_types_1 = require("../r-bridge/lang-4.x/tree-sitter/tree-sitter-types");
|
|
@@ -31,6 +29,8 @@ const lattice_1 = require("../abstract-interpretation/domains/lattice");
|
|
|
31
29
|
const set_range_domain_1 = require("../abstract-interpretation/domains/set-range-domain");
|
|
32
30
|
const fs_1 = __importDefault(require("fs"));
|
|
33
31
|
const flowr_analyzer_context_1 = require("../project/context/flowr-analyzer-context");
|
|
32
|
+
const r_project_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
33
|
+
const r_comment_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-comment");
|
|
34
34
|
/**
|
|
35
35
|
* The logger to be used for benchmarking as a global object.
|
|
36
36
|
*/
|
|
@@ -127,9 +127,9 @@ class BenchmarkSlicer {
|
|
|
127
127
|
let nodesNoComments = 0;
|
|
128
128
|
let commentChars = 0;
|
|
129
129
|
let commentCharsNoWhitespace = 0;
|
|
130
|
-
|
|
130
|
+
r_project_1.RProject.visitAst(this.normalizedAst.ast, t => {
|
|
131
131
|
nodes++;
|
|
132
|
-
const comments = t.info.adToks?.filter(
|
|
132
|
+
const comments = t.info.adToks?.filter(r_comment_1.RComment.is);
|
|
133
133
|
if (comments && comments.length > 0) {
|
|
134
134
|
const content = comments.map(c => c.lexeme ?? '').join('');
|
|
135
135
|
commentChars += content.length;
|
|
@@ -271,7 +271,7 @@ class BenchmarkSlicer {
|
|
|
271
271
|
stats.numberOfResultingValues++;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
-
|
|
274
|
+
r_project_1.RProject.visitAst(this.normalizedAst.ast, node => {
|
|
275
275
|
const operations = inference.getAbstractOperations(node.info.id);
|
|
276
276
|
const value = inference.getAbstractValue(node.info.id);
|
|
277
277
|
// Only store per-node information for nodes representing expressions or nodes with abstract values
|
|
@@ -50,10 +50,10 @@ const summarizer_1 = require("../../../util/summarizer");
|
|
|
50
50
|
const assert_1 = require("../../../util/assert");
|
|
51
51
|
const shell_1 = require("../../../r-bridge/shell");
|
|
52
52
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
53
|
-
const visitor_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/visitor");
|
|
54
|
-
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
55
53
|
const arrays_1 = require("../../../util/collections/arrays");
|
|
56
54
|
const semantics_1 = require("../../../abstract-interpretation/data-frame/semantics");
|
|
55
|
+
const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
56
|
+
const r_comment_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-comment");
|
|
57
57
|
const tempfile = (() => {
|
|
58
58
|
let _tempfile = undefined;
|
|
59
59
|
return () => {
|
|
@@ -159,9 +159,9 @@ async function summarizeSlicerStats(stats, report = () => {
|
|
|
159
159
|
let numberOfNormalizedTokensNoComments = 0;
|
|
160
160
|
let commentChars = 0;
|
|
161
161
|
let commentCharsNoWhitespace = 0;
|
|
162
|
-
|
|
162
|
+
r_project_1.RProject.visitAst(reParsed.ast, t => {
|
|
163
163
|
numberOfNormalizedTokens++;
|
|
164
|
-
const comments = t.info.adToks?.filter(
|
|
164
|
+
const comments = t.info.adToks?.filter(r_comment_1.RComment.is);
|
|
165
165
|
if (comments && comments.length > 0) {
|
|
166
166
|
const content = comments.map(c => c.lexeme ?? '').join('');
|
|
167
167
|
commentChars += content.length;
|
|
@@ -39,7 +39,7 @@ const ast_1 = require("../../../util/mermaid/ast");
|
|
|
39
39
|
const ansi_1 = require("../../../util/text/ansi");
|
|
40
40
|
const core_1 = require("../core");
|
|
41
41
|
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
42
|
-
const
|
|
42
|
+
const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
43
43
|
function formatInfo(out, type, meta) {
|
|
44
44
|
return out.formatter.format(`Copied ${type} to clipboard (normalize: ${meta['.meta'].timing + 'ms'}).`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ });
|
|
45
45
|
}
|
|
@@ -93,7 +93,7 @@ exports.normalizeHashCommand = {
|
|
|
93
93
|
const counts = new defaultmap_1.DefaultMap(() => 0);
|
|
94
94
|
let total = 0;
|
|
95
95
|
const files = result.ast.files.length;
|
|
96
|
-
|
|
96
|
+
r_project_1.RProject.visitAst(result.ast, n => {
|
|
97
97
|
counts.set(n.type, counts.get(n.type) + 1);
|
|
98
98
|
total++;
|
|
99
99
|
});
|
package/cli/repl/core.js
CHANGED
|
@@ -110,7 +110,7 @@ function replCompleter(line, config) {
|
|
|
110
110
|
function replQueryCompleter(splitLine, startingNewArg, config) {
|
|
111
111
|
const nonEmpty = splitLine.slice(1).map(s => s.trim()).filter(s => s.length > 0);
|
|
112
112
|
const queryShorts = Object.keys(query_1.SupportedQueries).map(q => `@${q}`).concat(['help']);
|
|
113
|
-
if (nonEmpty.length
|
|
113
|
+
if (nonEmpty.length === 0 || (nonEmpty.length === 1 && queryShorts.some(q => q.startsWith(nonEmpty[0]) && nonEmpty[0] !== q && !startingNewArg))) {
|
|
114
114
|
return { completions: queryShorts.map(q => `${q} `) };
|
|
115
115
|
}
|
|
116
116
|
else {
|
|
@@ -141,7 +141,7 @@ function makeDefaultReplReadline(config) {
|
|
|
141
141
|
*/
|
|
142
142
|
function handleString(code) {
|
|
143
143
|
return {
|
|
144
|
-
rCode: code.length
|
|
144
|
+
rCode: code.length === 0 ? undefined : (0, strings_1.startAndEndsWith)(code, '"') ? JSON.parse(code) : code,
|
|
145
145
|
remaining: []
|
|
146
146
|
};
|
|
147
147
|
}
|
package/config.js
CHANGED
|
@@ -213,7 +213,7 @@ function getEngineConfig(config, engine) {
|
|
|
213
213
|
return defaultEngineConfigs[engine];
|
|
214
214
|
}
|
|
215
215
|
else {
|
|
216
|
-
return engines.find(e => e.type
|
|
216
|
+
return engines.find(e => e.type === engine);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function loadConfigFromFile(configFile, workingDirectory) {
|
|
@@ -34,6 +34,7 @@ declare function uniqueControlFlowSets(cfg: ControlFlowInformation, _info?: CfgP
|
|
|
34
34
|
declare function toBasicBlocks(cfg: ControlFlowInformation, _info?: CfgPassInfo): ControlFlowInformation;
|
|
35
35
|
/**
|
|
36
36
|
* Uses {@link visitCfgInOrder} to find all nodes that are reachable from the control flow graph's {@link ControlFlowInformation.entryPoints} and returns them as a set.
|
|
37
|
+
* Please note that this will not visit the grouping delimiters of expression list!
|
|
37
38
|
* @param cfg - The control flow graph whose reachable nodes to find.
|
|
38
39
|
*/
|
|
39
40
|
export declare function cfgFindAllReachable(cfg: ControlFlowInformation): Set<NodeId>;
|
|
@@ -59,6 +59,7 @@ function toBasicBlocks(cfg, _info) {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Uses {@link visitCfgInOrder} to find all nodes that are reachable from the control flow graph's {@link ControlFlowInformation.entryPoints} and returns them as a set.
|
|
62
|
+
* Please note that this will not visit the grouping delimiters of expression list!
|
|
62
63
|
* @param cfg - The control flow graph whose reachable nodes to find.
|
|
63
64
|
*/
|
|
64
65
|
function cfgFindAllReachable(cfg) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
2
|
import type { MergeableRecord } from '../util/objects';
|
|
3
3
|
import { RFalse, RTrue } from '../r-bridge/lang-4.x/convert-values';
|
|
4
4
|
/**
|
|
@@ -343,7 +343,7 @@ exports.CfgVertex = {
|
|
|
343
343
|
*/
|
|
344
344
|
fromExitId(exitId) {
|
|
345
345
|
if (typeof exitId === 'string' && exitId.endsWith('-e')) {
|
|
346
|
-
return
|
|
346
|
+
return node_id_1.NodeId.normalize(exitId.slice(0, -2));
|
|
347
347
|
}
|
|
348
348
|
else {
|
|
349
349
|
return exitId;
|
|
@@ -564,7 +564,6 @@ class ControlFlowGraph {
|
|
|
564
564
|
*/
|
|
565
565
|
addVertex(vertex, rootVertex = true) {
|
|
566
566
|
const vid = exports.CfgVertex.getId(vertex);
|
|
567
|
-
(0, assert_1.guard)(!this.vtxInfos.has(vid), `Node with id ${vid} already exists`);
|
|
568
567
|
if (exports.CfgVertex.isBlock(vertex)) {
|
|
569
568
|
this._mayBB = true;
|
|
570
569
|
const elems = exports.CfgVertex.getBasicBlockElements(vertex);
|
|
@@ -6,7 +6,7 @@ exports.extractCfgQuick = extractCfgQuick;
|
|
|
6
6
|
exports.getCallsInCfg = getCallsInCfg;
|
|
7
7
|
exports.cfg2quads = cfg2quads;
|
|
8
8
|
const quads_1 = require("../util/quads");
|
|
9
|
-
const
|
|
9
|
+
const r_function_definition_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
10
10
|
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
11
11
|
const linker_1 = require("../dataflow/internal/linker");
|
|
12
12
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
@@ -14,7 +14,18 @@ const control_flow_graph_1 = require("./control-flow-graph");
|
|
|
14
14
|
const cfg_simplification_1 = require("./cfg-simplification");
|
|
15
15
|
const assert_1 = require("../util/assert");
|
|
16
16
|
const built_in_1 = require("../dataflow/environments/built-in");
|
|
17
|
+
const stateful_fold_1 = require("../r-bridge/lang-4.x/ast/model/processing/stateful-fold");
|
|
18
|
+
const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
|
|
17
19
|
const cfgFolds = {
|
|
20
|
+
down: (n, down) => {
|
|
21
|
+
if (r_function_definition_1.RFunctionDefinition.is(n)) {
|
|
22
|
+
return [down[0], true];
|
|
23
|
+
}
|
|
24
|
+
else if (model_1.RLoopConstructs.is(n)) {
|
|
25
|
+
return [true, down[1]];
|
|
26
|
+
}
|
|
27
|
+
return down;
|
|
28
|
+
},
|
|
18
29
|
foldNumber: cfgLeaf(control_flow_graph_1.CfgVertexType.Expression),
|
|
19
30
|
foldString: cfgLeaf(control_flow_graph_1.CfgVertexType.Expression),
|
|
20
31
|
foldLogical: cfgLeaf(control_flow_graph_1.CfgVertexType.Expression),
|
|
@@ -99,7 +110,7 @@ function cfgFoldProject(proj, folds) {
|
|
|
99
110
|
return (0, control_flow_graph_1.emptyControlFlowInformation)();
|
|
100
111
|
}
|
|
101
112
|
else if (proj.files.length === 1) {
|
|
102
|
-
return (0,
|
|
113
|
+
return (0, stateful_fold_1.foldAstStateful)(proj.files[0].root, [false, false], folds);
|
|
103
114
|
}
|
|
104
115
|
/* for many files, it is too expensive to keep all asts at once, hence we create and merge them incrementally */
|
|
105
116
|
let exitPoints;
|
|
@@ -109,7 +120,7 @@ function cfgFoldProject(proj, folds) {
|
|
|
109
120
|
let nexts;
|
|
110
121
|
let returns;
|
|
111
122
|
{
|
|
112
|
-
const firstInfo = (0,
|
|
123
|
+
const firstInfo = (0, stateful_fold_1.foldAstStateful)(proj.files[0].root, [false, false], folds);
|
|
113
124
|
exitPoints = firstInfo.exitPoints;
|
|
114
125
|
finalGraph = firstInfo.graph;
|
|
115
126
|
firstEntryPoints = firstInfo.entryPoints;
|
|
@@ -118,7 +129,7 @@ function cfgFoldProject(proj, folds) {
|
|
|
118
129
|
returns = firstInfo.returns;
|
|
119
130
|
}
|
|
120
131
|
for (let i = 1; i < proj.files.length; i++) {
|
|
121
|
-
const nextInfo = (0,
|
|
132
|
+
const nextInfo = (0, stateful_fold_1.foldAstStateful)(proj.files[i].root, [false, false], folds);
|
|
122
133
|
finalGraph.mergeWith(nextInfo.graph);
|
|
123
134
|
for (const exitPoint of exitPoints) {
|
|
124
135
|
for (const entryPoint of nextInfo.entryPoints) {
|
|
@@ -147,17 +158,23 @@ function cfgLeaf(type) {
|
|
|
147
158
|
};
|
|
148
159
|
}
|
|
149
160
|
const cfgLeafStatement = cfgLeaf(control_flow_graph_1.CfgVertexType.Statement);
|
|
150
|
-
function cfgBreak(leaf) {
|
|
161
|
+
function cfgBreak(leaf, down) {
|
|
162
|
+
if (!down[0]) {
|
|
163
|
+
return cfgLeafStatement(leaf);
|
|
164
|
+
}
|
|
151
165
|
return { ...cfgLeafStatement(leaf), breaks: [leaf.info.id], exitPoints: [] };
|
|
152
166
|
}
|
|
153
|
-
function cfgNext(leaf) {
|
|
167
|
+
function cfgNext(leaf, down) {
|
|
168
|
+
if (!down[0]) {
|
|
169
|
+
return cfgLeafStatement(leaf);
|
|
170
|
+
}
|
|
154
171
|
return { ...cfgLeafStatement(leaf), nexts: [leaf.info.id], exitPoints: [] };
|
|
155
172
|
}
|
|
156
173
|
function cfgIgnore(_leaf) {
|
|
157
174
|
return { graph: new control_flow_graph_1.ControlFlowGraph(), breaks: [], nexts: [], returns: [], exitPoints: [], entryPoints: [] };
|
|
158
175
|
}
|
|
159
176
|
function identifyMayStatementType(node) {
|
|
160
|
-
return node.info.role === "
|
|
177
|
+
return node.info.role === "el-c" /* RoleInParent.ExpressionListChild */ ? control_flow_graph_1.CfgVertexType.Statement : control_flow_graph_1.CfgVertexType.Expression;
|
|
161
178
|
}
|
|
162
179
|
function cfgIfThenElse(ifNode, condition, then, otherwise) {
|
|
163
180
|
const ifId = ifNode.info.id;
|
|
@@ -318,7 +335,7 @@ function cfgFunctionDefinition(fn, params, body) {
|
|
|
318
335
|
}
|
|
319
336
|
return { graph: graph, breaks: [], nexts: [], returns: [], exitPoints: [fnId], entryPoints: [fnId] };
|
|
320
337
|
}
|
|
321
|
-
function cfgFunctionCall(call, name, args) {
|
|
338
|
+
function cfgFunctionCall(call, name, args, down) {
|
|
322
339
|
if (call.named && call.functionName.content === 'ifelse') {
|
|
323
340
|
// special built-in handling for ifelse as it is an expression that does not short-circuit
|
|
324
341
|
return cfgIfThenElse(call, args[0] === r_function_call_1.EmptyArgument ? (0, control_flow_graph_1.emptyControlFlowInformation)() : args[0], args[1] === r_function_call_1.EmptyArgument ? (0, control_flow_graph_1.emptyControlFlowInformation)() : args[1], args[2] === r_function_call_1.EmptyArgument ? (0, control_flow_graph_1.emptyControlFlowInformation)() : args[2]);
|
|
@@ -358,30 +375,32 @@ function cfgFunctionCall(call, name, args) {
|
|
|
358
375
|
graph.addEdge(control_flow_graph_1.CfgVertex.toExitId(callId), exit, control_flow_graph_1.CfgEdge.makeFd());
|
|
359
376
|
}
|
|
360
377
|
if (call.named && call.functionName.content === 'return') {
|
|
361
|
-
|
|
362
|
-
|
|
378
|
+
if (down[1]) {
|
|
379
|
+
info.returns.push(control_flow_graph_1.CfgVertex.toExitId(callId));
|
|
380
|
+
info.exitPoints.length = 0;
|
|
381
|
+
}
|
|
363
382
|
}
|
|
364
383
|
// should not contain any breaks, nexts, or returns, (except for the body if something like 'break()')
|
|
365
384
|
return info;
|
|
366
385
|
}
|
|
367
386
|
exports.ResolvedCallSuffix = control_flow_graph_1.CfgVertex.toExitId('-resolved-call');
|
|
368
387
|
const OriginToFoldTypeMap = {
|
|
369
|
-
[built_in_1.BuiltInProcName.IfThenElse]: (folds, call, args) => {
|
|
388
|
+
[built_in_1.BuiltInProcName.IfThenElse]: (folds, call, args, down) => {
|
|
370
389
|
// arguments are in order!
|
|
371
390
|
return folds.foldIfThenElse(call, // we will have to this more sophisticated if we rewrite the dfg based generation
|
|
372
|
-
args[0] === r_function_call_1.EmptyArgument ? (0, control_flow_graph_1.emptyControlFlowInformation)() : args[0], args[1] === r_function_call_1.EmptyArgument ? (0, control_flow_graph_1.emptyControlFlowInformation)() : args[1], args[2] === r_function_call_1.EmptyArgument ? (0, control_flow_graph_1.emptyControlFlowInformation)() : args[2],
|
|
391
|
+
args[0] === r_function_call_1.EmptyArgument ? (0, control_flow_graph_1.emptyControlFlowInformation)() : args[0], args[1] === r_function_call_1.EmptyArgument ? (0, control_flow_graph_1.emptyControlFlowInformation)() : args[1], args[2] === r_function_call_1.EmptyArgument ? (0, control_flow_graph_1.emptyControlFlowInformation)() : args[2], down);
|
|
373
392
|
}
|
|
374
393
|
};
|
|
375
394
|
function cfgFunctionCallWithDataflow(graph, folds) {
|
|
376
|
-
return (call, name, args) => {
|
|
395
|
+
return (call, name, args, down) => {
|
|
377
396
|
const vtx = graph.getVertex(call.info.id);
|
|
378
397
|
if (vtx?.tag === vertex_1.VertexType.FunctionCall && vtx.onlyBuiltin && vtx.origin.length === 1) {
|
|
379
398
|
const mayMap = OriginToFoldTypeMap[vtx.origin[0]];
|
|
380
399
|
if (mayMap) {
|
|
381
|
-
return mayMap(folds, call, args, vtx);
|
|
400
|
+
return mayMap(folds, call, args, down, vtx);
|
|
382
401
|
}
|
|
383
402
|
}
|
|
384
|
-
const baseCfg = cfgFunctionCall(call, name, args);
|
|
403
|
+
const baseCfg = cfgFunctionCall(call, name, args, down);
|
|
385
404
|
/* try to resolve the call and link the target definitions */
|
|
386
405
|
const targets = (0, linker_1.getAllFunctionCallTargets)(call.info.id, graph);
|
|
387
406
|
const exits = [];
|
|
@@ -279,6 +279,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
279
279
|
case built_in_1.BuiltInProcName.Recall:
|
|
280
280
|
return this.onRecallCall({ call });
|
|
281
281
|
case built_in_1.BuiltInProcName.Default:
|
|
282
|
+
case built_in_1.BuiltInProcName.DefaultReadAllArgs:
|
|
282
283
|
case built_in_1.BuiltInProcName.Function:
|
|
283
284
|
case built_in_1.BuiltInProcName.FunctionDefinition:
|
|
284
285
|
return this.onDefaultFunctionCall({ call });
|
package/dataflow/cluster.js
CHANGED
|
@@ -37,7 +37,7 @@ function makeCluster(graph, from, notReached) {
|
|
|
37
37
|
// cluster adjacent edges
|
|
38
38
|
for (const [dest, e] of [...graph.outgoingEdges(from) ?? [], ...graph.ingoingEdges(from) ?? []]) {
|
|
39
39
|
// don't cluster for function content if it isn't returned
|
|
40
|
-
if (edge_1.DfEdge.doesNotIncludeType(e, edge_1.EdgeType.Returns) && info.onlyBuiltin && info.name
|
|
40
|
+
if (edge_1.DfEdge.doesNotIncludeType(e, edge_1.EdgeType.Returns) && info.onlyBuiltin && info.name === '{') {
|
|
41
41
|
continue;
|
|
42
42
|
}
|
|
43
43
|
if (notReached.delete(dest)) {
|
|
@@ -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 {
|
|
@@ -94,6 +81,7 @@ export interface BuiltInEvalHandlerArgs {
|
|
|
94
81
|
}
|
|
95
82
|
export type BuiltInEvalHandler = (args: BuiltInEvalHandlerArgs) => Value;
|
|
96
83
|
declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { returnsNthArgument, useAsProcessor, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
|
|
84
|
+
declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'forceArgs'>): DataflowInformation;
|
|
97
85
|
/**
|
|
98
86
|
* This contains all names of built-in function handlers and origins
|
|
99
87
|
*/
|
|
@@ -110,6 +98,8 @@ export declare enum BuiltInProcName {
|
|
|
110
98
|
Break = "builtin:break",
|
|
111
99
|
/** the default built-in processor, see {@link defaultBuiltInProcessor} */
|
|
112
100
|
Default = "builtin:default",
|
|
101
|
+
/** Just a more performant variant of the default processor for built-ins that need to read all their arguments, see {@link defaultBuiltInProcessor}, this will still produce the origin `BuiltIn.Default` */
|
|
102
|
+
DefaultReadAllArgs = "builtin:default-read-all-args",
|
|
113
103
|
/** for `eval` calls, see {@link processEvalCall} */
|
|
114
104
|
Eval = "builtin:eval",
|
|
115
105
|
/** for expression lists, see {@link processExpressionList} */
|
|
@@ -181,6 +171,7 @@ export declare const BuiltInProcessorMapper: {
|
|
|
181
171
|
readonly "builtin:assignment": typeof processAssignment;
|
|
182
172
|
readonly "builtin:assignment-like": typeof processAssignmentLike;
|
|
183
173
|
readonly "builtin:default": typeof defaultBuiltInProcessor;
|
|
174
|
+
readonly "builtin:default-read-all-args": typeof defaultBuiltInProcessorReadallArgs;
|
|
184
175
|
readonly "builtin:eval": typeof processEvalCall;
|
|
185
176
|
readonly "builtin:expression-list": typeof processExpressionList;
|
|
186
177
|
readonly "builtin:for-loop": typeof processForLoop;
|