@eagleoutice/flowr 2.13.16 → 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 -31
- 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/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/core.js +1 -1
- 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/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 +1 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/fn/exceptions-of-function.js +5 -4
- package/dataflow/fn/higher-order-function.js +5 -4
- package/dataflow/graph/call-graph.js +14 -14
- package/dataflow/graph/df-helper.d.ts +15 -0
- package/dataflow/graph/df-helper.js +10 -4
- 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 +3 -4
- package/dataflow/graph/graph-helper.js +4 -5
- package/dataflow/graph/graph.d.ts +11 -1
- package/dataflow/graph/graph.js +16 -5
- package/dataflow/graph/vertex.d.ts +42 -6
- package/dataflow/graph/vertex.js +42 -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-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.js +2 -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 +33 -5
- package/dataflow/internal/process/functions/call/nse.js +113 -6
- package/dataflow/internal/process/functions/call/quoted.d.ts +5 -0
- package/dataflow/internal/process/functions/call/quoted.js +21 -9
- 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 +17 -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/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/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/input-sources-query/simple-input-classifier.js +4 -4
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- 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/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.js +3 -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/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
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;
|
package/cli/repl/core.js
CHANGED
|
@@ -265,7 +265,7 @@ async function executeStatement(output, statement, analyzer, allowRSessionAccess
|
|
|
265
265
|
const args = processor.argsParser(remainingLine);
|
|
266
266
|
if (args.rCode) {
|
|
267
267
|
const rawPath = args.rCode.startsWith(retriever_1.fileProtocol)
|
|
268
|
-
? args.rCode.
|
|
268
|
+
? args.rCode.slice(retriever_1.fileProtocol.length)
|
|
269
269
|
: undefined;
|
|
270
270
|
const alreadyKnown = rawPath !== undefined
|
|
271
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.
|
|
@@ -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);
|
package/dataflow/cluster.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findAllClusters = findAllClusters;
|
|
4
4
|
const edge_1 = require("./graph/edge");
|
|
5
|
-
const vertex_1 = require("./graph/vertex");
|
|
6
5
|
const assert_1 = require("../util/assert");
|
|
6
|
+
const vertex_1 = require("./graph/vertex");
|
|
7
7
|
/**
|
|
8
8
|
* Find all clusters in the given dataflow graph.
|
|
9
9
|
*/
|
|
@@ -56,7 +56,7 @@ function makeCluster(graph, from, notReached, incoming) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
// cluster function def exit points
|
|
59
|
-
if (
|
|
59
|
+
if (vertex_1.FunctionDefinitionVertex.is(info)) {
|
|
60
60
|
for (const { nodeId } of info.exitPoints) {
|
|
61
61
|
reach(nodeId);
|
|
62
62
|
}
|
|
@@ -28,7 +28,12 @@ export declare enum ArgProp {
|
|
|
28
28
|
* the result is one of this argument's values, like `choices` in `match.arg(arg, choices)`. The bounding
|
|
29
29
|
* argument of a {@link CallProp.Narrows} call; without one such a call yields a value of its own making.
|
|
30
30
|
*/
|
|
31
|
-
Bounds = 1024
|
|
31
|
+
Bounds = 1024,
|
|
32
|
+
/**
|
|
33
|
+
* only atomic data works here, never a closure, as with `e1` in `e1 > e2`. A bare symbol in such an
|
|
34
|
+
* argument therefore names a variable even when a function of that name is in scope.
|
|
35
|
+
*/
|
|
36
|
+
Atomic = 2048
|
|
32
37
|
}
|
|
33
38
|
/**
|
|
34
39
|
* What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
|
|
@@ -158,6 +163,8 @@ export declare const FnSig: {
|
|
|
158
163
|
/** The positions carrying any of the given roles; see {@link argsWith}. */
|
|
159
164
|
readonly posWith: typeof argsWith;
|
|
160
165
|
};
|
|
166
|
+
/** What a call states about itself, as words rather than as a bit mask, for anything showing it to a reader. */
|
|
167
|
+
export declare function callPropWords(props: CallProps | undefined): string[];
|
|
161
168
|
/**
|
|
162
169
|
* Semantics of a built-in that hold no matter which processor handles the call. The remaining facts already
|
|
163
170
|
* have a home: the exit behavior in `cfg`, whether flowR can fold the call in the `evalHandler` of the
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DispatchCallees = exports.FnSig = exports.PropagatedProps = exports.FileInputProps = exports.SigDbInferable = exports.InputProps = exports.ExclusiveCallProps = exports.ImpureProps = exports.CallProp = exports.ArgProp = void 0;
|
|
4
|
+
exports.callPropWords = callPropWords;
|
|
4
5
|
exports.fnInfoFromSignature = fnInfoFromSignature;
|
|
5
6
|
/**
|
|
6
7
|
* What a single argument of a call is used for, as a bitmask.
|
|
@@ -33,6 +34,11 @@ var ArgProp;
|
|
|
33
34
|
* argument of a {@link CallProp.Narrows} call; without one such a call yields a value of its own making.
|
|
34
35
|
*/
|
|
35
36
|
ArgProp[ArgProp["Bounds"] = 1024] = "Bounds";
|
|
37
|
+
/**
|
|
38
|
+
* only atomic data works here, never a closure, as with `e1` in `e1 > e2`. A bare symbol in such an
|
|
39
|
+
* argument therefore names a variable even when a function of that name is in scope.
|
|
40
|
+
*/
|
|
41
|
+
ArgProp[ArgProp["Atomic"] = 2048] = "Atomic";
|
|
36
42
|
})(ArgProp || (exports.ArgProp = ArgProp = {}));
|
|
37
43
|
/**
|
|
38
44
|
* What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
|
|
@@ -165,6 +171,18 @@ exports.FnSig = {
|
|
|
165
171
|
/** The positions carrying any of the given roles; see {@link argsWith}. */
|
|
166
172
|
posWith: argsWith
|
|
167
173
|
};
|
|
174
|
+
/** the {@link CallProp} bits as the words a reader wants, in the order they are declared */
|
|
175
|
+
const CallPropNames = [
|
|
176
|
+
[CallProp.Pure, 'pure'], [CallProp.Throws, 'can throw'], [CallProp.Invisible, 'invisible'],
|
|
177
|
+
[CallProp.Generic, 'generic'], [CallProp.Method, 's3 method'], [CallProp.Scope, 'changes scope'],
|
|
178
|
+
[CallProp.NonDet, 'non deterministic'], [CallProp.Random, 'random'], [CallProp.Ambient, 'ambient state'],
|
|
179
|
+
[CallProp.File, 'file system'], [CallProp.Reads, 'reads'], [CallProp.Writes, 'writes'],
|
|
180
|
+
[CallProp.Network, 'network'], [CallProp.Prints, 'prints']
|
|
181
|
+
];
|
|
182
|
+
/** What a call states about itself, as words rather than as a bit mask, for anything showing it to a reader. */
|
|
183
|
+
function callPropWords(props) {
|
|
184
|
+
return props === undefined ? [] : CallPropNames.filter(([bit]) => (props & bit) !== 0).map(([, word]) => word);
|
|
185
|
+
}
|
|
168
186
|
const layouts = new WeakMap();
|
|
169
187
|
/**
|
|
170
188
|
* The positional view of a {@link FnSig}, computed on first use and cached per signature object,
|
|
@@ -67,6 +67,12 @@ export interface BuiltInIdentifierDefinition extends IdentifierReference {
|
|
|
67
67
|
/** folds a call to this function to a constant, see {@link BuiltInEvalHandlerMapper} */
|
|
68
68
|
evalHandler?: BuiltInEvalHandler;
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Whether the definition states that the call does not evaluate some of its arguments the standard way, either
|
|
72
|
+
* by quoting them or by handing them a data mask. Only such a definition changes what the arguments read, so
|
|
73
|
+
* only it has to run in place of the default processor.
|
|
74
|
+
*/
|
|
75
|
+
export declare function statesNonStandardEvaluation(definition: BuiltInIdentifierDefinition | undefined): boolean;
|
|
70
76
|
export interface BuiltInIdentifierConstant<T = unknown> extends IdentifierReference {
|
|
71
77
|
type: ReferenceType.BuiltInConstant;
|
|
72
78
|
definedAt: BuiltIn;
|
|
@@ -103,7 +109,7 @@ export interface BuiltInEvalHandlerArgs extends ResolveInfo {
|
|
|
103
109
|
}
|
|
104
110
|
export type BuiltInEvalHandler = (args: BuiltInEvalHandlerArgs) => Value;
|
|
105
111
|
declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
|
|
106
|
-
declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs, markArgsAsNSE: nse, markArgsAsMasked: masked }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'forceArgs' | 'markArgsAsNSE' | 'markArgsAsMasked'>): DataflowInformation;
|
|
112
|
+
declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs, markArgsAsNSE: nse, markArgsAsMasked: masked, sig }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'forceArgs' | 'markArgsAsNSE' | 'markArgsAsMasked' | 'sig'>): DataflowInformation;
|
|
107
113
|
export declare const BuiltInProcessorMapper: {
|
|
108
114
|
readonly "builtin:acc": typeof processAccess;
|
|
109
115
|
readonly "builtin:app": typeof processApply;
|