@eagleoutice/flowr 2.2.10 → 2.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/benchmark/slicer.d.ts +49 -22
- package/benchmark/slicer.js +88 -28
- package/benchmark/stats/print.js +16 -10
- package/benchmark/stats/size-of.js +18 -1
- package/benchmark/stats/stats.d.ts +3 -0
- package/benchmark/summarizer/second-phase/process.js +8 -2
- package/cli/benchmark-app.d.ts +5 -0
- package/cli/benchmark-app.js +49 -6
- package/cli/benchmark-helper-app.d.ts +4 -0
- package/cli/benchmark-helper-app.js +20 -4
- package/cli/common/options.js +13 -4
- package/cli/repl/commands/repl-commands.js +2 -0
- package/cli/repl/commands/repl-dataflow.d.ts +2 -0
- package/cli/repl/commands/repl-dataflow.js +35 -1
- package/cli/repl/server/compact.d.ts +2 -2
- package/cli/repl/server/compact.js +3 -3
- package/cli/repl/server/messages/message-analysis.d.ts +2 -2
- package/cli/repl/server/messages/message-analysis.js +2 -2
- package/config.d.ts +27 -2
- package/config.js +30 -4
- package/dataflow/environments/built-in-config.d.ts +5 -2
- package/dataflow/environments/built-in-config.js +8 -2
- package/dataflow/environments/built-in.d.ts +8 -1
- package/dataflow/environments/built-in.js +8 -1
- package/dataflow/environments/clone.d.ts +5 -0
- package/dataflow/environments/clone.js +5 -0
- package/dataflow/environments/default-builtin-config.js +96 -10
- package/dataflow/environments/define.d.ts +5 -1
- package/dataflow/environments/define.js +36 -10
- package/dataflow/environments/environment.js +4 -2
- package/dataflow/environments/overwrite.js +4 -0
- package/dataflow/environments/remove.d.ts +6 -0
- package/dataflow/environments/remove.js +24 -0
- package/dataflow/environments/resolve-by-name.js +1 -1
- package/dataflow/extractor.d.ts +1 -1
- package/dataflow/extractor.js +8 -6
- package/dataflow/graph/dataflowgraph-builder.d.ts +76 -6
- package/dataflow/graph/dataflowgraph-builder.js +102 -6
- package/dataflow/graph/edge.js +4 -1
- package/dataflow/graph/graph.d.ts +12 -1
- package/dataflow/graph/graph.js +37 -0
- package/dataflow/graph/vertex.d.ts +42 -2
- package/dataflow/graph/vertex.js +32 -0
- package/dataflow/internal/linker.js +3 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +3 -0
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +4 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +55 -45
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +27 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +37 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +10 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +140 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +51 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +21 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +3 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +83 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +20 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +15 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +75 -0
- package/dataflow/internal/process/functions/call/common.d.ts +1 -1
- package/dataflow/internal/process/functions/call/common.js +4 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +9 -5
- package/dataflow/internal/process/process-named-call.d.ts +3 -0
- package/dataflow/internal/process/process-named-call.js +3 -0
- package/dataflow/processor.d.ts +7 -7
- package/documentation/data/server/doc-data-server-messages.js +2 -2
- package/documentation/doc-util/doc-cfg.d.ts +11 -2
- package/documentation/doc-util/doc-cfg.js +35 -6
- package/documentation/doc-util/doc-code.js +10 -2
- package/documentation/print-capabilities-markdown.js +1 -1
- package/documentation/print-cfg-wiki.d.ts +1 -0
- package/documentation/print-cfg-wiki.js +84 -0
- package/documentation/print-core-wiki.js +2 -2
- package/documentation/print-interface-wiki.js +4 -0
- package/documentation/print-query-wiki.js +22 -3
- package/package.json +4 -3
- package/queries/catalog/call-context-query/call-context-query-executor.js +13 -0
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -0
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +13 -5
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -25
- package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -145
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +24 -0
- package/queries/catalog/dependencies-query/function-info/function-info.js +10 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.js +18 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +101 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.js +11 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +87 -0
- package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.js +38 -3
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +10 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +5 -1
- package/queries/catalog/project-query/project-query-executor.d.ts +3 -0
- package/queries/catalog/project-query/project-query-executor.js +17 -0
- package/queries/catalog/project-query/project-query-format.d.ts +67 -0
- package/queries/catalog/project-query/project-query-format.js +26 -0
- package/queries/query.d.ts +60 -1
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/slicing/static/fingerprint.js +8 -1
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +5 -16
- package/slicing/static/slicer-types.d.ts +2 -0
- package/slicing/static/static-slicer.d.ts +4 -2
- package/slicing/static/static-slicer.js +24 -18
- package/slicing/static/visiting-queue.d.ts +7 -1
- package/slicing/static/visiting-queue.js +20 -6
- package/util/arrays.d.ts +23 -0
- package/util/arrays.js +41 -0
- package/util/cfg/visitor.d.ts +1 -1
- package/util/cfg/visitor.js +2 -2
- package/util/{list-access.d.ts → containers.d.ts} +24 -4
- package/util/{list-access.js → containers.js} +42 -12
- package/util/mermaid/ast.js +12 -1
- package/util/mermaid/cfg.js +2 -2
- package/util/parallel.d.ts +2 -1
- package/util/parallel.js +11 -2
- package/util/prefix.d.ts +13 -0
- package/util/prefix.js +34 -0
- package/util/version.js +1 -1
package/util/arrays.js
CHANGED
|
@@ -8,6 +8,8 @@ exports.getUniqueCombinationsOfSize = getUniqueCombinationsOfSize;
|
|
|
8
8
|
exports.arraySum = arraySum;
|
|
9
9
|
exports.array2bag = array2bag;
|
|
10
10
|
exports.arrayEqual = arrayEqual;
|
|
11
|
+
exports.equidistantSampling = equidistantSampling;
|
|
12
|
+
exports.cartesianProduct = cartesianProduct;
|
|
11
13
|
const assert_1 = require("./assert");
|
|
12
14
|
/**
|
|
13
15
|
* Splits the array every time the given predicate fires.
|
|
@@ -174,4 +176,43 @@ function arrayEqual(a, b) {
|
|
|
174
176
|
}
|
|
175
177
|
return true;
|
|
176
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Samples elements from a list such that the distance between the sampled elements is as equal as possible.
|
|
181
|
+
*
|
|
182
|
+
* If the number of elements to sample is greater or equal to the number of elements in the list, the list is returned as is.
|
|
183
|
+
* If the number of elements to sample is less than or equal to 0, an empty list is returned.
|
|
184
|
+
*
|
|
185
|
+
* @param list - list of elements
|
|
186
|
+
* @param sampleCount - number of elements to sample
|
|
187
|
+
* @param rounding - rounding mode to use for the index calculation
|
|
188
|
+
* @returns - a list of elements equidistantly sampled from the input list
|
|
189
|
+
*/
|
|
190
|
+
function equidistantSampling(list, sampleCount, rounding = 'ceil') {
|
|
191
|
+
if (sampleCount >= list.length) {
|
|
192
|
+
return list.slice();
|
|
193
|
+
}
|
|
194
|
+
else if (sampleCount <= 0) {
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
197
|
+
const result = [];
|
|
198
|
+
const step = list.length / sampleCount;
|
|
199
|
+
for (let i = 0; i < sampleCount; i++) {
|
|
200
|
+
const index = rounding === 'floor' ? Math.floor(i * step) : Math.ceil(i * step);
|
|
201
|
+
result.push(list[index]);
|
|
202
|
+
}
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Returns the cartesian product of the given arrays.
|
|
207
|
+
* @example
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* cartesianProduct([1, 2], ['a', 'b', 'c'], [true, false])
|
|
211
|
+
* // -> [[1, 'a', true], [1, 'a', false], [1, 'b', true], [1, 'b', false], [1, 'c', true], [1, 'c', false], [2, 'a', true], [2, 'a', false], [2, 'b', true], [2, 'b', false], [2, 'c', true], [2, 'c', false]]
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
*/
|
|
215
|
+
function cartesianProduct(...arrays) {
|
|
216
|
+
return arrays.reduce((a, b) => a.flatMap(x => b.map(y => x.concat(y))), [[]]);
|
|
217
|
+
}
|
|
177
218
|
//# sourceMappingURL=arrays.js.map
|
package/util/cfg/visitor.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-i
|
|
|
6
6
|
* @param startNode - The node to start the traversal from.
|
|
7
7
|
* @param visitor - The visitor function to call for each node, if you return true the traversal from this node will be stopped.
|
|
8
8
|
*/
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function visitCfgInReverseOrder(graph: ControlFlowGraph, startNode: NodeId, visitor: (node: NodeId) => boolean | void): void;
|
package/util/cfg/visitor.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.visitCfgInReverseOrder = visitCfgInReverseOrder;
|
|
4
4
|
/**
|
|
5
5
|
* Visit all nodes reachable from the start node in the control flow graph, traversing the dependencies but ignoring cycles.
|
|
6
6
|
* @param graph - The control flow graph.
|
|
7
7
|
* @param startNode - The node to start the traversal from.
|
|
8
8
|
* @param visitor - The visitor function to call for each node, if you return true the traversal from this node will be stopped.
|
|
9
9
|
*/
|
|
10
|
-
function
|
|
10
|
+
function visitCfgInReverseOrder(graph, startNode,
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type -- void is used to indicate that the return value is ignored/we never stop
|
|
12
12
|
visitor) {
|
|
13
13
|
const visited = new Set();
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import type { REnvironmentInformation } from '../dataflow/environments/environment';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Identifier } from '../dataflow/environments/identifier';
|
|
3
|
+
import type { ContainerIndices, ContainerIndicesCollection, IndexIdentifier } from '../dataflow/graph/vertex';
|
|
3
4
|
import type { RAccess } from '../r-bridge/lang-4.x/ast/model/nodes/r-access';
|
|
5
|
+
import type { RArgument } from '../r-bridge/lang-4.x/ast/model/nodes/r-argument';
|
|
6
|
+
import type { RFunctionArgument } from '../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
4
7
|
import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
|
+
/**
|
|
9
|
+
* Returns the accessed and access argument of an access operation by filtering the operation arguments.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAccessOperands<OtherInfo>(args: readonly RFunctionArgument<OtherInfo & ParentInformation>[]): {
|
|
12
|
+
accessedArg: RArgument<OtherInfo & ParentInformation> | undefined;
|
|
13
|
+
accessArg: RArgument<OtherInfo & ParentInformation> | undefined;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the passed name in the passed environment and returns the indicesCollection of the resolved definitions.
|
|
17
|
+
*
|
|
18
|
+
* @param name - Name to resolve
|
|
19
|
+
* @param environment - Environment in which name is resolved
|
|
20
|
+
* @returns The indicesCollection of the resolved definitions
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveIndicesByName(name: Identifier, environment: REnvironmentInformation): ContainerIndices[] | undefined;
|
|
5
23
|
/**
|
|
6
24
|
* Resolves {@link accessedArg} in the {@link environment} and filters its indices according to {@link accessArg}.
|
|
7
25
|
*
|
|
26
|
+
* If no indices could be found that match the `accessArg`, the original indices are returned as overapproximation.
|
|
27
|
+
*
|
|
8
28
|
* @param accessedArg - The argument to resolve
|
|
9
29
|
* @param accessArg - The argument which is used to filter the indices
|
|
10
30
|
* @param environment - The environment in which {@link accessedArg} is resolved
|
|
@@ -14,7 +34,7 @@ export declare function resolveSingleIndex(accessedArg: {
|
|
|
14
34
|
lexeme: string;
|
|
15
35
|
}, accessArg: {
|
|
16
36
|
lexeme: string;
|
|
17
|
-
}, environment: REnvironmentInformation): ContainerIndicesCollection;
|
|
37
|
+
}, environment: REnvironmentInformation, isIndexBasedAccess: boolean): ContainerIndicesCollection;
|
|
18
38
|
/**
|
|
19
39
|
* Filters the single indices of the {@link indicesCollection} according to the lexeme of the {@link accessArg}.
|
|
20
40
|
*
|
|
@@ -24,7 +44,7 @@ export declare function resolveSingleIndex(accessedArg: {
|
|
|
24
44
|
*/
|
|
25
45
|
export declare function filterIndices(indicesCollection: ContainerIndicesCollection, accessArg: {
|
|
26
46
|
lexeme: string;
|
|
27
|
-
}): ContainerIndicesCollection;
|
|
47
|
+
}, isIndexBasedAccess: boolean): ContainerIndicesCollection;
|
|
28
48
|
/**
|
|
29
49
|
* Constructs the definition of a nested access.
|
|
30
50
|
*
|
|
@@ -38,7 +58,7 @@ export declare function filterIndices(indicesCollection: ContainerIndicesCollect
|
|
|
38
58
|
* @param leafIndices - The index at the end of the nested access i.e. `c` in `a$b$c`.
|
|
39
59
|
* @returns The constructed nested access
|
|
40
60
|
*/
|
|
41
|
-
export declare function constructNestedAccess<OtherInfo>(accessedArg: RAccess<OtherInfo & ParentInformation>, leafIndices: ContainerIndices): ContainerIndices[];
|
|
61
|
+
export declare function constructNestedAccess<OtherInfo>(accessedArg: RAccess<OtherInfo & ParentInformation>, leafIndices: ContainerIndices, constructIdentifier: (arg: RArgument<OtherInfo & ParentInformation>) => IndexIdentifier): ContainerIndices[];
|
|
42
62
|
/**
|
|
43
63
|
* Adds the passed list of {@link leafSubIndices} to the leaf (sub-)indices of {@link indicesCollection}.
|
|
44
64
|
*
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccessOperands = getAccessOperands;
|
|
4
|
+
exports.resolveIndicesByName = resolveIndicesByName;
|
|
3
5
|
exports.resolveSingleIndex = resolveSingleIndex;
|
|
4
6
|
exports.filterIndices = filterIndices;
|
|
5
7
|
exports.constructNestedAccess = constructNestedAccess;
|
|
@@ -8,19 +10,47 @@ const resolve_by_name_1 = require("../dataflow/environments/resolve-by-name");
|
|
|
8
10
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
9
11
|
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
10
12
|
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
13
|
+
/**
|
|
14
|
+
* Returns the accessed and access argument of an access operation by filtering the operation arguments.
|
|
15
|
+
*/
|
|
16
|
+
function getAccessOperands(args) {
|
|
17
|
+
const nonEmptyArgs = args.filter(arg => arg !== r_function_call_1.EmptyArgument);
|
|
18
|
+
const accessedArg = nonEmptyArgs.find(arg => arg.info.role === "accessed" /* RoleInParent.Accessed */);
|
|
19
|
+
const accessArg = nonEmptyArgs.find(arg => arg.info.role === "index-access" /* RoleInParent.IndexAccess */);
|
|
20
|
+
return { accessedArg, accessArg };
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the passed name in the passed environment and returns the indicesCollection of the resolved definitions.
|
|
24
|
+
*
|
|
25
|
+
* @param name - Name to resolve
|
|
26
|
+
* @param environment - Environment in which name is resolved
|
|
27
|
+
* @returns The indicesCollection of the resolved definitions
|
|
28
|
+
*/
|
|
29
|
+
function resolveIndicesByName(name, environment) {
|
|
30
|
+
const definitions = (0, resolve_by_name_1.resolveByName)(name, environment);
|
|
31
|
+
return definitions?.flatMap(def => def?.indicesCollection ?? []);
|
|
32
|
+
}
|
|
11
33
|
/**
|
|
12
34
|
* Resolves {@link accessedArg} in the {@link environment} and filters its indices according to {@link accessArg}.
|
|
13
35
|
*
|
|
36
|
+
* If no indices could be found that match the `accessArg`, the original indices are returned as overapproximation.
|
|
37
|
+
*
|
|
14
38
|
* @param accessedArg - The argument to resolve
|
|
15
39
|
* @param accessArg - The argument which is used to filter the indices
|
|
16
40
|
* @param environment - The environment in which {@link accessedArg} is resolved
|
|
17
41
|
* @returns The filtered {@link ContainerIndicesCollection} of the resolved {@link accessedArg}
|
|
18
42
|
*/
|
|
19
|
-
function resolveSingleIndex(accessedArg, accessArg, environment) {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
43
|
+
function resolveSingleIndex(accessedArg, accessArg, environment, isIndexBasedAccess) {
|
|
44
|
+
const indicesCollection = resolveIndicesByName(accessedArg.lexeme, environment);
|
|
45
|
+
const accessedIndicesCollection = filterIndices(indicesCollection, accessArg, isIndexBasedAccess);
|
|
46
|
+
// If the accessed indices couldn't be resolved, overapproximate by returning the original indices.
|
|
47
|
+
// This could also be the case, when nothing is acccessed, but we better be safe.
|
|
48
|
+
if (accessedIndicesCollection === undefined) {
|
|
49
|
+
return indicesCollection;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return accessedIndicesCollection;
|
|
53
|
+
}
|
|
24
54
|
}
|
|
25
55
|
/**
|
|
26
56
|
* Filters the single indices of the {@link indicesCollection} according to the lexeme of the {@link accessArg}.
|
|
@@ -29,11 +59,11 @@ function resolveSingleIndex(accessedArg, accessArg, environment) {
|
|
|
29
59
|
* @param accessArg - The argument which is used to filter {@link indicesCollection}
|
|
30
60
|
* @returns The filtered copy of {@link indicesCollection}
|
|
31
61
|
*/
|
|
32
|
-
function filterIndices(indicesCollection, accessArg) {
|
|
62
|
+
function filterIndices(indicesCollection, accessArg, isIndexBasedAccess) {
|
|
33
63
|
let accessedIndicesCollection = undefined;
|
|
34
64
|
for (const indices of indicesCollection ?? []) {
|
|
35
|
-
const filteredIndices = indices.indices.filter(index => accessArg.lexeme
|
|
36
|
-
if (filteredIndices.length
|
|
65
|
+
const filteredIndices = indices.indices.filter(index => (0, vertex_1.isAccessed)(index, accessArg.lexeme, isIndexBasedAccess));
|
|
66
|
+
if (filteredIndices.length === 0) {
|
|
37
67
|
continue;
|
|
38
68
|
}
|
|
39
69
|
accessedIndicesCollection ??= [];
|
|
@@ -57,7 +87,7 @@ function filterIndices(indicesCollection, accessArg) {
|
|
|
57
87
|
* @param leafIndices - The index at the end of the nested access i.e. `c` in `a$b$c`.
|
|
58
88
|
* @returns The constructed nested access
|
|
59
89
|
*/
|
|
60
|
-
function constructNestedAccess(accessedArg, leafIndices) {
|
|
90
|
+
function constructNestedAccess(accessedArg, leafIndices, constructIdentifier) {
|
|
61
91
|
const accessed = accessedArg.accessed;
|
|
62
92
|
const accesses = accessedArg.access.filter(arg => arg !== r_function_call_1.EmptyArgument).map(arg => arg);
|
|
63
93
|
const indices = [];
|
|
@@ -65,7 +95,7 @@ function constructNestedAccess(accessedArg, leafIndices) {
|
|
|
65
95
|
const newIndices = {
|
|
66
96
|
indices: [
|
|
67
97
|
{
|
|
68
|
-
|
|
98
|
+
identifier: constructIdentifier(access),
|
|
69
99
|
nodeId: access.info.id,
|
|
70
100
|
subIndices: [leafIndices],
|
|
71
101
|
}
|
|
@@ -73,7 +103,7 @@ function constructNestedAccess(accessedArg, leafIndices) {
|
|
|
73
103
|
isContainer: false,
|
|
74
104
|
};
|
|
75
105
|
if (accessed.type === type_1.RType.Access) {
|
|
76
|
-
const nestedIndices = constructNestedAccess(accessed, newIndices);
|
|
106
|
+
const nestedIndices = constructNestedAccess(accessed, newIndices, constructIdentifier);
|
|
77
107
|
indices.push(...nestedIndices);
|
|
78
108
|
}
|
|
79
109
|
else {
|
|
@@ -112,4 +142,4 @@ function addSubIndicesToLeafIndices(indicesCollection, leafSubIndices) {
|
|
|
112
142
|
}
|
|
113
143
|
return result;
|
|
114
144
|
}
|
|
115
|
-
//# sourceMappingURL=
|
|
145
|
+
//# sourceMappingURL=containers.js.map
|
package/util/mermaid/ast.js
CHANGED
|
@@ -5,9 +5,10 @@ exports.normalizedAstToMermaidUrl = normalizedAstToMermaidUrl;
|
|
|
5
5
|
const mermaid_1 = require("./mermaid");
|
|
6
6
|
const visitor_1 = require("../../r-bridge/lang-4.x/ast/model/processing/visitor");
|
|
7
7
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
8
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
8
9
|
function normalizedAstToMermaid(ast, prefix = 'flowchart TD\n') {
|
|
9
10
|
let output = prefix;
|
|
10
|
-
|
|
11
|
+
function showNode(n) {
|
|
11
12
|
const name = `${n.type} (${n.info.id})\\n${n.lexeme ?? ' '}`;
|
|
12
13
|
output += ` n${n.info.id}(["${(0, mermaid_1.escapeMarkdown)(name)}"])\n`;
|
|
13
14
|
if (n.info.parent !== undefined) {
|
|
@@ -19,6 +20,16 @@ function normalizedAstToMermaid(ast, prefix = 'flowchart TD\n') {
|
|
|
19
20
|
output += ` n${n.info.id} -.-|"group-open"| n${n.grouping[0].info.id}\n`;
|
|
20
21
|
output += ` n${n.info.id} -.-|"group-close"| n${n.grouping[1].info.id}\n`;
|
|
21
22
|
}
|
|
23
|
+
}
|
|
24
|
+
(0, visitor_1.visitAst)(ast, n => {
|
|
25
|
+
showNode(n);
|
|
26
|
+
if (n.type === 'RAccess' && (n.operator !== '[' && n.operator !== '[[')) {
|
|
27
|
+
for (const k of n.access) {
|
|
28
|
+
if (k !== r_function_call_1.EmptyArgument) {
|
|
29
|
+
showNode(k);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
22
33
|
return false;
|
|
23
34
|
});
|
|
24
35
|
return output;
|
package/util/mermaid/cfg.js
CHANGED
|
@@ -6,8 +6,8 @@ const mermaid_1 = require("./mermaid");
|
|
|
6
6
|
function getLexeme(n) {
|
|
7
7
|
return n ? n.info.fullLexeme ?? n.lexeme ?? '<unknown>' : '';
|
|
8
8
|
}
|
|
9
|
-
function cfgToMermaid(cfg, normalizedAst, prefix = '') {
|
|
10
|
-
let output = prefix
|
|
9
|
+
function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n') {
|
|
10
|
+
let output = prefix;
|
|
11
11
|
for (const [id, vertex] of cfg.graph.vertices()) {
|
|
12
12
|
const normalizedVertex = normalizedAst.idMap.get(id);
|
|
13
13
|
const content = getLexeme(normalizedVertex);
|
package/util/parallel.d.ts
CHANGED
|
@@ -13,12 +13,13 @@ export declare class LimitedThreadPool {
|
|
|
13
13
|
private skipped;
|
|
14
14
|
private currentlyRunning;
|
|
15
15
|
private reportingInterval;
|
|
16
|
+
private readonly timeLimitInMs;
|
|
16
17
|
/**
|
|
17
18
|
* Create a new parallel helper that runs the given `module` once for each list of {@link Arguments} in the `queue`.
|
|
18
19
|
* The `limit` stops the execution if `<limit>` number of runs exited successfully.
|
|
19
20
|
* The `parallel` parameter limits the number of parallel executions.
|
|
20
21
|
*/
|
|
21
|
-
constructor(module: string, queue: WorkingQueue, limit: number, parallel: number);
|
|
22
|
+
constructor(module: string, queue: WorkingQueue, limit: number, parallel: number, timeLimitInMs?: number);
|
|
22
23
|
run(): Promise<void>;
|
|
23
24
|
getStats(): {
|
|
24
25
|
counter: number;
|
package/util/parallel.js
CHANGED
|
@@ -56,16 +56,18 @@ class LimitedThreadPool {
|
|
|
56
56
|
skipped = [];
|
|
57
57
|
currentlyRunning = new Set();
|
|
58
58
|
reportingInterval = undefined;
|
|
59
|
+
timeLimitInMs;
|
|
59
60
|
/**
|
|
60
61
|
* Create a new parallel helper that runs the given `module` once for each list of {@link Arguments} in the `queue`.
|
|
61
62
|
* The `limit` stops the execution if `<limit>` number of runs exited successfully.
|
|
62
63
|
* The `parallel` parameter limits the number of parallel executions.
|
|
63
64
|
*/
|
|
64
|
-
constructor(module, queue, limit, parallel) {
|
|
65
|
+
constructor(module, queue, limit, parallel, timeLimitInMs) {
|
|
65
66
|
this.workingQueue = queue;
|
|
66
67
|
this.limit = limit;
|
|
67
68
|
this.module = module;
|
|
68
69
|
this.parallel = parallel;
|
|
70
|
+
this.timeLimitInMs = timeLimitInMs;
|
|
69
71
|
}
|
|
70
72
|
async run() {
|
|
71
73
|
this.reportingInterval = setInterval(() => {
|
|
@@ -93,8 +95,15 @@ class LimitedThreadPool {
|
|
|
93
95
|
console.log(`[${this.counter}/${this.limit}] Running next, currently running: ${this.currentlyRunning.size}, queue: ${this.workingQueue.length} [args: ${args.join(' ')}]`);
|
|
94
96
|
const child = cp.fork(this.module, args);
|
|
95
97
|
child.on('exit', this.onChildExit(args));
|
|
98
|
+
let timeout;
|
|
99
|
+
if (this.timeLimitInMs) {
|
|
100
|
+
timeout = setTimeout(() => {
|
|
101
|
+
log_1.log.error(`Killing child process with '${JSON.stringify(args)}' after ${this.timeLimitInMs}ms`);
|
|
102
|
+
child.kill();
|
|
103
|
+
}, this.timeLimitInMs);
|
|
104
|
+
}
|
|
96
105
|
// schedule re-schedule
|
|
97
|
-
await new Promise(resolve => child.on('exit', resolve)).then(() => this.runNext());
|
|
106
|
+
await new Promise(resolve => child.on('exit', resolve)).then(() => clearTimeout(timeout)).then(() => this.runNext());
|
|
98
107
|
}
|
|
99
108
|
onChildExit(args) {
|
|
100
109
|
return (code, signal) => {
|
package/util/prefix.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* given a potentially partial prefix like `hell`, this finds the matching name in the map, but only
|
|
3
|
+
* if it is unique!
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* findByPrefixIfUnique('hell', { 'hello', 'bar' }) // => 'hello'
|
|
8
|
+
* findByPrefixIfUnique('hell', { 'hello', 'hell' }) // => 'hell' (full match)
|
|
9
|
+
* findByPrefixIfUnique('h', { 'hello', 'hell' }) // => undefined (not unique)
|
|
10
|
+
* findByPrefixIfUnique('', { 'hello', 'hell' }) // => undefined (empty prefix)
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function findByPrefixIfUnique(prefix: string, keys: readonly string[]): string | undefined;
|
package/util/prefix.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findByPrefixIfUnique = findByPrefixIfUnique;
|
|
4
|
+
/**
|
|
5
|
+
* given a potentially partial prefix like `hell`, this finds the matching name in the map, but only
|
|
6
|
+
* if it is unique!
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* findByPrefixIfUnique('hell', { 'hello', 'bar' }) // => 'hello'
|
|
11
|
+
* findByPrefixIfUnique('hell', { 'hello', 'hell' }) // => 'hell' (full match)
|
|
12
|
+
* findByPrefixIfUnique('h', { 'hello', 'hell' }) // => undefined (not unique)
|
|
13
|
+
* findByPrefixIfUnique('', { 'hello', 'hell' }) // => undefined (empty prefix)
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function findByPrefixIfUnique(prefix, keys) {
|
|
17
|
+
if (prefix === '') {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
let found = undefined;
|
|
21
|
+
for (const key of keys) {
|
|
22
|
+
if (key === prefix) {
|
|
23
|
+
return key;
|
|
24
|
+
}
|
|
25
|
+
if (key.startsWith(prefix)) {
|
|
26
|
+
if (found) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
found = key;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return found;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=prefix.js.map
|
package/util/version.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.flowrVersion = flowrVersion;
|
|
4
4
|
const semver_1 = require("semver");
|
|
5
5
|
// this is automatically replaced with the current version by release-it
|
|
6
|
-
const version = '2.2.
|
|
6
|
+
const version = '2.2.12';
|
|
7
7
|
function flowrVersion() {
|
|
8
8
|
return new semver_1.SemVer(version);
|
|
9
9
|
}
|