@eagleoutice/flowr 2.9.13 → 2.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -10
- package/abstract-interpretation/absint-visitor.d.ts +1 -1
- package/abstract-interpretation/absint-visitor.js +20 -20
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -2
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +7 -5
- package/cli/repl/commands/repl-dataflow.js +5 -5
- package/cli/repl/parser/slice-query-parser.d.ts +1 -1
- package/cli/repl/parser/slice-query-parser.js +2 -2
- package/cli/repl/server/connection.js +2 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/repl/server/messages/message-slice.js +2 -2
- package/config.d.ts +8 -8
- package/control-flow/extract-cfg.js +2 -2
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +43 -43
- package/control-flow/useless-loop.d.ts +1 -1
- package/control-flow/useless-loop.js +3 -3
- package/core/print/dataflow-printer.d.ts +0 -14
- package/core/print/dataflow-printer.js +0 -21
- package/core/steps/all/core/20-dataflow.d.ts +3 -3
- package/core/steps/all/core/20-dataflow.js +3 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +2 -5
- package/core/steps/all/static-slicing/00-slice.js +6 -8
- package/core/steps/pipeline/default-pipelines.d.ts +89 -89
- package/dataflow/environments/built-in-proc-name.d.ts +83 -0
- package/dataflow/environments/built-in-proc-name.js +88 -0
- package/dataflow/environments/built-in.d.ts +1 -83
- package/dataflow/environments/built-in.js +37 -120
- package/dataflow/environments/default-builtin-config.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.js +75 -75
- package/dataflow/environments/identifier.d.ts +1 -0
- package/dataflow/environments/identifier.js +1 -0
- package/dataflow/eval/resolve/resolve.js +2 -2
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/exceptions-of-function.js +2 -2
- package/dataflow/graph/call-graph.d.ts +49 -19
- package/dataflow/graph/call-graph.js +117 -114
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.js +2 -2
- package/dataflow/graph/df-helper.d.ts +132 -0
- package/dataflow/graph/df-helper.js +131 -0
- package/dataflow/graph/diff-dataflow-graph.d.ts +5 -10
- package/dataflow/graph/diff-dataflow-graph.js +3 -28
- package/dataflow/graph/edge.d.ts +1 -0
- package/dataflow/graph/edge.js +1 -0
- package/dataflow/graph/graph-helper.d.ts +55 -0
- package/dataflow/graph/graph-helper.js +105 -0
- package/dataflow/graph/graph.d.ts +6 -1
- package/dataflow/graph/graph.js +6 -1
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/info.d.ts +14 -4
- package/dataflow/info.js +28 -16
- package/dataflow/internal/linker.d.ts +14 -10
- package/dataflow/internal/linker.js +29 -32
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
- 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 +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
- package/dataflow/internal/process/process-uninteresting-leaf.d.ts +1 -1
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -1
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.js +6 -6
- package/documentation/doc-util/doc-dfg.d.ts +3 -0
- package/documentation/doc-util/doc-dfg.js +5 -7
- package/documentation/doc-util/doc-normalized-ast.d.ts +0 -6
- package/documentation/doc-util/doc-normalized-ast.js +0 -23
- package/documentation/doc-util/doc-structure.js +3 -3
- package/documentation/doc-util/doc-types.js +3 -3
- package/documentation/wiki-core.js +5 -4
- package/documentation/wiki-dataflow-graph.js +14 -12
- package/documentation/wiki-interface.js +3 -3
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-normalized-ast.js +5 -4
- package/documentation/wiki-query.js +28 -3
- package/linter/linter-rules.d.ts +24 -1
- package/linter/linter-rules.js +3 -1
- package/linter/rules/seeded-randomness.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +35 -0
- package/linter/rules/stop-with-call-arg.js +72 -0
- package/linter/rules/useless-loop.d.ts +1 -1
- package/package.json +1 -1
- package/project/cache/flowr-analyzer-cache.d.ts +1 -1
- package/project/cache/flowr-analyzer-cache.js +1 -1
- package/project/flowr-analyzer-builder.d.ts +3 -0
- package/project/flowr-analyzer.d.ts +1 -1
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +2 -2
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/provenance-query/provenance-query-executor.d.ts +9 -0
- package/queries/catalog/provenance-query/provenance-query-executor.js +37 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +35 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +62 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -3
- package/queries/query.d.ts +9 -1
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/model/model.js +7 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +8 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +13 -0
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-printer.js +3 -3
- package/search/search-executor/search-enrichers.js +2 -2
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +40 -16
- package/slicing/criterion/parse.js +67 -63
- package/slicing/static/slicer-types.d.ts +2 -3
- package/slicing/static/static-slicer.d.ts +3 -4
- package/slicing/static/static-slicer.js +9 -12
- package/util/diff.d.ts +2 -2
- package/util/mermaid/ast.js +4 -4
- package/util/mermaid/cfg.js +5 -5
- package/util/mermaid/dfg.d.ts +33 -18
- package/util/mermaid/dfg.js +46 -31
- package/util/mermaid/mermaid.d.ts +57 -12
- package/util/mermaid/mermaid.js +74 -67
- package/util/range.d.ts +8 -0
- package/util/range.js +13 -1
- package/util/slice-direction.d.ts +7 -0
- package/util/slice-direction.js +12 -0
- package/util/version.js +1 -1
- package/dataflow/graph/invert-dfg.d.ts +0 -6
- package/dataflow/graph/invert-dfg.js +0 -20
- package/dataflow/graph/resolve-graph.d.ts +0 -8
- package/dataflow/graph/resolve-graph.js +0 -59
|
@@ -22,8 +22,8 @@ async function executeHappensBefore({ analyzer }, queries) {
|
|
|
22
22
|
log_1.log.warn('Duplicate happens-before query', query, 'ignoring');
|
|
23
23
|
}
|
|
24
24
|
try {
|
|
25
|
-
const resolvedA =
|
|
26
|
-
const resolvedB =
|
|
25
|
+
const resolvedA = parse_1.SingleSlicingCriterion.parse(a, ast.idMap);
|
|
26
|
+
const resolvedB = parse_1.SingleSlicingCriterion.parse(b, ast.idMap);
|
|
27
27
|
results[fingerprint] = (0, happens_before_1.happensBefore)(cfg.graph, resolvedA, resolvedB);
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InspectExceptionQuery, InspectExceptionQueryResult } from './inspect-exception-query-format';
|
|
2
2
|
import type { BasicQueryData } from '../../base-query-format';
|
|
3
|
-
import {
|
|
3
|
+
import { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
|
|
4
4
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
5
|
import type { ReadonlyFlowrAnalysisProvider } from '../../../project/flowr-analyzer';
|
|
6
6
|
/**
|
|
@@ -25,7 +25,7 @@ async function getFunctionsToConsiderInCallGraph(queries, analyzer, onlyDefiniti
|
|
|
25
25
|
const filterFor = new Set();
|
|
26
26
|
if (filters) {
|
|
27
27
|
for (const f of filters) {
|
|
28
|
-
const i =
|
|
28
|
+
const i = parse_1.SingleSlicingCriterion.tryParse(f, ast.idMap);
|
|
29
29
|
if (i !== undefined) {
|
|
30
30
|
filterFor.add(i);
|
|
31
31
|
}
|
|
@@ -4,7 +4,7 @@ exports.executeHigherOrderQuery = executeHigherOrderQuery;
|
|
|
4
4
|
const higher_order_function_1 = require("../../../dataflow/fn/higher-order-function");
|
|
5
5
|
const parse_1 = require("../../../slicing/criterion/parse");
|
|
6
6
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
7
|
-
const
|
|
7
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
8
8
|
/**
|
|
9
9
|
* Execute higher-order function inspection queries on the given analyzer.
|
|
10
10
|
*/
|
|
@@ -26,7 +26,7 @@ async function executeHigherOrderQuery({ analyzer }, queries) {
|
|
|
26
26
|
const filterFor = new Set();
|
|
27
27
|
if (filters) {
|
|
28
28
|
for (const f of filters) {
|
|
29
|
-
const i =
|
|
29
|
+
const i = parse_1.SingleSlicingCriterion.tryParse(f, ast.idMap);
|
|
30
30
|
if (i !== undefined) {
|
|
31
31
|
filterFor.add(i);
|
|
32
32
|
}
|
|
@@ -37,7 +37,7 @@ async function executeHigherOrderQuery({ analyzer }, queries) {
|
|
|
37
37
|
.filter(([, v]) => filterFor.size === 0 || filterFor.has(v.id));
|
|
38
38
|
let invertedGraph;
|
|
39
39
|
if (filterFor.size === 0 || filterFor.size > 10) {
|
|
40
|
-
invertedGraph =
|
|
40
|
+
invertedGraph = df_helper_1.Dataflow.invertGraph(graph, analyzer.inspectContext().env.makeCleanEnv());
|
|
41
41
|
}
|
|
42
42
|
const result = {};
|
|
43
43
|
for (const [id] of fns) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeLocationMapQuery = executeLocationMapQuery;
|
|
4
|
-
const parse_1 = require("../../../slicing/criterion/parse");
|
|
5
4
|
const assert_1 = require("../../../util/assert");
|
|
5
|
+
const parse_1 = require("../../../slicing/criterion/parse");
|
|
6
6
|
const fileIdRegex = /^(?<file>.*(\.[rR]))-/;
|
|
7
7
|
function fuzzyFindFile(node, idMap) {
|
|
8
8
|
if (node?.info.file) {
|
|
@@ -31,7 +31,7 @@ async function executeLocationMapQuery({ analyzer }, queries) {
|
|
|
31
31
|
const start = Date.now();
|
|
32
32
|
const criteriaOfInterest = new Set(queries
|
|
33
33
|
.flatMap(q => q.ids ?? [])
|
|
34
|
-
.map(c =>
|
|
34
|
+
.map(c => parse_1.SingleSlicingCriterion.tryParse(c, ast.idMap))
|
|
35
35
|
.filter(assert_1.isNotUndefined));
|
|
36
36
|
const locationMap = {
|
|
37
37
|
files: {},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BasicQueryData } from '../../base-query-format';
|
|
2
|
-
import {
|
|
2
|
+
import { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
|
|
3
3
|
import type { OriginQuery, OriginQueryResult } from './origin-query-format';
|
|
4
4
|
/**
|
|
5
5
|
* Produce a fingerprint string for an origin query
|
|
@@ -4,7 +4,7 @@ exports.fingerPrintOfQuery = fingerPrintOfQuery;
|
|
|
4
4
|
exports.executeResolveValueQuery = executeResolveValueQuery;
|
|
5
5
|
const log_1 = require("../../../util/log");
|
|
6
6
|
const parse_1 = require("../../../slicing/criterion/parse");
|
|
7
|
-
const
|
|
7
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
8
8
|
/**
|
|
9
9
|
* Produce a fingerprint string for an origin query
|
|
10
10
|
*/
|
|
@@ -22,12 +22,12 @@ async function executeResolveValueQuery({ analyzer }, queries) {
|
|
|
22
22
|
if (results[key]) {
|
|
23
23
|
log_1.log.warn(`Duplicate Key for origin-query: ${key}, skipping...`);
|
|
24
24
|
}
|
|
25
|
-
const astId =
|
|
25
|
+
const astId = parse_1.SingleSlicingCriterion.tryParse(key, (await analyzer.normalize()).idMap);
|
|
26
26
|
if (astId === undefined) {
|
|
27
27
|
log_1.log.warn(`Could not resolve id for ${key}, skipping...`);
|
|
28
28
|
continue;
|
|
29
29
|
}
|
|
30
|
-
results[key] =
|
|
30
|
+
results[key] = df_helper_1.Dataflow.origin((await analyzer.dataflow()).graph, astId);
|
|
31
31
|
}
|
|
32
32
|
return {
|
|
33
33
|
'.meta': {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BasicQueryData } from '../../base-query-format';
|
|
2
|
+
import type { ProvenanceQuery, ProvenanceQueryResult } from './provenance-query-format';
|
|
3
|
+
/**
|
|
4
|
+
* Execute static slice queries, catching duplicates with the same fingerprint
|
|
5
|
+
* @param analyzer - The basic query data containing the analyzer
|
|
6
|
+
* @param queries - The static slice queries to execute
|
|
7
|
+
* @returns The results of the static slice queries
|
|
8
|
+
*/
|
|
9
|
+
export declare function executeProvenanceQuery({ analyzer }: BasicQueryData, queries: readonly ProvenanceQuery[]): Promise<ProvenanceQueryResult>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeProvenanceQuery = executeProvenanceQuery;
|
|
4
|
+
const log_1 = require("../../../util/log");
|
|
5
|
+
const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
6
|
+
const parse_1 = require("../../../slicing/criterion/parse");
|
|
7
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
8
|
+
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
9
|
+
/**
|
|
10
|
+
* Execute static slice queries, catching duplicates with the same fingerprint
|
|
11
|
+
* @param analyzer - The basic query data containing the analyzer
|
|
12
|
+
* @param queries - The static slice queries to execute
|
|
13
|
+
* @returns The results of the static slice queries
|
|
14
|
+
*/
|
|
15
|
+
async function executeProvenanceQuery({ analyzer }, queries) {
|
|
16
|
+
const start = Date.now();
|
|
17
|
+
const results = {};
|
|
18
|
+
const nast = await analyzer.normalize();
|
|
19
|
+
const df = await analyzer.dataflow();
|
|
20
|
+
for (const query of queries) {
|
|
21
|
+
const key = query.criterion;
|
|
22
|
+
if (results[key]) {
|
|
23
|
+
log_1.log.warn(`Duplicate Key for provenance query: ${key}, skipping...`);
|
|
24
|
+
}
|
|
25
|
+
const criterionId = parse_1.SingleSlicingCriterion.tryParse(key, nast.idMap) ?? key;
|
|
26
|
+
const provenanceNode = nast.idMap.get(criterionId);
|
|
27
|
+
const fdef = r_function_definition_1.RFunctionDefinition.wrappingFunctionDefinition(provenanceNode, nast.idMap);
|
|
28
|
+
results[key] = Array.from(df_helper_1.Dataflow.provenance(criterionId, df.graph, fdef ? model_1.RNode.collectAllIds(fdef) : undefined));
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
'.meta': {
|
|
32
|
+
timing: Date.now() - start
|
|
33
|
+
},
|
|
34
|
+
results
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=provenance-query-executor.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
2
|
+
import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
|
|
3
|
+
import type { ParsedQueryLine } from '../../query';
|
|
4
|
+
import Joi from 'joi';
|
|
5
|
+
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
|
+
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
7
|
+
import type { FlowrConfig } from '../../../config';
|
|
8
|
+
import { executeProvenanceQuery } from './provenance-query-executor';
|
|
9
|
+
/** Calculates the provenance starting from a given criterion */
|
|
10
|
+
export interface ProvenanceQuery extends BaseQueryFormat {
|
|
11
|
+
readonly type: 'provenance';
|
|
12
|
+
/** The slicing criterion to use as a start*/
|
|
13
|
+
readonly criterion: SingleSlicingCriterion;
|
|
14
|
+
/** Whether to stop on fdef boundaries */
|
|
15
|
+
readonly restrictFdef?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ProvenanceQueryResult extends BaseQueryResult {
|
|
18
|
+
/**
|
|
19
|
+
* Maps the requested criteria to the returned ids
|
|
20
|
+
*/
|
|
21
|
+
results: Record<string, NodeId[]>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Checks whether the given argument represents a fdef boundary with an `f` suffix.
|
|
25
|
+
*/
|
|
26
|
+
export declare function fdefBoundaryParser(argument: string): boolean;
|
|
27
|
+
declare function provenanceQueryLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'provenance'>;
|
|
28
|
+
export declare const ProvenanceQueryDefinition: {
|
|
29
|
+
readonly executor: typeof executeProvenanceQuery;
|
|
30
|
+
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
|
|
31
|
+
readonly fromLine: typeof provenanceQueryLineParser;
|
|
32
|
+
readonly schema: Joi.ObjectSchema<any>;
|
|
33
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ProvenanceQueryDefinition = void 0;
|
|
7
|
+
exports.fdefBoundaryParser = fdefBoundaryParser;
|
|
8
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
+
const time_1 = require("../../../util/text/time");
|
|
10
|
+
const joi_1 = __importDefault(require("joi"));
|
|
11
|
+
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
12
|
+
const provenance_query_executor_1 = require("./provenance-query-executor");
|
|
13
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
14
|
+
/**
|
|
15
|
+
* Checks whether the given argument represents a fdef boundary with an `f` suffix.
|
|
16
|
+
*/
|
|
17
|
+
function fdefBoundaryParser(argument) {
|
|
18
|
+
const endBracket = argument.indexOf(')');
|
|
19
|
+
return argument[endBracket + 1] === 'f';
|
|
20
|
+
}
|
|
21
|
+
function provenanceQueryLineParser(output, line, _config) {
|
|
22
|
+
const criterion = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
|
|
23
|
+
const stopFdef = fdefBoundaryParser(line[0]);
|
|
24
|
+
if (!criterion || criterion.length !== 1) {
|
|
25
|
+
output.stderr(output.formatter.format('Invalid provenance query format, a single slicing criterion must be given in the form "(criterion1)"', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
26
|
+
return { query: [] };
|
|
27
|
+
}
|
|
28
|
+
return { query: [{
|
|
29
|
+
type: 'provenance',
|
|
30
|
+
criterion: criterion[0],
|
|
31
|
+
restrictFdef: stopFdef
|
|
32
|
+
}], rCode: line[1] };
|
|
33
|
+
}
|
|
34
|
+
exports.ProvenanceQueryDefinition = {
|
|
35
|
+
executor: provenance_query_executor_1.executeProvenanceQuery,
|
|
36
|
+
asciiSummarizer: async (formatter, analyzer, queryResults, result) => {
|
|
37
|
+
const out = queryResults;
|
|
38
|
+
const df = await analyzer.dataflow();
|
|
39
|
+
result.push(`Query: ${(0, ansi_1.bold)('provenance', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
40
|
+
for (const [key, obj] of Object.entries(out.results)) {
|
|
41
|
+
result.push(` ╰ Provenance for ${key}`);
|
|
42
|
+
const dfg = df_helper_1.Dataflow.reduceGraph(df.graph, new Set(obj));
|
|
43
|
+
result.push(` ╰ [Mermaid Url](${df_helper_1.Dataflow.visualize.mermaid.url(dfg)})`);
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
},
|
|
47
|
+
fromLine: provenanceQueryLineParser,
|
|
48
|
+
schema: joi_1.default.object({
|
|
49
|
+
type: joi_1.default.string().valid('provenance').required().description('The type of the query.'),
|
|
50
|
+
criterion: joi_1.default.string().required().description('The slicing criterion to use.'),
|
|
51
|
+
restrictFdef: joi_1.default.boolean().required().description('Whether to stop on fdef boundaries.')
|
|
52
|
+
}).description('Provenance query definition'),
|
|
53
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
54
|
+
const flattened = [];
|
|
55
|
+
const out = queryResults;
|
|
56
|
+
for (const obj of Object.values(out.results)) {
|
|
57
|
+
flattened.push(...obj);
|
|
58
|
+
}
|
|
59
|
+
return flattened;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=provenance-query-format.js.map
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fingerPrintOfQuery = fingerPrintOfQuery;
|
|
4
4
|
exports.executeResolveValueQuery = executeResolveValueQuery;
|
|
5
5
|
const log_1 = require("../../../util/log");
|
|
6
|
-
const parse_1 = require("../../../slicing/criterion/parse");
|
|
7
6
|
const alias_tracking_1 = require("../../../dataflow/eval/resolve/alias-tracking");
|
|
7
|
+
const parse_1 = require("../../../slicing/criterion/parse");
|
|
8
8
|
/**
|
|
9
9
|
* Naive fingerprint to filter out duplicate queries.
|
|
10
10
|
*/
|
|
@@ -25,7 +25,7 @@ async function executeResolveValueQuery({ analyzer }, queries) {
|
|
|
25
25
|
log_1.log.warn(`Duplicate Key for resolve-value-query: ${key}, skipping...`);
|
|
26
26
|
}
|
|
27
27
|
const values = query.criteria
|
|
28
|
-
.map(criteria =>
|
|
28
|
+
.map(criteria => parse_1.SingleSlicingCriterion.parse(criteria, idMap))
|
|
29
29
|
.flatMap(ident => (0, alias_tracking_1.resolveIdToValue)(ident, { graph, full: true, idMap, resolve: analyzer.flowrConfig.solver.variables, ctx: analyzer.inspectContext() }));
|
|
30
30
|
results[key] = {
|
|
31
31
|
values: values
|
|
@@ -17,7 +17,7 @@ exports.SearchQueryDefinition = {
|
|
|
17
17
|
const out = queryResults;
|
|
18
18
|
result.push(`Query: ${(0, ansi_1.bold)('search', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
19
19
|
for (const [, { ids, search }] of out.results.entries()) {
|
|
20
|
-
result.push(` ╰ [query](${
|
|
20
|
+
result.push(` ╰ [query](${mermaid_1.Mermaid.codeToUrl((0, flowr_search_printer_1.flowrSearchToMermaid)(search))}): {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, ids)}}`);
|
|
21
21
|
}
|
|
22
22
|
return true;
|
|
23
23
|
},
|
|
@@ -7,7 +7,8 @@ const reconstruct_1 = require("../../../reconstruct/reconstruct");
|
|
|
7
7
|
const auto_select_defaults_1 = require("../../../reconstruct/auto-select/auto-select-defaults");
|
|
8
8
|
const magic_comments_1 = require("../../../reconstruct/auto-select/magic-comments");
|
|
9
9
|
const log_1 = require("../../../util/log");
|
|
10
|
-
const
|
|
10
|
+
const slice_direction_1 = require("../../../util/slice-direction");
|
|
11
|
+
const parse_1 = require("../../../slicing/criterion/parse");
|
|
11
12
|
/**
|
|
12
13
|
* Produce a fingerprint string for a static slice query
|
|
13
14
|
*/
|
|
@@ -30,7 +31,8 @@ async function executeStaticSliceQuery({ analyzer }, queries) {
|
|
|
30
31
|
}
|
|
31
32
|
const { criteria, noReconstruction, noMagicComments } = query;
|
|
32
33
|
const sliceStart = Date.now();
|
|
33
|
-
const
|
|
34
|
+
const n = await analyzer.normalize();
|
|
35
|
+
const slice = (0, static_slicer_1.staticSlice)(analyzer.inspectContext(), await analyzer.dataflow(), n, parse_1.SlicingCriteria.convertAll(criteria, n.idMap), query.direction ?? slice_direction_1.SliceDirection.Backward, analyzer.flowrConfig.solver.slicer?.threshold);
|
|
34
36
|
const sliceEnd = Date.now();
|
|
35
37
|
if (noReconstruction) {
|
|
36
38
|
results[key] = { slice: { ...slice, '.meta': { timing: sliceEnd - sliceStart } } };
|
|
@@ -5,11 +5,11 @@ import type { SlicingCriteria } from '../../../slicing/criterion/parse';
|
|
|
5
5
|
import type { ParsedQueryLine } from '../../query';
|
|
6
6
|
import Joi from 'joi';
|
|
7
7
|
import { executeStaticSliceQuery } from './static-slice-query-executor';
|
|
8
|
-
import { SliceDirection } from '../../../core/steps/all/static-slicing/00-slice';
|
|
9
8
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
10
9
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
11
10
|
import type { FlowrConfig } from '../../../config';
|
|
12
|
-
|
|
11
|
+
import { SliceDirection } from '../../../util/slice-direction';
|
|
12
|
+
/** Calculates and returns the static backward or forward slice from the given criteria */
|
|
13
13
|
export interface StaticSliceQuery extends BaseQueryFormat {
|
|
14
14
|
readonly type: 'static-slice';
|
|
15
15
|
/** The slicing criteria to use */
|
|
@@ -9,12 +9,12 @@ const time_1 = require("../../../util/text/time");
|
|
|
9
9
|
const joi_1 = __importDefault(require("joi"));
|
|
10
10
|
const static_slice_query_executor_1 = require("./static-slice-query-executor");
|
|
11
11
|
const query_print_1 = require("../../query-print");
|
|
12
|
-
const _00_slice_1 = require("../../../core/steps/all/static-slicing/00-slice");
|
|
13
12
|
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
13
|
+
const slice_direction_1 = require("../../../util/slice-direction");
|
|
14
14
|
function sliceQueryLineParser(output, line, _config) {
|
|
15
15
|
const criteria = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
|
|
16
16
|
const direction = (0, slice_query_parser_1.sliceDirectionParser)(line[0]);
|
|
17
|
-
if (!criteria || criteria.length
|
|
17
|
+
if (!criteria || criteria.length === 0) {
|
|
18
18
|
output.stderr(output.formatter.format('Invalid static-slice query format, slicing criteria must be given in the form "(criterion1;criterion2;...)"', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
19
19
|
return { query: [] };
|
|
20
20
|
}
|
|
@@ -68,7 +68,7 @@ exports.StaticSliceQueryDefinition = {
|
|
|
68
68
|
criteria: joi_1.default.array().items(joi_1.default.string()).min(0).required().description('The slicing criteria to use.'),
|
|
69
69
|
noReconstruction: joi_1.default.boolean().optional().description('Do not reconstruct the slice into readable code.'),
|
|
70
70
|
noMagicComments: joi_1.default.boolean().optional().description('Should the magic comments (force-including lines within the slice) be ignored?'),
|
|
71
|
-
direction: joi_1.default.string().valid(...Object.values(
|
|
71
|
+
direction: joi_1.default.string().valid(...Object.values(slice_direction_1.SliceDirection)).optional().description('The direction to slice in. Defaults to backward slicing if unset.')
|
|
72
72
|
}).description('Slice query used to slice the dataflow graph'),
|
|
73
73
|
flattenInvolvedNodes: (queryResults) => {
|
|
74
74
|
const flattened = [];
|
package/queries/query.d.ts
CHANGED
|
@@ -33,10 +33,11 @@ import type { CallGraphQuery } from './catalog/call-graph-query/call-graph-query
|
|
|
33
33
|
import type { InspectRecursionQuery } from './catalog/inspect-recursion-query/inspect-recursion-query-format';
|
|
34
34
|
import type { DoesCallQuery } from './catalog/does-call-query/does-call-query-format';
|
|
35
35
|
import type { InspectExceptionQuery } from './catalog/inspect-exceptions-query/inspect-exception-query-format';
|
|
36
|
+
import type { ProvenanceQuery } from './catalog/provenance-query/provenance-query-format';
|
|
36
37
|
/**
|
|
37
38
|
* These are all queries that can be executed from within flowR
|
|
38
39
|
*/
|
|
39
|
-
export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DoesCallQuery | CallGraphQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | DfShapeQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectExceptionQuery | InspectHigherOrderQuery | InspectRecursionQuery | ResolveValueQuery | ProjectQuery | OriginQuery | LinterQuery;
|
|
40
|
+
export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DoesCallQuery | CallGraphQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | DfShapeQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectExceptionQuery | InspectHigherOrderQuery | InspectRecursionQuery | ResolveValueQuery | ProjectQuery | OriginQuery | LinterQuery | ProvenanceQuery;
|
|
40
41
|
export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
|
|
41
42
|
type: QueryType;
|
|
42
43
|
};
|
|
@@ -156,6 +157,13 @@ export declare const SupportedQueries: {
|
|
|
156
157
|
readonly schema: Joi.ObjectSchema<any>;
|
|
157
158
|
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
158
159
|
};
|
|
160
|
+
readonly provenance: {
|
|
161
|
+
readonly executor: typeof import("./catalog/provenance-query/provenance-query-executor").executeProvenanceQuery;
|
|
162
|
+
readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
|
|
163
|
+
readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"provenance">;
|
|
164
|
+
readonly schema: Joi.ObjectSchema<any>;
|
|
165
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
166
|
+
};
|
|
159
167
|
readonly dependencies: {
|
|
160
168
|
readonly executor: typeof import("./catalog/dependencies-query/dependencies-query-executor").executeDependenciesQuery;
|
|
161
169
|
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[], queries: readonly Query[]) => true;
|
package/queries/query.js
CHANGED
|
@@ -40,6 +40,7 @@ const call_graph_query_format_1 = require("./catalog/call-graph-query/call-graph
|
|
|
40
40
|
const inspect_recursion_query_format_1 = require("./catalog/inspect-recursion-query/inspect-recursion-query-format");
|
|
41
41
|
const does_call_query_format_1 = require("./catalog/does-call-query/does-call-query-format");
|
|
42
42
|
const inspect_exception_query_format_1 = require("./catalog/inspect-exceptions-query/inspect-exception-query-format");
|
|
43
|
+
const provenance_query_format_1 = require("./catalog/provenance-query/provenance-query-format");
|
|
43
44
|
exports.SupportedQueries = {
|
|
44
45
|
'call-context': call_context_query_format_1.CallContextQueryDefinition,
|
|
45
46
|
'config': config_query_format_1.ConfigQueryDefinition,
|
|
@@ -54,6 +55,7 @@ exports.SupportedQueries = {
|
|
|
54
55
|
'normalized-ast': normalized_ast_query_format_1.NormalizedAstQueryDefinition,
|
|
55
56
|
'dataflow-cluster': cluster_query_format_1.ClusterQueryDefinition,
|
|
56
57
|
'static-slice': static_slice_query_format_1.StaticSliceQueryDefinition,
|
|
58
|
+
'provenance': provenance_query_format_1.ProvenanceQueryDefinition,
|
|
57
59
|
'dependencies': dependencies_query_format_1.DependenciesQueryDefinition,
|
|
58
60
|
'location-map': location_map_query_format_1.LocationMapQueryDefinition,
|
|
59
61
|
'search': search_query_format_1.SearchQueryDefinition,
|
|
@@ -28,6 +28,7 @@ import type { ParentInformation } from './processing/decorate';
|
|
|
28
28
|
import type { NodeId } from './processing/node-id';
|
|
29
29
|
import type { OnEnter, OnExit } from './processing/visitor';
|
|
30
30
|
import type { SingleOrArrayOrNothing } from '../../../../abstract-interpretation/normalized-ast-fold';
|
|
31
|
+
import { getDocumentationOf } from '../../../roxygen2/documentation-provider';
|
|
31
32
|
/** Simply an empty type constraint used to say that there are additional decorations (see {@link RAstNodeBase}). */
|
|
32
33
|
export type NoInfo = object;
|
|
33
34
|
/**
|
|
@@ -287,5 +288,10 @@ export declare const RNode: {
|
|
|
287
288
|
readonly lexeme: <R extends RNode<ParentInformation>>(this: void, node: R | undefined) => R extends {
|
|
288
289
|
lexeme: string;
|
|
289
290
|
} ? string : string | undefined;
|
|
291
|
+
/**
|
|
292
|
+
* Return the (roxygen) documentation associated with the given node, if available.
|
|
293
|
+
* @see {@link getDocumentationOf}
|
|
294
|
+
*/
|
|
295
|
+
readonly documentation: typeof getDocumentationOf;
|
|
290
296
|
};
|
|
291
297
|
export type OtherInfoNode = RNode | RDelimiter;
|
|
@@ -6,6 +6,7 @@ const type_1 = require("./type");
|
|
|
6
6
|
const r_access_1 = require("./nodes/r-access");
|
|
7
7
|
const visitor_1 = require("./processing/visitor");
|
|
8
8
|
const assert_1 = require("../../../../util/assert");
|
|
9
|
+
const documentation_provider_1 = require("../../../roxygen2/documentation-provider");
|
|
9
10
|
/**
|
|
10
11
|
* Helper object to provide helper functions for {@link RConstant|RConstants}.
|
|
11
12
|
* @see {@link RNode} - for more general helper functions for all nodes
|
|
@@ -260,6 +261,11 @@ exports.RNode = {
|
|
|
260
261
|
*/
|
|
261
262
|
lexeme(node) {
|
|
262
263
|
return node?.info.fullLexeme ?? node?.lexeme;
|
|
263
|
-
}
|
|
264
|
+
},
|
|
265
|
+
/**
|
|
266
|
+
* Return the (roxygen) documentation associated with the given node, if available.
|
|
267
|
+
* @see {@link getDocumentationOf}
|
|
268
|
+
*/
|
|
269
|
+
documentation: documentation_provider_1.getDocumentationOf
|
|
264
270
|
};
|
|
265
271
|
//# sourceMappingURL=model.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { RAstNodeBase, Location, NoInfo
|
|
1
|
+
import type { RAstNodeBase, Location, NoInfo } from '../model';
|
|
2
|
+
import { RNode } from '../model';
|
|
2
3
|
import { RType } from '../type';
|
|
3
4
|
import type { RParameter } from './r-parameter';
|
|
5
|
+
import type { AstIdMap, ParentInformation } from '../processing/decorate';
|
|
4
6
|
/**
|
|
5
7
|
* ```r
|
|
6
8
|
* function(<parameters>) <body>
|
|
@@ -25,4 +27,9 @@ export declare const RFunctionDefinition: {
|
|
|
25
27
|
* Type guard for {@link RFunctionDefinition} nodes.
|
|
26
28
|
*/
|
|
27
29
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RFunctionDefinition<Info>;
|
|
30
|
+
/**
|
|
31
|
+
* Checks whether the given id is part of a function definition, and if so, this returns the id of the
|
|
32
|
+
* inner-most function definition.
|
|
33
|
+
*/
|
|
34
|
+
readonly wrappingFunctionDefinition: <Info = object>(this: void, n: RNode<ParentInformation & Info> | undefined, idMap: AstIdMap<ParentInformation & Info>) => RFunctionDefinition<ParentInformation & Info> | undefined;
|
|
28
35
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RFunctionDefinition = void 0;
|
|
4
|
+
const model_1 = require("../model");
|
|
4
5
|
const type_1 = require("../type");
|
|
5
6
|
/**
|
|
6
7
|
* Helper for working with {@link RFunctionDefinition} AST nodes.
|
|
@@ -12,6 +13,18 @@ exports.RFunctionDefinition = {
|
|
|
12
13
|
*/
|
|
13
14
|
is(node) {
|
|
14
15
|
return node?.type === type_1.RType.FunctionDefinition;
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Checks whether the given id is part of a function definition, and if so, this returns the id of the
|
|
19
|
+
* inner-most function definition.
|
|
20
|
+
*/
|
|
21
|
+
wrappingFunctionDefinition(n, idMap) {
|
|
22
|
+
for (const p of model_1.RNode.iterateParents(n, idMap)) {
|
|
23
|
+
if (exports.RFunctionDefinition.is(p)) {
|
|
24
|
+
return p;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
15
28
|
}
|
|
16
29
|
};
|
|
17
30
|
//# sourceMappingURL=r-function-definition.js.map
|
|
@@ -3,8 +3,8 @@ import { VertexType } from '../dataflow/graph/vertex';
|
|
|
3
3
|
import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { FlowrSearchElement } from './flowr-search';
|
|
5
5
|
import { Enrichment } from './search-executor/search-enrichers';
|
|
6
|
-
import type { BuiltInProcName } from '../dataflow/environments/built-in';
|
|
7
6
|
import type { DataflowInformation } from '../dataflow/info';
|
|
7
|
+
import type { BuiltInProcName } from '../dataflow/environments/built-in-proc-name';
|
|
8
8
|
export type FlowrFilterName = keyof typeof FlowrFilters;
|
|
9
9
|
interface FlowrFilterWithArgs<Filter extends FlowrFilterName, Args extends FlowrFilterArgs<Filter>> {
|
|
10
10
|
name: Filter;
|
|
@@ -4,10 +4,10 @@ exports.flowrSearchToMermaid = flowrSearchToMermaid;
|
|
|
4
4
|
exports.flowrSearchToAscii = flowrSearchToAscii;
|
|
5
5
|
exports.flowrSearchToCode = flowrSearchToCode;
|
|
6
6
|
const flowr_search_traverse_1 = require("./flowr-search-traverse");
|
|
7
|
-
const mermaid_1 = require("../util/mermaid/mermaid");
|
|
8
7
|
const flowr_search_filters_1 = require("./flowr-search-filters");
|
|
9
8
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
10
9
|
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
10
|
+
const mermaid_1 = require("../util/mermaid/mermaid");
|
|
11
11
|
/**
|
|
12
12
|
* Converts a {@link FlowrSearchLike} object to a mermaid flowchart.
|
|
13
13
|
*/
|
|
@@ -21,8 +21,8 @@ function argsToMermaidString(args) {
|
|
|
21
21
|
if (args === undefined) {
|
|
22
22
|
return '';
|
|
23
23
|
}
|
|
24
|
-
return Object.entries(args).map(([key, value]) => `${key}: ${(0, flowr_search_filters_1.isBinaryTree)(value) ? '_' +
|
|
25
|
-
:
|
|
24
|
+
return Object.entries(args).map(([key, value]) => `${key}: ${(0, flowr_search_filters_1.isBinaryTree)(value) ? '_' + mermaid_1.Mermaid.escape((0, flowr_search_filters_1.binaryTreeToString)(value.tree)) + '_'
|
|
25
|
+
: mermaid_1.Mermaid.escape(JSON.stringify(value))}`)
|
|
26
26
|
.join(', ');
|
|
27
27
|
}
|
|
28
28
|
function argsToAsciiString(args) {
|
|
@@ -6,13 +6,13 @@ exports.enrichElement = enrichElement;
|
|
|
6
6
|
const objects_1 = require("../../util/objects");
|
|
7
7
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
8
8
|
const assert_1 = require("../../util/assert");
|
|
9
|
-
const dfg_get_origin_1 = require("../../dataflow/origin/dfg-get-origin");
|
|
10
9
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
11
10
|
const cfg_simplification_1 = require("../../control-flow/cfg-simplification");
|
|
12
11
|
const call_context_query_executor_1 = require("../../queries/catalog/call-context-query/call-context-query-executor");
|
|
13
12
|
const cfg_kind_1 = require("../../project/cfg-kind");
|
|
14
13
|
const identify_link_to_last_call_relation_1 = require("../../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
15
14
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
15
|
+
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
16
16
|
/**
|
|
17
17
|
* An enumeration that stores the names of the available enrichments that can be applied to a set of search elements.
|
|
18
18
|
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
@@ -37,7 +37,7 @@ exports.Enrichments = {
|
|
|
37
37
|
const n = await analyzer.normalize();
|
|
38
38
|
const callVertex = df.graph.getVertex(e.node.info.id);
|
|
39
39
|
if (callVertex?.tag === vertex_1.VertexType.FunctionCall) {
|
|
40
|
-
const origins =
|
|
40
|
+
const origins = df_helper_1.Dataflow.origin(df.graph, callVertex.id);
|
|
41
41
|
if (!origins || origins.length === 0) {
|
|
42
42
|
content.targets = [(0, node_id_1.recoverName)(callVertex.id, n.idMap)];
|
|
43
43
|
}
|
|
@@ -133,7 +133,7 @@ async function generateSyntax(input, args) {
|
|
|
133
133
|
}
|
|
134
134
|
async function generateCriterion(input, args) {
|
|
135
135
|
const idMap = (await input.normalize()).idMap;
|
|
136
|
-
return new flowr_search_1.FlowrSearchElements(args.criterion.map(c => ({ node: idMap.get(
|
|
136
|
+
return new flowr_search_1.FlowrSearchElements(args.criterion.map(c => ({ node: idMap.get(parse_1.SingleSlicingCriterion.parse(c, idMap)) })));
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Gets the search generator function for the given name
|