@eagleoutice/flowr 2.10.9 → 2.10.10
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 +103 -33
- package/abstract-interpretation/absint-visitor.js +6 -3
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
- package/abstract-interpretation/domains/interval-domain.js +1 -1
- package/abstract-interpretation/domains/lattice.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
- package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
- package/abstract-interpretation/domains/singleton-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
- package/abstract-interpretation/unsupported-functions.d.ts +3 -2
- package/abstract-interpretation/unsupported-functions.js +38 -28
- package/cli/benchmark-app.js +2 -1
- package/cli/common/script.js +3 -2
- package/cli/flowr.js +47 -10
- package/cli/repl/commands/repl-cfg.js +9 -9
- package/cli/repl/commands/repl-commands.js +5 -0
- package/cli/repl/commands/repl-dataflow.js +31 -24
- package/cli/repl/commands/repl-main.d.ts +6 -0
- package/cli/repl/commands/repl-normalize.js +15 -12
- package/cli/repl/commands/repl-parse.js +1 -1
- package/cli/repl/commands/repl-query.js +4 -5
- package/cli/repl/commands/repl-quit.js +2 -1
- package/cli/repl/core.d.ts +11 -0
- package/cli/repl/core.js +101 -3
- package/cli/repl/execute.js +3 -2
- package/cli/repl/parser/slice-query-parser.d.ts +16 -0
- package/cli/repl/parser/slice-query-parser.js +52 -0
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +25 -0
- package/cli/repl/server/messages/message-analysis.d.ts +10 -0
- package/cli/repl/server/messages/message-analysis.js +6 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/script-core/statistics-core.js +2 -1
- package/cli/script-core/statistics-helper-core.js +2 -1
- package/cli/wiki.d.ts +2 -1
- package/cli/wiki.js +4 -1
- package/config.d.ts +9 -10
- package/config.js +25 -7
- package/control-flow/diff-cfg.d.ts +1 -1
- package/control-flow/diff-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +1 -0
- package/control-flow/simple-visitor.js +6 -5
- package/control-flow/useless-loop.js +2 -2
- package/core/print/dataflow-printer.d.ts +2 -2
- package/core/print/dataflow-printer.js +2 -2
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/core/steps/pipeline/default-pipelines.d.ts +146 -146
- package/dataflow/environments/append.d.ts +2 -1
- package/dataflow/environments/append.js +2 -1
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +122 -66
- package/dataflow/environments/default-builtin-config.js +324 -145
- package/dataflow/environments/environment.d.ts +2 -1
- package/dataflow/environments/environment.js +13 -9
- package/dataflow/environments/identifier.d.ts +55 -2
- package/dataflow/environments/identifier.js +14 -2
- package/dataflow/environments/reference-to-maybe.d.ts +2 -0
- package/dataflow/environments/reference-to-maybe.js +56 -11
- package/dataflow/environments/resolve-by-name.js +13 -7
- package/dataflow/eval/values/general.js +4 -0
- package/dataflow/extractor.js +12 -2
- package/dataflow/graph/df-helper.d.ts +6 -0
- package/dataflow/graph/df-helper.js +33 -0
- package/dataflow/graph/graph.js +1 -1
- package/dataflow/info.d.ts +1 -1
- package/dataflow/internal/linker.d.ts +5 -1
- package/dataflow/internal/linker.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +53 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +38 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +6 -0
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-origin.js +1 -1
- package/dataflow/processor.d.ts +6 -0
- package/documentation/data/faq/faqs.d.ts +2 -1
- package/documentation/data/faq/faqs.js +75 -57
- package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
- package/documentation/data/server/doc-data-server-messages.js +15 -7
- package/documentation/doc-readme.js +15 -15
- package/documentation/doc-util/doc-cfg.d.ts +3 -1
- package/documentation/doc-util/doc-cfg.js +3 -3
- package/documentation/doc-util/doc-dfg.d.ts +3 -1
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-files.d.ts +3 -1
- package/documentation/doc-util/doc-files.js +9 -6
- package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +2 -1
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -0
- package/documentation/doc-util/doc-types.d.ts +6 -6
- package/documentation/doc-util/doc-types.js +11 -9
- package/documentation/issue-linting-rule.js +1 -2
- package/documentation/wiki-analyzer.js +9 -9
- package/documentation/wiki-cfg.js +40 -41
- package/documentation/wiki-core.js +119 -31
- package/documentation/wiki-create-linting-rules.d.ts +6 -0
- package/documentation/wiki-create-linting-rules.js +95 -0
- package/documentation/wiki-dataflow-graph.js +77 -76
- package/documentation/wiki-engine.js +1 -2
- package/documentation/wiki-faq.d.ts +2 -1
- package/documentation/wiki-faq.js +4 -4
- package/documentation/wiki-interface.js +19 -6
- package/documentation/wiki-linter.d.ts +1 -1
- package/documentation/wiki-linter.js +14 -6
- package/documentation/wiki-linting-and-testing.js +2 -2
- package/documentation/wiki-mk/doc-context.d.ts +3 -3
- package/documentation/wiki-mk/doc-maker.d.ts +2 -0
- package/documentation/wiki-mk/doc-maker.js +7 -1
- package/documentation/wiki-normalized-ast.js +5 -5
- package/documentation/wiki-onboarding.d.ts +2 -1
- package/documentation/wiki-onboarding.js +5 -5
- package/documentation/wiki-overview.js +3 -3
- package/documentation/wiki-query.js +85 -84
- package/documentation/wiki-search.js +4 -5
- package/documentation/wiki-setup.js +6 -7
- package/gas.d.ts +74 -0
- package/gas.js +18 -0
- package/linter/linter-executor.js +2 -8
- package/linter/linter-format.d.ts +4 -11
- package/linter/linter-rules.d.ts +88 -86
- package/linter/linter-rules.js +7 -1
- package/linter/rules/absolute-path.d.ts +2 -7
- package/linter/rules/absolute-path.js +6 -4
- package/linter/rules/dataframe-access-validation.d.ts +1 -6
- package/linter/rules/dataframe-access-validation.js +8 -6
- package/linter/rules/dead-code.d.ts +2 -11
- package/linter/rules/dead-code.js +16 -11
- package/linter/rules/deprecated-functions.d.ts +3 -3
- package/linter/rules/file-path-validity.d.ts +1 -6
- package/linter/rules/file-path-validity.js +5 -5
- package/linter/rules/function-finder-util.d.ts +7 -11
- package/linter/rules/function-finder-util.js +9 -6
- package/linter/rules/naming-convention.d.ts +2 -7
- package/linter/rules/naming-convention.js +3 -2
- package/linter/rules/network-functions.d.ts +2 -7
- package/linter/rules/network-functions.js +14 -12
- package/linter/rules/no-leaked-credentials.d.ts +36 -0
- package/linter/rules/no-leaked-credentials.js +75 -0
- package/linter/rules/problematic-inputs.d.ts +1 -8
- package/linter/rules/problematic-inputs.js +5 -4
- package/linter/rules/roxygen-arguments.d.ts +2 -7
- package/linter/rules/roxygen-arguments.js +13 -20
- package/linter/rules/seeded-randomness.d.ts +2 -7
- package/linter/rules/seeded-randomness.js +7 -4
- package/linter/rules/software-has-license.d.ts +31 -0
- package/linter/rules/software-has-license.js +46 -0
- package/linter/rules/software-has-tests.d.ts +38 -0
- package/linter/rules/software-has-tests.js +48 -0
- package/linter/rules/stop-with-call-arg.d.ts +2 -7
- package/linter/rules/stop-with-call-arg.js +3 -2
- package/linter/rules/unused-definition.d.ts +3 -8
- package/linter/rules/unused-definition.js +7 -5
- package/linter/rules/useless-loop.d.ts +2 -7
- package/linter/rules/useless-loop.js +5 -2
- package/package.json +3 -2
- package/project/context/flowr-analyzer-context.d.ts +13 -14
- package/project/context/flowr-analyzer-context.js +4 -0
- package/project/context/flowr-analyzer-files-context.d.ts +12 -0
- package/project/context/flowr-analyzer-files-context.js +12 -2
- package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
- package/project/context/flowr-analyzer-gas-context.js +101 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
- package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
- package/project/plugins/flowr-analyzer-plugin.js +14 -7
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +3 -1
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +54 -8
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
- package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
- package/queries/catalog/dice-query/dice-query-executor.js +52 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
- package/queries/catalog/dice-query/dice-query-format.js +102 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
- package/queries/catalog/linter-query/linter-query-executor.js +7 -0
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +1 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
- package/queries/query.d.ts +18 -1
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +5 -0
- package/r-bridge/data/data.js +6 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
- package/r-bridge/parser.js +2 -9
- package/r-bridge/shell.d.ts +8 -1
- package/r-bridge/shell.js +26 -7
- package/search/flowr-search-builder.d.ts +2 -2
- package/search/flowr-search-builder.js +1 -1
- package/search/flowr-search-filters.d.ts +30 -9
- package/search/flowr-search-filters.js +26 -21
- package/search/search-executor/search-enrichers.d.ts +600 -0
- package/search/search-executor/search-enrichers.js +23 -2
- package/slicing/static/static-slicer.d.ts +39 -11
- package/slicing/static/static-slicer.js +44 -14
- package/util/collections/queue.d.ts +16 -0
- package/util/collections/queue.js +38 -0
- package/util/log.d.ts +1 -1
- package/util/log.js +1 -1
- package/util/mermaid/dfg.d.ts +2 -2
- package/util/mermaid/dfg.js +2 -2
- package/util/objects.d.ts +9 -0
- package/util/objects.js +54 -0
- package/util/proc.d.ts +6 -0
- package/util/proc.js +20 -0
- package/util/version.js +1 -1
package/cli/repl/execute.js
CHANGED
|
@@ -9,6 +9,7 @@ const child_process_1 = __importDefault(require("child_process"));
|
|
|
9
9
|
const readline_1 = __importDefault(require("readline"));
|
|
10
10
|
const assert_1 = require("../../util/assert");
|
|
11
11
|
const log_1 = require("../../util/log");
|
|
12
|
+
const proc_1 = require("../../util/proc");
|
|
12
13
|
/**
|
|
13
14
|
* Simply captures the output of the script executed by {@link waitOnScript}.
|
|
14
15
|
* @param stdio - The standard io tuple provided by {@link waitOnScript}
|
|
@@ -54,14 +55,14 @@ async function waitOnScript(module, args, io, exitOnError = false) {
|
|
|
54
55
|
if (code) {
|
|
55
56
|
console.error(`Script ${module} exited with code ${String(code)} and signal ${JSON.stringify(signal)}`);
|
|
56
57
|
if (exitOnError) {
|
|
57
|
-
|
|
58
|
+
(0, proc_1.exitSafe)(code);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
child.on('error', err => {
|
|
62
63
|
console.error(`Script ${module} signaled error ${JSON.stringify(err)}`);
|
|
63
64
|
if (exitOnError) {
|
|
64
|
-
|
|
65
|
+
(0, proc_1.exitSafe)(1);
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
await new Promise((resolve, reject) => child.on('exit', code => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { SlicingCriterion, SlicingCriteria } from '../../../slicing/criterion/parse';
|
|
2
2
|
import { SliceDirection } from '../../../util/slice-direction';
|
|
3
|
+
import type { CommandCompletions } from '../core';
|
|
4
|
+
import type { FlowrConfig } from '../../../config';
|
|
3
5
|
/**
|
|
4
6
|
* Checks whether the given argument represents a slicing direction with an `f` suffix.
|
|
5
7
|
*/
|
|
@@ -12,3 +14,17 @@ export declare function sliceCriterionParser(argument: string | undefined): Slic
|
|
|
12
14
|
* Parses multiple slicing criteria from the given argument.
|
|
13
15
|
*/
|
|
14
16
|
export declare function sliceCriteriaParser(argument: string | undefined): SlicingCriteria | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Tab-completer for query arguments of the form `(line@var;line@var;...)`.
|
|
19
|
+
* Guides the user step by step: `(` then digits then `@` then variable then `)`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function criteriaQueryCompleter(line: readonly string[], startingNewArg: boolean, _config: FlowrConfig): CommandCompletions;
|
|
22
|
+
/**
|
|
23
|
+
* Parses a dice argument of the form `(from1;from2->to1;to2)`.
|
|
24
|
+
* Returns `{ from, to }` on success, or `undefined` if the argument is malformed.
|
|
25
|
+
* Each side is a semicolon-separated list of slicing criteria; a single criterion needs no semicolon.
|
|
26
|
+
*/
|
|
27
|
+
export declare function diceCriteriaParser(argument: string | undefined): {
|
|
28
|
+
from: SlicingCriteria;
|
|
29
|
+
to: SlicingCriteria;
|
|
30
|
+
} | undefined;
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.sliceDirectionParser = sliceDirectionParser;
|
|
4
4
|
exports.sliceCriterionParser = sliceCriterionParser;
|
|
5
5
|
exports.sliceCriteriaParser = sliceCriteriaParser;
|
|
6
|
+
exports.criteriaQueryCompleter = criteriaQueryCompleter;
|
|
7
|
+
exports.diceCriteriaParser = diceCriteriaParser;
|
|
6
8
|
const slice_direction_1 = require("../../../util/slice-direction");
|
|
7
9
|
/**
|
|
8
10
|
* Checks whether the given argument represents a slicing direction with an `f` suffix.
|
|
@@ -31,4 +33,54 @@ function sliceCriteriaParser(argument) {
|
|
|
31
33
|
return criteria;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
36
|
+
/** Last partial criterion fragment after the most recent `;` or after `(`. */
|
|
37
|
+
function lastCriterionFragment(arg) {
|
|
38
|
+
return arg.slice(Math.max(arg.indexOf('(') + 1, arg.lastIndexOf(';') + 1));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Tab-completer for query arguments of the form `(line@var;line@var;...)`.
|
|
42
|
+
* Guides the user step by step: `(` then digits then `@` then variable then `)`.
|
|
43
|
+
*/
|
|
44
|
+
function criteriaQueryCompleter(line, startingNewArg, _config) {
|
|
45
|
+
if (line.length === 0) {
|
|
46
|
+
return { completions: ['('] };
|
|
47
|
+
}
|
|
48
|
+
if (startingNewArg || line.length !== 1) {
|
|
49
|
+
return { completions: [] };
|
|
50
|
+
}
|
|
51
|
+
const arg = line[0];
|
|
52
|
+
if (arg.endsWith(')') || arg.endsWith(')f')) {
|
|
53
|
+
return { completions: [] };
|
|
54
|
+
}
|
|
55
|
+
const fragment = lastCriterionFragment(arg);
|
|
56
|
+
if (/^\d+$/.test(fragment)) {
|
|
57
|
+
return { completions: [`${arg}@`], argumentPart: arg };
|
|
58
|
+
}
|
|
59
|
+
if (/^\d+@\w+$/.test(fragment)) {
|
|
60
|
+
return { completions: [`${arg})`], argumentPart: arg };
|
|
61
|
+
}
|
|
62
|
+
return { completions: [] };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parses a dice argument of the form `(from1;from2->to1;to2)`.
|
|
66
|
+
* Returns `{ from, to }` on success, or `undefined` if the argument is malformed.
|
|
67
|
+
* Each side is a semicolon-separated list of slicing criteria; a single criterion needs no semicolon.
|
|
68
|
+
*/
|
|
69
|
+
function diceCriteriaParser(argument) {
|
|
70
|
+
if (!argument?.startsWith('(') || !argument.includes(')')) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const endBracket = argument.indexOf(')');
|
|
74
|
+
const inner = argument.slice(1, endBracket);
|
|
75
|
+
const arrowIdx = inner.indexOf('->');
|
|
76
|
+
if (arrowIdx < 0) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const from = inner.slice(0, arrowIdx).split(';').filter(s => s.length > 0);
|
|
80
|
+
const to = inner.slice(arrowIdx + 2).split(';').filter(s => s.length > 0);
|
|
81
|
+
if (from.length === 0 || to.length === 0) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return { from, to };
|
|
85
|
+
}
|
|
34
86
|
//# sourceMappingURL=slice-query-parser.js.map
|
|
@@ -23,6 +23,7 @@ export declare class FlowRServerConnection {
|
|
|
23
23
|
private currentMessageBuffer;
|
|
24
24
|
private handleData;
|
|
25
25
|
private handleFileAnalysisRequest;
|
|
26
|
+
private invalidateTokens;
|
|
26
27
|
private sendFileAnalysisResponse;
|
|
27
28
|
private createAnalyzerForRequest;
|
|
28
29
|
private handleSliceRequest;
|
|
@@ -135,6 +135,16 @@ class FlowRServerConnection {
|
|
|
135
135
|
}
|
|
136
136
|
const message = requestResult.message;
|
|
137
137
|
this.logger.info(`[${this.name}] Received file analysis request for ${message.filename ?? 'unknown file'}${message.filetoken ? ' with token: ' + message.filetoken : ''}`);
|
|
138
|
+
if (message.content === undefined && message.filepath === undefined) {
|
|
139
|
+
(0, send_1.sendMessage)(this.socket, {
|
|
140
|
+
type: 'response-file-analysis',
|
|
141
|
+
format: 'json',
|
|
142
|
+
id: message.id,
|
|
143
|
+
results: {}
|
|
144
|
+
});
|
|
145
|
+
this.invalidateTokens(message.invalidateToken);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
138
148
|
if (message.filetoken && this.fileMap.has(message.filetoken)) {
|
|
139
149
|
this.logger.warn(`File token ${message.filetoken} already exists. Overwriting.`);
|
|
140
150
|
// explicitly delete the previous store
|
|
@@ -156,6 +166,21 @@ class FlowRServerConnection {
|
|
|
156
166
|
}
|
|
157
167
|
// this is an interestingly named function that means "I am a callback that removes a file" - so this deletes the file
|
|
158
168
|
tempFile.removeCallback();
|
|
169
|
+
this.invalidateTokens(message.invalidateToken);
|
|
170
|
+
}
|
|
171
|
+
invalidateTokens(invalidateToken) {
|
|
172
|
+
if (!invalidateToken) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const tokens = typeof invalidateToken === 'string' ? [invalidateToken] : invalidateToken;
|
|
176
|
+
for (const token of tokens) {
|
|
177
|
+
if (this.fileMap.delete(token)) {
|
|
178
|
+
this.logger.info(`[${this.name}] Invalidated file token ${token}`);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
this.logger.warn(`[${this.name}] Cannot invalidate unknown file token ${token}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
159
184
|
}
|
|
160
185
|
async sendFileAnalysisResponse(analyzer, message) {
|
|
161
186
|
let cfg = undefined;
|
|
@@ -34,6 +34,16 @@ export interface FileAnalysisRequestMessage extends IdMessageBase {
|
|
|
34
34
|
cfg?: boolean;
|
|
35
35
|
/** Controls the serialization of the `results` (and the {@link ControlFlowGraph} if the corresponding flag is set). If missing, we assume _json_. */
|
|
36
36
|
format?: 'compact' | 'json' | 'n-quads';
|
|
37
|
+
/**
|
|
38
|
+
* One or more previously stored file tokens that the server should drop after it has answered this request.
|
|
39
|
+
* Use this to free the memory of analyses you no longer need.
|
|
40
|
+
*
|
|
41
|
+
* You may send a request that contains _only_ this field (without `content` or `filepath`) to drop tokens
|
|
42
|
+
* without performing a new analysis. In that case the server answers with an empty `results` object.
|
|
43
|
+
* As the tokens are dropped only after the response, you may also pass the request's own `filetoken` here to
|
|
44
|
+
* analyze a file once and have the server forget it immediately afterward.
|
|
45
|
+
*/
|
|
46
|
+
invalidateToken?: string | readonly string[];
|
|
37
47
|
}
|
|
38
48
|
export declare const requestAnalysisMessage: MessageDefinition<FileAnalysisRequestMessage>;
|
|
39
49
|
/**
|
|
@@ -15,8 +15,12 @@ exports.requestAnalysisMessage = {
|
|
|
15
15
|
content: joi_1.default.string().optional().description('The content of the file or an R expression (either give this or the filepath).'),
|
|
16
16
|
filepath: joi_1.default.alternatives(joi_1.default.string(), joi_1.default.array().items(joi_1.default.string())).optional().description('The path to the file(s) on the local machine (either give this or the content).'),
|
|
17
17
|
cfg: joi_1.default.boolean().optional().description('If you want to extract the control flow information of the file.'),
|
|
18
|
-
format: joi_1.default.string().valid('json', 'n-quads', 'compact').optional().description('The format of the results, if missing we assume json.')
|
|
19
|
-
|
|
18
|
+
format: joi_1.default.string().valid('json', 'n-quads', 'compact').optional().description('The format of the results, if missing we assume json.'),
|
|
19
|
+
invalidateToken: joi_1.default.alternatives(joi_1.default.string(), joi_1.default.array().items(joi_1.default.string())).optional().description('One or more file tokens to drop from the server store after this request has been answered.')
|
|
20
|
+
}).when(joi_1.default.object({ invalidateToken: joi_1.default.exist() }).unknown(), {
|
|
21
|
+
then: joi_1.default.object().oxor('content', 'filepath'),
|
|
22
|
+
otherwise: joi_1.default.object().xor('content', 'filepath')
|
|
23
|
+
})
|
|
20
24
|
};
|
|
21
25
|
const jsonSchema = joi_1.default.object({
|
|
22
26
|
type: joi_1.default.string().valid('response-file-analysis').required().description('The type of the message.'),
|
|
@@ -23,7 +23,7 @@ export interface SliceRequestMessage extends IdMessageBase {
|
|
|
23
23
|
}
|
|
24
24
|
export declare const requestSliceMessage: MessageDefinition<SliceRequestMessage>;
|
|
25
25
|
/**
|
|
26
|
-
* Similar to {@link
|
|
26
|
+
* Similar to {@link FileAnalysisResponseMessageJson} this only contains the results of
|
|
27
27
|
* the slice steps.
|
|
28
28
|
*/
|
|
29
29
|
export interface SliceResponseMessage extends IdMessageBase {
|
|
@@ -16,6 +16,7 @@ const statistics_helper_core_1 = require("./statistics-helper-core");
|
|
|
16
16
|
const command_line_args_1 = __importDefault(require("command-line-args"));
|
|
17
17
|
const scripts_info_1 = require("../common/scripts-info");
|
|
18
18
|
const ansi_1 = require("../../util/text/ansi");
|
|
19
|
+
const proc_1 = require("../../util/proc");
|
|
19
20
|
const testRegex = /[^/]*\/test/i;
|
|
20
21
|
const exampleRegex = /[^/]*\/example/i;
|
|
21
22
|
function getPrefixForFile(file) {
|
|
@@ -63,7 +64,7 @@ async function collectFileArguments(options, verboseAdd, dumpJson, features) {
|
|
|
63
64
|
async function flowrScriptGetStats(options, config) {
|
|
64
65
|
if (options.input.length === 0) {
|
|
65
66
|
console.error('No input files given. Nothing to do. See \'--help\' if this is an error.');
|
|
66
|
-
|
|
67
|
+
return (0, proc_1.exitSafe)(0);
|
|
67
68
|
}
|
|
68
69
|
if (options['no-ansi']) {
|
|
69
70
|
log_1.log.info('disabling ansi colors');
|
|
@@ -21,6 +21,7 @@ const time_1 = require("../../util/text/time");
|
|
|
21
21
|
const tar_1 = require("tar");
|
|
22
22
|
const ansi_1 = require("../../util/text/ansi");
|
|
23
23
|
const config_1 = require("../../config");
|
|
24
|
+
const proc_1 = require("../../util/proc");
|
|
24
25
|
const flowr_analyzer_context_1 = require("../../project/context/flowr-analyzer-context");
|
|
25
26
|
function compressFolder(folder, target) {
|
|
26
27
|
return (0, tar_1.create)({
|
|
@@ -50,7 +51,7 @@ async function getStatsForSingleFile(options, config) {
|
|
|
50
51
|
target = (0, features_1.retrieveArchiveName)(options['output-dir']);
|
|
51
52
|
if (fs_1.default.existsSync(target)) {
|
|
52
53
|
console.log(`Archive ${target} exists. Skip.`);
|
|
53
|
-
|
|
54
|
+
return (0, proc_1.exitSafe)(0);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
// assume correct
|
package/cli/wiki.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ import { WikiLinter } from '../documentation/wiki-linter';
|
|
|
9
9
|
import { WikiSetup } from '../documentation/wiki-setup';
|
|
10
10
|
import { WikiOverview } from '../documentation/wiki-overview';
|
|
11
11
|
import { WikiAbsint } from '../documentation/wiki-absint';
|
|
12
|
-
|
|
12
|
+
import { WikiCreateLintingRules } from '../documentation/wiki-create-linting-rules';
|
|
13
|
+
export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, WikiCreateLintingRules, IssueLintingRule, DocReadme, DocCapabilities];
|
|
13
14
|
export type ValidWikiDocumentTargets = ReturnType<typeof AllWikiDocuments[number]['getTarget']>;
|
|
14
15
|
export type ValidWikiDocumentTargetsNoSuffix = ValidWikiDocumentTargets extends `${infer Name}.${string}` ? Name : never;
|
|
15
16
|
/**
|
package/cli/wiki.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.AllWikiDocuments = void 0;
|
|
7
7
|
exports.makeAllWikis = makeAllWikis;
|
|
8
|
+
const proc_1 = require("../util/proc");
|
|
8
9
|
const doc_context_1 = require("../documentation/wiki-mk/doc-context");
|
|
9
10
|
const shell_1 = require("../r-bridge/shell");
|
|
10
11
|
const tree_sitter_executor_1 = require("../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor");
|
|
@@ -26,6 +27,7 @@ const os_1 = __importDefault(require("os"));
|
|
|
26
27
|
const wiki_setup_1 = require("../documentation/wiki-setup");
|
|
27
28
|
const wiki_overview_1 = require("../documentation/wiki-overview");
|
|
28
29
|
const wiki_absint_1 = require("../documentation/wiki-absint");
|
|
30
|
+
const wiki_create_linting_rules_1 = require("../documentation/wiki-create-linting-rules");
|
|
29
31
|
exports.AllWikiDocuments = [
|
|
30
32
|
new wiki_faq_1.WikiFaq(),
|
|
31
33
|
new documentation_1.WikiSearch(),
|
|
@@ -43,6 +45,7 @@ exports.AllWikiDocuments = [
|
|
|
43
45
|
new documentation_1.WikiLintingAndTesting(),
|
|
44
46
|
new wiki_linter_1.WikiLinter(),
|
|
45
47
|
new wiki_absint_1.WikiAbsint(),
|
|
48
|
+
new wiki_create_linting_rules_1.WikiCreateLintingRules(),
|
|
46
49
|
new issue_linting_rule_1.IssueLintingRule(),
|
|
47
50
|
new doc_readme_1.DocReadme(),
|
|
48
51
|
new documentation_1.DocCapabilities()
|
|
@@ -159,7 +162,7 @@ if (require.main === module) {
|
|
|
159
162
|
}
|
|
160
163
|
void makeAllWikis(options.force, options.filter).catch(err => {
|
|
161
164
|
console.error('Error while generating wikis:', err);
|
|
162
|
-
|
|
165
|
+
(0, proc_1.exitSafe)(1);
|
|
163
166
|
}).then(() => {
|
|
164
167
|
if (options['keep-alive']) {
|
|
165
168
|
console.log('Wiki generator running in keep-alive mode...');
|
package/config.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { DataflowProcessors } from './dataflow/processor';
|
|
|
7
7
|
import type { ParentInformation } from './r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
8
|
import type { FlowrAnalyzerContext } from './project/context/flowr-analyzer-context';
|
|
9
9
|
import type { BuiltInFlowrPluginArgs, BuiltInFlowrPluginName } from './project/plugins/plugin-registry';
|
|
10
|
+
import { type FlowrGasConfig } from './gas';
|
|
10
11
|
export declare enum VariableResolve {
|
|
11
12
|
/** Don't resolve constants at all */
|
|
12
13
|
Disabled = "disabled",
|
|
@@ -83,16 +84,6 @@ export interface FlowrLaxSourcingOptions extends MergeableRecord {
|
|
|
83
84
|
* - `faa-bar.R` (replaced spaces and oo)
|
|
84
85
|
*/
|
|
85
86
|
readonly applyReplacements?: Record<string, string>[];
|
|
86
|
-
/**
|
|
87
|
-
* Whether to check the heap memory usage before analyzing a sourced file,
|
|
88
|
-
* skipping the analysis when memory pressure exceeds {@link memoryThreshold}.
|
|
89
|
-
*/
|
|
90
|
-
readonly checkMemoryOnSource?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Fraction of the V8 heap limit at which source analysis is skipped (0-1).
|
|
93
|
-
* Only effective when {@link checkMemoryOnSource} is true.
|
|
94
|
-
*/
|
|
95
|
-
readonly memoryThreshold?: number;
|
|
96
87
|
}
|
|
97
88
|
export type ConfigPlugin<T extends BuiltInFlowrPluginName | string> = T | string | (T extends BuiltInFlowrPluginName ? [T, BuiltInFlowrPluginArgs<T>] : [string, unknown[]]);
|
|
98
89
|
/**
|
|
@@ -218,6 +209,14 @@ export interface FlowrConfig extends MergeableRecord {
|
|
|
218
209
|
};
|
|
219
210
|
};
|
|
220
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* Resource-usage guard (gas) configuration.
|
|
214
|
+
* Gas checks are disabled by default (all feature factors are `0`).
|
|
215
|
+
* Set a `feature factor > 0` to enable checking for that feature.
|
|
216
|
+
* @see {@link FlowrGasConfig}
|
|
217
|
+
* @see {@link ReadOnlyFlowrAnalyzerGasContext}
|
|
218
|
+
*/
|
|
219
|
+
readonly gas: FlowrGasConfig;
|
|
221
220
|
}
|
|
222
221
|
export type ValidFlowrConfigPaths = Paths<FlowrConfig, {
|
|
223
222
|
depth: 9;
|
package/config.js
CHANGED
|
@@ -11,6 +11,7 @@ const log_1 = require("./util/log");
|
|
|
11
11
|
const files_1 = require("./util/files");
|
|
12
12
|
const joi_1 = __importDefault(require("joi"));
|
|
13
13
|
const object_path_1 = __importDefault(require("object-path"));
|
|
14
|
+
const gas_1 = require("./gas");
|
|
14
15
|
var VariableResolve;
|
|
15
16
|
(function (VariableResolve) {
|
|
16
17
|
/** Don't resolve constants at all */
|
|
@@ -105,9 +106,7 @@ exports.FlowrConfig = {
|
|
|
105
106
|
ignoreCapitalization: true,
|
|
106
107
|
inferWorkingDirectory: InferWorkingDirectory.ActiveScript,
|
|
107
108
|
searchPath: [],
|
|
108
|
-
repeatedSourceLimit: 2
|
|
109
|
-
checkMemoryOnSource: true,
|
|
110
|
-
memoryThreshold: 0.9
|
|
109
|
+
repeatedSourceLimit: 2
|
|
111
110
|
},
|
|
112
111
|
instrument: {
|
|
113
112
|
dataflowExtractors: undefined
|
|
@@ -126,6 +125,13 @@ exports.FlowrConfig = {
|
|
|
126
125
|
maxReadLines: 1e6
|
|
127
126
|
}
|
|
128
127
|
}
|
|
128
|
+
},
|
|
129
|
+
gas: {
|
|
130
|
+
thresholds: {
|
|
131
|
+
memory: { problematic: 0.7, critical: 0.9 },
|
|
132
|
+
timeMs: { problematic: 100_000, critical: 120_000 }
|
|
133
|
+
},
|
|
134
|
+
features: {}
|
|
129
135
|
}
|
|
130
136
|
};
|
|
131
137
|
},
|
|
@@ -174,9 +180,7 @@ exports.FlowrConfig = {
|
|
|
174
180
|
inferWorkingDirectory: joi_1.default.string().valid(...Object.values(InferWorkingDirectory)).description('Try to infer the working directory from the main or any script to analyze.'),
|
|
175
181
|
searchPath: joi_1.default.array().items(joi_1.default.string()).description('Additionally search in these paths.'),
|
|
176
182
|
repeatedSourceLimit: joi_1.default.number().optional().description('How often the same file can be sourced within a single run? Please be aware: in case of cyclic sources this may not reach a fixpoint so give this a sensible limit.'),
|
|
177
|
-
applyReplacements: joi_1.default.array().items(joi_1.default.object()).description('Provide name replacements for loaded files')
|
|
178
|
-
checkMemoryOnSource: joi_1.default.boolean().optional().description('Check heap memory usage before analyzing a sourced file, skipping when memory pressure exceeds the configured threshold.'),
|
|
179
|
-
memoryThreshold: joi_1.default.number().min(0).max(1).optional().description('Fraction of the V8 heap limit (0-1) at which source analysis is skipped. Only effective when checkMemoryOnSource is true.')
|
|
183
|
+
applyReplacements: joi_1.default.array().items(joi_1.default.object()).description('Provide name replacements for loaded files')
|
|
180
184
|
}).optional().description('If lax source calls are active, flowR searches for sourced files much more freely, based on the configurations you give it. This option is only in effect if `ignoreSourceCalls` is set to false.'),
|
|
181
185
|
slicer: joi_1.default.object({
|
|
182
186
|
threshold: joi_1.default.number().optional().description('The maximum number of iterations to perform on a single function call during slicing.'),
|
|
@@ -192,7 +196,21 @@ exports.FlowrConfig = {
|
|
|
192
196
|
maxReadLines: joi_1.default.number().min(1).description('The maximum number of lines to read when extracting data frame shapes from loaded files, such as CSV files.')
|
|
193
197
|
}).description('Configuration options for reading data frame shapes from loaded external data files, such as CSV files.')
|
|
194
198
|
}).description('The configuration of the shape inference for data frames.')
|
|
195
|
-
}).description('The configuration options for abstract interpretation.')
|
|
199
|
+
}).description('The configuration options for abstract interpretation.'),
|
|
200
|
+
gas: joi_1.default.object({
|
|
201
|
+
thresholds: joi_1.default.object({
|
|
202
|
+
memory: joi_1.default.object({
|
|
203
|
+
problematic: joi_1.default.number().min(0).max(1).optional().description('Heap fraction (0-1) above which Problematic is returned.'),
|
|
204
|
+
critical: joi_1.default.number().min(0).max(1).optional().description('Heap fraction (0-1) above which Critical is returned.')
|
|
205
|
+
}).optional().description('Heap-usage fraction thresholds (0-1).'),
|
|
206
|
+
timeMs: joi_1.default.object({
|
|
207
|
+
problematic: joi_1.default.number().min(0).optional().description('Elapsed ms above which Problematic is returned.'),
|
|
208
|
+
critical: joi_1.default.number().min(0).optional().description('Elapsed ms above which Critical is returned.')
|
|
209
|
+
}).optional().description('Elapsed analysis time thresholds in milliseconds.')
|
|
210
|
+
}).optional().description('Shared thresholds for all gas checks (scaled by per-feature factor).'),
|
|
211
|
+
features: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.number().min(0).optional()).optional().description('Per-feature sensitivity factors. 0 or absent disables gas checking for that feature. A factor of 2 makes the feature twice as sensitive. Recognised keys: `source`, `side-effect-linking`, `linter`.'),
|
|
212
|
+
heapProvider: joi_1.default.function().optional().description('Custom heap statistics source (programmatic configs only), overriding the built-in v8/performance.memory detection.')
|
|
213
|
+
}).optional().description(`Resource-usage guard (gas) configuration. All feature factors default to 0 (disabled). See ${gas_1.GasWikiRef}.`)
|
|
196
214
|
}).description('The configuration file format for flowR.'),
|
|
197
215
|
/**
|
|
198
216
|
* Parses the given JSON string as a flowR config file, returning the resulting config object if the parsing and validation were successful, or `undefined` if there was an error.
|
|
@@ -4,6 +4,6 @@ import { type ControlFlowGraph } from './control-flow-graph';
|
|
|
4
4
|
/**
|
|
5
5
|
* Compare two control flow graphs and return a report on the differences.
|
|
6
6
|
* If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
|
|
7
|
-
* @see {@link
|
|
7
|
+
* @see {@link diffDataflowGraph} - for dataflow graphs
|
|
8
8
|
*/
|
|
9
9
|
export declare function diffOfControlFlowGraphs(left: NamedGraph<ControlFlowGraph>, right: NamedGraph<ControlFlowGraph>, config?: Partial<GenericDiffConfiguration>): GraphDifferenceReport;
|
package/control-flow/diff-cfg.js
CHANGED
|
@@ -9,7 +9,7 @@ const arrays_1 = require("../util/collections/arrays");
|
|
|
9
9
|
/**
|
|
10
10
|
* Compare two control flow graphs and return a report on the differences.
|
|
11
11
|
* If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
|
|
12
|
-
* @see {@link
|
|
12
|
+
* @see {@link diffDataflowGraph} - for dataflow graphs
|
|
13
13
|
*/
|
|
14
14
|
function diffOfControlFlowGraphs(left, right, config) {
|
|
15
15
|
if (left.graph === right.graph) {
|
|
@@ -253,6 +253,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
253
253
|
return this.onRecallCall({ call });
|
|
254
254
|
case built_in_proc_name_1.BuiltInProcName.PurrrFormula:
|
|
255
255
|
return this.onPurrFormulaCall({ call });
|
|
256
|
+
case built_in_proc_name_1.BuiltInProcName.NamespaceAccess:
|
|
256
257
|
case built_in_proc_name_1.BuiltInProcName.NewEnv:
|
|
257
258
|
case built_in_proc_name_1.BuiltInProcName.With:
|
|
258
259
|
case built_in_proc_name_1.BuiltInProcName.Attach:
|
|
@@ -4,6 +4,7 @@ exports.visitCfgInReverseOrder = visitCfgInReverseOrder;
|
|
|
4
4
|
exports.visitCfgInOrder = visitCfgInOrder;
|
|
5
5
|
exports.canReach = canReach;
|
|
6
6
|
const control_flow_graph_1 = require("./control-flow-graph");
|
|
7
|
+
const queue_1 = require("../util/collections/queue");
|
|
7
8
|
/**
|
|
8
9
|
* Visit all nodes reachable from the start node in the control flow graph, traversing the dependencies but ignoring cycles.
|
|
9
10
|
* @param graph - The control flow graph.
|
|
@@ -58,10 +59,10 @@ function visitCfgInOrder(graph, startNodes,
|
|
|
58
59
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type -- void is used to indicate that the return value is ignored/we never stop
|
|
59
60
|
visitor) {
|
|
60
61
|
const visited = new Set();
|
|
61
|
-
const queue =
|
|
62
|
+
const queue = new queue_1.ArrayQueue(startNodes);
|
|
62
63
|
const hasBb = graph.mayHaveBasicBlocks();
|
|
63
|
-
while (queue.
|
|
64
|
-
const current = queue.
|
|
64
|
+
while (!queue.isEmpty()) {
|
|
65
|
+
const current = queue.dequeue();
|
|
65
66
|
if (visited.has(current)) {
|
|
66
67
|
continue;
|
|
67
68
|
}
|
|
@@ -74,13 +75,13 @@ visitor) {
|
|
|
74
75
|
if (control_flow_graph_1.CfgVertex.isBlock(get)) {
|
|
75
76
|
const elems = control_flow_graph_1.CfgVertex.getBasicBlockElements(get);
|
|
76
77
|
for (const e of elems.toReversed()) {
|
|
77
|
-
queue.
|
|
78
|
+
queue.enqueue(control_flow_graph_1.CfgVertex.getId(e));
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
const outgoing = graph.ingoingEdges(current) ?? [];
|
|
82
83
|
for (const [to] of outgoing) {
|
|
83
|
-
queue.
|
|
84
|
+
queue.enqueue(to);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
return visited;
|
|
@@ -93,14 +93,14 @@ class CfgSingleIterationLoopDetector extends semantic_cfg_guided_visitor_1.Seman
|
|
|
93
93
|
(0, assert_1.guard)(exits.size !== 0, "Can't find end of loop");
|
|
94
94
|
const stack = [this.loopToCheck];
|
|
95
95
|
while (stack.length > 0) {
|
|
96
|
-
const current = stack.
|
|
96
|
+
const current = stack.pop();
|
|
97
97
|
if (!this.visitNode(current)) {
|
|
98
98
|
continue;
|
|
99
99
|
}
|
|
100
100
|
if (!exits.has(current)) {
|
|
101
101
|
const next = ingoing(current) ?? [];
|
|
102
102
|
for (const [to] of next) {
|
|
103
|
-
stack.
|
|
103
|
+
stack.push(to);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
this.onlyLoopyOnce ||= this.encounteredLoopBreaker && (0, info_1.happensInEveryBranch)(this.loopCds?.filter(c => !c.byIteration));
|
|
@@ -5,8 +5,8 @@ export declare function dataflowGraphToJson(df: DataflowInformation): string;
|
|
|
5
5
|
/**
|
|
6
6
|
* Transforms the dataflow graph into a quad serialization.
|
|
7
7
|
* @see {@link df2quads}
|
|
8
|
-
* @see {@link
|
|
9
|
-
* @see {@link
|
|
8
|
+
* @see {@link DataflowMermaid.url}
|
|
9
|
+
* @see {@link DataflowMermaid.convert}
|
|
10
10
|
* @see {@link dataflowGraphToJson}
|
|
11
11
|
*/
|
|
12
12
|
export declare function dataflowGraphToQuads(df: DataflowInformation, config: QuadSerializationConfiguration): string;
|
|
@@ -52,8 +52,8 @@ function dataflowGraphToJson(df) {
|
|
|
52
52
|
/**
|
|
53
53
|
* Transforms the dataflow graph into a quad serialization.
|
|
54
54
|
* @see {@link df2quads}
|
|
55
|
-
* @see {@link
|
|
56
|
-
* @see {@link
|
|
55
|
+
* @see {@link DataflowMermaid.url}
|
|
56
|
+
* @see {@link DataflowMermaid.convert}
|
|
57
57
|
* @see {@link dataflowGraphToJson}
|
|
58
58
|
*/
|
|
59
59
|
function dataflowGraphToQuads(df, config) {
|
|
@@ -9,7 +9,7 @@ function processor(results, input) {
|
|
|
9
9
|
const direction = input.direction ?? slice_direction_1.SliceDirection.Backward;
|
|
10
10
|
const threshold = input.threshold ?? input.context?.config.solver.slicer?.threshold;
|
|
11
11
|
const n = results.normalize;
|
|
12
|
-
return (0, static_slicer_1.staticSlice)(input.context, results.dataflow, n, parse_1.SlicingCriteria.convertAll(input.criterion, n.idMap), direction, threshold);
|
|
12
|
+
return (0, static_slicer_1.staticSlice)({ ctx: input.context, info: results.dataflow, ast: n, ids: parse_1.SlicingCriteria.convertAll(input.criterion, n.idMap), direction, threshold });
|
|
13
13
|
}
|
|
14
14
|
exports.STATIC_SLICE = {
|
|
15
15
|
name: 'slice',
|