@eagleoutice/flowr 2.9.0 → 2.9.1
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 +22 -22
- 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 +49 -7
- package/dataflow/environments/default-builtin-config.js +14 -2
- 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/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/internal/linker.js +10 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +26 -4
- 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 +20 -1
- 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 +204 -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/linter/rules/naming-convention.d.ts +9 -2
- package/linter/rules/naming-convention.js +38 -36
- 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/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 +20 -20
- 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 +3 -3
- package/util/r-value.d.ts +3 -2
- package/util/r-value.js +3 -0
- package/util/version.js +1 -1
|
@@ -75,7 +75,7 @@ function convertTreeNode(node) {
|
|
|
75
75
|
grouping: undefined,
|
|
76
76
|
info: {
|
|
77
77
|
fullRange: (0, range_1.invalidRange)(),
|
|
78
|
-
|
|
78
|
+
adToks: [],
|
|
79
79
|
treeSitterId: -1,
|
|
80
80
|
}
|
|
81
81
|
};
|
|
@@ -87,7 +87,7 @@ function convertTreeNode(node) {
|
|
|
87
87
|
const defaultInfo = {
|
|
88
88
|
info: {
|
|
89
89
|
fullRange: range,
|
|
90
|
-
|
|
90
|
+
adToks: [],
|
|
91
91
|
fullLexeme: node.text,
|
|
92
92
|
treeSitterId: node.id
|
|
93
93
|
}
|
|
@@ -103,7 +103,7 @@ function convertTreeNode(node) {
|
|
|
103
103
|
grouping: undefined,
|
|
104
104
|
lexeme: undefined,
|
|
105
105
|
info: {
|
|
106
|
-
|
|
106
|
+
adToks: remainingComments.map(c => c[1]),
|
|
107
107
|
treeSitterId: node.id
|
|
108
108
|
}
|
|
109
109
|
};
|
|
@@ -136,7 +136,7 @@ function convertTreeNode(node) {
|
|
|
136
136
|
}
|
|
137
137
|
],
|
|
138
138
|
info: {
|
|
139
|
-
|
|
139
|
+
adToks: remainingComments.map(c => c[1]),
|
|
140
140
|
treeSitterId: node.id
|
|
141
141
|
}
|
|
142
142
|
};
|
|
@@ -185,7 +185,7 @@ function convertTreeNode(node) {
|
|
|
185
185
|
named: true,
|
|
186
186
|
infixSpecial: true,
|
|
187
187
|
info: {
|
|
188
|
-
|
|
188
|
+
adToks: comments,
|
|
189
189
|
treeSitterId: node.id
|
|
190
190
|
}
|
|
191
191
|
};
|
|
@@ -200,7 +200,7 @@ function convertTreeNode(node) {
|
|
|
200
200
|
...defaultInfo,
|
|
201
201
|
info: {
|
|
202
202
|
fullRange: range,
|
|
203
|
-
|
|
203
|
+
adToks: comments,
|
|
204
204
|
fullLexeme: node.text,
|
|
205
205
|
treeSitterId: node.id
|
|
206
206
|
}
|
|
@@ -215,7 +215,7 @@ function convertTreeNode(node) {
|
|
|
215
215
|
lexeme: op.text,
|
|
216
216
|
info: {
|
|
217
217
|
fullRange: range,
|
|
218
|
-
|
|
218
|
+
adToks: comments,
|
|
219
219
|
fullLexeme: node.text,
|
|
220
220
|
treeSitterId: node.id
|
|
221
221
|
}
|
|
@@ -288,7 +288,7 @@ function convertTreeNode(node) {
|
|
|
288
288
|
lexeme: variableNode.text,
|
|
289
289
|
info: {
|
|
290
290
|
fullRange: undefined,
|
|
291
|
-
|
|
291
|
+
adToks: [],
|
|
292
292
|
fullLexeme: undefined,
|
|
293
293
|
treeSitterId: variableNode.id
|
|
294
294
|
}
|
|
@@ -299,7 +299,7 @@ function convertTreeNode(node) {
|
|
|
299
299
|
lexeme: forNode.text,
|
|
300
300
|
info: {
|
|
301
301
|
fullRange: range,
|
|
302
|
-
|
|
302
|
+
adToks: variableComments.concat(sequenceComments).map(c => c[1]),
|
|
303
303
|
fullLexeme: node.text,
|
|
304
304
|
treeSitterId: node.id
|
|
305
305
|
}
|
|
@@ -347,7 +347,7 @@ function convertTreeNode(node) {
|
|
|
347
347
|
...defaultInfo,
|
|
348
348
|
info: {
|
|
349
349
|
...defaultInfo.info,
|
|
350
|
-
|
|
350
|
+
adToks: comments.map(c => c[1]),
|
|
351
351
|
}
|
|
352
352
|
};
|
|
353
353
|
if (func.type === tree_sitter_types_1.TreeSitterType.Identifier || func.type === tree_sitter_types_1.TreeSitterType.String || func.type === tree_sitter_types_1.TreeSitterType.NamespaceOperator || func.type === tree_sitter_types_1.TreeSitterType.Return) {
|
|
@@ -366,7 +366,7 @@ function convertTreeNode(node) {
|
|
|
366
366
|
...funcNode,
|
|
367
367
|
info: {
|
|
368
368
|
fullRange: range,
|
|
369
|
-
|
|
369
|
+
adToks: [],
|
|
370
370
|
fullLexeme: node.text,
|
|
371
371
|
treeSitterId: node.id
|
|
372
372
|
}
|
|
@@ -395,7 +395,7 @@ function convertTreeNode(node) {
|
|
|
395
395
|
lexeme: name.text,
|
|
396
396
|
info: {
|
|
397
397
|
...defaultInfo.info,
|
|
398
|
-
|
|
398
|
+
adToks: comments.map(c => c[1]),
|
|
399
399
|
}
|
|
400
400
|
};
|
|
401
401
|
}
|
|
@@ -471,7 +471,7 @@ function convertTreeNode(node) {
|
|
|
471
471
|
lexeme: rhs?.text,
|
|
472
472
|
info: {
|
|
473
473
|
fullRange: rhsRange,
|
|
474
|
-
|
|
474
|
+
adToks: [],
|
|
475
475
|
fullLexeme: rhs?.text,
|
|
476
476
|
treeSitterId: rhs?.id
|
|
477
477
|
}
|
|
@@ -498,7 +498,7 @@ function convertTreeNode(node) {
|
|
|
498
498
|
lexeme: name.text,
|
|
499
499
|
info: {
|
|
500
500
|
fullRange: range,
|
|
501
|
-
|
|
501
|
+
adToks: [],
|
|
502
502
|
fullLexeme: name.text,
|
|
503
503
|
treeSitterId: name.id
|
|
504
504
|
}
|
|
@@ -509,7 +509,7 @@ function convertTreeNode(node) {
|
|
|
509
509
|
lexeme: name.text,
|
|
510
510
|
info: {
|
|
511
511
|
fullRange: range,
|
|
512
|
-
|
|
512
|
+
adToks: [],
|
|
513
513
|
fullLexeme: name.text,
|
|
514
514
|
treeSitterId: name.id
|
|
515
515
|
}
|
|
@@ -551,7 +551,7 @@ function convertTreeNode(node) {
|
|
|
551
551
|
lexeme: nameNode.text,
|
|
552
552
|
info: {
|
|
553
553
|
fullRange: nameRange,
|
|
554
|
-
|
|
554
|
+
adToks: [],
|
|
555
555
|
fullLexeme: nameNode.text,
|
|
556
556
|
treeSitterId: nameNode.id
|
|
557
557
|
}
|
|
@@ -587,7 +587,7 @@ function convertTreeNode(node) {
|
|
|
587
587
|
grouping: undefined,
|
|
588
588
|
info: {
|
|
589
589
|
fullRange: (0, range_1.invalidRange)(),
|
|
590
|
-
|
|
590
|
+
adToks: [],
|
|
591
591
|
treeSitterId: -1,
|
|
592
592
|
}
|
|
593
593
|
};
|
|
@@ -622,7 +622,7 @@ function splitComments(nodes) {
|
|
|
622
622
|
location: makeSourceRange(node),
|
|
623
623
|
lexeme: node.text,
|
|
624
624
|
info: {
|
|
625
|
-
|
|
625
|
+
adToks: [],
|
|
626
626
|
fullLexeme: node.text,
|
|
627
627
|
treeSitterId: node.id
|
|
628
628
|
}
|
|
@@ -651,8 +651,8 @@ function linkCommentsToNextNodes(nodes, comments) {
|
|
|
651
651
|
// if there is no valid sibling, we just link the comment to the first node (see normalize-expressions.ts)
|
|
652
652
|
const [, node] = (sibling ? nodes.find(([s]) => s.equals(sibling)) : undefined) ?? nodes[0] ?? [];
|
|
653
653
|
if (node) {
|
|
654
|
-
node.info.
|
|
655
|
-
node.info.
|
|
654
|
+
node.info.adToks ??= [];
|
|
655
|
+
node.info.adToks.push(commentNode);
|
|
656
656
|
}
|
|
657
657
|
else {
|
|
658
658
|
remain.push([commentSyntaxNode, commentNode]);
|
|
@@ -35,7 +35,7 @@ function parseRoxygenCommentsOfNode(node, idMap) {
|
|
|
35
35
|
let comments;
|
|
36
36
|
let cur = node;
|
|
37
37
|
do {
|
|
38
|
-
comments = cur?.info.
|
|
38
|
+
comments = cur?.info.adToks
|
|
39
39
|
?.filter(r_comment_1.isRComment).filter(r => (0, assert_1.isNotUndefined)(r.lexeme));
|
|
40
40
|
cur = cur?.info.parent ? idMap?.get(cur.info.parent) : undefined;
|
|
41
41
|
} while ((comments === undefined || comments.length === 0) && cur !== undefined);
|
|
@@ -53,7 +53,7 @@ function makeMagicCommentHandler(and) {
|
|
|
53
53
|
lines = new Set();
|
|
54
54
|
const startLineStack = [];
|
|
55
55
|
(0, visitor_1.visitAst)(normalizedAst.ast.files.map(f => f.root), n => {
|
|
56
|
-
const comments = n.info.
|
|
56
|
+
const comments = n.info.adToks;
|
|
57
57
|
if (!comments) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
@@ -10,7 +10,7 @@ import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-a
|
|
|
10
10
|
/**
|
|
11
11
|
* Returns the function call targets (definitions) by the given caller
|
|
12
12
|
*/
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function getAllFunctionCallTargetsForSlice(dataflowGraph: DataflowGraph, callerInfo: DataflowGraphVertexFunctionCall, baseEnvironment: REnvironmentInformation, queue: VisitingQueue, ctx: ReadOnlyFlowrAnalyzerContext): [Set<DataflowGraphVertexInfo>, REnvironmentInformation];
|
|
14
14
|
/** returns the new threshold hit count */
|
|
15
15
|
export declare function sliceForCall(current: NodeToSlice, callerInfo: DataflowGraphVertexFunctionCall, { graph }: DataflowInformation, queue: VisitingQueue, ctx: ReadOnlyFlowrAnalyzerContext): void;
|
|
16
16
|
/** Returns true if we found at least one return edge */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAllFunctionCallTargetsForSlice = getAllFunctionCallTargetsForSlice;
|
|
4
4
|
exports.sliceForCall = sliceForCall;
|
|
5
5
|
exports.handleReturns = handleReturns;
|
|
6
6
|
const assert_1 = require("../../util/assert");
|
|
@@ -16,7 +16,7 @@ const static_slicer_1 = require("./static-slicer");
|
|
|
16
16
|
/**
|
|
17
17
|
* Returns the function call targets (definitions) by the given caller
|
|
18
18
|
*/
|
|
19
|
-
function
|
|
19
|
+
function getAllFunctionCallTargetsForSlice(dataflowGraph, callerInfo, baseEnvironment, queue, ctx) {
|
|
20
20
|
// bind with call-local environments during slicing
|
|
21
21
|
const outgoingEdges = dataflowGraph.get(callerInfo.id, true);
|
|
22
22
|
(0, assert_1.guard)(outgoingEdges !== undefined, () => `outgoing edges of id: ${callerInfo.id} must be in graph but can not be found, keep in slice to be sure`);
|
|
@@ -60,7 +60,7 @@ function linkCallTargets(onlyForSideEffects, functionCallTargets, activeEnvironm
|
|
|
60
60
|
}
|
|
61
61
|
/** returns the new threshold hit count */
|
|
62
62
|
function sliceForCall(current, callerInfo, { graph }, queue, ctx) {
|
|
63
|
-
const [functionCallTargets, activeEnvironment] =
|
|
63
|
+
const [functionCallTargets, activeEnvironment] = getAllFunctionCallTargetsForSlice(graph, callerInfo, current.baseEnvironment, queue, ctx);
|
|
64
64
|
if (functionCallTargets.size === 0) {
|
|
65
65
|
/*
|
|
66
66
|
* if we do not have any call to resolve this function, we have to assume that every function passed is actually called!
|
package/util/r-value.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Value, type ValueInterval, type ValueLogical, type ValueNumber, type ValueString, type ValueVector } from '../dataflow/eval/values/r-value';
|
|
1
|
+
import { type ValueNull, type Value, type ValueInterval, type ValueLogical, type ValueNumber, type ValueString, type ValueVector } from '../dataflow/eval/values/r-value';
|
|
2
2
|
import type { RLogicalValue } from '../r-bridge/lang-4.x/ast/model/nodes/r-logical';
|
|
3
3
|
import { type RNumberValue, type RStringValue } from '../r-bridge/lang-4.x/convert-values';
|
|
4
4
|
/**
|
|
@@ -25,8 +25,9 @@ export declare function unwrapRVector(value: RStringValue[] | RNumberValue[] | R
|
|
|
25
25
|
export declare function unwrapRVector(value: unknown): string[] | number[] | boolean[] | (string | number | boolean)[] | undefined;
|
|
26
26
|
export declare function unwrapRValueToString(value: RStringValue | RNumberValue | RLogicalValue | string | number): string;
|
|
27
27
|
export declare function unwrapRValueToString(value: unknown): string | undefined;
|
|
28
|
+
export declare function unliftRValue(value: ValueNull): null;
|
|
28
29
|
export declare function unliftRValue(value: ValueString): RStringValue | undefined;
|
|
29
30
|
export declare function unliftRValue(value: ValueNumber | ValueInterval): RNumberValue | undefined;
|
|
30
31
|
export declare function unliftRValue(value: ValueLogical): RLogicalValue | undefined;
|
|
31
32
|
export declare function unliftRValue(value: ValueVector): (RStringValue | RNumberValue | RLogicalValue)[] | undefined;
|
|
32
|
-
export declare function unliftRValue(value: Value): RStringValue | RNumberValue | 'fn-def' | boolean | ('fn-def' | RStringValue | RNumberValue | RLogicalValue)[] | undefined;
|
|
33
|
+
export declare function unliftRValue(value: Value): RStringValue | RNumberValue | 'fn-def' | boolean | ('fn-def' | RStringValue | RNumberValue | RLogicalValue | null)[] | null | undefined;
|
package/util/r-value.js
CHANGED
package/util/version.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
|
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
7
|
const assert_1 = require("./assert");
|
|
8
8
|
// this is automatically replaced with the current version by release-it
|
|
9
|
-
const version = '2.9.
|
|
9
|
+
const version = '2.9.1';
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
12
12
|
*/
|