@eagleoutice/flowr 2.4.8 → 2.6.0
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 +66 -45
- package/benchmark/slicer.js +1 -1
- package/benchmark/summarizer/second-phase/graph.js +2 -2
- package/cli/flowr.js +3 -29
- package/cli/repl/commands/repl-cfg.d.ts +5 -5
- package/cli/repl/commands/repl-cfg.js +21 -22
- package/cli/repl/commands/repl-commands.d.ts +3 -3
- package/cli/repl/commands/repl-commands.js +2 -0
- package/cli/repl/commands/repl-dataflow.d.ts +5 -5
- package/cli/repl/commands/repl-dataflow.js +27 -30
- package/cli/repl/commands/repl-execute.js +1 -0
- package/cli/repl/commands/repl-lineage.js +1 -0
- package/cli/repl/commands/repl-main.d.ts +34 -3
- package/cli/repl/commands/repl-normalize.d.ts +3 -3
- package/cli/repl/commands/repl-normalize.js +15 -19
- package/cli/repl/commands/repl-parse.d.ts +2 -2
- package/cli/repl/commands/repl-parse.js +13 -8
- package/cli/repl/commands/repl-query.d.ts +3 -3
- package/cli/repl/commands/repl-query.js +29 -19
- package/cli/repl/commands/repl-quit.js +1 -0
- package/cli/repl/commands/repl-version.js +1 -0
- package/cli/repl/core.d.ts +4 -1
- package/cli/repl/core.js +21 -1
- package/cli/repl/server/connection.d.ts +7 -3
- package/cli/repl/server/connection.js +40 -48
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/slicer-app.js +8 -3
- package/config.d.ts +1 -1
- package/config.js +4 -1
- package/control-flow/extract-cfg.d.ts +1 -1
- package/control-flow/extract-cfg.js +1 -1
- package/core/pipeline-executor.d.ts +5 -0
- package/core/pipeline-executor.js +5 -0
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/core/steps/pipeline/default-pipelines.d.ts +42 -42
- package/core/steps/pipeline/default-pipelines.js +4 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
- package/dataflow/graph/dataflowgraph-builder.js +6 -6
- package/documentation/doc-util/doc-query.d.ts +3 -6
- package/documentation/doc-util/doc-query.js +5 -17
- package/documentation/doc-util/doc-search.js +7 -10
- package/documentation/doc-util/doc-structure.d.ts +4 -0
- package/documentation/doc-util/doc-structure.js +28 -0
- package/documentation/doc-util/doc-types.d.ts +5 -1
- package/documentation/doc-util/doc-types.js +29 -3
- package/documentation/print-analyzer-wiki.d.ts +1 -0
- package/documentation/print-analyzer-wiki.js +137 -0
- package/documentation/print-core-wiki.d.ts +2 -1
- package/documentation/print-core-wiki.js +58 -4
- package/documentation/print-dataflow-graph-wiki.js +15 -22
- package/documentation/print-interface-wiki.js +18 -1
- package/documentation/print-linter-wiki.js +5 -1
- package/documentation/print-linting-and-testing-wiki.js +4 -0
- package/documentation/print-normalized-ast-wiki.js +6 -8
- package/documentation/print-readme.js +6 -0
- package/engines.d.ts +9 -0
- package/engines.js +38 -0
- package/linter/linter-executor.d.ts +2 -8
- package/linter/linter-executor.js +9 -4
- package/linter/linter-format.d.ts +8 -9
- package/linter/linter-rules.d.ts +57 -15
- package/linter/linter-rules.js +2 -0
- package/linter/rules/absolute-path.d.ts +1 -0
- package/linter/rules/dataframe-access-validation.d.ts +4 -3
- package/linter/rules/dataframe-access-validation.js +7 -4
- package/linter/rules/dead-code.d.ts +2 -1
- package/linter/rules/deprecated-functions.d.ts +15 -28
- package/linter/rules/deprecated-functions.js +5 -43
- package/linter/rules/file-path-validity.d.ts +2 -1
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/function-finder-util.d.ts +51 -0
- package/linter/rules/function-finder-util.js +77 -0
- package/linter/rules/naming-convention.d.ts +2 -1
- package/linter/rules/network-functions.d.ts +40 -0
- package/linter/rules/network-functions.js +24 -0
- package/linter/rules/seeded-randomness.d.ts +2 -1
- package/linter/rules/unused-definition.d.ts +2 -1
- package/linter/rules/useless-loop.d.ts +3 -2
- package/linter/rules/useless-loop.js +4 -6
- package/package.json +5 -1
- package/project/cache/flowr-analyzer-cache.d.ts +93 -0
- package/project/cache/flowr-analyzer-cache.js +156 -0
- package/project/cache/flowr-cache.d.ts +28 -0
- package/project/cache/flowr-cache.js +49 -0
- package/project/context/abstract-flowr-analyzer-context.d.ts +35 -0
- package/project/context/abstract-flowr-analyzer-context.js +46 -0
- package/project/context/flowr-analyzer-context.d.ts +48 -0
- package/project/context/flowr-analyzer-context.js +47 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +38 -0
- package/project/context/flowr-analyzer-dependencies-context.js +39 -0
- package/project/context/flowr-analyzer-files-context.d.ts +86 -0
- package/project/context/flowr-analyzer-files-context.js +130 -0
- package/project/context/flowr-analyzer-loading-order-context.d.ts +76 -0
- package/project/context/flowr-analyzer-loading-order-context.js +90 -0
- package/project/context/flowr-file.d.ts +89 -0
- package/project/context/flowr-file.js +78 -0
- package/project/flowr-analyzer-builder.d.ts +106 -0
- package/project/flowr-analyzer-builder.js +197 -0
- package/project/flowr-analyzer.d.ts +125 -0
- package/project/flowr-analyzer.js +81 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
- package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
- package/project/plugins/file-plugins/flowr-description-file.js +38 -0
- package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
- package/project/plugins/flowr-analyzer-plugin.js +82 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
- package/project/plugins/package-version-plugins/package.d.ts +15 -0
- package/project/plugins/package-version-plugins/package.js +56 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
- package/queries/base-query-format.d.ts +2 -8
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +20 -13
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
- package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
- package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
- package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.js +5 -5
- package/queries/catalog/config-query/config-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.js +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
- package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
- package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
- package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
- package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
- package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
- package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.js +2 -3
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
- package/queries/catalog/linter-query/linter-query-format.js +1 -1
- 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 +3 -2
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
- package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
- package/queries/catalog/project-query/project-query-executor.js +2 -2
- package/queries/catalog/project-query/project-query-format.d.ts +1 -54
- package/queries/catalog/project-query/project-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
- package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
- package/queries/catalog/search-query/search-query-executor.js +3 -3
- package/queries/catalog/search-query/search-query-format.d.ts +1 -54
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
- package/queries/query-print.d.ts +4 -4
- package/queries/query-print.js +12 -12
- package/queries/query.d.ts +29 -885
- package/queries/query.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
- package/r-bridge/retriever.d.ts +15 -2
- package/r-bridge/retriever.js +15 -5
- package/search/flowr-search-executor.d.ts +3 -5
- package/search/flowr-search-executor.js +6 -4
- package/search/flowr-search-filters.d.ts +12 -6
- package/search/flowr-search-filters.js +1 -1
- package/search/flowr-search.d.ts +5 -16
- package/search/flowr-search.js +14 -5
- package/search/search-executor/search-enrichers.d.ts +37 -36
- package/search/search-executor/search-enrichers.js +4 -4
- package/search/search-executor/search-generators.d.ts +12 -12
- package/search/search-executor/search-generators.js +27 -19
- package/search/search-executor/search-mappers.d.ts +5 -5
- package/search/search-executor/search-transformer.d.ts +17 -17
- package/search/search-executor/search-transformer.js +14 -7
- package/util/collections/arrays.d.ts +1 -0
- package/util/collections/arrays.js +15 -0
- package/util/collections/objectmap.d.ts +17 -0
- package/util/collections/objectmap.js +28 -0
- package/util/containers.d.ts +0 -1
- package/util/containers.js +0 -1
- package/util/files.d.ts +17 -0
- package/util/files.js +65 -0
- package/util/formats/adapter-format.d.ts +6 -0
- package/util/formats/adapter-format.js +3 -0
- package/util/formats/adapter.d.ts +18 -0
- package/util/formats/adapter.js +49 -0
- package/util/formats/adapters/r-adapter.d.ts +4 -0
- package/util/formats/adapters/r-adapter.js +7 -0
- package/util/formats/adapters/rmd-adapter.d.ts +26 -0
- package/util/formats/adapters/rmd-adapter.js +91 -0
- package/util/version.js +1 -1
|
@@ -48,20 +48,20 @@ const core_1 = require("../core");
|
|
|
48
48
|
const extract_cfg_1 = require("../../../control-flow/extract-cfg");
|
|
49
49
|
const quads_1 = require("../../../util/quads");
|
|
50
50
|
const print_1 = require("../../../core/print/print");
|
|
51
|
+
const _00_parse_1 = require("../../../core/steps/all/core/00-parse");
|
|
52
|
+
const _10_normalize_1 = require("../../../core/steps/all/core/10-normalize");
|
|
53
|
+
const _20_dataflow_1 = require("../../../core/steps/all/core/20-dataflow");
|
|
51
54
|
const ansi_1 = require("../../../util/text/ansi");
|
|
52
55
|
const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
|
|
53
56
|
const graph_1 = require("../../../dataflow/graph/graph");
|
|
54
57
|
const tmp = __importStar(require("tmp"));
|
|
55
58
|
const fs_1 = __importDefault(require("fs"));
|
|
56
|
-
const magic_comments_1 = require("../../../reconstruct/auto-select/magic-comments");
|
|
57
59
|
const message_lineage_1 = require("./messages/message-lineage");
|
|
58
60
|
const repl_lineage_1 = require("../commands/repl-lineage");
|
|
59
|
-
const assert_1 = require("../../../util/assert");
|
|
60
|
-
const auto_select_defaults_1 = require("../../../reconstruct/auto-select/auto-select-defaults");
|
|
61
61
|
const message_query_1 = require("./messages/message-query");
|
|
62
|
-
const query_1 = require("../../../queries/query");
|
|
63
62
|
const compact_1 = require("./compact");
|
|
64
63
|
const _00_slice_1 = require("../../../core/steps/all/static-slicing/00-slice");
|
|
64
|
+
const flowr_analyzer_builder_1 = require("../../../project/flowr-analyzer-builder");
|
|
65
65
|
/**
|
|
66
66
|
* Each connection handles a single client, answering to its requests.
|
|
67
67
|
* There is no need to construct this class manually, {@link FlowRServer} will do it for you.
|
|
@@ -117,7 +117,7 @@ class FlowRServerConnection {
|
|
|
117
117
|
this.handleRepl(request.message);
|
|
118
118
|
break;
|
|
119
119
|
case 'request-lineage':
|
|
120
|
-
this.handleLineageRequest(request.message);
|
|
120
|
+
void this.handleLineageRequest(request.message);
|
|
121
121
|
break;
|
|
122
122
|
case 'request-query':
|
|
123
123
|
this.handleQueryRequest(request.message);
|
|
@@ -146,9 +146,11 @@ class FlowRServerConnection {
|
|
|
146
146
|
this.fileMap.delete(message.filetoken);
|
|
147
147
|
}
|
|
148
148
|
const tempFile = tmp.fileSync({ postfix: '.R' });
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
.
|
|
149
|
+
const analyzer = await this.createAnalyzerForRequest(message, tempFile.name);
|
|
150
|
+
try {
|
|
151
|
+
await this.sendFileAnalysisResponse(analyzer, message);
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
152
154
|
this.logger.error(`[${this.name}] Error while analyzing file ${message.filename ?? 'unknown file'}: ${String(e)}`);
|
|
153
155
|
(0, send_1.sendMessage)(this.socket, {
|
|
154
156
|
id: message.id,
|
|
@@ -156,22 +158,17 @@ class FlowRServerConnection {
|
|
|
156
158
|
fatal: false,
|
|
157
159
|
reason: `Error while analyzing file ${message.filename ?? 'unknown file'}: ${String(e)}`
|
|
158
160
|
});
|
|
159
|
-
}
|
|
161
|
+
}
|
|
160
162
|
// this is an interestingly named function that means "I am a callback that removes a file" - so this deletes the file
|
|
161
163
|
tempFile.removeCallback();
|
|
162
164
|
}
|
|
163
|
-
async sendFileAnalysisResponse(
|
|
165
|
+
async sendFileAnalysisResponse(analyzer, message) {
|
|
164
166
|
let cfg = undefined;
|
|
165
167
|
if (message.cfg) {
|
|
166
|
-
cfg =
|
|
168
|
+
cfg = await analyzer.controlflow();
|
|
167
169
|
}
|
|
168
170
|
const config = () => ({ context: message.filename ?? 'unknown', getId: (0, quads_1.defaultQuadIdGenerator)() });
|
|
169
|
-
const sanitizedResults = sanitizeAnalysisResults(
|
|
170
|
-
const pipeline = slicer.getPipeline();
|
|
171
|
-
const parseStep = pipeline.steps.get('parse');
|
|
172
|
-
const normalizedStep = pipeline.steps.get('normalize');
|
|
173
|
-
const dataflowStep = pipeline.steps.get('dataflow');
|
|
174
|
-
(0, assert_1.guard)(parseStep !== undefined && normalizedStep !== undefined && dataflowStep !== undefined, 'All steps must be present');
|
|
171
|
+
const sanitizedResults = sanitizeAnalysisResults(await analyzer.parse(), await analyzer.normalize(), await analyzer.dataflow());
|
|
175
172
|
if (message.format === 'n-quads') {
|
|
176
173
|
(0, send_1.sendMessage)(this.socket, {
|
|
177
174
|
type: 'response-file-analysis',
|
|
@@ -179,9 +176,9 @@ class FlowRServerConnection {
|
|
|
179
176
|
id: message.id,
|
|
180
177
|
cfg: cfg ? (0, extract_cfg_1.cfg2quads)(cfg, config()) : undefined,
|
|
181
178
|
results: {
|
|
182
|
-
parse: await (0, print_1.printStepResult)(
|
|
183
|
-
normalize: await (0, print_1.printStepResult)(
|
|
184
|
-
dataflow: await (0, print_1.printStepResult)(
|
|
179
|
+
parse: await (0, print_1.printStepResult)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, await analyzer.parse(), 5 /* StepOutputFormat.RdfQuads */, config()),
|
|
180
|
+
normalize: await (0, print_1.printStepResult)(_10_normalize_1.NORMALIZE, await analyzer.normalize(), 5 /* StepOutputFormat.RdfQuads */, config()),
|
|
181
|
+
dataflow: await (0, print_1.printStepResult)(_20_dataflow_1.STATIC_DATAFLOW, await analyzer.dataflow(), 5 /* StepOutputFormat.RdfQuads */, config())
|
|
185
182
|
}
|
|
186
183
|
});
|
|
187
184
|
}
|
|
@@ -204,7 +201,7 @@ class FlowRServerConnection {
|
|
|
204
201
|
});
|
|
205
202
|
}
|
|
206
203
|
}
|
|
207
|
-
|
|
204
|
+
async createAnalyzerForRequest(message, tempFile) {
|
|
208
205
|
let request;
|
|
209
206
|
if (message.content !== undefined) {
|
|
210
207
|
// we store the code in a temporary file in case it's too big for the shell to handle
|
|
@@ -222,18 +219,18 @@ class FlowRServerConnection {
|
|
|
222
219
|
else {
|
|
223
220
|
throw new Error('Either content or filepath must be defined.');
|
|
224
221
|
}
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
222
|
+
const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder(request)
|
|
223
|
+
.setConfig(this.config)
|
|
224
|
+
.setParser(this.parser)
|
|
225
|
+
.build();
|
|
229
226
|
if (message.filetoken) {
|
|
230
227
|
this.logger.info(`Storing file token ${message.filetoken}`);
|
|
231
228
|
this.fileMap.set(message.filetoken, {
|
|
232
229
|
filename: message.filename,
|
|
233
|
-
|
|
230
|
+
analyzer: analyzer
|
|
234
231
|
});
|
|
235
232
|
}
|
|
236
|
-
return
|
|
233
|
+
return analyzer;
|
|
237
234
|
}
|
|
238
235
|
handleSliceRequest(base) {
|
|
239
236
|
const requestResult = (0, validate_1.validateMessage)(base, message_slice_1.requestSliceMessage);
|
|
@@ -253,16 +250,16 @@ class FlowRServerConnection {
|
|
|
253
250
|
});
|
|
254
251
|
return;
|
|
255
252
|
}
|
|
256
|
-
fileInformation.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
253
|
+
void fileInformation.analyzer.query([{
|
|
254
|
+
type: 'static-slice',
|
|
255
|
+
criteria: request.criterion,
|
|
256
|
+
noMagicComments: request.noMagicComments,
|
|
257
|
+
direction: request.direction
|
|
258
|
+
}]).then(result => {
|
|
262
259
|
(0, send_1.sendMessage)(this.socket, {
|
|
263
260
|
type: 'response-slice',
|
|
264
261
|
id: request.id,
|
|
265
|
-
results: Object.fromEntries(Object.entries(
|
|
262
|
+
results: Object.fromEntries(Object.entries(result)
|
|
266
263
|
.filter(([k,]) => default_pipelines_1.DEFAULT_SLICING_PIPELINE.steps.get(k)?.executed === 1 /* PipelineStepStage.OncePerRequest */))
|
|
267
264
|
});
|
|
268
265
|
}).catch(e => {
|
|
@@ -301,7 +298,7 @@ class FlowRServerConnection {
|
|
|
301
298
|
});
|
|
302
299
|
});
|
|
303
300
|
}
|
|
304
|
-
handleLineageRequest(base) {
|
|
301
|
+
async handleLineageRequest(base) {
|
|
305
302
|
const requestResult = (0, validate_1.validateMessage)(base, message_lineage_1.requestLineageMessage);
|
|
306
303
|
if (requestResult.type === 'error') {
|
|
307
304
|
(0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
|
|
@@ -319,10 +316,8 @@ class FlowRServerConnection {
|
|
|
319
316
|
});
|
|
320
317
|
return;
|
|
321
318
|
}
|
|
322
|
-
const
|
|
323
|
-
(0,
|
|
324
|
-
(0, assert_1.guard)(ast !== undefined, `AST must be present (request: ${request.filetoken})`);
|
|
325
|
-
const lineageIds = (0, repl_lineage_1.getLineage)(request.criterion, dfg.graph, ast.idMap);
|
|
319
|
+
const analyzer = fileInformation.analyzer;
|
|
320
|
+
const lineageIds = (0, repl_lineage_1.getLineage)(request.criterion, (await analyzer.dataflow()).graph, (await analyzer.normalize()).idMap);
|
|
326
321
|
(0, send_1.sendMessage)(this.socket, {
|
|
327
322
|
type: 'response-lineage',
|
|
328
323
|
id: request.id,
|
|
@@ -347,10 +342,7 @@ class FlowRServerConnection {
|
|
|
347
342
|
});
|
|
348
343
|
return;
|
|
349
344
|
}
|
|
350
|
-
|
|
351
|
-
(0, assert_1.guard)(dfg !== undefined, `Dataflow graph must be present (request: ${request.filetoken})`);
|
|
352
|
-
(0, assert_1.guard)(ast !== undefined, `AST must be present (request: ${request.filetoken})`);
|
|
353
|
-
void Promise.resolve((0, query_1.executeQueries)({ dataflow: dfg, ast, config: this.config }, request.query)).then(results => {
|
|
345
|
+
void Promise.resolve(fileInformation.analyzer.query(request.query)).then(results => {
|
|
354
346
|
(0, send_1.sendMessage)(this.socket, {
|
|
355
347
|
type: 'response-query',
|
|
356
348
|
id: request.id,
|
|
@@ -368,17 +360,17 @@ class FlowRServerConnection {
|
|
|
368
360
|
}
|
|
369
361
|
}
|
|
370
362
|
exports.FlowRServerConnection = FlowRServerConnection;
|
|
371
|
-
function sanitizeAnalysisResults(
|
|
363
|
+
function sanitizeAnalysisResults(parse, normalize, dataflow) {
|
|
372
364
|
return {
|
|
373
|
-
|
|
365
|
+
parse: parse,
|
|
374
366
|
normalize: {
|
|
375
|
-
...
|
|
367
|
+
...normalize,
|
|
376
368
|
idMap: undefined
|
|
377
369
|
},
|
|
378
370
|
dataflow: {
|
|
379
|
-
...
|
|
371
|
+
...dataflow,
|
|
380
372
|
// we want to keep the DataflowGraph type information, but not the idMap
|
|
381
|
-
graph: new graph_1.DataflowGraph(undefined).mergeWith(
|
|
373
|
+
graph: new graph_1.DataflowGraph(undefined).mergeWith(dataflow?.graph)
|
|
382
374
|
}
|
|
383
375
|
};
|
|
384
376
|
}
|
|
@@ -17,7 +17,7 @@ export interface SliceRequestMessage extends IdMessageBase {
|
|
|
17
17
|
/** The direction to slice in. Defaults to backward slicing if unset. */
|
|
18
18
|
direction?: SliceDirection;
|
|
19
19
|
/**
|
|
20
|
-
* Should the magic comments (force-including lines within the slice) be
|
|
20
|
+
* Should the magic comments (force-including lines within the slice) be ignored?
|
|
21
21
|
*/
|
|
22
22
|
noMagicComments?: boolean;
|
|
23
23
|
}
|
package/cli/slicer-app.js
CHANGED
|
@@ -15,6 +15,7 @@ const print_1 = require("../benchmark/stats/print");
|
|
|
15
15
|
const magic_comments_1 = require("../reconstruct/auto-select/magic-comments");
|
|
16
16
|
const auto_select_defaults_1 = require("../reconstruct/auto-select/auto-select-defaults");
|
|
17
17
|
const config_1 = require("../config");
|
|
18
|
+
const adapter_1 = require("../util/formats/adapter");
|
|
18
19
|
const options = (0, script_1.processCommandLineArgs)('slicer', ['input', 'criterion'], {
|
|
19
20
|
subtitle: 'Slice R code based on a given slicing criterion',
|
|
20
21
|
examples: [
|
|
@@ -31,8 +32,8 @@ async function getSlice() {
|
|
|
31
32
|
(0, assert_1.guard)(options.criterion !== undefined, 'a slicing criterion must be given');
|
|
32
33
|
const config = (0, config_1.getConfig)();
|
|
33
34
|
await slicer.init(options['input-is-text']
|
|
34
|
-
?
|
|
35
|
-
:
|
|
35
|
+
? (0, adapter_1.requestFromText)(options.input.replaceAll('\\n', '\n'))
|
|
36
|
+
: (0, adapter_1.requestFromFile)(options.input), config, options['no-magic-comments'] ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect));
|
|
36
37
|
let mappedSlices = [];
|
|
37
38
|
let reconstruct = undefined;
|
|
38
39
|
const doSlicing = options.criterion.trim() !== '';
|
|
@@ -74,7 +75,11 @@ async function getSlice() {
|
|
|
74
75
|
}
|
|
75
76
|
else {
|
|
76
77
|
if (doSlicing && options.diff) {
|
|
77
|
-
|
|
78
|
+
let originalCode = options.input;
|
|
79
|
+
if (!options['input-is-text']) {
|
|
80
|
+
const request = (0, adapter_1.requestFromFile)(options.input);
|
|
81
|
+
originalCode = request.request === 'text' ? request.content : fs_1.default.readFileSync(request.content).toString();
|
|
82
|
+
}
|
|
78
83
|
console.log((0, slice_diff_ansi_1.sliceDiffAnsi)(slice.result, normalize, new Set(mappedSlices.map(({ id }) => id)), originalCode));
|
|
79
84
|
}
|
|
80
85
|
if (options.stats) {
|
package/config.d.ts
CHANGED
|
@@ -209,7 +209,7 @@ export declare function parseConfig(jsonString: string): FlowrConfigOptions | un
|
|
|
209
209
|
/**
|
|
210
210
|
* Creates a new flowr config that has the updated values.
|
|
211
211
|
*/
|
|
212
|
-
export declare function amendConfig(config: FlowrConfigOptions, amendmentFunc: (config: DeepWritable<FlowrConfigOptions>) => FlowrConfigOptions): FlowrConfigOptions;
|
|
212
|
+
export declare function amendConfig(config: FlowrConfigOptions, amendmentFunc: (config: DeepWritable<FlowrConfigOptions>) => FlowrConfigOptions | void): FlowrConfigOptions;
|
|
213
213
|
export declare function cloneConfig(config: FlowrConfigOptions): FlowrConfigOptions;
|
|
214
214
|
export declare function getConfig(configFile?: string, configWorkingDirectory?: string): FlowrConfigOptions;
|
|
215
215
|
export declare function getEngineConfig<T extends EngineConfig['type']>(config: FlowrConfigOptions, engine: T): EngineConfig & {
|
package/config.js
CHANGED
|
@@ -162,8 +162,11 @@ function parseConfig(jsonString) {
|
|
|
162
162
|
/**
|
|
163
163
|
* Creates a new flowr config that has the updated values.
|
|
164
164
|
*/
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
165
166
|
function amendConfig(config, amendmentFunc) {
|
|
166
|
-
|
|
167
|
+
const newConfig = cloneConfig(config);
|
|
168
|
+
amendmentFunc(newConfig);
|
|
169
|
+
return newConfig;
|
|
167
170
|
}
|
|
168
171
|
function cloneConfig(config) {
|
|
169
172
|
return JSON.parse(JSON.stringify(config));
|
|
@@ -18,7 +18,7 @@ import type { FlowrConfigOptions } from '../config';
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function extractCfg<Info = ParentInformation>(ast: NormalizedAst<Info & ParentInformation>, config: FlowrConfigOptions, graph?: DataflowGraph, simplifications?: readonly CfgSimplificationPassName[]): ControlFlowInformation;
|
|
20
20
|
/**
|
|
21
|
-
* A version of {@link extractCfg} that is much quicker and does not apply any
|
|
21
|
+
* A version of {@link extractCfg} that is much quicker and does not apply any simplifications or dataflow information.
|
|
22
22
|
*/
|
|
23
23
|
export declare function extractCfgQuick<Info = ParentInformation>(ast: NormalizedAst<Info>): ControlFlowInformation<import("./control-flow-graph").CfgSimpleVertex>;
|
|
24
24
|
export declare const ResolvedCallSuffix = "-resolved-call-exit";
|
|
@@ -67,7 +67,7 @@ function extractCfg(ast, config, graph, simplifications) {
|
|
|
67
67
|
return (0, cfg_simplification_1.simplifyControlFlowInformation)((0, fold_1.foldAst)(ast.ast, graph ? dataflowCfgFolds(graph) : cfgFolds), { ast, dfg: graph, config }, simplifications);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* A version of {@link extractCfg} that is much quicker and does not apply any
|
|
70
|
+
* A version of {@link extractCfg} that is much quicker and does not apply any simplifications or dataflow information.
|
|
71
71
|
*/
|
|
72
72
|
function extractCfgQuick(ast) {
|
|
73
73
|
return (0, fold_1.foldAst)(ast.ast, cfgFolds);
|
|
@@ -3,6 +3,10 @@ import { PipelineStepStage } from './steps/pipeline-step';
|
|
|
3
3
|
import type { Pipeline, PipelineInput, PipelineOutput, PipelinePerRequestInput, PipelineStepOutputWithName } from './steps/pipeline/pipeline';
|
|
4
4
|
import type { FlowrConfigOptions } from '../config';
|
|
5
5
|
/**
|
|
6
|
+
* **Please note:** The {@link PipelineExecutor} is now considered to be a rather low-level API for flowR. While it still works
|
|
7
|
+
* and is the basis for all other layers, we strongly recommend using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder}
|
|
8
|
+
* to create and use an analyzer instance that is pre-configured for your use-case.
|
|
9
|
+
*
|
|
6
10
|
* The pipeline executor allows to execute arbitrary {@link Pipeline|pipelines} in a step-by-step fashion.
|
|
7
11
|
* If you are not yet in the possession of a {@link Pipeline|pipeline}, you can use the {@link createPipeline} function
|
|
8
12
|
* to create one for yourself, based on the steps that you want to execute.
|
|
@@ -98,6 +102,7 @@ export declare class PipelineExecutor<P extends Pipeline> {
|
|
|
98
102
|
* The required additional input is specified by the {@link IPipelineStep#requiredInput|required input configuration} of each step in the `pipeline`.
|
|
99
103
|
*
|
|
100
104
|
* Please see {@link createDataflowPipeline} and friends for engine agnostic shortcuts to create a pipeline executor.
|
|
105
|
+
* And in general, please prefer using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder} to create and use an analyzer instance.
|
|
101
106
|
*
|
|
102
107
|
* @param pipeline - The {@link Pipeline} to execute, probably created with {@link createPipeline}.
|
|
103
108
|
* @param input - External {@link PipelineInput|configuration and input} required to execute the given pipeline.
|
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PipelineExecutor = void 0;
|
|
4
4
|
const assert_1 = require("../util/assert");
|
|
5
5
|
/**
|
|
6
|
+
* **Please note:** The {@link PipelineExecutor} is now considered to be a rather low-level API for flowR. While it still works
|
|
7
|
+
* and is the basis for all other layers, we strongly recommend using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder}
|
|
8
|
+
* to create and use an analyzer instance that is pre-configured for your use-case.
|
|
9
|
+
*
|
|
6
10
|
* The pipeline executor allows to execute arbitrary {@link Pipeline|pipelines} in a step-by-step fashion.
|
|
7
11
|
* If you are not yet in the possession of a {@link Pipeline|pipeline}, you can use the {@link createPipeline} function
|
|
8
12
|
* to create one for yourself, based on the steps that you want to execute.
|
|
@@ -98,6 +102,7 @@ class PipelineExecutor {
|
|
|
98
102
|
* The required additional input is specified by the {@link IPipelineStep#requiredInput|required input configuration} of each step in the `pipeline`.
|
|
99
103
|
*
|
|
100
104
|
* Please see {@link createDataflowPipeline} and friends for engine agnostic shortcuts to create a pipeline executor.
|
|
105
|
+
* And in general, please prefer using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder} to create and use an analyzer instance.
|
|
101
106
|
*
|
|
102
107
|
* @param pipeline - The {@link Pipeline} to execute, probably created with {@link createPipeline}.
|
|
103
108
|
* @param input - External {@link PipelineInput|configuration and input} required to execute the given pipeline.
|
|
@@ -27,7 +27,7 @@ function verifyAndBuildPipeline(steps) {
|
|
|
27
27
|
// now, we do the same for the per-request steps, keeping the per-file steps known
|
|
28
28
|
initializeSteps(perRequestSteps, perRequestStepMap, initsPerRequest, visited);
|
|
29
29
|
const sortedPerRequest = topologicalSort(initsPerRequest, perRequestStepMap, visited);
|
|
30
|
-
const sorted =
|
|
30
|
+
const sorted = sortedPerFile.concat(sortedPerRequest);
|
|
31
31
|
validateStepOutput(sorted, perRequestStepMap, steps);
|
|
32
32
|
return {
|
|
33
33
|
steps: perRequestStepMap,
|
|
@@ -8,20 +8,6 @@ import type { RShell } from '../../../r-bridge/shell';
|
|
|
8
8
|
import type { TreeSitterExecutor } from '../../../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor';
|
|
9
9
|
import type { FlowrConfigOptions } from '../../../config';
|
|
10
10
|
export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
|
|
11
|
-
readonly name: "slice";
|
|
12
|
-
readonly humanReadableName: "static slice";
|
|
13
|
-
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
14
|
-
readonly processor: (results: {
|
|
15
|
-
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
16
|
-
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
17
|
-
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
18
|
-
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
19
|
-
readonly printer: {
|
|
20
|
-
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
21
|
-
};
|
|
22
|
-
readonly dependencies: readonly ["dataflow"];
|
|
23
|
-
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
24
|
-
} | {
|
|
25
11
|
readonly name: "parse";
|
|
26
12
|
readonly humanReadableName: "parse with R shell";
|
|
27
13
|
readonly description: "Parse the given R code into an AST";
|
|
@@ -54,6 +40,20 @@ export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
|
|
|
54
40
|
};
|
|
55
41
|
readonly dependencies: readonly ["parse"];
|
|
56
42
|
readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
|
|
43
|
+
} | {
|
|
44
|
+
readonly name: "slice";
|
|
45
|
+
readonly humanReadableName: "static slice";
|
|
46
|
+
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
47
|
+
readonly processor: (results: {
|
|
48
|
+
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
49
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
50
|
+
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
51
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
52
|
+
readonly printer: {
|
|
53
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
54
|
+
};
|
|
55
|
+
readonly dependencies: readonly ["dataflow"];
|
|
56
|
+
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
57
57
|
} | {
|
|
58
58
|
readonly humanReadableName: "dataflow";
|
|
59
59
|
readonly processor: (results: {
|
|
@@ -90,20 +90,6 @@ export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
|
|
|
90
90
|
readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
|
|
91
91
|
}>;
|
|
92
92
|
export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline").Pipeline<{
|
|
93
|
-
readonly name: "slice";
|
|
94
|
-
readonly humanReadableName: "static slice";
|
|
95
|
-
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
96
|
-
readonly processor: (results: {
|
|
97
|
-
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
98
|
-
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
99
|
-
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
100
|
-
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
101
|
-
readonly printer: {
|
|
102
|
-
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
103
|
-
};
|
|
104
|
-
readonly dependencies: readonly ["dataflow"];
|
|
105
|
-
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
106
|
-
} | {
|
|
107
93
|
readonly name: "parse";
|
|
108
94
|
readonly humanReadableName: "parse with R shell";
|
|
109
95
|
readonly description: "Parse the given R code into an AST";
|
|
@@ -136,6 +122,20 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
|
|
|
136
122
|
};
|
|
137
123
|
readonly dependencies: readonly ["parse"];
|
|
138
124
|
readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
|
|
125
|
+
} | {
|
|
126
|
+
readonly name: "slice";
|
|
127
|
+
readonly humanReadableName: "static slice";
|
|
128
|
+
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
129
|
+
readonly processor: (results: {
|
|
130
|
+
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
131
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
132
|
+
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
133
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
134
|
+
readonly printer: {
|
|
135
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
136
|
+
};
|
|
137
|
+
readonly dependencies: readonly ["dataflow"];
|
|
138
|
+
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
139
139
|
} | {
|
|
140
140
|
readonly humanReadableName: "dataflow";
|
|
141
141
|
readonly processor: (results: {
|
|
@@ -172,20 +172,6 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
|
|
|
172
172
|
readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
|
|
173
173
|
}>;
|
|
174
174
|
export declare const DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipeline").Pipeline<{
|
|
175
|
-
readonly name: "slice";
|
|
176
|
-
readonly humanReadableName: "static slice";
|
|
177
|
-
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
178
|
-
readonly processor: (results: {
|
|
179
|
-
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
180
|
-
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
181
|
-
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
182
|
-
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
183
|
-
readonly printer: {
|
|
184
|
-
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
185
|
-
};
|
|
186
|
-
readonly dependencies: readonly ["dataflow"];
|
|
187
|
-
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
188
|
-
} | {
|
|
189
175
|
readonly name: "parse";
|
|
190
176
|
readonly humanReadableName: "parse with R shell";
|
|
191
177
|
readonly description: "Parse the given R code into an AST";
|
|
@@ -218,6 +204,20 @@ export declare const DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipel
|
|
|
218
204
|
};
|
|
219
205
|
readonly dependencies: readonly ["parse"];
|
|
220
206
|
readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
|
|
207
|
+
} | {
|
|
208
|
+
readonly name: "slice";
|
|
209
|
+
readonly humanReadableName: "static slice";
|
|
210
|
+
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
211
|
+
readonly processor: (results: {
|
|
212
|
+
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
213
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
214
|
+
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
215
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
216
|
+
readonly printer: {
|
|
217
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
218
|
+
};
|
|
219
|
+
readonly dependencies: readonly ["dataflow"];
|
|
220
|
+
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
221
221
|
} | {
|
|
222
222
|
readonly humanReadableName: "dataflow";
|
|
223
223
|
readonly processor: (results: {
|
|
@@ -33,6 +33,7 @@ exports.TREE_SITTER_NORMALIZE_PIPELINE = (0, pipeline_1.createPipeline)(_01_pars
|
|
|
33
33
|
exports.DEFAULT_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP);
|
|
34
34
|
exports.TREE_SITTER_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_tree_sitter_1.PARSE_WITH_TREE_SITTER_STEP);
|
|
35
35
|
/**
|
|
36
|
+
* **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
|
|
36
37
|
* Returns either a {@link DEFAULT_PARSE_PIPELINE} or a {@link TREE_SITTER_PARSE_PIPELINE} depending on the parser used.
|
|
37
38
|
*
|
|
38
39
|
* @see {@link createNormalizePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
|
|
@@ -45,6 +46,7 @@ function createParsePipeline(parser, inputs, config) {
|
|
|
45
46
|
}, config);
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
49
|
+
* **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
|
|
48
50
|
* Returns either a {@link DEFAULT_SLICING_PIPELINE} or a {@link TREE_SITTER_SLICING_PIPELINE} depending on the parser used.
|
|
49
51
|
*
|
|
50
52
|
* @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createDataflowPipeline}
|
|
@@ -57,6 +59,7 @@ function createSlicePipeline(parser, inputs, config) {
|
|
|
57
59
|
}, config);
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
62
|
+
* **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
|
|
60
63
|
* Returns either a {@link DEFAULT_NORMALIZE_PIPELINE} or a {@link TREE_SITTER_NORMALIZE_PIPELINE} depending on the parser used.
|
|
61
64
|
*
|
|
62
65
|
* @see {@link createParsePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
|
|
@@ -69,10 +72,10 @@ function createNormalizePipeline(parser, inputs, config) {
|
|
|
69
72
|
}, config);
|
|
70
73
|
}
|
|
71
74
|
/**
|
|
75
|
+
* **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
|
|
72
76
|
* Returns either a {@link DEFAULT_DATAFLOW_PIPELINE} or a {@link TREE_SITTER_DATAFLOW_PIPELINE} depending on the parser used.
|
|
73
77
|
*
|
|
74
78
|
* @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createSlicePipeline}
|
|
75
|
-
*
|
|
76
79
|
*/
|
|
77
80
|
function createDataflowPipeline(parser, inputs, config) {
|
|
78
81
|
const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_DATAFLOW_PIPELINE : exports.DEFAULT_DATAFLOW_PIPELINE;
|
|
@@ -7,8 +7,7 @@ import type { DataflowGraphVertexAstLink, DataflowGraphVertexUse, FunctionOrigin
|
|
|
7
7
|
import type { ControlDependency } from '../info';
|
|
8
8
|
import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
9
9
|
import type { FlowrSearchLike } from '../../search/flowr-search-builder';
|
|
10
|
-
import type {
|
|
11
|
-
import type { FlowrSearchInput } from '../../search/flowr-search';
|
|
10
|
+
import type { FlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
12
11
|
export declare function emptyGraph(idMap?: AstIdMap): DataflowGraphBuilder;
|
|
13
12
|
export type DataflowGraphEdgeTarget = NodeId | (readonly NodeId[]);
|
|
14
13
|
/**
|
|
@@ -103,9 +102,9 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
103
102
|
*
|
|
104
103
|
* @param from - Either a node id or a query to find the node id.
|
|
105
104
|
* @param to - Either a node id or a query to find the node id.
|
|
106
|
-
* @param
|
|
105
|
+
* @param input - The input to search in i.e. the dataflow graph.
|
|
107
106
|
*/
|
|
108
|
-
readsQuery
|
|
107
|
+
readsQuery(from: FromQueryParam, to: ToQueryParam, input: FlowrAnalysisProvider): Promise<this>;
|
|
109
108
|
/**
|
|
110
109
|
* Adds a **defined-by edge** with from as defined variable, and to
|
|
111
110
|
* as a variable/function contributing to its definition.
|
|
@@ -118,7 +117,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
118
117
|
*
|
|
119
118
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
120
119
|
*/
|
|
121
|
-
definedByQuery
|
|
120
|
+
definedByQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
122
121
|
/**
|
|
123
122
|
* Adds a **call edge** with from as caller, and to as callee.
|
|
124
123
|
*
|
|
@@ -130,7 +129,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
130
129
|
*
|
|
131
130
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
132
131
|
*/
|
|
133
|
-
callsQuery
|
|
132
|
+
callsQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
134
133
|
/**
|
|
135
134
|
* Adds a **return edge** with from as function, and to as exit point.
|
|
136
135
|
*
|
|
@@ -142,7 +141,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
142
141
|
*
|
|
143
142
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
144
143
|
*/
|
|
145
|
-
returnsQuery
|
|
144
|
+
returnsQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
146
145
|
/**
|
|
147
146
|
* Adds a **defines-on-call edge** with from as variable, and to as its definition
|
|
148
147
|
*
|
|
@@ -154,7 +153,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
154
153
|
*
|
|
155
154
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
156
155
|
*/
|
|
157
|
-
definesOnCallQuery
|
|
156
|
+
definesOnCallQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
158
157
|
/**
|
|
159
158
|
* Adds a **defined-by-on-call edge** with from as definition, and to as variable.
|
|
160
159
|
*
|
|
@@ -166,7 +165,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
166
165
|
*
|
|
167
166
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
168
167
|
*/
|
|
169
|
-
definedByOnCallQuery
|
|
168
|
+
definedByOnCallQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
170
169
|
/**
|
|
171
170
|
* Adds an **argument edge** with from as function call, and to as argument.
|
|
172
171
|
*
|
|
@@ -178,7 +177,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
178
177
|
*
|
|
179
178
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
180
179
|
*/
|
|
181
|
-
argumentQuery
|
|
180
|
+
argumentQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
182
181
|
/**
|
|
183
182
|
* Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
|
|
184
183
|
*
|
|
@@ -190,7 +189,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
190
189
|
*
|
|
191
190
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
192
191
|
*/
|
|
193
|
-
nseQuery
|
|
192
|
+
nseQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
194
193
|
/**
|
|
195
194
|
* Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
|
|
196
195
|
*
|
|
@@ -202,7 +201,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
202
201
|
*
|
|
203
202
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
204
203
|
*/
|
|
205
|
-
sideEffectOnCallQuery
|
|
204
|
+
sideEffectOnCallQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
206
205
|
/**
|
|
207
206
|
* explicitly overwrite the root ids of the graph,
|
|
208
207
|
* this is just an easier variant in case you working with a lot of functions this saves you a lot of `false` flags.
|
|
@@ -174,13 +174,13 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
174
174
|
}
|
|
175
175
|
return this.addEdge((0, node_id_1.normalizeIdToNumberIfPossible)(from), (0, node_id_1.normalizeIdToNumberIfPossible)(to), type);
|
|
176
176
|
}
|
|
177
|
-
queryHelper(from, to, data, type) {
|
|
177
|
+
async queryHelper(from, to, data, type) {
|
|
178
178
|
let fromId;
|
|
179
179
|
if ('nodeId' in from) {
|
|
180
180
|
fromId = from.nodeId;
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
183
|
-
const result = (0, flowr_search_executor_1.runSearch)(from.query, data).getElements();
|
|
183
|
+
const result = (await (0, flowr_search_executor_1.runSearch)(from.query, data)).getElements();
|
|
184
184
|
(0, assert_1.guard)(result.length === 1, `from query result should yield exactly one node, but yielded ${result.length}`);
|
|
185
185
|
fromId = result[0].node.info.id;
|
|
186
186
|
}
|
|
@@ -189,7 +189,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
189
189
|
toIds = to.target;
|
|
190
190
|
}
|
|
191
191
|
else {
|
|
192
|
-
const result = (0, flowr_search_executor_1.runSearch)(to.query, data).getElements();
|
|
192
|
+
const result = (await (0, flowr_search_executor_1.runSearch)(to.query, data)).getElements();
|
|
193
193
|
toIds = result.map(r => r.node.info.id);
|
|
194
194
|
}
|
|
195
195
|
return this.edgeHelper(fromId, toIds, type);
|
|
@@ -209,10 +209,10 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
209
209
|
*
|
|
210
210
|
* @param from - Either a node id or a query to find the node id.
|
|
211
211
|
* @param to - Either a node id or a query to find the node id.
|
|
212
|
-
* @param
|
|
212
|
+
* @param input - The input to search in i.e. the dataflow graph.
|
|
213
213
|
*/
|
|
214
|
-
readsQuery(from, to,
|
|
215
|
-
return this.queryHelper(from, to,
|
|
214
|
+
readsQuery(from, to, input) {
|
|
215
|
+
return this.queryHelper(from, to, input, edge_1.EdgeType.Reads);
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* Adds a **defined-by edge** with from as defined variable, and to
|