@eagleoutice/flowr 2.0.0 → 2.0.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/benchmark/slicer.js +30 -5
- package/benchmark/stats/print.js +28 -9
- package/benchmark/stats/stats.d.ts +5 -0
- package/benchmark/summarizer/data.d.ts +10 -1
- package/benchmark/summarizer/first-phase/process.d.ts +1 -1
- package/benchmark/summarizer/first-phase/process.js +83 -30
- package/benchmark/summarizer/second-phase/process.js +20 -4
- package/cli/repl/commands/commands.js +19 -1
- package/cli/slicer-app.js +1 -1
- package/dataflow/environments/append.js +1 -2
- package/dataflow/environments/built-in.js +2 -1
- package/dataflow/environments/clone.js +1 -1
- package/dataflow/environments/diff.d.ts +1 -1
- package/dataflow/environments/diff.js +16 -18
- package/dataflow/environments/environment.d.ts +4 -7
- package/dataflow/environments/environment.js +5 -8
- package/dataflow/environments/identifier.d.ts +2 -1
- package/dataflow/environments/overwrite.js +1 -2
- package/dataflow/environments/scoping.js +1 -1
- package/dataflow/graph/diff.js +11 -6
- package/dataflow/graph/graph.d.ts +6 -2
- package/dataflow/graph/graph.js +13 -7
- package/dataflow/graph/vertex.d.ts +2 -1
- package/dataflow/info.d.ts +10 -1
- package/dataflow/info.js +54 -2
- package/dataflow/internal/linker.d.ts +1 -1
- package/dataflow/internal/linker.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +21 -25
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +10 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-logical-bin-op.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-logical-bin-op.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
- package/dataflow/internal/process/functions/call/default-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +1 -1
- package/dataflow/processor.d.ts +2 -3
- package/package.json +4 -2
- package/r-bridge/data/data.d.ts +1 -1
- package/r-bridge/data/data.js +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/operators.js +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-call.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-binary.js +1 -1
- package/r-bridge/retriever.d.ts +1 -1
- package/r-bridge/retriever.js +3 -2
- package/r-bridge/shell.js +4 -3
- package/reconstruct/reconstruct.d.ts +3 -3
- package/reconstruct/reconstruct.js +40 -41
- package/slicing/criterion/filters/all-variables.js +1 -1
- package/slicing/static/static-slicer.js +2 -2
- package/statistics/features/common-syntax-probability.js +1 -1
- package/statistics/features/supported/control-flow/control-flow.js +1 -1
- package/statistics/features/supported/defined-functions/defined-functions.js +1 -1
- package/statistics/features/supported/loops/loops.js +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +1 -1
- package/util/assert.d.ts +1 -1
- package/util/mermaid/ast.js +4 -0
- package/util/mermaid/dfg.js +15 -5
- package/util/mermaid/mermaid.js +21 -1
- package/util/version.js +1 -1
|
@@ -63,7 +63,7 @@ function visitCalls(info, input) {
|
|
|
63
63
|
if (dataflowNode) {
|
|
64
64
|
hasCallsEdge = [...dataflowNode[1].values()].some(e => (0, edge_1.edgeIncludesType)(e.types, 4 /* EdgeType.Calls */));
|
|
65
65
|
}
|
|
66
|
-
if (node.
|
|
66
|
+
if (!node.named) {
|
|
67
67
|
info.unnamedCalls++;
|
|
68
68
|
(0, statistics_file_1.appendStatisticsFile)(exports.usedFunctions.name, 'unnamed-calls', [node.lexeme], input.filepath);
|
|
69
69
|
allCalls.push([
|
package/util/assert.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export type GuardMessage = string | (() => string);
|
|
|
9
9
|
* @param message - if a string, will be used as error message, if a function, will be called to produce the error message (can be used to avoid costly message generations)
|
|
10
10
|
* @throws GuardError - if the assertion fails
|
|
11
11
|
*/
|
|
12
|
-
export declare function guard(assertion: boolean, message?: GuardMessage): asserts assertion;
|
|
12
|
+
export declare function guard(assertion: boolean | undefined, message?: GuardMessage): asserts assertion;
|
package/util/mermaid/ast.js
CHANGED
|
@@ -13,6 +13,10 @@ function normalizedAstToMermaid(ast, prefix = '') {
|
|
|
13
13
|
const roleSuffix = context.role === "expr-list-child" /* RoleInParent.ExpressionListChild */ || context.role === "call-argument" /* RoleInParent.FunctionCallArgument */ || context.role === "function-def-param" /* RoleInParent.FunctionDefinitionParameter */ ? `-${context.index}` : '';
|
|
14
14
|
output += ` n${n.info.parent} -->|"${context.role}${roleSuffix}"| n${n.info.id}\n`;
|
|
15
15
|
}
|
|
16
|
+
if (n.type === "RExpressionList" /* RType.ExpressionList */ && n.grouping !== undefined) {
|
|
17
|
+
output += ` n${n.info.id} -.-|"group-open"| n${n.grouping[0].info.id}\n`;
|
|
18
|
+
output += ` n${n.info.id} -.-|"group-close"| n${n.grouping[1].info.id}\n`;
|
|
19
|
+
}
|
|
16
20
|
return false;
|
|
17
21
|
});
|
|
18
22
|
return output;
|
package/util/mermaid/dfg.js
CHANGED
|
@@ -12,6 +12,14 @@ function formatRange(range) {
|
|
|
12
12
|
if (range === undefined) {
|
|
13
13
|
return '??-??';
|
|
14
14
|
}
|
|
15
|
+
else if (range[0] === range[2]) {
|
|
16
|
+
if (range[1] === range[3]) {
|
|
17
|
+
return `${range[0]}.${range[1]}`;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return `${range[0]}.${range[1]}-${range[3]}`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
15
23
|
return `${range[0]}.${range[1]}-${range[2]}.${range[3]}`;
|
|
16
24
|
}
|
|
17
25
|
exports.formatRange = formatRange;
|
|
@@ -102,7 +110,7 @@ function printEnvironmentToLines(env) {
|
|
|
102
110
|
else if (env.id === environment_1.BuiltInEnvironment.id) {
|
|
103
111
|
return ['Built-in'];
|
|
104
112
|
}
|
|
105
|
-
const lines = [...printEnvironmentToLines(env.parent), `${env.id}
|
|
113
|
+
const lines = [...printEnvironmentToLines(env.parent), `${env.id}${'-'.repeat(40)}`];
|
|
106
114
|
const longestName = Math.max(...[...env.memory.keys()].map(x => x.length));
|
|
107
115
|
for (const [name, defs] of env.memory.entries()) {
|
|
108
116
|
const printName = `${name}:`;
|
|
@@ -119,15 +127,17 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
|
|
|
119
127
|
}
|
|
120
128
|
}
|
|
121
129
|
const node = mermaid.rootGraph.idMap?.get(info.id);
|
|
122
|
-
const
|
|
130
|
+
const lexeme = node?.lexeme ?? (node?.type === "RExpressionList" /* RType.ExpressionList */ ? node?.grouping?.[0]?.lexeme : '') ?? '??';
|
|
131
|
+
const escapedName = (0, mermaid_1.escapeMarkdown)(node ? `[${node.type}] ${lexeme}` : '??');
|
|
123
132
|
const deps = info.controlDependencies ? ', :maybe:' + info.controlDependencies.join(',') : '';
|
|
124
|
-
|
|
133
|
+
const n = node?.info.fullRange ?? node?.location ?? (node?.type === "RExpressionList" /* RType.ExpressionList */ ? node?.grouping?.[0].location : undefined);
|
|
134
|
+
mermaid.nodeLines.push(` ${idPrefix}${id}${open}"\`${escapedName}${escapedName.length > 10 ? '\n ' : ' '}(${id}${deps})\n *${formatRange(n)}*${fCall ? displayFunctionArgMapping(info.args) : ''}\`"${close}`);
|
|
125
135
|
if (mark?.has(id)) {
|
|
126
136
|
mermaid.nodeLines.push(` style ${idPrefix}${id} stroke:black,stroke-width:7px; `);
|
|
127
137
|
}
|
|
128
138
|
const edges = mermaid.rootGraph.get(id, true);
|
|
129
139
|
(0, assert_1.guard)(edges !== undefined, `node ${id} must be found`);
|
|
130
|
-
const artificialCdEdges = (info.controlDependencies ?? []).map(x => [x, { types: new Set(['CD']) }]);
|
|
140
|
+
const artificialCdEdges = (info.controlDependencies ?? []).map(x => [x.id, { types: new Set([x.when ? 'CD-True' : 'CD-False']) }]);
|
|
131
141
|
for (const [target, edge] of [...edges[1], ...artificialCdEdges]) {
|
|
132
142
|
const edgeTypes = typeof edge.types == 'number' ? new Set((0, edge_1.splitEdgeTypes)(edge.types)) : edge.types;
|
|
133
143
|
const edgeId = encodeEdge(idPrefix + id, idPrefix + target, edgeTypes);
|
|
@@ -138,7 +148,7 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
|
|
|
138
148
|
// who invented this syntax?!
|
|
139
149
|
mermaid.edgeLines.push(` linkStyle ${mermaid.presentEdges.size - 1} stroke:red,color:red,stroke-width:4px;`);
|
|
140
150
|
}
|
|
141
|
-
if (edgeTypes.has('CD')) {
|
|
151
|
+
if (edgeTypes.has('CD-True')) {
|
|
142
152
|
mermaid.edgeLines.push(` linkStyle ${mermaid.presentEdges.size - 1} stroke:gray,color:gray;`);
|
|
143
153
|
}
|
|
144
154
|
if (target === built_in_1.BuiltIn) {
|
package/util/mermaid/mermaid.js
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mermaidCodeToUrl = exports.escapeMarkdown = void 0;
|
|
4
|
+
const replacements = {
|
|
5
|
+
// keep newlines
|
|
6
|
+
'\\n': '\n',
|
|
7
|
+
'`': '#96;',
|
|
8
|
+
'[': '#91;',
|
|
9
|
+
']': '#93;',
|
|
10
|
+
'<': '#60;',
|
|
11
|
+
'>': '#62;',
|
|
12
|
+
'*': '#42;',
|
|
13
|
+
'+': '#43;',
|
|
14
|
+
'-': '#45;',
|
|
15
|
+
'"': '#34;',
|
|
16
|
+
'\\': '#92;',
|
|
17
|
+
'_': '#95;',
|
|
18
|
+
'{': '#123;',
|
|
19
|
+
'}': '#125;'
|
|
20
|
+
};
|
|
4
21
|
function escapeMarkdown(text) {
|
|
5
|
-
|
|
22
|
+
for (const [key, value] of Object.entries(replacements)) {
|
|
23
|
+
text = text.replaceAll(key, value);
|
|
24
|
+
}
|
|
25
|
+
return text;
|
|
6
26
|
}
|
|
7
27
|
exports.escapeMarkdown = escapeMarkdown;
|
|
8
28
|
/**
|
package/util/version.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.flowrVersion = void 0;
|
|
4
4
|
const semver_1 = require("semver");
|
|
5
5
|
// this is automatically replaced with the current version by release-it
|
|
6
|
-
const version = '2.0.
|
|
6
|
+
const version = '2.0.2';
|
|
7
7
|
function flowrVersion() {
|
|
8
8
|
return new semver_1.SemVer(version);
|
|
9
9
|
}
|