@eagleoutice/flowr 2.9.0 → 2.9.2
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 +26 -26
- package/benchmark/slicer.js +1 -1
- package/benchmark/summarizer/first-phase/process.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +25 -0
- package/control-flow/semantic-cfg-guided-visitor.js +25 -0
- package/dataflow/environments/built-in-config.d.ts +1 -1
- package/dataflow/environments/built-in.d.ts +10 -0
- package/dataflow/environments/built-in.js +10 -0
- package/dataflow/environments/default-builtin-config.d.ts +50 -7
- package/dataflow/environments/default-builtin-config.js +15 -3
- package/dataflow/environments/identifier.d.ts +4 -2
- package/dataflow/environments/identifier.js +3 -1
- package/dataflow/environments/resolve-by-name.js +5 -2
- package/dataflow/eval/resolve/alias-tracking.js +8 -1
- package/dataflow/eval/resolve/resolve-argument.js +2 -2
- package/dataflow/eval/values/general.js +1 -1
- package/dataflow/eval/values/r-value.d.ts +4 -1
- package/dataflow/eval/values/r-value.js +2 -0
- package/dataflow/graph/dataflowgraph-builder.d.ts +3 -2
- package/dataflow/graph/dataflowgraph-builder.js +4 -3
- package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +5 -1
- package/dataflow/graph/graph.d.ts +66 -10
- package/dataflow/graph/graph.js +85 -22
- package/dataflow/graph/vertex.d.ts +11 -1
- package/dataflow/internal/linker.d.ts +1 -1
- package/dataflow/internal/linker.js +22 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +14 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +30 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +22 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +12 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +27 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +210 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +24 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +1 -0
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +1 -0
- package/documentation/data/interface/doc-writing-code.js +1 -2
- package/documentation/wiki-dataflow-graph.js +8 -4
- package/linter/rules/naming-convention.d.ts +9 -2
- package/linter/rules/naming-convention.js +38 -36
- package/linter/rules/seeded-randomness.js +2 -2
- package/package.json +2 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +24 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +61 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -3
- package/r-bridge/data/data.d.ts +4 -4
- package/r-bridge/data/data.js +4 -4
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/type.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/type.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-break.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-comment.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-line-directive.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
- 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 +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +22 -22
- package/r-bridge/roxygen2/roxygen-parse.js +1 -1
- package/reconstruct/auto-select/magic-comments.js +1 -1
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +4 -4
- package/util/mermaid/dfg.js +5 -5
- package/util/r-value.d.ts +3 -2
- package/util/r-value.js +3 -0
- package/util/version.js +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ It offers a wide variety of features, for example:
|
|
|
24
24
|
|
|
25
25
|
```shell
|
|
26
26
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
27
|
-
flowR repl using flowR v2.
|
|
27
|
+
flowR repl using flowR v2.9.1, R grammar v14 (tree-sitter engine)
|
|
28
28
|
R> :query @linter "read.csv(\"/root/x.txt\")"
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -33,13 +33,13 @@ It offers a wide variety of features, for example:
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
```text
|
|
36
|
-
Query: linter (
|
|
36
|
+
Query: linter (2 ms)
|
|
37
37
|
╰ Deprecated Functions (deprecated-functions):
|
|
38
|
-
╰ Metadata: totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs:
|
|
38
|
+
╰ Metadata: totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0
|
|
39
39
|
╰ File Path Validity (file-path-validity):
|
|
40
40
|
╰ certain:
|
|
41
41
|
╰ Path `/root/x.txt` at 1.1-23
|
|
42
|
-
╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs:
|
|
42
|
+
╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs: 1
|
|
43
43
|
╰ Seeded Randomness (seeded-randomness):
|
|
44
44
|
╰ Metadata: consumerCalls: 0, callsWithFunctionProducers: 0, callsWithAssignmentProducers: 0, callsWithNonConstantProducers: 0, callsWithOtherBranchProducers: 0, searchTimeMs: 0, processTimeMs: 0
|
|
45
45
|
╰ Absolute Paths (absolute-file-paths):
|
|
@@ -53,12 +53,12 @@ It offers a wide variety of features, for example:
|
|
|
53
53
|
╰ Network Functions (network-functions):
|
|
54
54
|
╰ Metadata: totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0
|
|
55
55
|
╰ Dataframe Access Validation (dataframe-access-validation):
|
|
56
|
-
╰ Metadata: numOperations: 0, numAccesses: 0, totalAccessed: 0, searchTimeMs: 0, processTimeMs:
|
|
56
|
+
╰ Metadata: numOperations: 0, numAccesses: 0, totalAccessed: 0, searchTimeMs: 0, processTimeMs: 0
|
|
57
57
|
╰ Dead Code (dead-code):
|
|
58
|
-
╰ Metadata: consideredNodes: 5, searchTimeMs:
|
|
58
|
+
╰ Metadata: consideredNodes: 5, searchTimeMs: 1, processTimeMs: 0
|
|
59
59
|
╰ Useless Loops (useless-loop):
|
|
60
60
|
╰ Metadata: numOfUselessLoops: 0, searchTimeMs: 0, processTimeMs: 0
|
|
61
|
-
All queries together required ≈
|
|
61
|
+
All queries together required ≈2 ms (1ms accuracy, total 3 ms)
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
|
|
@@ -80,36 +80,36 @@ It offers a wide variety of features, for example:
|
|
|
80
80
|
|
|
81
81
|
_Results (prettified and summarized):_
|
|
82
82
|
|
|
83
|
-
Query: **linter** (
|
|
83
|
+
Query: **linter** (2 ms)\
|
|
84
84
|
╰ **Deprecated Functions** (deprecated-functions):\
|
|
85
|
-
╰ _Metadata_: <code>totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs:
|
|
85
|
+
╰ _Metadata_: <code>totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 1, processTimeMs: 0</code>\
|
|
86
86
|
╰ **File Path Validity** (file-path-validity):\
|
|
87
87
|
╰ certain:\
|
|
88
88
|
╰ Path `/root/x.txt` at 1.1-23\
|
|
89
|
-
╰ _Metadata_: <code>totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs:
|
|
89
|
+
╰ _Metadata_: <code>totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
90
90
|
╰ **Seeded Randomness** (seeded-randomness):\
|
|
91
91
|
╰ _Metadata_: <code>consumerCalls: 0, callsWithFunctionProducers: 0, callsWithAssignmentProducers: 0, callsWithNonConstantProducers: 0, callsWithOtherBranchProducers: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
92
92
|
╰ **Absolute Paths** (absolute-file-paths):\
|
|
93
93
|
╰ certain:\
|
|
94
94
|
╰ Path `/root/x.txt` at 1.1-23\
|
|
95
|
-
╰ _Metadata_: <code>totalConsidered: 1, totalUnknown: 0, searchTimeMs:
|
|
95
|
+
╰ _Metadata_: <code>totalConsidered: 1, totalUnknown: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
96
96
|
╰ **Unused Definitions** (unused-definitions):\
|
|
97
97
|
╰ _Metadata_: <code>totalConsidered: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
98
98
|
╰ **Naming Convention** (naming-convention):\
|
|
99
|
-
╰ _Metadata_: <code>numMatches: 0, numBreak: 0, searchTimeMs:
|
|
99
|
+
╰ _Metadata_: <code>numMatches: 0, numBreak: 0, searchTimeMs: 1, processTimeMs: 0</code>\
|
|
100
100
|
╰ **Network Functions** (network-functions):\
|
|
101
101
|
╰ _Metadata_: <code>totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
102
102
|
╰ **Dataframe Access Validation** (dataframe-access-validation):\
|
|
103
103
|
╰ _Metadata_: <code>numOperations: 0, numAccesses: 0, totalAccessed: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
104
104
|
╰ **Dead Code** (dead-code):\
|
|
105
|
-
╰ _Metadata_: <code>consideredNodes: 5, searchTimeMs:
|
|
105
|
+
╰ _Metadata_: <code>consideredNodes: 5, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
106
106
|
╰ **Useless Loops** (useless-loop):\
|
|
107
107
|
╰ _Metadata_: <code>numOfUselessLoops: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
108
|
-
_All queries together required ≈
|
|
108
|
+
_All queries together required ≈2 ms (1ms accuracy, total 2 ms)_
|
|
109
109
|
|
|
110
110
|
<details> <summary style="color:gray">Show Detailed Results as Json</summary>
|
|
111
111
|
|
|
112
|
-
The analysis required _2.
|
|
112
|
+
The analysis required _2.3 ms_ (including parsing and normalization and the query) within the generation environment.
|
|
113
113
|
|
|
114
114
|
In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
|
|
115
115
|
Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
|
|
@@ -126,7 +126,7 @@ It offers a wide variety of features, for example:
|
|
|
126
126
|
".meta": {
|
|
127
127
|
"totalCalls": 0,
|
|
128
128
|
"totalFunctionDefinitions": 0,
|
|
129
|
-
"searchTimeMs":
|
|
129
|
+
"searchTimeMs": 1,
|
|
130
130
|
"processTimeMs": 0
|
|
131
131
|
}
|
|
132
132
|
},
|
|
@@ -149,7 +149,7 @@ It offers a wide variety of features, for example:
|
|
|
149
149
|
"totalUnknown": 0,
|
|
150
150
|
"totalWritesBeforeAlways": 0,
|
|
151
151
|
"totalValid": 0,
|
|
152
|
-
"searchTimeMs":
|
|
152
|
+
"searchTimeMs": 0,
|
|
153
153
|
"processTimeMs": 0
|
|
154
154
|
}
|
|
155
155
|
},
|
|
@@ -181,7 +181,7 @@ It offers a wide variety of features, for example:
|
|
|
181
181
|
".meta": {
|
|
182
182
|
"totalConsidered": 1,
|
|
183
183
|
"totalUnknown": 0,
|
|
184
|
-
"searchTimeMs":
|
|
184
|
+
"searchTimeMs": 0,
|
|
185
185
|
"processTimeMs": 0
|
|
186
186
|
}
|
|
187
187
|
},
|
|
@@ -198,7 +198,7 @@ It offers a wide variety of features, for example:
|
|
|
198
198
|
".meta": {
|
|
199
199
|
"numMatches": 0,
|
|
200
200
|
"numBreak": 0,
|
|
201
|
-
"searchTimeMs":
|
|
201
|
+
"searchTimeMs": 1,
|
|
202
202
|
"processTimeMs": 0
|
|
203
203
|
}
|
|
204
204
|
},
|
|
@@ -225,7 +225,7 @@ It offers a wide variety of features, for example:
|
|
|
225
225
|
"results": [],
|
|
226
226
|
".meta": {
|
|
227
227
|
"consideredNodes": 5,
|
|
228
|
-
"searchTimeMs":
|
|
228
|
+
"searchTimeMs": 0,
|
|
229
229
|
"processTimeMs": 0
|
|
230
230
|
}
|
|
231
231
|
},
|
|
@@ -239,11 +239,11 @@ It offers a wide variety of features, for example:
|
|
|
239
239
|
}
|
|
240
240
|
},
|
|
241
241
|
".meta": {
|
|
242
|
-
"timing":
|
|
242
|
+
"timing": 2
|
|
243
243
|
}
|
|
244
244
|
},
|
|
245
245
|
".meta": {
|
|
246
|
-
"timing":
|
|
246
|
+
"timing": 2
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
```
|
|
@@ -308,7 +308,7 @@ It offers a wide variety of features, for example:
|
|
|
308
308
|
|
|
309
309
|
```shell
|
|
310
310
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
311
|
-
flowR repl using flowR v2.
|
|
311
|
+
flowR repl using flowR v2.9.1, R grammar v14 (tree-sitter engine)
|
|
312
312
|
R> :query @static-slice (11@sum) file://test/testfiles/example.R
|
|
313
313
|
```
|
|
314
314
|
|
|
@@ -322,7 +322,7 @@ It offers a wide variety of features, for example:
|
|
|
322
322
|
N <- 10
|
|
323
323
|
for(i in 1:(N-1)) sum <- sum + i + w
|
|
324
324
|
sum
|
|
325
|
-
All queries together required ≈
|
|
325
|
+
All queries together required ≈4 ms (1ms accuracy, total 4 ms)
|
|
326
326
|
```
|
|
327
327
|
|
|
328
328
|
|
|
@@ -356,7 +356,7 @@ It offers a wide variety of features, for example:
|
|
|
356
356
|
|
|
357
357
|
|
|
358
358
|
* 🚀 **fast call-graph, data-, and control-flow graphs**\
|
|
359
|
-
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">118
|
|
359
|
+
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">118 ms</span></i> (as of Feb 3, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
|
|
360
360
|
_flowR_ can analyze the data- and control-flow of the average real-world R script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
|
|
361
361
|
and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/wiki/dataflow-graph) for more details on the dataflow graphs as well as call graphs.
|
|
362
362
|
|
|
@@ -392,7 +392,7 @@ It offers a wide variety of features, for example:
|
|
|
392
392
|
|
|
393
393
|
```shell
|
|
394
394
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
395
|
-
flowR repl using flowR v2.
|
|
395
|
+
flowR repl using flowR v2.9.1, R grammar v14 (tree-sitter engine)
|
|
396
396
|
R> :dataflow* test/testfiles/example.R
|
|
397
397
|
```
|
|
398
398
|
|
package/benchmark/slicer.js
CHANGED
|
@@ -131,7 +131,7 @@ class BenchmarkSlicer {
|
|
|
131
131
|
let commentCharsNoWhitespace = 0;
|
|
132
132
|
(0, visitor_1.visitAst)(this.normalizedAst.ast.files.map(f => f.root), t => {
|
|
133
133
|
nodes++;
|
|
134
|
-
const comments = t.info.
|
|
134
|
+
const comments = t.info.adToks?.filter(t => t.type === type_1.RType.Comment);
|
|
135
135
|
if (comments && comments.length > 0) {
|
|
136
136
|
const content = comments.map(c => c.lexeme ?? '').join('');
|
|
137
137
|
commentChars += content.length;
|
|
@@ -161,7 +161,7 @@ async function summarizeSlicerStats(stats, report = () => {
|
|
|
161
161
|
let commentCharsNoWhitespace = 0;
|
|
162
162
|
(0, visitor_1.visitAst)(reParsed.ast.files.map(f => f.root), t => {
|
|
163
163
|
numberOfNormalizedTokens++;
|
|
164
|
-
const comments = t.info.
|
|
164
|
+
const comments = t.info.adToks?.filter(t => t.type === type_1.RType.Comment);
|
|
165
165
|
if (comments && comments.length > 0) {
|
|
166
166
|
const content = comments.map(c => c.lexeme ?? '').join('');
|
|
167
167
|
commentChars += content.length;
|
|
@@ -496,11 +496,36 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
|
|
|
496
496
|
* This event triggers for every call to a function that performs an S3-like dispatch.
|
|
497
497
|
*
|
|
498
498
|
* For example, this triggers for `UseMethod` in `UseMethod("print")`.
|
|
499
|
+
* @see {@link SemanticCfgGuidedVisitor#onS3DispatchNextCall|`onS3DispatchNextCall`} for `NextMethod` calls.
|
|
499
500
|
* @protected
|
|
500
501
|
*/
|
|
501
502
|
protected onS3DispatchCall(_data: {
|
|
502
503
|
call: DataflowGraphVertexFunctionCall;
|
|
503
504
|
}): void;
|
|
505
|
+
/**
|
|
506
|
+
* This event triggers for every call to a function that performs an S3-like *next* dispatch.
|
|
507
|
+
*
|
|
508
|
+
* For example, this triggers for `NextMethod`.
|
|
509
|
+
* @see {@link SemanticCfgGuidedVisitor#onS3DispatchCall|`onS3DispatchCall`} for `UseMethod` calls.
|
|
510
|
+
* @protected
|
|
511
|
+
*/
|
|
512
|
+
protected onS3DispatchNextCall(_data: {
|
|
513
|
+
call: DataflowGraphVertexFunctionCall;
|
|
514
|
+
}): void;
|
|
515
|
+
/**
|
|
516
|
+
* This event triggers for every call to a function that creates a new S7 generic, such as `new_generic`.
|
|
517
|
+
* @protected
|
|
518
|
+
*/
|
|
519
|
+
protected onS7NewGenericCall(_data: {
|
|
520
|
+
call: DataflowGraphVertexFunctionCall;
|
|
521
|
+
}): void;
|
|
522
|
+
/**
|
|
523
|
+
* This event triggers for every call to a function that performs an S7 dispatch, such as `S7_dispatch`.
|
|
524
|
+
* @protected
|
|
525
|
+
*/
|
|
526
|
+
protected onS7DispatchCall(_data: {
|
|
527
|
+
call: DataflowGraphVertexFunctionCall;
|
|
528
|
+
}): void;
|
|
504
529
|
/**
|
|
505
530
|
* This event triggers for every call to a function that registers a hook, such as `on.exit`.
|
|
506
531
|
*
|
|
@@ -263,6 +263,12 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
263
263
|
return this.onLocalCall({ call });
|
|
264
264
|
case built_in_1.BuiltInProcName.S3Dispatch:
|
|
265
265
|
return this.onS3DispatchCall({ call });
|
|
266
|
+
case built_in_1.BuiltInProcName.S3DispatchNext:
|
|
267
|
+
return this.onS3DispatchNextCall({ call });
|
|
268
|
+
case built_in_1.BuiltInProcName.S7NewGeneric:
|
|
269
|
+
return this.onS7NewGenericCall({ call });
|
|
270
|
+
case built_in_1.BuiltInProcName.S7Dispatch:
|
|
271
|
+
return this.onS7DispatchCall({ call });
|
|
266
272
|
case built_in_1.BuiltInProcName.Break:
|
|
267
273
|
return this.onBreakCall({ call });
|
|
268
274
|
case built_in_1.BuiltInProcName.Return:
|
|
@@ -578,9 +584,28 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
578
584
|
* This event triggers for every call to a function that performs an S3-like dispatch.
|
|
579
585
|
*
|
|
580
586
|
* For example, this triggers for `UseMethod` in `UseMethod("print")`.
|
|
587
|
+
* @see {@link SemanticCfgGuidedVisitor#onS3DispatchNextCall|`onS3DispatchNextCall`} for `NextMethod` calls.
|
|
581
588
|
* @protected
|
|
582
589
|
*/
|
|
583
590
|
onS3DispatchCall(_data) { }
|
|
591
|
+
/**
|
|
592
|
+
* This event triggers for every call to a function that performs an S3-like *next* dispatch.
|
|
593
|
+
*
|
|
594
|
+
* For example, this triggers for `NextMethod`.
|
|
595
|
+
* @see {@link SemanticCfgGuidedVisitor#onS3DispatchCall|`onS3DispatchCall`} for `UseMethod` calls.
|
|
596
|
+
* @protected
|
|
597
|
+
*/
|
|
598
|
+
onS3DispatchNextCall(_data) { }
|
|
599
|
+
/**
|
|
600
|
+
* This event triggers for every call to a function that creates a new S7 generic, such as `new_generic`.
|
|
601
|
+
* @protected
|
|
602
|
+
*/
|
|
603
|
+
onS7NewGenericCall(_data) { }
|
|
604
|
+
/**
|
|
605
|
+
* This event triggers for every call to a function that performs an S7 dispatch, such as `S7_dispatch`.
|
|
606
|
+
* @protected
|
|
607
|
+
*/
|
|
608
|
+
onS7DispatchCall(_data) { }
|
|
584
609
|
/**
|
|
585
610
|
* This event triggers for every call to a function that registers a hook, such as `on.exit`.
|
|
586
611
|
*
|
|
@@ -39,7 +39,7 @@ export interface BuiltInReplacementDefinition extends BaseBuiltInDefinition {
|
|
|
39
39
|
readonly suffixes: ('<<-' | '<-')[];
|
|
40
40
|
readonly config: {
|
|
41
41
|
readIndices: boolean;
|
|
42
|
-
|
|
42
|
+
constructName?: 's7';
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
export type BuiltInDefinition<T extends keyof typeof BuiltInProcessorMapper = keyof typeof BuiltInProcessorMapper> = BuiltInConstantDefinition<unknown> | BuiltInFunctionDefinition<T> | BuiltInReplacementDefinition;
|
|
@@ -40,6 +40,8 @@ import { processRegisterHook } from '../internal/process/functions/call/built-in
|
|
|
40
40
|
import { processLocal } from '../internal/process/functions/call/built-in/built-in-local';
|
|
41
41
|
import { processS3Dispatch } from '../internal/process/functions/call/built-in/built-in-s-three-dispatch';
|
|
42
42
|
import { processRecall } from '../internal/process/functions/call/built-in/built-in-recall';
|
|
43
|
+
import { processS7NewGeneric } from '../internal/process/functions/call/built-in/built-in-s-seven-new-generic';
|
|
44
|
+
import { processS7Dispatch } from '../internal/process/functions/call/built-in/built-in-s-seven-dispatch';
|
|
43
45
|
export type BuiltIn = `built-in:${string}`;
|
|
44
46
|
/**
|
|
45
47
|
* Generate a built-in id for the given name
|
|
@@ -139,6 +141,12 @@ export declare enum BuiltInProcName {
|
|
|
139
141
|
Rm = "builtin:rm",
|
|
140
142
|
/** for `UseMethod` calls, see {@link processS3Dispatch} */
|
|
141
143
|
S3Dispatch = "builtin:s3-dispatch",
|
|
144
|
+
/** for `NextMethod` calls, see {@link processS3Dispatch} */
|
|
145
|
+
S3DispatchNext = "builtin:s3-dispatch-next",
|
|
146
|
+
/** for `new.generic` calls, see {@link processS7NewGeneric} */
|
|
147
|
+
S7NewGeneric = "builtin:s7-new-generic",
|
|
148
|
+
/** for `S7_dispatch` calls (and their implicit creations), see {@link processS7Dispatch} */
|
|
149
|
+
S7Dispatch = "builtin:s7-dispatch",
|
|
142
150
|
/** for `source` calls, see {@link processSourceCall} */
|
|
143
151
|
Source = "builtin:source",
|
|
144
152
|
/** for special binary operators like `%x%`, see {@link processSpecialBinOp} */
|
|
@@ -181,6 +189,8 @@ export declare const BuiltInProcessorMapper: {
|
|
|
181
189
|
readonly "builtin:replacement": typeof processReplacementFunction;
|
|
182
190
|
readonly "builtin:rm": typeof processRm;
|
|
183
191
|
readonly "builtin:s3-dispatch": typeof processS3Dispatch;
|
|
192
|
+
readonly "builtin:s7-new-generic": typeof processS7NewGeneric;
|
|
193
|
+
readonly "builtin:s7-dispatch": typeof processS7Dispatch;
|
|
184
194
|
readonly "builtin:source": typeof processSourceCall;
|
|
185
195
|
readonly "builtin:special-bin-op": typeof processSpecialBinOp;
|
|
186
196
|
readonly "builtin:stopifnot": typeof processStopIfNot;
|
|
@@ -39,6 +39,8 @@ const built_in_register_hook_1 = require("../internal/process/functions/call/bui
|
|
|
39
39
|
const built_in_local_1 = require("../internal/process/functions/call/built-in/built-in-local");
|
|
40
40
|
const built_in_s_three_dispatch_1 = require("../internal/process/functions/call/built-in/built-in-s-three-dispatch");
|
|
41
41
|
const built_in_recall_1 = require("../internal/process/functions/call/built-in/built-in-recall");
|
|
42
|
+
const built_in_s_seven_new_generic_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-new-generic");
|
|
43
|
+
const built_in_s_seven_dispatch_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-dispatch");
|
|
42
44
|
/**
|
|
43
45
|
* Generate a built-in id for the given name
|
|
44
46
|
*/
|
|
@@ -175,6 +177,12 @@ var BuiltInProcName;
|
|
|
175
177
|
BuiltInProcName["Rm"] = "builtin:rm";
|
|
176
178
|
/** for `UseMethod` calls, see {@link processS3Dispatch} */
|
|
177
179
|
BuiltInProcName["S3Dispatch"] = "builtin:s3-dispatch";
|
|
180
|
+
/** for `NextMethod` calls, see {@link processS3Dispatch} */
|
|
181
|
+
BuiltInProcName["S3DispatchNext"] = "builtin:s3-dispatch-next";
|
|
182
|
+
/** for `new.generic` calls, see {@link processS7NewGeneric} */
|
|
183
|
+
BuiltInProcName["S7NewGeneric"] = "builtin:s7-new-generic";
|
|
184
|
+
/** for `S7_dispatch` calls (and their implicit creations), see {@link processS7Dispatch} */
|
|
185
|
+
BuiltInProcName["S7Dispatch"] = "builtin:s7-dispatch";
|
|
178
186
|
/** for `source` calls, see {@link processSourceCall} */
|
|
179
187
|
BuiltInProcName["Source"] = "builtin:source";
|
|
180
188
|
/** for special binary operators like `%x%`, see {@link processSpecialBinOp} */
|
|
@@ -217,6 +225,8 @@ exports.BuiltInProcessorMapper = {
|
|
|
217
225
|
[BuiltInProcName.Replacement]: built_in_replacement_1.processReplacementFunction,
|
|
218
226
|
[BuiltInProcName.Rm]: built_in_rm_1.processRm,
|
|
219
227
|
[BuiltInProcName.S3Dispatch]: built_in_s_three_dispatch_1.processS3Dispatch,
|
|
228
|
+
[BuiltInProcName.S7NewGeneric]: built_in_s_seven_new_generic_1.processS7NewGeneric,
|
|
229
|
+
[BuiltInProcName.S7Dispatch]: built_in_s_seven_dispatch_1.processS7Dispatch,
|
|
220
230
|
[BuiltInProcName.Source]: built_in_source_1.processSourceCall,
|
|
221
231
|
[BuiltInProcName.SpecialBinOp]: built_in_special_bin_op_1.processSpecialBinOp,
|
|
222
232
|
[BuiltInProcName.StopIfNot]: built_in_stop_if_not_1.processStopIfNot,
|
|
@@ -404,7 +404,7 @@ export declare const DefaultBuiltinConfig: [{
|
|
|
404
404
|
readonly assumePrimitive: true;
|
|
405
405
|
}, {
|
|
406
406
|
readonly type: "function";
|
|
407
|
-
readonly names: ["assign", "
|
|
407
|
+
readonly names: ["assign", "setValidity"];
|
|
408
408
|
readonly processor: BuiltInProcName.Assignment;
|
|
409
409
|
readonly config: {
|
|
410
410
|
readonly targetVariable: true;
|
|
@@ -426,6 +426,7 @@ export declare const DefaultBuiltinConfig: [{
|
|
|
426
426
|
readonly idx: 2;
|
|
427
427
|
readonly name: "definition";
|
|
428
428
|
};
|
|
429
|
+
readonly modesForFn: ["s4"];
|
|
429
430
|
};
|
|
430
431
|
readonly assumePrimitive: true;
|
|
431
432
|
}, {
|
|
@@ -543,23 +544,57 @@ export declare const DefaultBuiltinConfig: [{
|
|
|
543
544
|
readonly assumePrimitive: true;
|
|
544
545
|
}, {
|
|
545
546
|
readonly type: "function";
|
|
546
|
-
readonly names: ["
|
|
547
|
-
readonly processor: BuiltInProcName.
|
|
547
|
+
readonly names: ["UseMethod"];
|
|
548
|
+
readonly processor: BuiltInProcName.S3Dispatch;
|
|
548
549
|
readonly config: {
|
|
549
|
-
readonly
|
|
550
|
-
|
|
551
|
-
|
|
550
|
+
readonly args: {
|
|
551
|
+
readonly generic: "generic";
|
|
552
|
+
readonly object: "object";
|
|
553
|
+
};
|
|
552
554
|
};
|
|
553
555
|
readonly assumePrimitive: true;
|
|
554
556
|
}, {
|
|
555
557
|
readonly type: "function";
|
|
556
|
-
readonly names: ["
|
|
558
|
+
readonly names: ["NextMethod"];
|
|
557
559
|
readonly processor: BuiltInProcName.S3Dispatch;
|
|
558
560
|
readonly config: {
|
|
559
561
|
readonly args: {
|
|
560
562
|
readonly generic: "generic";
|
|
561
563
|
readonly object: "object";
|
|
562
564
|
};
|
|
565
|
+
readonly inferFromClosure: true;
|
|
566
|
+
};
|
|
567
|
+
readonly assumePrimitive: true;
|
|
568
|
+
}, {
|
|
569
|
+
readonly type: "function";
|
|
570
|
+
readonly names: ["new_generic"];
|
|
571
|
+
readonly processor: BuiltInProcName.S7NewGeneric;
|
|
572
|
+
readonly config: {
|
|
573
|
+
readonly args: {
|
|
574
|
+
readonly name: "name";
|
|
575
|
+
readonly dispatchArg: "dispatch_args";
|
|
576
|
+
readonly fun: "fun";
|
|
577
|
+
};
|
|
578
|
+
};
|
|
579
|
+
readonly assumePrimitive: true;
|
|
580
|
+
}, {
|
|
581
|
+
readonly type: "function";
|
|
582
|
+
readonly names: ["setGeneric"];
|
|
583
|
+
readonly processor: BuiltInProcName.S7NewGeneric;
|
|
584
|
+
readonly config: {
|
|
585
|
+
readonly args: {
|
|
586
|
+
readonly name: "name";
|
|
587
|
+
readonly dispatchArg: undefined;
|
|
588
|
+
readonly fun: "fun";
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
readonly assumePrimitive: true;
|
|
592
|
+
}, {
|
|
593
|
+
readonly type: "function";
|
|
594
|
+
readonly names: ["S7_dispatch"];
|
|
595
|
+
readonly processor: BuiltInProcName.S7Dispatch;
|
|
596
|
+
readonly config: {
|
|
597
|
+
readonly libFn: true;
|
|
563
598
|
};
|
|
564
599
|
readonly assumePrimitive: true;
|
|
565
600
|
}, {
|
|
@@ -672,6 +707,14 @@ export declare const DefaultBuiltinConfig: [{
|
|
|
672
707
|
readonly config: {
|
|
673
708
|
readonly readIndices: true;
|
|
674
709
|
};
|
|
710
|
+
}, {
|
|
711
|
+
readonly type: "replacement";
|
|
712
|
+
readonly suffixes: ["<-", "<<-"];
|
|
713
|
+
readonly names: ["method"];
|
|
714
|
+
readonly config: {
|
|
715
|
+
readonly readIndices: true;
|
|
716
|
+
readonly constructName: "s7";
|
|
717
|
+
};
|
|
675
718
|
}, {
|
|
676
719
|
readonly type: "replacement";
|
|
677
720
|
readonly suffixes: ["<-", "<<-"];
|
|
@@ -257,8 +257,8 @@ exports.DefaultBuiltinConfig = [
|
|
|
257
257
|
{ type: 'function', names: [identifier_1.Identifier.make('library', 'base'), identifier_1.Identifier.make('require', 'base')], processor: built_in_1.BuiltInProcName.Library, config: {}, assumePrimitive: false },
|
|
258
258
|
{ type: 'function', names: ['<-', '='], processor: built_in_1.BuiltInProcName.Assignment, config: { canBeReplacement: true }, assumePrimitive: true },
|
|
259
259
|
{ type: 'function', names: [':='], processor: built_in_1.BuiltInProcName.Assignment, config: {}, assumePrimitive: true },
|
|
260
|
-
{ type: 'function', names: ['assign', '
|
|
261
|
-
{ type: 'function', names: ['setMethod'], processor: built_in_1.BuiltInProcName.AssignmentLike, config: { targetVariable: true, canBeReplacement: false, target: { idx: 0, name: 'f' }, source: { idx: 2, name: 'definition' } }, assumePrimitive: true },
|
|
260
|
+
{ type: 'function', names: ['assign', 'setValidity'], processor: built_in_1.BuiltInProcName.Assignment, config: { targetVariable: true, mayHaveMoreArgs: true }, assumePrimitive: true },
|
|
261
|
+
{ type: 'function', names: ['setMethod'], processor: built_in_1.BuiltInProcName.AssignmentLike, config: { targetVariable: true, canBeReplacement: false, target: { idx: 0, name: 'f' }, source: { idx: 2, name: 'definition' }, modesForFn: ['s4'] }, assumePrimitive: true },
|
|
262
262
|
{ type: 'function', names: ['delayedAssign'], processor: built_in_1.BuiltInProcName.Assignment, config: { quoteSource: true, targetVariable: true }, assumePrimitive: true },
|
|
263
263
|
{ type: 'function', names: ['<<-'], processor: built_in_1.BuiltInProcName.Assignment, config: { superAssignment: true, canBeReplacement: true }, assumePrimitive: true },
|
|
264
264
|
{ type: 'function', names: ['->'], processor: built_in_1.BuiltInProcName.Assignment, config: { swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
|
|
@@ -273,8 +273,11 @@ exports.DefaultBuiltinConfig = [
|
|
|
273
273
|
{ type: 'function', names: ['repeat'], processor: built_in_1.BuiltInProcName.RepeatLoop, config: {}, assumePrimitive: true },
|
|
274
274
|
{ type: 'function', names: ['while'], processor: built_in_1.BuiltInProcName.WhileLoop, config: {}, assumePrimitive: true },
|
|
275
275
|
{ type: 'function', names: ['do.call'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, unquoteFunction: true }, assumePrimitive: true },
|
|
276
|
-
{ type: 'function', names: ['NextMethod'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, unquoteFunction: true, resolveInEnvironment: 'global' }, assumePrimitive: true },
|
|
277
276
|
{ type: 'function', names: ['UseMethod'], processor: built_in_1.BuiltInProcName.S3Dispatch, config: { args: { generic: 'generic', object: 'object' } }, assumePrimitive: true },
|
|
277
|
+
{ type: 'function', names: ['NextMethod'], processor: built_in_1.BuiltInProcName.S3Dispatch, config: { args: { generic: 'generic', object: 'object' }, inferFromClosure: true }, assumePrimitive: true },
|
|
278
|
+
{ type: 'function', names: ['new_generic'], processor: built_in_1.BuiltInProcName.S7NewGeneric, config: { args: { name: 'name', dispatchArg: 'dispatch_args', fun: 'fun' } }, assumePrimitive: true },
|
|
279
|
+
{ type: 'function', names: ['setGeneric'], processor: built_in_1.BuiltInProcName.S7NewGeneric, config: { args: { name: 'name', dispatchArg: undefined, fun: 'fun' } }, assumePrimitive: true },
|
|
280
|
+
{ type: 'function', names: ['S7_dispatch'], processor: built_in_1.BuiltInProcName.S7Dispatch, config: { libFn: true }, assumePrimitive: true },
|
|
278
281
|
{ type: 'function', names: ['.Primitive', '.Internal'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, unquoteFunction: true, resolveInEnvironment: 'global' }, assumePrimitive: true },
|
|
279
282
|
{ type: 'function', names: ['interference'], processor: built_in_1.BuiltInProcName.Apply, config: { unquoteFunction: true, nameOfFunctionArgument: 'propensity_integrand', libFn: true }, assumePrimitive: false },
|
|
280
283
|
{ type: 'function', names: ['ddply'], processor: built_in_1.BuiltInProcName.Apply, config: { unquoteFunction: true, indexOfFunction: 2, nameOfFunctionArgument: '.fun', libFn: true }, assumePrimitive: false },
|
|
@@ -341,6 +344,15 @@ exports.DefaultBuiltinConfig = [
|
|
|
341
344
|
readIndices: true
|
|
342
345
|
}
|
|
343
346
|
},
|
|
347
|
+
{
|
|
348
|
+
type: 'replacement',
|
|
349
|
+
suffixes: ['<-', '<<-'],
|
|
350
|
+
names: ['method'],
|
|
351
|
+
config: {
|
|
352
|
+
readIndices: true,
|
|
353
|
+
constructName: 's7'
|
|
354
|
+
}
|
|
355
|
+
},
|
|
344
356
|
{
|
|
345
357
|
type: 'replacement',
|
|
346
358
|
suffixes: ['<-', '<<-'],
|
|
@@ -40,7 +40,7 @@ export declare const Identifier: {
|
|
|
40
40
|
readonly make: (this: void, name: BrandedIdentifier, namespace?: BrandedNamespace, internal?: boolean) => Identifier;
|
|
41
41
|
/**
|
|
42
42
|
* Parse an identifier from its string representation,
|
|
43
|
-
* Please note, that in R if one writes `"pkg::a"` this refers to a symbol named `
|
|
43
|
+
* Please note, that in R if one writes `"pkg::a"` this refers to a symbol named `pkg::a` and NOT to the namespaced identifier `a` in package `pkg`.
|
|
44
44
|
* In this scenario, see {@link Identifier.make} instead.
|
|
45
45
|
*/
|
|
46
46
|
readonly parse: (this: void, str: string) => Identifier;
|
|
@@ -125,7 +125,9 @@ export declare enum ReferenceType {
|
|
|
125
125
|
/** The identifier is defined by a built-in function */
|
|
126
126
|
BuiltInFunction = 128,
|
|
127
127
|
/** Prefix to identify S3 methods, use this, to for example dispatch a call to `f` which will then link to `f.*` */
|
|
128
|
-
S3MethodPrefix = 256
|
|
128
|
+
S3MethodPrefix = 256,
|
|
129
|
+
/** Prefix to identify S7 methods, use this, to for example dispatch a call to `f` which will then link to `f<7>*` */
|
|
130
|
+
S7MethodPrefix = 512
|
|
129
131
|
}
|
|
130
132
|
/** Reverse mapping of the reference types so you can get the name from the bitmask (useful for debugging) */
|
|
131
133
|
export declare const ReferenceTypeReverseMapping: Map<ReferenceType, string>;
|
|
@@ -34,7 +34,7 @@ exports.Identifier = {
|
|
|
34
34
|
},
|
|
35
35
|
/**
|
|
36
36
|
* Parse an identifier from its string representation,
|
|
37
|
-
* Please note, that in R if one writes `"pkg::a"` this refers to a symbol named `
|
|
37
|
+
* Please note, that in R if one writes `"pkg::a"` this refers to a symbol named `pkg::a` and NOT to the namespaced identifier `a` in package `pkg`.
|
|
38
38
|
* In this scenario, see {@link Identifier.make} instead.
|
|
39
39
|
*/
|
|
40
40
|
parse(str) {
|
|
@@ -192,6 +192,8 @@ var ReferenceType;
|
|
|
192
192
|
ReferenceType[ReferenceType["BuiltInFunction"] = 128] = "BuiltInFunction";
|
|
193
193
|
/** Prefix to identify S3 methods, use this, to for example dispatch a call to `f` which will then link to `f.*` */
|
|
194
194
|
ReferenceType[ReferenceType["S3MethodPrefix"] = 256] = "S3MethodPrefix";
|
|
195
|
+
/** Prefix to identify S7 methods, use this, to for example dispatch a call to `f` which will then link to `f<7>*` */
|
|
196
|
+
ReferenceType[ReferenceType["S7MethodPrefix"] = 512] = "S7MethodPrefix";
|
|
195
197
|
})(ReferenceType || (exports.ReferenceType = ReferenceType = {}));
|
|
196
198
|
/** Reverse mapping of the reference types so you can get the name from the bitmask (useful for debugging) */
|
|
197
199
|
exports.ReferenceTypeReverseMapping = new Map(Object.entries(ReferenceType).map(([k, v]) => [v, k]));
|
|
@@ -6,6 +6,7 @@ exports.resolvesToBuiltInConstant = resolvesToBuiltInConstant;
|
|
|
6
6
|
const logic_1 = require("../../util/logic");
|
|
7
7
|
const identifier_1 = require("./identifier");
|
|
8
8
|
const info_1 = require("../info");
|
|
9
|
+
const built_in_s_seven_dispatch_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-dispatch");
|
|
9
10
|
const FunctionTargetTypes = identifier_1.ReferenceType.Function | identifier_1.ReferenceType.BuiltInFunction | identifier_1.ReferenceType.Unknown | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Parameter;
|
|
10
11
|
const VariableTargetTypes = identifier_1.ReferenceType.Variable | identifier_1.ReferenceType.Parameter | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Unknown;
|
|
11
12
|
const ConstantTargetTypes = identifier_1.ReferenceType.Constant | identifier_1.ReferenceType.BuiltInConstant | identifier_1.ReferenceType.Unknown;
|
|
@@ -21,6 +22,7 @@ const TargetTypePredicate = {
|
|
|
21
22
|
[identifier_1.ReferenceType.BuiltInConstant]: ({ type }) => (0, identifier_1.isReferenceType)(type, BuiltInConstantTargetTypes),
|
|
22
23
|
[identifier_1.ReferenceType.BuiltInFunction]: ({ type }) => (0, identifier_1.isReferenceType)(type, BuiltInFunctionTargetTypes),
|
|
23
24
|
[identifier_1.ReferenceType.S3MethodPrefix]: ({ type }) => (0, identifier_1.isReferenceType)(type, FunctionTargetTypes),
|
|
25
|
+
[identifier_1.ReferenceType.S7MethodPrefix]: ({ type }) => (0, identifier_1.isReferenceType)(type, FunctionTargetTypes),
|
|
24
26
|
};
|
|
25
27
|
/**
|
|
26
28
|
* Resolves a given identifier name to a list of its possible definition location using R scoping and resolving rules.
|
|
@@ -45,10 +47,11 @@ function resolveByName(id, environment, target) {
|
|
|
45
47
|
continue;
|
|
46
48
|
}
|
|
47
49
|
let definition;
|
|
48
|
-
if (target === identifier_1.ReferenceType.S3MethodPrefix) {
|
|
50
|
+
if (target === identifier_1.ReferenceType.S3MethodPrefix || target === identifier_1.ReferenceType.S7MethodPrefix) {
|
|
49
51
|
// S3 method prefixes only resolve to functions, S3s must not match the exported criteria!
|
|
52
|
+
const infix = target === identifier_1.ReferenceType.S3MethodPrefix ? '.' : built_in_s_seven_dispatch_1.S7DispatchSeparator;
|
|
50
53
|
definition = current.memory.entries()
|
|
51
|
-
.filter(([defName]) => defName.startsWith(name +
|
|
54
|
+
.filter(([defName]) => defName.startsWith(name + infix))
|
|
52
55
|
.flatMap(([, defs]) => defs)
|
|
53
56
|
.toArray();
|
|
54
57
|
}
|
|
@@ -87,6 +87,10 @@ function getAliases(sourceIds, dataflow, environment) {
|
|
|
87
87
|
if (info === undefined) {
|
|
88
88
|
return undefined;
|
|
89
89
|
}
|
|
90
|
+
else if (info.tag === vertex_1.VertexType.FunctionDefinition) {
|
|
91
|
+
definitions.add(sourceId);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
90
94
|
const defs = AliasHandler[info.tag](sourceId, dataflow, environment);
|
|
91
95
|
for (const def of defs ?? []) {
|
|
92
96
|
definitions.add(def);
|
|
@@ -351,7 +355,10 @@ function resolveToConstants(name, environment) {
|
|
|
351
355
|
return r_value_1.Top;
|
|
352
356
|
}
|
|
353
357
|
const values = new Set();
|
|
354
|
-
definitions.forEach(def =>
|
|
358
|
+
definitions.forEach(def => {
|
|
359
|
+
const d = def.value;
|
|
360
|
+
values.add(d === undefined ? r_value_1.Top : (0, general_1.valueFromTsValue)(d));
|
|
361
|
+
});
|
|
355
362
|
return (0, set_constants_1.setFrom)(...values);
|
|
356
363
|
}
|
|
357
364
|
//# sourceMappingURL=alias-tracking.js.map
|
|
@@ -26,7 +26,7 @@ function getArgumentStringValue(variableResolve, graph, vertex, argumentIndex, a
|
|
|
26
26
|
}
|
|
27
27
|
if (argumentIndex === 'unnamed') {
|
|
28
28
|
// return all unnamed arguments
|
|
29
|
-
const references = vertex.args.filter(arg => arg !== r_function_call_1.EmptyArgument && !arg.name).map(graph_1.
|
|
29
|
+
const references = vertex.args.filter(arg => arg !== r_function_call_1.EmptyArgument && !arg.name).map(graph_1.FunctionArgument.getReference).filter(assert_1.isNotUndefined);
|
|
30
30
|
const map = new Map();
|
|
31
31
|
for (const ref of references) {
|
|
32
32
|
let valueNode = graph.idMap?.get(ref);
|
|
@@ -42,7 +42,7 @@ function getArgumentStringValue(variableResolve, graph, vertex, argumentIndex, a
|
|
|
42
42
|
return map;
|
|
43
43
|
}
|
|
44
44
|
if (argumentIndex < vertex.args.length) {
|
|
45
|
-
const arg =
|
|
45
|
+
const arg = graph_1.FunctionArgument.getReference(vertex.args[argumentIndex]);
|
|
46
46
|
if (!arg) {
|
|
47
47
|
return undefined;
|
|
48
48
|
}
|
|
@@ -37,6 +37,9 @@ export interface ValueString<Str extends Lift<RStringValue> = Lift<RStringValue>
|
|
|
37
37
|
type: 'string';
|
|
38
38
|
value: Str;
|
|
39
39
|
}
|
|
40
|
+
export interface ValueNull {
|
|
41
|
+
type: 'null';
|
|
42
|
+
}
|
|
40
43
|
export interface ValueFunctionDefinition {
|
|
41
44
|
type: 'function-definition';
|
|
42
45
|
}
|
|
@@ -48,7 +51,7 @@ export interface ValueLogical {
|
|
|
48
51
|
type: 'logical';
|
|
49
52
|
value: Lift<TernaryLogical>;
|
|
50
53
|
}
|
|
51
|
-
export type Value = Lift<ValueInterval | ValueVector | ValueSet | ValueNumber | ValueString | ValueLogical | ValueMissing | ValueFunctionDefinition>;
|
|
54
|
+
export type Value = Lift<ValueInterval | ValueVector | ValueSet | ValueNumber | ValueString | ValueLogical | ValueMissing | ValueFunctionDefinition | ValueNull>;
|
|
52
55
|
export type ValueType<V> = V extends {
|
|
53
56
|
type: infer T;
|
|
54
57
|
} ? T : never;
|