@eagleoutice/flowr 2.13.15 → 2.14.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 +31 -37
- package/abstract-interpretation/absint-visitor.js +1 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +18 -17
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +6 -6
- package/abstract-interpretation/data-frame/resolve-args.d.ts +9 -4
- package/abstract-interpretation/data-frame/resolve-args.js +10 -5
- package/abstract-interpretation/unsupported-functions.d.ts +1 -0
- package/abstract-interpretation/unsupported-functions.js +1 -0
- package/benchmark/calibration.d.ts +12 -5
- package/benchmark/calibration.js +42 -14
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +5 -4
- package/benchmark/stats/size-of.js +1 -1
- package/benchmark/summarizer/first-phase/process.d.ts +2 -0
- package/benchmark/summarizer/first-phase/process.js +2 -0
- package/cli/common/options.d.ts +0 -31
- package/cli/common/options.js +1 -8
- package/cli/common/scripts-info.d.ts +0 -38
- package/cli/common/scripts-info.js +0 -8
- package/cli/repl/commands/repl-query.js +37 -2
- package/cli/repl/core.js +6 -3
- package/cli/repl/parser/slice-query-parser.js +1 -1
- package/cli/repl/print-version.js +2 -2
- package/config.d.ts +16 -0
- package/config.js +79 -0
- package/control-flow/control-flow-graph.d.ts +2 -0
- package/control-flow/control-flow-graph.js +2 -0
- package/control-flow/extract-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +1 -1
- package/control-flow/useless-loop.js +1 -1
- package/core/print/slice-diff-ansi.js +1 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/dataflow/cluster.js +2 -2
- package/dataflow/environments/built-in-props.d.ts +8 -1
- package/dataflow/environments/built-in-props.js +18 -0
- package/dataflow/environments/built-in.d.ts +7 -1
- package/dataflow/environments/built-in.js +42 -3
- package/dataflow/environments/default-builtin-config.d.ts +442 -10
- package/dataflow/environments/default-builtin-config.js +188 -18
- package/dataflow/environments/environment.d.ts +1 -1
- package/dataflow/environments/identifier.d.ts +7 -2
- package/dataflow/environments/identifier.js +6 -1
- package/dataflow/environments/query-fn-props.js +2 -2
- package/dataflow/environments/reference-to-maybe.js +5 -5
- package/dataflow/environments/resolve-by-name.d.ts +3 -0
- package/dataflow/environments/resolve-by-name.js +30 -5
- package/dataflow/environments/resolve-helper.d.ts +6 -0
- package/dataflow/environments/resolve-helper.js +6 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
- package/dataflow/eval/resolve/alias-tracking.js +21 -14
- package/dataflow/eval/resolve/node-value.d.ts +6 -0
- package/dataflow/eval/resolve/node-value.js +15 -9
- package/dataflow/eval/resolve/resolve-argument.js +2 -2
- package/dataflow/eval/resolve/resolve-numbers.js +2 -2
- package/dataflow/eval/resolve/resolve-operators.js +4 -3
- package/dataflow/eval/resolve/resolve-strings.js +3 -3
- package/dataflow/eval/resolve/resolve-working-directory.js +2 -1
- package/dataflow/eval/resolve/resolve.d.ts +5 -5
- package/dataflow/eval/resolve/resolve.js +10 -11
- package/dataflow/eval/values/general.d.ts +4 -1
- package/dataflow/eval/values/general.js +4 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/fn/exceptions-of-function.js +5 -4
- package/dataflow/fn/higher-order-function.d.ts +1 -1
- package/dataflow/fn/higher-order-function.js +22 -2
- package/dataflow/graph/call-graph.d.ts +1 -1
- package/dataflow/graph/call-graph.js +15 -15
- package/dataflow/graph/df-helper.d.ts +17 -2
- package/dataflow/graph/df-helper.js +11 -5
- package/dataflow/graph/diff-dataflow-graph.js +6 -6
- package/dataflow/graph/edge.d.ts +27 -0
- package/dataflow/graph/edge.js +33 -0
- package/dataflow/graph/graph-helper.d.ts +4 -4
- package/dataflow/graph/graph-helper.js +5 -5
- package/dataflow/graph/graph.d.ts +11 -1
- package/dataflow/graph/graph.js +16 -5
- package/dataflow/graph/vertex.d.ts +47 -6
- package/dataflow/graph/vertex.js +47 -6
- package/dataflow/internal/linker.d.ts +1 -0
- package/dataflow/internal/linker.js +11 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
- 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.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
- 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-new-generic.js +3 -3
- 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 +8 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -12
- package/dataflow/internal/process/functions/call/common.d.ts +9 -1
- package/dataflow/internal/process/functions/call/common.js +17 -6
- package/dataflow/internal/process/functions/call/deferred.d.ts +7 -0
- package/dataflow/internal/process/functions/call/deferred.js +24 -1
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
- package/dataflow/internal/process/functions/call/nse.d.ts +34 -5
- package/dataflow/internal/process/functions/call/nse.js +114 -6
- package/dataflow/internal/process/functions/call/quoted.d.ts +6 -0
- package/dataflow/internal/process/functions/call/quoted.js +26 -11
- package/dataflow/origin/dfg-get-origin.d.ts +1 -0
- package/dataflow/origin/dfg-get-origin.js +9 -6
- package/documentation/data/faq/faqs.js +88 -88
- package/documentation/data/faq/recommended-configs.js +1 -1
- package/documentation/data/faq/wiki-faq-store.js +1 -1
- package/documentation/doc-capabilities.js +1 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-auto-gen.js +6 -2
- package/documentation/doc-util/doc-functions.js +1 -1
- package/documentation/wiki-cfg.js +2 -2
- package/documentation/wiki-create-linting-rules.js +45 -45
- package/documentation/wiki-dataflow-graph.js +25 -18
- package/documentation/wiki-linting-and-testing.js +93 -5
- package/documentation/wiki-mk/doc-maker.js +1 -1
- package/documentation/wiki-overview.js +12 -1
- package/documentation/wiki-signature-database.js +3 -0
- package/linter/linter-format.d.ts +1 -0
- package/linter/linter-format.js +1 -0
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/function-finder-util.js +1 -1
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/no-leaked-credentials.js +2 -1
- package/linter/rules/stop-with-call-arg.js +4 -4
- package/linter/rules/undefined-symbol-util.d.ts +1 -1
- package/linter/rules/undefined-symbol-util.js +5 -4
- package/linter/rules/undefined-symbol.js +3 -3
- package/linter/rules/unused-definition.js +2 -1
- package/package.json +35 -45
- package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
- package/project/context/flowr-analyzer-environment-context.js +25 -0
- package/project/dependency-version-space.js +1 -2
- package/project/flowr-analyzer.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +3 -3
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +3 -1
- package/project/sigdb/build.js +16 -16
- package/project/sigdb/codec.d.ts +1 -1
- package/project/sigdb/codec.js +13 -13
- package/project/sigdb/decompress.d.ts +1 -1
- package/project/sigdb/decompress.js +33 -33
- package/project/sigdb/index-format.js +2 -2
- package/project/sigdb/manifest.js +21 -21
- package/project/sigdb/memory-source.d.ts +64 -0
- package/project/sigdb/memory-source.js +133 -0
- package/project/sigdb/reader.js +13 -13
- package/queries/catalog/absint-query/absint-query-format.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/dependencies-query/link-devices.js +2 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
- package/queries/catalog/does-call-query/does-call-query-format.js +2 -1
- package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
- package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
- package/queries/catalog/signature-query/signature-query-executor.js +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/retriever.d.ts +2 -1
- package/r-bridge/retriever.js +3 -2
- package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
- package/r-bridge/roxygen2/documentation-provider.js +1 -0
- package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
- package/r-bridge/roxygen2/roxygen-parse.js +1 -1
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-filters.js +2 -2
- package/search/search-executor/search-enrichers.js +4 -4
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +1 -0
- package/slicing/criterion/parse.js +4 -3
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +2 -2
- package/slicing/static/static-slicer.js +4 -3
- package/util/assert.js +1 -1
- package/util/log.d.ts +4 -1
- package/util/log.js +15 -2
- package/util/logic.js +2 -2
- package/util/mermaid/cfg.js +1 -1
- package/util/mermaid/dfg.js +6 -6
- package/util/mermaid/mermaid.js +3 -1
- package/util/quads.js +19 -6
- package/util/r-version.d.ts +2 -0
- package/util/r-version.js +2 -0
- package/util/record.d.ts +1 -0
- package/util/record.js +1 -0
- package/util/schema.js +2 -2
- package/util/text/ansi.d.ts +2 -0
- package/util/text/ansi.js +8 -0
- package/util/text/name-rank.d.ts +29 -0
- package/util/text/name-rank.js +39 -0
- package/util/text/url-encoding.d.ts +15 -0
- package/util/text/url-encoding.js +59 -0
- package/util/version.js +1 -1
- package/cli/export-quads-app.d.ts +0 -7
- package/cli/export-quads-app.js +0 -44
|
@@ -7,12 +7,19 @@
|
|
|
7
7
|
* and cheap (well below a second).
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
/** How often the {@link calibrationRound} is
|
|
11
|
-
export declare const
|
|
10
|
+
/** How often the {@link calibrationRound} is timed within one {@link runCalibration} call. */
|
|
11
|
+
export declare const CalibrationReps = 6;
|
|
12
12
|
/** How many elements a single {@link calibrationRound} works on. */
|
|
13
13
|
export declare const CalibrationSize = 4096;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Times {@link calibrationRound} {@link CalibrationReps} times and reports the fastest of them.
|
|
16
|
+
*
|
|
17
|
+
* The first round is thrown away: it pays for compiling the workload and would describe the engine
|
|
18
|
+
* rather than the machine. Of the rounds that follow, only the fastest counts, because every
|
|
19
|
+
* disturbance a shared runner can add (another job, a scheduler switch, a collection) can only ever
|
|
20
|
+
* make a round slower. That makes the number a statement about the machine, not about its bad luck.
|
|
21
|
+
* @returns the nanoseconds the fastest round took
|
|
17
22
|
*/
|
|
18
|
-
export declare function runCalibration():
|
|
23
|
+
export declare function runCalibration(): bigint;
|
|
24
|
+
/** the checksum of the rounds run so far, only exposed so that the workload has an observable effect */
|
|
25
|
+
export declare function calibrationChecksum(): number;
|
package/benchmark/calibration.js
CHANGED
|
@@ -9,12 +9,15 @@
|
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CalibrationSize = exports.
|
|
12
|
+
exports.CalibrationSize = exports.CalibrationReps = void 0;
|
|
13
13
|
exports.runCalibration = runCalibration;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
exports.calibrationChecksum = calibrationChecksum;
|
|
15
|
+
/** How often the {@link calibrationRound} is timed within one {@link runCalibration} call. */
|
|
16
|
+
exports.CalibrationReps = 6;
|
|
16
17
|
/** How many elements a single {@link calibrationRound} works on. */
|
|
17
18
|
exports.CalibrationSize = 4096;
|
|
19
|
+
/** the checksums land here, so that no engine can decide the workload has no effect and drop it */
|
|
20
|
+
let sink = 0;
|
|
18
21
|
/** xorshift32 with a fixed seed so that every round does the exact same work */
|
|
19
22
|
function nextRandom(state) {
|
|
20
23
|
state ^= state << 13;
|
|
@@ -23,41 +26,66 @@ function nextRandom(state) {
|
|
|
23
26
|
return state | 0;
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
|
-
* One round of the calibration workload, mixing integer arithmetic, array sorting, string handling,
|
|
27
|
-
* to cover the operations that dominate the analysis itself.
|
|
29
|
+
* One round of the calibration workload, mixing integer arithmetic, array sorting, string handling,
|
|
30
|
+
* short-lived objects, and map lookups to cover the operations that dominate the analysis itself.
|
|
31
|
+
*
|
|
32
|
+
* Every round does the very same work, which is what allows {@link runCalibration} to compare its repetitions.
|
|
28
33
|
* @returns a checksum, only returned so that the work cannot be optimized away
|
|
29
34
|
*/
|
|
30
|
-
function calibrationRound(
|
|
31
|
-
let state = 0x1337
|
|
35
|
+
function calibrationRound() {
|
|
36
|
+
let state = 0x1337;
|
|
32
37
|
const numbers = new Array(exports.CalibrationSize);
|
|
33
38
|
for (let i = 0; i < exports.CalibrationSize; i++) {
|
|
34
39
|
state = nextRandom(state);
|
|
35
40
|
numbers[i] = state % 100_000;
|
|
36
41
|
}
|
|
37
42
|
numbers.sort((a, b) => a - b);
|
|
43
|
+
/* the analysis spends most of its time on small objects that die young, so the workload allocates some too */
|
|
44
|
+
const nodes = [];
|
|
38
45
|
const map = new Map();
|
|
46
|
+
const seen = new Set();
|
|
39
47
|
for (let i = 0; i < exports.CalibrationSize; i++) {
|
|
40
48
|
const key = `k${numbers[i] % 512}`;
|
|
49
|
+
nodes.push({ id: key, value: numbers[i], next: i + 1 });
|
|
41
50
|
map.set(key, (map.get(key) ?? 0) + i);
|
|
51
|
+
seen.add(key);
|
|
42
52
|
}
|
|
43
|
-
let checksum =
|
|
53
|
+
let checksum = seen.size;
|
|
44
54
|
for (const [key, value] of map) {
|
|
45
55
|
checksum = (checksum + key.length * value) | 0;
|
|
46
56
|
}
|
|
57
|
+
for (const node of nodes) {
|
|
58
|
+
checksum = (checksum + node.id.length + (node.value & 0xff) + node.next) | 0;
|
|
59
|
+
}
|
|
47
60
|
for (let i = 0; i < exports.CalibrationSize; i++) {
|
|
48
61
|
checksum = (checksum + Math.floor(Math.sqrt(numbers[i] + 1))) | 0;
|
|
49
62
|
}
|
|
50
63
|
return checksum;
|
|
51
64
|
}
|
|
52
65
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
66
|
+
* Times {@link calibrationRound} {@link CalibrationReps} times and reports the fastest of them.
|
|
67
|
+
*
|
|
68
|
+
* The first round is thrown away: it pays for compiling the workload and would describe the engine
|
|
69
|
+
* rather than the machine. Of the rounds that follow, only the fastest counts, because every
|
|
70
|
+
* disturbance a shared runner can add (another job, a scheduler switch, a collection) can only ever
|
|
71
|
+
* make a round slower. That makes the number a statement about the machine, not about its bad luck.
|
|
72
|
+
* @returns the nanoseconds the fastest round took
|
|
55
73
|
*/
|
|
56
74
|
function runCalibration() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
sink = calibrationRound();
|
|
76
|
+
let best = undefined;
|
|
77
|
+
for (let rep = 0; rep < exports.CalibrationReps; rep++) {
|
|
78
|
+
const start = process.hrtime.bigint();
|
|
79
|
+
sink = (sink + calibrationRound()) | 0;
|
|
80
|
+
const took = process.hrtime.bigint() - start;
|
|
81
|
+
if (best === undefined || took < best) {
|
|
82
|
+
best = took;
|
|
83
|
+
}
|
|
60
84
|
}
|
|
61
|
-
return
|
|
85
|
+
return best ?? 0n;
|
|
86
|
+
}
|
|
87
|
+
/** the checksum of the rounds run so far, only exposed so that the workload has an observable effect */
|
|
88
|
+
function calibrationChecksum() {
|
|
89
|
+
return sink;
|
|
62
90
|
}
|
|
63
91
|
//# sourceMappingURL=calibration.js.map
|
package/benchmark/slicer.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export declare class BenchmarkSlicer {
|
|
|
97
97
|
inferDataFrameShapes(): SlicerStatsDfShape;
|
|
98
98
|
/**
|
|
99
99
|
* Measure the phases that are not part of the slicing itself: the dependencies query, the linter,
|
|
100
|
-
* and the synthetic {@link runCalibration | calibration} workload.
|
|
100
|
+
* and the synthetic {@link runCalibration | calibration} workload, the only one that reports its own time.
|
|
101
101
|
*
|
|
102
102
|
* These run *after* all other steps and are excluded from the {@link CommonSlicerMeasurements} (and hence from
|
|
103
103
|
* the `total`), so that they cannot distort any of the existing measurements.
|
package/benchmark/slicer.js
CHANGED
|
@@ -129,10 +129,10 @@ class BenchmarkSlicer {
|
|
|
129
129
|
for (const [n, info] of vertices) {
|
|
130
130
|
const outgoingEdges = this.dataflow.graph.outgoingEdges(n);
|
|
131
131
|
numberOfEdges += outgoingEdges?.size ?? 0;
|
|
132
|
-
if (
|
|
132
|
+
if (vertex_1.FunctionCallVertex.is(info)) {
|
|
133
133
|
numberOfCalls++;
|
|
134
134
|
}
|
|
135
|
-
else if (
|
|
135
|
+
else if (vertex_1.FunctionDefinitionVertex.is(info)) {
|
|
136
136
|
numberOfDefinitions++;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -344,7 +344,7 @@ class BenchmarkSlicer {
|
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
346
346
|
* Measure the phases that are not part of the slicing itself: the dependencies query, the linter,
|
|
347
|
-
* and the synthetic {@link runCalibration | calibration} workload.
|
|
347
|
+
* and the synthetic {@link runCalibration | calibration} workload, the only one that reports its own time.
|
|
348
348
|
*
|
|
349
349
|
* These run *after* all other steps and are excluded from the {@link CommonSlicerMeasurements} (and hence from
|
|
350
350
|
* the `total`), so that they cannot distort any of the existing measurements.
|
|
@@ -359,7 +359,8 @@ class BenchmarkSlicer {
|
|
|
359
359
|
await this.measureAdditional('dependencies query', () => analyzer.query([{ type: 'dependencies' }]));
|
|
360
360
|
await this.measureAdditional('linter run', () => analyzer.query([{ type: 'linter' }]));
|
|
361
361
|
}
|
|
362
|
-
|
|
362
|
+
/* the calibration times itself, so that neither the warmup nor the rounds it discards count */
|
|
363
|
+
this.additionalMeasurements.set('calibration', (0, calibration_1.runCalibration)());
|
|
363
364
|
}
|
|
364
365
|
catch (e) {
|
|
365
366
|
exports.benchmarkLogger.error(`failed to measure the additional phases: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -6,6 +6,8 @@ import type { RShellEngineConfig } from '../../../config';
|
|
|
6
6
|
/**
|
|
7
7
|
* Summarizes the given stats by calculating the min, max, median, mean, and the standard deviation for each measurement.
|
|
8
8
|
* @see Slicer
|
|
9
|
+
* The re-parse below measures the raw parser on the sliced output, the analyzer's pipeline would measure something else.
|
|
10
|
+
* @lintIgnore use-instead
|
|
9
11
|
*/
|
|
10
12
|
export declare function summarizeSlicerStats(stats: SlicerStats, report?: (criteria: SlicingCriteria, stats: PerSliceStats) => void, engineConf?: RShellEngineConfig): Promise<Readonly<SummarizedSlicerStats>>;
|
|
11
13
|
/**
|
|
@@ -106,6 +106,8 @@ function calculateReductionForSlice(input, dataflow, perSlice, ignoreFluff) {
|
|
|
106
106
|
/**
|
|
107
107
|
* Summarizes the given stats by calculating the min, max, median, mean, and the standard deviation for each measurement.
|
|
108
108
|
* @see Slicer
|
|
109
|
+
* The re-parse below measures the raw parser on the sliced output, the analyzer's pipeline would measure something else.
|
|
110
|
+
* @lintIgnore use-instead
|
|
109
111
|
*/
|
|
110
112
|
async function summarizeSlicerStats(stats, report = () => {
|
|
111
113
|
}, engineConf) {
|
package/cli/common/options.d.ts
CHANGED
|
@@ -205,37 +205,6 @@ export declare const benchmarkHelperOptions: [{
|
|
|
205
205
|
readonly type: StringConstructor;
|
|
206
206
|
readonly description: "The random seed for sampling the slicing criteria if a maximum is set";
|
|
207
207
|
}];
|
|
208
|
-
export declare const exportQuadsOptions: [{
|
|
209
|
-
readonly name: "verbose";
|
|
210
|
-
readonly alias: "v";
|
|
211
|
-
readonly type: BooleanConstructor;
|
|
212
|
-
readonly description: "Run with verbose logging";
|
|
213
|
-
}, {
|
|
214
|
-
readonly name: "help";
|
|
215
|
-
readonly alias: "h";
|
|
216
|
-
readonly type: BooleanConstructor;
|
|
217
|
-
readonly description: "Print this usage guide";
|
|
218
|
-
}, {
|
|
219
|
-
readonly name: "input";
|
|
220
|
-
readonly alias: "i";
|
|
221
|
-
readonly type: StringConstructor;
|
|
222
|
-
readonly description: "Pass a folder or file as src to read from";
|
|
223
|
-
readonly multiple: true;
|
|
224
|
-
readonly defaultOption: true;
|
|
225
|
-
readonly defaultValue: readonly [];
|
|
226
|
-
readonly typeLabel: "{underline files/folders}";
|
|
227
|
-
}, {
|
|
228
|
-
readonly name: "limit";
|
|
229
|
-
readonly alias: "l";
|
|
230
|
-
readonly type: NumberConstructor;
|
|
231
|
-
readonly description: "Limit the number of files to process";
|
|
232
|
-
}, {
|
|
233
|
-
readonly name: "output";
|
|
234
|
-
readonly alias: "o";
|
|
235
|
-
readonly type: StringConstructor;
|
|
236
|
-
readonly description: "File to write all the generated quads to (defaults to {italic out.quads})";
|
|
237
|
-
readonly typeLabel: "{underline file}";
|
|
238
|
-
}];
|
|
239
208
|
export declare const slicerOptions: [{
|
|
240
209
|
readonly name: "verbose";
|
|
241
210
|
readonly alias: "v";
|
package/cli/common/options.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.summarizerOptions = exports.slicerOptions = exports.
|
|
6
|
+
exports.summarizerOptions = exports.slicerOptions = exports.benchmarkHelperOptions = exports.benchmarkOptions = void 0;
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const time_1 = require("../../util/text/time");
|
|
9
9
|
/**
|
|
@@ -48,13 +48,6 @@ exports.benchmarkHelperOptions = [
|
|
|
48
48
|
{ name: 'no-extra-phases', type: Boolean, description: 'Skip the dependencies query, the linter run and the calibration, which cost suite runtime', defaultValue: false },
|
|
49
49
|
{ name: 'seed', type: String, description: 'The random seed for sampling the slicing criteria if a maximum is set' },
|
|
50
50
|
];
|
|
51
|
-
exports.exportQuadsOptions = [
|
|
52
|
-
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
|
|
53
|
-
{ name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
|
|
54
|
-
{ name: 'input', alias: 'i', type: String, description: 'Pass a folder or file as src to read from', multiple: true, defaultOption: true, defaultValue: [], typeLabel: '{underline files/folders}' },
|
|
55
|
-
{ name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process' },
|
|
56
|
-
{ name: 'output', alias: 'o', type: String, description: 'File to write all the generated quads to (defaults to {italic out.quads})', typeLabel: '{underline file}' },
|
|
57
|
-
];
|
|
58
51
|
exports.slicerOptions = [
|
|
59
52
|
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
|
|
60
53
|
{ name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
|
|
@@ -387,44 +387,6 @@ declare const _scripts: {
|
|
|
387
387
|
usageExample: string;
|
|
388
388
|
type: string;
|
|
389
389
|
};
|
|
390
|
-
'export-quads': {
|
|
391
|
-
toolName: string;
|
|
392
|
-
target: string;
|
|
393
|
-
description: string;
|
|
394
|
-
usageExample: string;
|
|
395
|
-
options: [{
|
|
396
|
-
readonly name: "verbose";
|
|
397
|
-
readonly alias: "v";
|
|
398
|
-
readonly type: BooleanConstructor;
|
|
399
|
-
readonly description: "Run with verbose logging";
|
|
400
|
-
}, {
|
|
401
|
-
readonly name: "help";
|
|
402
|
-
readonly alias: "h";
|
|
403
|
-
readonly type: BooleanConstructor;
|
|
404
|
-
readonly description: "Print this usage guide";
|
|
405
|
-
}, {
|
|
406
|
-
readonly name: "input";
|
|
407
|
-
readonly alias: "i";
|
|
408
|
-
readonly type: StringConstructor;
|
|
409
|
-
readonly description: "Pass a folder or file as src to read from";
|
|
410
|
-
readonly multiple: true;
|
|
411
|
-
readonly defaultOption: true;
|
|
412
|
-
readonly defaultValue: readonly [];
|
|
413
|
-
readonly typeLabel: "{underline files/folders}";
|
|
414
|
-
}, {
|
|
415
|
-
readonly name: "limit";
|
|
416
|
-
readonly alias: "l";
|
|
417
|
-
readonly type: NumberConstructor;
|
|
418
|
-
readonly description: "Limit the number of files to process";
|
|
419
|
-
}, {
|
|
420
|
-
readonly name: "output";
|
|
421
|
-
readonly alias: "o";
|
|
422
|
-
readonly type: StringConstructor;
|
|
423
|
-
readonly description: "File to write all the generated quads to (defaults to {italic out.quads})";
|
|
424
|
-
readonly typeLabel: "{underline file}";
|
|
425
|
-
}];
|
|
426
|
-
type: string;
|
|
427
|
-
};
|
|
428
390
|
};
|
|
429
391
|
export declare const scripts: Record<keyof typeof _scripts, ScriptInformation>;
|
|
430
392
|
/**
|
|
@@ -40,14 +40,6 @@ const _scripts = {
|
|
|
40
40
|
options: options_1.summarizerOptions,
|
|
41
41
|
usageExample: 'summarizer "benchmark.json"',
|
|
42
42
|
type: 'master script',
|
|
43
|
-
},
|
|
44
|
-
'export-quads': {
|
|
45
|
-
toolName: 'export-quads',
|
|
46
|
-
target: 'export-quads-app',
|
|
47
|
-
description: 'Export quads of the normalized AST of a given R code file',
|
|
48
|
-
usageExample: 'export-quads "example.R" --output "example.quads"',
|
|
49
|
-
options: options_1.exportQuadsOptions,
|
|
50
|
-
type: 'master script',
|
|
51
43
|
}
|
|
52
44
|
};
|
|
53
45
|
exports.scripts = _scripts;
|
|
@@ -142,6 +142,7 @@ async function processQueryArgs(output, analyzer, remainingArgs) {
|
|
|
142
142
|
parsedQuery = [{ type: 'call-context', callName: query }];
|
|
143
143
|
}
|
|
144
144
|
if (input) {
|
|
145
|
+
input = unquoteWhole(input);
|
|
145
146
|
input = (0, path_input_1.handlePathLikeInput)(output, input, analyzer.flowrConfig);
|
|
146
147
|
// reuse a prior analysis (e.g. a dataflow from :df#) when the target is unchanged
|
|
147
148
|
if (!analyzerHasTarget(analyzer, input)) {
|
|
@@ -171,12 +172,46 @@ function parseArgs(line) {
|
|
|
171
172
|
const [, name, rest] = configMatch;
|
|
172
173
|
return { rCode: undefined, remaining: rest === undefined ? [name] : [name, rest] };
|
|
173
174
|
}
|
|
174
|
-
const
|
|
175
|
+
const [query, rest] = splitQueryFromRest(line);
|
|
175
176
|
return {
|
|
176
177
|
rCode: undefined,
|
|
177
|
-
|
|
178
|
+
/* the rest keeps its quotes: they belong to the R code, where dropping them turns a string into a symbol */
|
|
179
|
+
remaining: [query, ...(0, args_1.splitAtEscapeSensitive)(rest, false)]
|
|
178
180
|
};
|
|
179
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Undoes a wrapping of the whole code in quotes, as `:query \@dependencies "library(x)"` writes it. A quote the
|
|
184
|
+
* code itself contains ends the wrapping early, so it is left alone.
|
|
185
|
+
*/
|
|
186
|
+
function unquoteWhole(code) {
|
|
187
|
+
const quote = code[0];
|
|
188
|
+
if ((quote !== '"' && quote !== '\'') || code.length < 2 || code[code.length - 1] !== quote) {
|
|
189
|
+
return code;
|
|
190
|
+
}
|
|
191
|
+
for (let i = 1; i < code.length - 1; i++) {
|
|
192
|
+
if (code[i] === quote && code[i - 1] !== '\\') {
|
|
193
|
+
return code;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return code.slice(1, -1);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Separates the query from everything after it. The query is either a bare token (`@static-slice`) or the
|
|
200
|
+
* quoted JSON form (`"[{\"type\": ...}]"`), whose escapes are undone; the rest is handed on verbatim.
|
|
201
|
+
*/
|
|
202
|
+
function splitQueryFromRest(line) {
|
|
203
|
+
const trimmed = line.trimStart();
|
|
204
|
+
const quote = trimmed[0];
|
|
205
|
+
if (quote !== '"' && quote !== '\'') {
|
|
206
|
+
const space = trimmed.indexOf(' ');
|
|
207
|
+
return space < 0 ? [trimmed, ''] : [trimmed.slice(0, space), trimmed.slice(space + 1)];
|
|
208
|
+
}
|
|
209
|
+
let end = 1;
|
|
210
|
+
while (end < trimmed.length && !(trimmed[end] === quote && trimmed[end - 1] !== '\\')) {
|
|
211
|
+
end++;
|
|
212
|
+
}
|
|
213
|
+
return [trimmed.slice(1, end).replace(/\\(.)/g, '$1'), trimmed.slice(end + 1).trimStart()];
|
|
214
|
+
}
|
|
180
215
|
exports.queryCommand = {
|
|
181
216
|
description: 'Query the given R code (use \'help\' for more information)',
|
|
182
217
|
isCodeCommand: true,
|
package/cli/repl/core.js
CHANGED
|
@@ -165,8 +165,11 @@ function completionSuggestion(line, config) {
|
|
|
165
165
|
}
|
|
166
166
|
function replQueryCompleter(splitLine, startingNewArg, config) {
|
|
167
167
|
const nonEmpty = splitLine.slice(1).map(s => s.trim()).filter(s => s.length > 0);
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
/* `?<type>` documents a query instead of running it, and completes to the same names */
|
|
169
|
+
const asking = !startingNewArg && nonEmpty.length === 1 && nonEmpty[0].startsWith('?');
|
|
170
|
+
const queryShorts = asking ? Object.keys(query_1.SupportedQueries).map(q => `?${q}`)
|
|
171
|
+
: ['help'].concat(Object.keys(query_1.SupportedQueries).map(q => `@${q}`));
|
|
172
|
+
if (asking || nonEmpty.length === 0 || (nonEmpty.length === 1 && queryShorts.some(q => q.startsWith(nonEmpty[0]) && nonEmpty[0] !== q && !startingNewArg))) {
|
|
170
173
|
return { completions: queryShorts.map(q => `${q} `) };
|
|
171
174
|
}
|
|
172
175
|
else {
|
|
@@ -262,7 +265,7 @@ async function executeStatement(output, statement, analyzer, allowRSessionAccess
|
|
|
262
265
|
const args = processor.argsParser(remainingLine);
|
|
263
266
|
if (args.rCode) {
|
|
264
267
|
const rawPath = args.rCode.startsWith(retriever_1.fileProtocol)
|
|
265
|
-
? args.rCode.
|
|
268
|
+
? args.rCode.slice(retriever_1.fileProtocol.length)
|
|
266
269
|
: undefined;
|
|
267
270
|
const alreadyKnown = rawPath !== undefined
|
|
268
271
|
&& analyzer.context().files.getFileByPath(rawPath) !== undefined;
|
|
@@ -76,7 +76,7 @@ function warn(output, message) {
|
|
|
76
76
|
* {@link SliceFlag#conflicts|conflict} with each other, as they are applied silently otherwise.
|
|
77
77
|
*/
|
|
78
78
|
function warnAboutSliceFlags(output, argument, flags) {
|
|
79
|
-
const given = [...new Set(
|
|
79
|
+
const given = [...new Set(sliceFlagSuffix(argument))];
|
|
80
80
|
const known = new Map(flags.map(f => [f.flag, f]));
|
|
81
81
|
const unknown = given.filter(f => !known.has(f));
|
|
82
82
|
if (unknown.length > 0) {
|
|
@@ -5,7 +5,7 @@ exports.printVersionRepl = printVersionRepl;
|
|
|
5
5
|
const version_1 = require("../../util/version");
|
|
6
6
|
const manifest_1 = require("../../project/sigdb/manifest");
|
|
7
7
|
const ansi_1 = require("../../util/text/ansi");
|
|
8
|
-
const
|
|
8
|
+
const url_1 = require("url");
|
|
9
9
|
/**
|
|
10
10
|
* Returns a version string for the REPL including flowR, R, and the engine in use.
|
|
11
11
|
*/
|
|
@@ -40,7 +40,7 @@ function sigDbSummaryString() {
|
|
|
40
40
|
if (entries.length === 0) {
|
|
41
41
|
return it('no sigdb');
|
|
42
42
|
}
|
|
43
|
-
const link = (text, file) => it(ansi_1.formatter.hyperlink(text, (0,
|
|
43
|
+
const link = (text, file) => it(ansi_1.formatter.hyperlink(text, (0, url_1.pathToFileURL)(file).href, true));
|
|
44
44
|
// if every ref shares the same date, print it once
|
|
45
45
|
const shared = entries.every(e => e.date !== undefined && e.date === entries[0].date) ? entries[0].date : undefined;
|
|
46
46
|
const refs = entries.map(e => link(shared === undefined && e.date !== undefined ? `${e.label} ${e.date}` : e.label, e.file));
|
package/config.d.ts
CHANGED
|
@@ -491,6 +491,22 @@ export declare const FlowrConfig: {
|
|
|
491
491
|
readonly getForEngine: <T extends EngineConfig["type"]>(this: void, config: FlowrConfig, engine: T) => (EngineConfig & {
|
|
492
492
|
type: T;
|
|
493
493
|
}) | undefined;
|
|
494
|
+
/**
|
|
495
|
+
* Every key `config` changed against the {@link FlowrConfig.default|default}, as `a.b.c=<json>` lines.
|
|
496
|
+
* A whole configuration is a long document while an edit to it is usually one line, which is what makes
|
|
497
|
+
* this the form to hand around: a link, a command line, a bug report.
|
|
498
|
+
* @see {@link FlowrConfig.applyPaths} - to read them back
|
|
499
|
+
* @example
|
|
500
|
+
* ```ts
|
|
501
|
+
* FlowrConfig.changedPaths(config); // ['solver.sigdb.enabled=false']
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
readonly changedPaths: (this: void, config: FlowrConfig) => string[];
|
|
505
|
+
/**
|
|
506
|
+
* The inverse of {@link FlowrConfig.changedPaths}: the default configuration with those keys set again.
|
|
507
|
+
* A line that names no known key, or whose value is not readable, is skipped rather than guessed at.
|
|
508
|
+
*/
|
|
509
|
+
readonly applyPaths: (this: void, paths: Iterable<string>, base?: FlowrConfig) => FlowrConfig;
|
|
494
510
|
/**
|
|
495
511
|
* Returns a new config object with the given value set at the given key, where the key is a dot-separated path to the value in the config object.
|
|
496
512
|
* @see {@link setInConfigInPlace} for a version that modifies the config object in place instead of returning a new one.
|
package/config.js
CHANGED
|
@@ -188,6 +188,38 @@ function mergeConfigOntoDefaults(base, addon) {
|
|
|
188
188
|
};
|
|
189
189
|
return merge(base, addon);
|
|
190
190
|
}
|
|
191
|
+
/** The shortest start of `key` that none of its `siblings` share, which is how a path stays short and readable. */
|
|
192
|
+
function shortestPrefix(key, siblings = []) {
|
|
193
|
+
for (let length = 1; length < key.length; length++) {
|
|
194
|
+
const prefix = key.slice(0, length);
|
|
195
|
+
if (!siblings.some(other => other !== key && other.startsWith(prefix))) {
|
|
196
|
+
return prefix;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return key;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The full path a possibly shortened one names, walking `within` a segment at a time: a segment that names a
|
|
203
|
+
* key outright is that key, otherwise it has to start exactly one of them.
|
|
204
|
+
*/
|
|
205
|
+
function expandPath(path, within) {
|
|
206
|
+
const full = [];
|
|
207
|
+
let at = within;
|
|
208
|
+
for (const segment of path.split('.')) {
|
|
209
|
+
if (at === null || typeof at !== 'object') {
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
const keys = Object.keys(at);
|
|
213
|
+
const key = keys.includes(segment) ? segment : keys.filter(other => other.startsWith(segment));
|
|
214
|
+
if (typeof key !== 'string' && key.length !== 1) {
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
const found = typeof key === 'string' ? key : key[0];
|
|
218
|
+
full.push(found);
|
|
219
|
+
at = at[found];
|
|
220
|
+
}
|
|
221
|
+
return full.length > 0 ? full.join('.') : undefined;
|
|
222
|
+
}
|
|
191
223
|
exports.FlowrConfig = {
|
|
192
224
|
name: 'FlowrConfig',
|
|
193
225
|
/**
|
|
@@ -535,6 +567,53 @@ exports.FlowrConfig = {
|
|
|
535
567
|
return defaultEngineConfigs[engine];
|
|
536
568
|
}
|
|
537
569
|
},
|
|
570
|
+
/**
|
|
571
|
+
* Every key `config` changed against the {@link FlowrConfig.default|default}, as `a.b.c=<json>` lines.
|
|
572
|
+
* A whole configuration is a long document while an edit to it is usually one line, which is what makes
|
|
573
|
+
* this the form to hand around: a link, a command line, a bug report.
|
|
574
|
+
* @see {@link FlowrConfig.applyPaths} - to read them back
|
|
575
|
+
* @example
|
|
576
|
+
* ```ts
|
|
577
|
+
* FlowrConfig.changedPaths(config); // ['solver.sigdb.enabled=false']
|
|
578
|
+
* ```
|
|
579
|
+
*/
|
|
580
|
+
changedPaths(config) {
|
|
581
|
+
const found = [];
|
|
582
|
+
const walk = (current, base, path, siblings) => {
|
|
583
|
+
if (current !== null && base !== null && typeof current === 'object' && typeof base === 'object'
|
|
584
|
+
&& !Array.isArray(current) && !Array.isArray(base)) {
|
|
585
|
+
const keys = [...new Set([...Object.keys(current), ...Object.keys(base)])];
|
|
586
|
+
for (const key of keys) {
|
|
587
|
+
walk(current[key], base[key], [...path, key], [...siblings, keys]);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
else if (JSON.stringify(current) !== JSON.stringify(base)) {
|
|
591
|
+
const short = path.map((key, at) => shortestPrefix(key, siblings[at]));
|
|
592
|
+
found.push(`${short.join('.')}=${JSON.stringify(current)}`);
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
walk(config, exports.FlowrConfig.default(), [], []);
|
|
596
|
+
return found;
|
|
597
|
+
},
|
|
598
|
+
/**
|
|
599
|
+
* The inverse of {@link FlowrConfig.changedPaths}: the default configuration with those keys set again.
|
|
600
|
+
* A line that names no known key, or whose value is not readable, is skipped rather than guessed at.
|
|
601
|
+
*/
|
|
602
|
+
applyPaths(paths, base = exports.FlowrConfig.default()) {
|
|
603
|
+
const config = structuredClone(base);
|
|
604
|
+
for (const line of paths) {
|
|
605
|
+
const at = line.indexOf('=');
|
|
606
|
+
const key = at < 0 ? undefined : expandPath(line.slice(0, at), config);
|
|
607
|
+
if (key === undefined) {
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
try {
|
|
611
|
+
object_path_1.default.set(config, key, JSON.parse(line.slice(at + 1)));
|
|
612
|
+
}
|
|
613
|
+
catch { /* a value nobody can read is one to leave alone */ }
|
|
614
|
+
}
|
|
615
|
+
return config;
|
|
616
|
+
},
|
|
538
617
|
/**
|
|
539
618
|
* Returns a new config object with the given value set at the given key, where the key is a dot-separated path to the value in the config object.
|
|
540
619
|
* @see {@link setInConfigInPlace} for a version that modifies the config object in place instead of returning a new one.
|
|
@@ -68,6 +68,7 @@ export type CfgVertex = CfgStatementVertex | CfgExpressionVertex | CfgBasicBlock
|
|
|
68
68
|
* Helper object for {@link CfgVertex} - a vertex in the {@link ControlFlowGraph} that may have markers attached to it (e.g., for function calls).
|
|
69
69
|
*/
|
|
70
70
|
export declare const CfgVertex: {
|
|
71
|
+
readonly name: "CfgVertex";
|
|
71
72
|
/**
|
|
72
73
|
* Create a new expression vertex with the given id, children, call targets, and markers.
|
|
73
74
|
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
@@ -309,6 +310,7 @@ export type CfgEdge = CfgFlowDependencyEdge | CfgControlDependencyEdge;
|
|
|
309
310
|
* Helper object for {@link CfgEdge} - an edge in the {@link ControlFlowGraph}.
|
|
310
311
|
*/
|
|
311
312
|
export declare const CfgEdge: {
|
|
313
|
+
readonly name: "CfgEdge";
|
|
312
314
|
/**
|
|
313
315
|
* Check whether the given edge is a flow dependency edge.
|
|
314
316
|
*/
|
|
@@ -36,6 +36,7 @@ var CfgVertexType;
|
|
|
36
36
|
* Helper object for {@link CfgVertex} - a vertex in the {@link ControlFlowGraph} that may have markers attached to it (e.g., for function calls).
|
|
37
37
|
*/
|
|
38
38
|
exports.CfgVertex = {
|
|
39
|
+
name: 'CfgVertex',
|
|
39
40
|
/**
|
|
40
41
|
* Create a new expression vertex with the given id, children, call targets, and markers.
|
|
41
42
|
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
@@ -400,6 +401,7 @@ exports.CfgVertex = {
|
|
|
400
401
|
* Helper object for {@link CfgEdge} - an edge in the {@link ControlFlowGraph}.
|
|
401
402
|
*/
|
|
402
403
|
exports.CfgEdge = {
|
|
404
|
+
name: 'CfgEdge',
|
|
403
405
|
/**
|
|
404
406
|
* Check whether the given edge is a flow dependency edge.
|
|
405
407
|
*/
|
|
@@ -469,7 +469,7 @@ const OriginToFoldTypeMap = {
|
|
|
469
469
|
function cfgFunctionCallWithDataflow(graph, folds) {
|
|
470
470
|
return (call, name, args, down) => {
|
|
471
471
|
const vtx = graph.getVertex(call.info.id);
|
|
472
|
-
if (
|
|
472
|
+
if (vertex_1.FunctionCallVertex.is(vtx) && vtx.onlyBuiltin && vtx.origin.length === 1) {
|
|
473
473
|
const origin = vtx.origin[0];
|
|
474
474
|
const mayMap = OriginToFoldTypeMap[origin];
|
|
475
475
|
// ifelse/fifelse/if_else share the IfThenElse origin but are eager calls, so only fold a real `if` node
|
|
@@ -123,7 +123,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
|
|
|
123
123
|
*/
|
|
124
124
|
protected onProgram(_data: RExpressionList<OtherInfo>): void;
|
|
125
125
|
/**
|
|
126
|
-
* A helper function to request the {@link
|
|
126
|
+
* A helper function to request the {@link Dataflow.origin|origins} of the given node.
|
|
127
127
|
*/
|
|
128
128
|
protected getOrigins(id: NodeId): Origin[] | undefined;
|
|
129
129
|
/**
|
|
@@ -293,7 +293,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
293
293
|
*/
|
|
294
294
|
onProgram(_data) { }
|
|
295
295
|
/**
|
|
296
|
-
* A helper function to request the {@link
|
|
296
|
+
* A helper function to request the {@link Dataflow.origin|origins} of the given node.
|
|
297
297
|
*/
|
|
298
298
|
getOrigins(id) {
|
|
299
299
|
return df_helper_1.Dataflow.origin(this.config.dfg, id);
|
|
@@ -26,7 +26,7 @@ function onlyLoopsOnce(loop, dataflow, controlflow, ast, ctx) {
|
|
|
26
26
|
if (!vertex) {
|
|
27
27
|
return undefined;
|
|
28
28
|
}
|
|
29
|
-
(0, assert_1.guard)(
|
|
29
|
+
(0, assert_1.guard)(vertex_1.FunctionCallVertex.is(vertex), 'invalid vertex type for onlyLoopsOnce');
|
|
30
30
|
(0, assert_1.guard)(vertex.origin !== 'unnamed' && exports.loopyFunctions.has(vertex.origin[0]), 'onlyLoopsOnce can only be called with loops');
|
|
31
31
|
// 1. In case of for loop, check if vector has only one element
|
|
32
32
|
if (vertex.origin[0] === built_in_proc_name_1.BuiltInProcName.ForLoop) {
|
|
@@ -44,7 +44,7 @@ function sliceDiffAnsi(slice, normalized, criteriaIds, originalCode) {
|
|
|
44
44
|
for (const { selected, location } of importantLocations) {
|
|
45
45
|
const [sl, sc, , ec] = location;
|
|
46
46
|
const line = lines[sl - 1];
|
|
47
|
-
lines[sl - 1] = `${line.
|
|
47
|
+
lines[sl - 1] = `${line.slice(0, Math.max(0, sc - 1))}${ansi_1.ansiFormatter.reset()}${highlight(line.slice(Math.max(0, sc - 1), ec), selected)}${grayOut()}${line.slice(Math.max(0, ec))}`;
|
|
48
48
|
}
|
|
49
49
|
return `${grayOut()}${lines.join('\n')}${ansi_1.ansiFormatter.reset()}`;
|
|
50
50
|
}
|
|
@@ -86,7 +86,7 @@ function topologicallyInsertDecoratorElements(decoratorsOfLastOthers, stepMap, v
|
|
|
86
86
|
let changed = true;
|
|
87
87
|
while (changed) {
|
|
88
88
|
changed = false;
|
|
89
|
-
for (const elem of
|
|
89
|
+
for (const elem of decoratorsOfLastOthers) {
|
|
90
90
|
const step = stepMap.get(elem);
|
|
91
91
|
if (allDependenciesAreVisited(step, visited)) {
|
|
92
92
|
decoratorsOfLastOthers.delete(elem);
|