@eagleoutice/flowr 2.13.14 → 2.13.16
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 +25 -31
- package/abstract-interpretation/data-frame/resolve-args.js +11 -12
- package/abstract-interpretation/unsupported-functions.d.ts +1 -0
- package/abstract-interpretation/unsupported-functions.js +1 -0
- package/benchmark/summarizer/second-phase/graph.d.ts +23 -0
- package/benchmark/summarizer/second-phase/graph.js +47 -14
- package/cli/repl/commands/repl-cfg.js +2 -42
- package/cli/repl/commands/repl-clipboard.d.ts +7 -0
- package/cli/repl/commands/repl-clipboard.js +53 -0
- package/cli/repl/commands/repl-dataflow.js +5 -70
- package/cli/repl/commands/repl-normalize.js +3 -51
- package/cli/repl/commands/repl-query.js +37 -2
- package/cli/repl/core.js +5 -2
- package/control-flow/cfg-dead-code.js +5 -29
- package/control-flow/control-flow-graph.d.ts +2 -0
- package/control-flow/control-flow-graph.js +2 -0
- package/control-flow/diff-cfg.js +2 -56
- package/control-flow/semantic-cfg-guided-visitor.d.ts +7 -0
- package/control-flow/semantic-cfg-guided-visitor.js +14 -0
- package/control-flow/useless-loop.js +4 -26
- package/core/steps/all/core/10-normalize.d.ts +8 -0
- package/core/steps/all/core/10-normalize.js +10 -8
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +5 -7
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -9
- package/data/r-base-packages.generated.d.ts +1 -0
- package/data/r-base-packages.generated.js +5 -3
- package/dataflow/environments/built-in-config.d.ts +9 -1
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in-props.d.ts +4 -0
- package/dataflow/environments/built-in-props.js +3 -3
- package/dataflow/environments/built-in.d.ts +4 -2
- package/dataflow/environments/built-in.js +53 -3
- package/dataflow/environments/data-masking-functions.d.ts +3 -4
- package/dataflow/environments/data-masking-functions.js +7 -8
- package/dataflow/environments/default-builtin-config.d.ts +92 -12
- package/dataflow/environments/default-builtin-config.js +86 -43
- package/dataflow/environments/environment.d.ts +5 -0
- package/dataflow/environments/environment.js +17 -12
- package/dataflow/environments/identifier.d.ts +3 -0
- package/dataflow/eval/resolve/alias-tracking.js +4 -7
- package/dataflow/eval/resolve/node-value.d.ts +51 -0
- package/dataflow/eval/resolve/node-value.js +71 -0
- package/dataflow/eval/resolve/resolve-argument.js +10 -7
- package/dataflow/eval/resolve/resolve-operators.js +1 -2
- package/dataflow/eval/values/general.d.ts +4 -0
- package/dataflow/eval/values/general.js +14 -0
- package/dataflow/eval/values/r-value.d.ts +15 -0
- package/dataflow/eval/values/r-value.js +27 -1
- package/dataflow/extractor.js +2 -0
- package/dataflow/fn/higher-order-function.d.ts +1 -1
- package/dataflow/fn/higher-order-function.js +22 -4
- package/dataflow/graph/call-graph.d.ts +1 -1
- package/dataflow/graph/call-graph.js +1 -1
- package/dataflow/graph/df-helper.d.ts +2 -2
- package/dataflow/graph/df-helper.js +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +3 -55
- package/dataflow/graph/graph-helper.d.ts +1 -0
- package/dataflow/graph/graph-helper.js +1 -0
- package/dataflow/graph/graph.d.ts +5 -0
- package/dataflow/graph/graph.js +27 -0
- package/dataflow/graph/vertex.d.ts +5 -0
- package/dataflow/graph/vertex.js +5 -0
- package/dataflow/internal/linker.d.ts +23 -0
- package/dataflow/internal/linker.js +70 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +39 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +10 -22
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +29 -53
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +19 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +3 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +69 -52
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +2 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +31 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +7 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +20 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +105 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +1 -27
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +1 -1
- package/dataflow/internal/process/functions/call/deferred.d.ts +48 -0
- package/dataflow/internal/process/functions/call/deferred.js +149 -0
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -12
- package/dataflow/internal/process/functions/call/known-call-handling.js +35 -35
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +8 -4
- package/dataflow/internal/process/functions/call/nse.d.ts +29 -0
- package/dataflow/internal/process/functions/call/nse.js +88 -0
- package/dataflow/internal/process/functions/call/quoted.d.ts +30 -0
- package/dataflow/internal/process/functions/call/quoted.js +191 -0
- package/documentation/doc-util/doc-types.js +15 -9
- package/documentation/wiki-dataflow-graph.js +8 -0
- package/linter/linter-format.d.ts +1 -0
- package/linter/linter-format.js +1 -0
- package/linter/rules/deprecated-functions.js +9 -3
- package/linter/rules/seeded-randomness.js +2 -3
- package/linter/rules/undefined-symbol.js +10 -1
- package/package.json +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +6 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +17 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +2 -11
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +3 -15
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +16 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +26 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -11
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +3 -15
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +4 -10
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -9
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +2 -9
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +1 -1
- package/project/sigdb/reader.d.ts +9 -0
- package/project/sigdb/reader.js +30 -0
- package/queries/catalog/absint-query/absint-query-format.js +1 -1
- package/queries/catalog/does-call-query/does-call-query-format.js +2 -1
- package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -12
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -37
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -23
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
- package/queries/query-function-filter.d.ts +21 -0
- package/queries/query-function-filter.js +48 -0
- package/r-bridge/data/data.d.ts +13 -3
- package/r-bridge/data/data.js +15 -3
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +4 -0
- package/search/flowr-search-filters.d.ts +5 -1
- package/search/flowr-search-filters.js +31 -21
- package/search/search-executor/search-enrichers.d.ts +24 -4
- package/search/search-executor/search-enrichers.js +22 -9
- package/search/search-executor/search-transformer.js +1 -1
- package/slicing/criterion/parse.d.ts +1 -0
- package/slicing/criterion/parse.js +1 -0
- package/util/diff-graph.d.ts +13 -0
- package/util/diff-graph.js +64 -1
- package/util/files.js +9 -8
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +3 -1
- package/util/r-version.d.ts +2 -0
- package/util/r-version.js +2 -0
- package/util/record.d.ts +1 -0
- package/util/record.js +1 -0
- package/util/version.js +1 -1
|
@@ -1,41 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.dataflowSimpleStarCommand = exports.dataflowSimplifiedCommand = exports.dataflowSilentCommand = exports.dataflowAsciiCommand = exports.dataflowStarCommand = exports.dataflowCommand = void 0;
|
|
37
4
|
const ansi_1 = require("../../../util/text/ansi");
|
|
38
5
|
const core_1 = require("../core");
|
|
6
|
+
const repl_clipboard_1 = require("./repl-clipboard");
|
|
39
7
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
40
8
|
const dfg_ascii_1 = require("../../../util/simple-df/dfg-ascii");
|
|
41
9
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
@@ -89,16 +57,7 @@ exports.dataflowCommand = {
|
|
|
89
57
|
fn: async ({ output, analyzer }) => {
|
|
90
58
|
const result = await analyzer.dataflow();
|
|
91
59
|
const mermaid = df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false, qualifyBaseR: (0, config_1.isSigDbEnabled)(analyzer.flowrConfig) }).string;
|
|
92
|
-
|
|
93
|
-
if (output.allowClipboard !== false) {
|
|
94
|
-
try {
|
|
95
|
-
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
96
|
-
clipboard.default.writeSync(mermaid);
|
|
97
|
-
output.stdout(formatInfo(output, 'mermaid code', result));
|
|
98
|
-
}
|
|
99
|
-
catch { /* do nothing this is a service thing */
|
|
100
|
-
}
|
|
101
|
-
}
|
|
60
|
+
await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid code', result));
|
|
102
61
|
}
|
|
103
62
|
};
|
|
104
63
|
exports.dataflowStarCommand = {
|
|
@@ -111,15 +70,7 @@ exports.dataflowStarCommand = {
|
|
|
111
70
|
fn: async ({ output, analyzer }) => {
|
|
112
71
|
const result = await analyzer.dataflow();
|
|
113
72
|
const mermaid = df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false, undefined, false, (0, config_1.isSigDbEnabled)(analyzer.flowrConfig));
|
|
114
|
-
|
|
115
|
-
if (output.allowClipboard !== false) {
|
|
116
|
-
try {
|
|
117
|
-
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
118
|
-
clipboard.default.writeSync(mermaid);
|
|
119
|
-
output.stdout(formatInfo(output, 'mermaid url', result));
|
|
120
|
-
}
|
|
121
|
-
catch { /* do nothing this is a service thing */ }
|
|
122
|
-
}
|
|
73
|
+
await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid url', result));
|
|
123
74
|
}
|
|
124
75
|
};
|
|
125
76
|
exports.dataflowAsciiCommand = {
|
|
@@ -174,15 +125,7 @@ exports.dataflowSimplifiedCommand = {
|
|
|
174
125
|
fn: async ({ output, analyzer }) => {
|
|
175
126
|
const result = await analyzer.dataflow();
|
|
176
127
|
const mermaid = df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false, simplified: true, qualifyBaseR: (0, config_1.isSigDbEnabled)(analyzer.flowrConfig) }).string;
|
|
177
|
-
|
|
178
|
-
if (output.allowClipboard !== false) {
|
|
179
|
-
try {
|
|
180
|
-
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
181
|
-
clipboard.default.writeSync(mermaid);
|
|
182
|
-
output.stdout(formatInfo(output, 'mermaid code', result));
|
|
183
|
-
}
|
|
184
|
-
catch { /* do nothing this is a service thing */ }
|
|
185
|
-
}
|
|
128
|
+
await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid code', result));
|
|
186
129
|
}
|
|
187
130
|
};
|
|
188
131
|
exports.dataflowSimpleStarCommand = {
|
|
@@ -195,15 +138,7 @@ exports.dataflowSimpleStarCommand = {
|
|
|
195
138
|
fn: async ({ output, analyzer }) => {
|
|
196
139
|
const result = await analyzer.dataflow();
|
|
197
140
|
const mermaid = df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false, undefined, true, (0, config_1.isSigDbEnabled)(analyzer.flowrConfig));
|
|
198
|
-
|
|
199
|
-
if (output.allowClipboard !== false) {
|
|
200
|
-
try {
|
|
201
|
-
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
202
|
-
clipboard.default.writeSync(mermaid);
|
|
203
|
-
output.stdout(formatInfo(output, 'mermaid url', result));
|
|
204
|
-
}
|
|
205
|
-
catch { /* do nothing this is a service thing */ }
|
|
206
|
-
}
|
|
141
|
+
await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid url', result));
|
|
207
142
|
}
|
|
208
143
|
};
|
|
209
144
|
//# sourceMappingURL=repl-dataflow.js.map
|
|
@@ -1,42 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.normalizeHashCommand = exports.normalizeStarCommand = exports.normalizeCommand = void 0;
|
|
37
4
|
const ast_1 = require("../../../util/mermaid/ast");
|
|
38
5
|
const ansi_1 = require("../../../util/text/ansi");
|
|
39
6
|
const core_1 = require("../core");
|
|
7
|
+
const repl_clipboard_1 = require("./repl-clipboard");
|
|
40
8
|
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
41
9
|
const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
42
10
|
function formatInfo(out, type, meta) {
|
|
@@ -52,15 +20,7 @@ exports.normalizeCommand = {
|
|
|
52
20
|
fn: async ({ output, analyzer }) => {
|
|
53
21
|
const result = await analyzer.normalize();
|
|
54
22
|
const mermaid = (0, ast_1.normalizedAstToMermaid)(result.ast);
|
|
55
|
-
|
|
56
|
-
if (output.allowClipboard !== false) {
|
|
57
|
-
try {
|
|
58
|
-
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
59
|
-
clipboard.default.writeSync(mermaid);
|
|
60
|
-
output.stdout(formatInfo(output, 'mermaid url', result));
|
|
61
|
-
}
|
|
62
|
-
catch { /* do nothing this is a service thing */ }
|
|
63
|
-
}
|
|
23
|
+
await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid url', result));
|
|
64
24
|
}
|
|
65
25
|
};
|
|
66
26
|
exports.normalizeStarCommand = {
|
|
@@ -73,15 +33,7 @@ exports.normalizeStarCommand = {
|
|
|
73
33
|
fn: async ({ output, analyzer }) => {
|
|
74
34
|
const result = await analyzer.normalize();
|
|
75
35
|
const mermaid = (0, ast_1.normalizedAstToMermaidUrl)(result.ast);
|
|
76
|
-
|
|
77
|
-
if (output.allowClipboard !== false) {
|
|
78
|
-
try {
|
|
79
|
-
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
80
|
-
clipboard.default.writeSync(mermaid);
|
|
81
|
-
output.stdout(formatInfo(output, 'mermaid url', result));
|
|
82
|
-
}
|
|
83
|
-
catch { /* do nothing this is a service thing */ }
|
|
84
|
-
}
|
|
36
|
+
await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid url', result));
|
|
85
37
|
}
|
|
86
38
|
};
|
|
87
39
|
exports.normalizeHashCommand = {
|
|
@@ -142,6 +142,7 @@ async function processQueryArgs(output, analyzer, remainingArgs) {
|
|
|
142
142
|
parsedQuery = [{ type: 'call-context', callName: query }];
|
|
143
143
|
}
|
|
144
144
|
if (input) {
|
|
145
|
+
input = unquoteWhole(input);
|
|
145
146
|
input = (0, path_input_1.handlePathLikeInput)(output, input, analyzer.flowrConfig);
|
|
146
147
|
// reuse a prior analysis (e.g. a dataflow from :df#) when the target is unchanged
|
|
147
148
|
if (!analyzerHasTarget(analyzer, input)) {
|
|
@@ -171,12 +172,46 @@ function parseArgs(line) {
|
|
|
171
172
|
const [, name, rest] = configMatch;
|
|
172
173
|
return { rCode: undefined, remaining: rest === undefined ? [name] : [name, rest] };
|
|
173
174
|
}
|
|
174
|
-
const
|
|
175
|
+
const [query, rest] = splitQueryFromRest(line);
|
|
175
176
|
return {
|
|
176
177
|
rCode: undefined,
|
|
177
|
-
|
|
178
|
+
/* the rest keeps its quotes: they belong to the R code, where dropping them turns a string into a symbol */
|
|
179
|
+
remaining: [query, ...(0, args_1.splitAtEscapeSensitive)(rest, false)]
|
|
178
180
|
};
|
|
179
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Undoes a wrapping of the whole code in quotes, as `:query \@dependencies "library(x)"` writes it. A quote the
|
|
184
|
+
* code itself contains ends the wrapping early, so it is left alone.
|
|
185
|
+
*/
|
|
186
|
+
function unquoteWhole(code) {
|
|
187
|
+
const quote = code[0];
|
|
188
|
+
if ((quote !== '"' && quote !== '\'') || code.length < 2 || code[code.length - 1] !== quote) {
|
|
189
|
+
return code;
|
|
190
|
+
}
|
|
191
|
+
for (let i = 1; i < code.length - 1; i++) {
|
|
192
|
+
if (code[i] === quote && code[i - 1] !== '\\') {
|
|
193
|
+
return code;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return code.slice(1, -1);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Separates the query from everything after it. The query is either a bare token (`@static-slice`) or the
|
|
200
|
+
* quoted JSON form (`"[{\"type\": ...}]"`), whose escapes are undone; the rest is handed on verbatim.
|
|
201
|
+
*/
|
|
202
|
+
function splitQueryFromRest(line) {
|
|
203
|
+
const trimmed = line.trimStart();
|
|
204
|
+
const quote = trimmed[0];
|
|
205
|
+
if (quote !== '"' && quote !== '\'') {
|
|
206
|
+
const space = trimmed.indexOf(' ');
|
|
207
|
+
return space < 0 ? [trimmed, ''] : [trimmed.slice(0, space), trimmed.slice(space + 1)];
|
|
208
|
+
}
|
|
209
|
+
let end = 1;
|
|
210
|
+
while (end < trimmed.length && !(trimmed[end] === quote && trimmed[end - 1] !== '\\')) {
|
|
211
|
+
end++;
|
|
212
|
+
}
|
|
213
|
+
return [trimmed.slice(1, end).replace(/\\(.)/g, '$1'), trimmed.slice(end + 1).trimStart()];
|
|
214
|
+
}
|
|
180
215
|
exports.queryCommand = {
|
|
181
216
|
description: 'Query the given R code (use \'help\' for more information)',
|
|
182
217
|
isCodeCommand: true,
|
package/cli/repl/core.js
CHANGED
|
@@ -165,8 +165,11 @@ function completionSuggestion(line, config) {
|
|
|
165
165
|
}
|
|
166
166
|
function replQueryCompleter(splitLine, startingNewArg, config) {
|
|
167
167
|
const nonEmpty = splitLine.slice(1).map(s => s.trim()).filter(s => s.length > 0);
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
/* `?<type>` documents a query instead of running it, and completes to the same names */
|
|
169
|
+
const asking = !startingNewArg && nonEmpty.length === 1 && nonEmpty[0].startsWith('?');
|
|
170
|
+
const queryShorts = asking ? Object.keys(query_1.SupportedQueries).map(q => `?${q}`)
|
|
171
|
+
: ['help'].concat(Object.keys(query_1.SupportedQueries).map(q => `@${q}`));
|
|
172
|
+
if (asking || nonEmpty.length === 0 || (nonEmpty.length === 1 && queryShorts.some(q => q.startsWith(nonEmpty[0]) && nonEmpty[0] !== q && !startingNewArg))) {
|
|
170
173
|
return { completions: queryShorts.map(q => `${q} `) };
|
|
171
174
|
}
|
|
172
175
|
else {
|
|
@@ -6,11 +6,10 @@ const logic_1 = require("../util/logic");
|
|
|
6
6
|
const semantic_cfg_guided_visitor_1 = require("./semantic-cfg-guided-visitor");
|
|
7
7
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
8
8
|
const graph_1 = require("../dataflow/graph/graph");
|
|
9
|
-
const
|
|
9
|
+
const node_value_1 = require("../dataflow/eval/resolve/node-value");
|
|
10
10
|
const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
|
|
11
11
|
const log_1 = require("../util/log");
|
|
12
12
|
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
13
|
-
const general_1 = require("../dataflow/eval/values/general");
|
|
14
13
|
const r_value_1 = require("../dataflow/eval/values/r-value");
|
|
15
14
|
const simple_visitor_1 = require("./simple-visitor");
|
|
16
15
|
const convert_values_1 = require("../r-bridge/lang-4.x/convert-values");
|
|
@@ -95,19 +94,13 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
|
|
|
95
94
|
if (this.cachedConditions.has(id)) {
|
|
96
95
|
return;
|
|
97
96
|
}
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
full: true,
|
|
101
|
-
idMap: this.config.normalizedAst.idMap,
|
|
102
|
-
resolve: this.config.ctx.config.solver.variables,
|
|
103
|
-
ctx: this.config.ctx,
|
|
104
|
-
}));
|
|
105
|
-
if (values === undefined || values.elements.length !== 1 || values.elements[0].type !== 'logical' || !(0, r_value_1.isValue)(values.elements[0].value)) {
|
|
97
|
+
const value = node_value_1.NodeValue.inGraph.soleOf(valueId, this.config.dfg, this.config.ctx, 'logical', { idMap: this.config.normalizedAst.idMap });
|
|
98
|
+
if (value === undefined || !(0, r_value_1.isValue)(value.value)) {
|
|
106
99
|
this.unableToCalculateValue(id);
|
|
107
100
|
return;
|
|
108
101
|
}
|
|
109
102
|
/* we should translate this to truthy later */
|
|
110
|
-
this.storeDefiniteValue(id, Boolean(
|
|
103
|
+
this.storeDefiniteValue(id, Boolean(value.value));
|
|
111
104
|
}
|
|
112
105
|
handleWithCondition(data) {
|
|
113
106
|
const id = data.call.id;
|
|
@@ -117,21 +110,6 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
|
|
|
117
110
|
}
|
|
118
111
|
this.handleValuesFor(id, typeof data.condition === 'object' ? data.condition.nodeId : data.condition);
|
|
119
112
|
}
|
|
120
|
-
getBoolArgValue(data) {
|
|
121
|
-
if (data.call.args.length !== 1 || data.call.args[0] === r_function_call_1.EmptyArgument) {
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
const values = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(data.call.args[0].nodeId, {
|
|
125
|
-
graph: this.config.dfg,
|
|
126
|
-
full: true,
|
|
127
|
-
idMap: this.config.normalizedAst.idMap,
|
|
128
|
-
ctx: this.config.ctx,
|
|
129
|
-
}));
|
|
130
|
-
if (values === undefined || values.elements.length !== 1 || values.elements[0].type !== 'logical' || !(0, r_value_1.isValue)(values.elements[0].value)) {
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
return Boolean(values.elements[0].value);
|
|
134
|
-
}
|
|
135
113
|
onIfThenElseCall(data) {
|
|
136
114
|
this.handleWithCondition(data);
|
|
137
115
|
}
|
|
@@ -191,9 +169,7 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
|
|
|
191
169
|
return result;
|
|
192
170
|
}
|
|
193
171
|
computeSelectedSwitchArm(v) {
|
|
194
|
-
const target =
|
|
195
|
-
graph: this.config.dfg, full: true, idMap: this.config.normalizedAst.idMap, resolve: this.config.ctx.config.solver.variables, ctx: this.config.ctx
|
|
196
|
-
});
|
|
172
|
+
const target = node_value_1.NodeValue.inGraph.singleStringOf(graph_1.FunctionArgument.getReference(v.args[0]), this.config.dfg, this.config.ctx, { idMap: this.config.normalizedAst.idMap });
|
|
197
173
|
if (target === undefined) {
|
|
198
174
|
return 'unknown';
|
|
199
175
|
}
|
|
@@ -68,6 +68,7 @@ export type CfgVertex = CfgStatementVertex | CfgExpressionVertex | CfgBasicBlock
|
|
|
68
68
|
* Helper object for {@link CfgVertex} - a vertex in the {@link ControlFlowGraph} that may have markers attached to it (e.g., for function calls).
|
|
69
69
|
*/
|
|
70
70
|
export declare const CfgVertex: {
|
|
71
|
+
readonly name: "CfgVertex";
|
|
71
72
|
/**
|
|
72
73
|
* Create a new expression vertex with the given id, children, call targets, and markers.
|
|
73
74
|
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
@@ -309,6 +310,7 @@ export type CfgEdge = CfgFlowDependencyEdge | CfgControlDependencyEdge;
|
|
|
309
310
|
* Helper object for {@link CfgEdge} - an edge in the {@link ControlFlowGraph}.
|
|
310
311
|
*/
|
|
311
312
|
export declare const CfgEdge: {
|
|
313
|
+
readonly name: "CfgEdge";
|
|
312
314
|
/**
|
|
313
315
|
* Check whether the given edge is a flow dependency edge.
|
|
314
316
|
*/
|
|
@@ -36,6 +36,7 @@ var CfgVertexType;
|
|
|
36
36
|
* Helper object for {@link CfgVertex} - a vertex in the {@link ControlFlowGraph} that may have markers attached to it (e.g., for function calls).
|
|
37
37
|
*/
|
|
38
38
|
exports.CfgVertex = {
|
|
39
|
+
name: 'CfgVertex',
|
|
39
40
|
/**
|
|
40
41
|
* Create a new expression vertex with the given id, children, call targets, and markers.
|
|
41
42
|
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
@@ -400,6 +401,7 @@ exports.CfgVertex = {
|
|
|
400
401
|
* Helper object for {@link CfgEdge} - an edge in the {@link ControlFlowGraph}.
|
|
401
402
|
*/
|
|
402
403
|
exports.CfgEdge = {
|
|
404
|
+
name: 'CfgEdge',
|
|
403
405
|
/**
|
|
404
406
|
* Check whether the given edge is a flow dependency edge.
|
|
405
407
|
*/
|
package/control-flow/diff-cfg.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.diffOfControlFlowGraphs = diffOfControlFlowGraphs;
|
|
4
|
-
const json_1 = require("../util/json");
|
|
5
4
|
const diff_graph_1 = require("../util/diff-graph");
|
|
6
5
|
const diff_1 = require("../util/diff");
|
|
7
6
|
const control_flow_graph_1 = require("./control-flow-graph");
|
|
@@ -22,7 +21,7 @@ function diffOfControlFlowGraphs(left, right, config) {
|
|
|
22
21
|
function diffDataflowGraphs(ctx) {
|
|
23
22
|
diffRootVertices(ctx);
|
|
24
23
|
diffVertices(ctx);
|
|
25
|
-
|
|
24
|
+
diff_graph_1.GraphDiff.outgoingEdges(ctx, diffEdges);
|
|
26
25
|
}
|
|
27
26
|
function diffRootVertices(ctx) {
|
|
28
27
|
(0, diff_1.setDifference)(ctx.left.rootIds(), ctx.right.rootIds(), {
|
|
@@ -90,38 +89,6 @@ function diffVertices(ctx) {
|
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
|
-
function diffOutgoingEdges(ctx) {
|
|
94
|
-
const lEdges = new Map([...ctx.left.edges()]);
|
|
95
|
-
const rEdges = new Map([...ctx.right.edges()]);
|
|
96
|
-
if (lEdges.size < rEdges.size && !ctx.config.leftIsSubgraph || lEdges.size > rEdges.size && !ctx.config.rightIsSubgraph) {
|
|
97
|
-
ctx.report.addComment(`Detected different number of edges! ${ctx.leftname} has ${lEdges.size} (${JSON.stringify(lEdges, json_1.jsonReplacer)}). ${ctx.rightname} has ${rEdges.size} ${JSON.stringify(rEdges, json_1.jsonReplacer)}`);
|
|
98
|
-
}
|
|
99
|
-
for (const [id, edge] of lEdges) {
|
|
100
|
-
/* This has nothing to do with the subset relation as we verify this in the same graph.
|
|
101
|
-
* Yet we still do the check as a subgraph may not have to have all source vertices for edges.
|
|
102
|
-
*/
|
|
103
|
-
if (!ctx.left.hasVertex(id)) {
|
|
104
|
-
if (!ctx.config.leftIsSubgraph) {
|
|
105
|
-
ctx.report.addComment(`The source ${id} of edges ${JSON.stringify(edge, json_1.jsonReplacer)} is not present in ${ctx.leftname}. This means that the graph contains an edge but not the corresponding vertex.`);
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
diffEdges(ctx, id, edge, rEdges.get(id));
|
|
110
|
-
}
|
|
111
|
-
// just to make it both ways in case the length differs
|
|
112
|
-
for (const [id, edge] of rEdges) {
|
|
113
|
-
if (!ctx.right.hasVertex(id)) {
|
|
114
|
-
if (!ctx.config.rightIsSubgraph) {
|
|
115
|
-
ctx.report.addComment(`The source ${id} of edges ${JSON.stringify(edge, json_1.jsonReplacer)} is not present in ${ctx.rightname}. This means that the graph contains an edge but not the corresponding vertex.`);
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (!ctx.config.leftIsSubgraph && !lEdges.has(id)) {
|
|
120
|
-
diffEdges(ctx, id, undefined, edge);
|
|
121
|
-
}
|
|
122
|
-
/* otherwise, we already cover the edge above */
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
92
|
function diffEdge(edge, otherEdge, ctx, id, target) {
|
|
126
93
|
const el = control_flow_graph_1.CfgEdge.getType(edge);
|
|
127
94
|
const ol = control_flow_graph_1.CfgEdge.getType(otherEdge);
|
|
@@ -140,27 +107,6 @@ function diffEdge(edge, otherEdge, ctx, id, target) {
|
|
|
140
107
|
}
|
|
141
108
|
}
|
|
142
109
|
function diffEdges(ctx, id, lEdges, rEdges) {
|
|
143
|
-
|
|
144
|
-
if ((lEdges === undefined && !ctx.config.leftIsSubgraph)
|
|
145
|
-
|| (rEdges === undefined && !ctx.config.rightIsSubgraph)) {
|
|
146
|
-
ctx.report.addComment(`Vertex ${id} has undefined outgoing edges. ${ctx.leftname}: ${JSON.stringify(lEdges, json_1.jsonReplacer)} vs ${ctx.rightname}: ${JSON.stringify(rEdges, json_1.jsonReplacer)}`, { tag: 'vertex', id });
|
|
147
|
-
}
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (lEdges.size < rEdges.size && !ctx.config.leftIsSubgraph
|
|
151
|
-
|| lEdges.size > rEdges.size && !ctx.config.rightIsSubgraph) {
|
|
152
|
-
ctx.report.addComment(`Vertex ${id} differs in number of outgoing edges. ${ctx.leftname}: [${[...lEdges.keys()].join(',')}] vs ${ctx.rightname}: [${[...rEdges.keys()].join(',')}] `, { tag: 'vertex', id });
|
|
153
|
-
}
|
|
154
|
-
// order independent compare
|
|
155
|
-
for (const [target, edge] of lEdges) {
|
|
156
|
-
const otherEdge = rEdges.get(target);
|
|
157
|
-
if (otherEdge === undefined) {
|
|
158
|
-
if (!ctx.config.rightIsSubgraph) {
|
|
159
|
-
ctx.report.addComment(`Target of ${id}->${target} in ${ctx.leftname} is not present in ${ctx.rightname}`, { tag: 'edge', from: id, to: target });
|
|
160
|
-
}
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
diffEdge(edge, otherEdge, ctx, id, target);
|
|
164
|
-
}
|
|
110
|
+
diff_graph_1.GraphDiff.edges(ctx, id, lEdges, rEdges, diffEdge);
|
|
165
111
|
}
|
|
166
112
|
//# sourceMappingURL=diff-cfg.js.map
|
|
@@ -46,6 +46,13 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
|
|
|
46
46
|
* A helper function to get the normalized AST node for the given id or fail if it does not exist.
|
|
47
47
|
*/
|
|
48
48
|
protected getNormalizedAst(id: NodeId | undefined): RNode<OtherInfo & ParentInformation> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The logical the call's only argument resolves to, `undefined` if the call does not take exactly one
|
|
51
|
+
* argument or if that argument does not resolve to a single logical.
|
|
52
|
+
*/
|
|
53
|
+
protected getBoolArgValue(data: {
|
|
54
|
+
call: DataflowGraphVertexFunctionCall;
|
|
55
|
+
}): boolean | undefined;
|
|
49
56
|
/**
|
|
50
57
|
* See {@link DataflowAwareCfgGuidedVisitor#visitValue} for the base implementation.
|
|
51
58
|
* This now dispatches the value to the appropriate event handler based on its type.
|
|
@@ -10,6 +10,8 @@ const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-functi
|
|
|
10
10
|
const convert_values_1 = require("../r-bridge/lang-4.x/convert-values");
|
|
11
11
|
const df_helper_1 = require("../dataflow/graph/df-helper");
|
|
12
12
|
const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
|
|
13
|
+
const node_value_1 = require("../dataflow/eval/resolve/node-value");
|
|
14
|
+
const r_value_1 = require("../dataflow/eval/values/r-value");
|
|
13
15
|
/**
|
|
14
16
|
* This visitor extends on the {@link DataflowAwareCfgGuidedVisitor} by dispatching visitors for separate function calls as well,
|
|
15
17
|
* providing more information!
|
|
@@ -40,6 +42,17 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
40
42
|
getNormalizedAst(id) {
|
|
41
43
|
return id === undefined ? undefined : this.config.normalizedAst.idMap.get(id);
|
|
42
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* The logical the call's only argument resolves to, `undefined` if the call does not take exactly one
|
|
47
|
+
* argument or if that argument does not resolve to a single logical.
|
|
48
|
+
*/
|
|
49
|
+
getBoolArgValue(data) {
|
|
50
|
+
if (data.call.args.length !== 1 || data.call.args[0] === r_function_call_1.EmptyArgument) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const value = node_value_1.NodeValue.inGraph.soleOf(data.call.args[0].nodeId, this.config.dfg, this.config.ctx, 'logical', { idMap: this.config.normalizedAst.idMap });
|
|
54
|
+
return value !== undefined && (0, r_value_1.isValue)(value.value) ? Boolean(value.value) : undefined;
|
|
55
|
+
}
|
|
43
56
|
/**
|
|
44
57
|
* See {@link DataflowAwareCfgGuidedVisitor#visitValue} for the base implementation.
|
|
45
58
|
* This now dispatches the value to the appropriate event handler based on its type.
|
|
@@ -262,6 +275,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
262
275
|
case built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs:
|
|
263
276
|
case built_in_proc_name_1.BuiltInProcName.Function:
|
|
264
277
|
case built_in_proc_name_1.BuiltInProcName.FunctionDefinition:
|
|
278
|
+
case built_in_proc_name_1.BuiltInProcName.StringTemplate:
|
|
265
279
|
case built_in_proc_name_1.BuiltInProcName.S7MakeConstructor:
|
|
266
280
|
case built_in_proc_name_1.BuiltInProcName.ClassGenerator:
|
|
267
281
|
case built_in_proc_name_1.BuiltInProcName.DefineArgument:
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loopyFunctions = void 0;
|
|
4
4
|
exports.onlyLoopsOnce = onlyLoopsOnce;
|
|
5
|
-
const
|
|
6
|
-
const general_1 = require("../dataflow/eval/values/general");
|
|
5
|
+
const node_value_1 = require("../dataflow/eval/resolve/node-value");
|
|
7
6
|
const r_value_1 = require("../dataflow/eval/values/r-value");
|
|
8
7
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
9
8
|
const info_1 = require("../dataflow/info");
|
|
@@ -38,16 +37,11 @@ function onlyLoopsOnce(loop, dataflow, controlflow, ast, ctx) {
|
|
|
38
37
|
if (vectorOfLoop === r_function_call_1.EmptyArgument) {
|
|
39
38
|
return undefined;
|
|
40
39
|
}
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
idMap: dataflow.idMap,
|
|
44
|
-
resolve: ctx.config.solver.variables,
|
|
45
|
-
ctx: ctx
|
|
46
|
-
}));
|
|
47
|
-
if (values?.elements.length !== 1 || values.elements[0].type !== 'vector' || !(0, r_value_1.isValue)(values.elements[0].elements)) {
|
|
40
|
+
const vector = node_value_1.NodeValue.inGraph.soleOf(vectorOfLoop.nodeId, dataflow, ctx, 'vector');
|
|
41
|
+
if (vector === undefined || !(0, r_value_1.isValue)(vector.elements)) {
|
|
48
42
|
return undefined;
|
|
49
43
|
}
|
|
50
|
-
if (
|
|
44
|
+
if (vector.elements.length === 1) {
|
|
51
45
|
return true;
|
|
52
46
|
}
|
|
53
47
|
}
|
|
@@ -70,22 +64,6 @@ class CfgSingleIterationLoopDetector extends semantic_cfg_guided_visitor_1.Seman
|
|
|
70
64
|
super(config);
|
|
71
65
|
this.loopToCheck = loop;
|
|
72
66
|
}
|
|
73
|
-
getBoolArgValue(data) {
|
|
74
|
-
if (data.call.args.length !== 1 || data.call.args[0] === r_function_call_1.EmptyArgument) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
const values = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(data.call.args[0].nodeId, {
|
|
78
|
-
graph: this.config.dfg,
|
|
79
|
-
full: true,
|
|
80
|
-
idMap: this.config.normalizedAst.idMap,
|
|
81
|
-
resolve: this.config.ctx.config.solver.variables,
|
|
82
|
-
ctx: this.config.ctx
|
|
83
|
-
}));
|
|
84
|
-
if (values?.elements.length !== 1 || values.elements[0].type != 'logical' || !(0, r_value_1.isValue)(values.elements[0].value)) {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
return Boolean(values.elements[0].value);
|
|
88
|
-
}
|
|
89
67
|
startVisitor(_) {
|
|
90
68
|
const g = this.config.controlFlow.graph;
|
|
91
69
|
const ingoing = (i) => g.ingoingEdges(i);
|
|
@@ -10,6 +10,14 @@ export interface NormalizeRequiredInput {
|
|
|
10
10
|
readonly getId?: IdGenerator<NoInfo>;
|
|
11
11
|
readonly context: FlowrAnalyzerContext;
|
|
12
12
|
}
|
|
13
|
+
/** The output formats shared by every normalization step. */
|
|
14
|
+
export declare const NormalizePrinters: {
|
|
15
|
+
readonly 0: typeof internalPrinter;
|
|
16
|
+
readonly 2: typeof normalizedAstToJson;
|
|
17
|
+
readonly 5: typeof normalizedAstToQuads;
|
|
18
|
+
readonly 3: typeof printNormalizedAstToMermaid;
|
|
19
|
+
readonly 4: typeof printNormalizedAstToMermaidUrl;
|
|
20
|
+
};
|
|
13
21
|
declare function processor(results: {
|
|
14
22
|
parse?: ParseStepOutput<string>;
|
|
15
23
|
}, input: Partial<NormalizeRequiredInput>): import("../../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project").RProject<import("../../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NORMALIZE = void 0;
|
|
3
|
+
exports.NORMALIZE = exports.NormalizePrinters = void 0;
|
|
4
4
|
const print_1 = require("../../../print/print");
|
|
5
5
|
const normalize_printer_1 = require("../../../print/normalize-printer");
|
|
6
6
|
const parser_1 = require("../../../../r-bridge/lang-4.x/ast/parser/json/parser");
|
|
7
|
+
/** The output formats shared by every normalization step. */
|
|
8
|
+
exports.NormalizePrinters = {
|
|
9
|
+
[0 /* StepOutputFormat.Internal */]: print_1.internalPrinter,
|
|
10
|
+
[2 /* StepOutputFormat.Json */]: normalize_printer_1.normalizedAstToJson,
|
|
11
|
+
[5 /* StepOutputFormat.RdfQuads */]: normalize_printer_1.normalizedAstToQuads,
|
|
12
|
+
[3 /* StepOutputFormat.Mermaid */]: normalize_printer_1.printNormalizedAstToMermaid,
|
|
13
|
+
[4 /* StepOutputFormat.MermaidUrl */]: normalize_printer_1.printNormalizedAstToMermaidUrl
|
|
14
|
+
};
|
|
7
15
|
function processor(results, input) {
|
|
8
16
|
return (0, parser_1.normalize)(results.parse, input.getId);
|
|
9
17
|
}
|
|
@@ -13,13 +21,7 @@ exports.NORMALIZE = {
|
|
|
13
21
|
description: 'Normalize the AST to flowR\'s AST',
|
|
14
22
|
processor,
|
|
15
23
|
executed: 0 /* PipelineStepStage.OncePerFile */,
|
|
16
|
-
printer:
|
|
17
|
-
[0 /* StepOutputFormat.Internal */]: print_1.internalPrinter,
|
|
18
|
-
[2 /* StepOutputFormat.Json */]: normalize_printer_1.normalizedAstToJson,
|
|
19
|
-
[5 /* StepOutputFormat.RdfQuads */]: normalize_printer_1.normalizedAstToQuads,
|
|
20
|
-
[3 /* StepOutputFormat.Mermaid */]: normalize_printer_1.printNormalizedAstToMermaid,
|
|
21
|
-
[4 /* StepOutputFormat.MermaidUrl */]: normalize_printer_1.printNormalizedAstToMermaidUrl
|
|
22
|
-
},
|
|
24
|
+
printer: exports.NormalizePrinters,
|
|
23
25
|
dependencies: ['parse'],
|
|
24
26
|
requiredInput: undefined
|
|
25
27
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { internalPrinter } from '../../../print/print';
|
|
2
|
-
import { normalizedAstToJson, normalizedAstToQuads, printNormalizedAstToMermaid, printNormalizedAstToMermaidUrl } from '../../../print/normalize-printer';
|
|
3
1
|
import { PipelineStepStage } from '../../pipeline-step';
|
|
4
2
|
import type { NormalizeRequiredInput } from './10-normalize';
|
|
5
3
|
import type { ParseStepOutput } from '../../../../r-bridge/parser';
|
|
@@ -14,11 +12,11 @@ export declare const NORMALIZE_TREE_SITTER: {
|
|
|
14
12
|
readonly processor: typeof processor;
|
|
15
13
|
readonly executed: PipelineStepStage.OncePerFile;
|
|
16
14
|
readonly printer: {
|
|
17
|
-
readonly 0: typeof internalPrinter;
|
|
18
|
-
readonly 2: typeof normalizedAstToJson;
|
|
19
|
-
readonly 5: typeof normalizedAstToQuads;
|
|
20
|
-
readonly 3: typeof printNormalizedAstToMermaid;
|
|
21
|
-
readonly 4: typeof printNormalizedAstToMermaidUrl;
|
|
15
|
+
readonly 0: typeof import("../../../print/print").internalPrinter;
|
|
16
|
+
readonly 2: typeof import("../../../print/normalize-printer").normalizedAstToJson;
|
|
17
|
+
readonly 5: typeof import("../../../print/normalize-printer").normalizedAstToQuads;
|
|
18
|
+
readonly 3: typeof import("../../../print/normalize-printer").printNormalizedAstToMermaid;
|
|
19
|
+
readonly 4: typeof import("../../../print/normalize-printer").printNormalizedAstToMermaidUrl;
|
|
22
20
|
};
|
|
23
21
|
readonly dependencies: readonly ["parse"];
|
|
24
22
|
readonly requiredInput: NormalizeRequiredInput;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NORMALIZE_TREE_SITTER = void 0;
|
|
4
|
-
const print_1 = require("../../../print/print");
|
|
5
|
-
const normalize_printer_1 = require("../../../print/normalize-printer");
|
|
6
4
|
const parser_1 = require("../../../../r-bridge/lang-4.x/ast/parser/json/parser");
|
|
5
|
+
const _10_normalize_1 = require("./10-normalize");
|
|
7
6
|
function processor(results, input) {
|
|
8
7
|
return (0, parser_1.normalizeTreeSitter)(results.parse, input.getId, input.context.config);
|
|
9
8
|
}
|
|
@@ -13,13 +12,7 @@ exports.NORMALIZE_TREE_SITTER = {
|
|
|
13
12
|
description: 'Normalize the AST to flowR\'s AST',
|
|
14
13
|
processor,
|
|
15
14
|
executed: 0 /* PipelineStepStage.OncePerFile */,
|
|
16
|
-
printer:
|
|
17
|
-
[0 /* StepOutputFormat.Internal */]: print_1.internalPrinter,
|
|
18
|
-
[2 /* StepOutputFormat.Json */]: normalize_printer_1.normalizedAstToJson,
|
|
19
|
-
[5 /* StepOutputFormat.RdfQuads */]: normalize_printer_1.normalizedAstToQuads,
|
|
20
|
-
[3 /* StepOutputFormat.Mermaid */]: normalize_printer_1.printNormalizedAstToMermaid,
|
|
21
|
-
[4 /* StepOutputFormat.MermaidUrl */]: normalize_printer_1.printNormalizedAstToMermaidUrl
|
|
22
|
-
},
|
|
15
|
+
printer: _10_normalize_1.NormalizePrinters,
|
|
23
16
|
dependencies: ['parse'],
|
|
24
17
|
requiredInput: undefined
|
|
25
18
|
};
|