@eagleoutice/flowr 2.13.16 → 2.14.1
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 +36 -25
- 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 +16 -7
- package/benchmark/calibration.js +44 -17
- package/benchmark/slicer.d.ts +3 -2
- package/benchmark/slicer.js +9 -5
- 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/benchmark-app.js +4 -1
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +2 -2
- package/cli/common/options.d.ts +5 -31
- package/cli/common/options.js +2 -8
- package/cli/common/scripts-info.d.ts +5 -38
- package/cli/common/scripts-info.js +0 -8
- package/cli/repl/core.js +1 -1
- package/cli/repl/execute.d.ts +2 -2
- package/cli/repl/execute.js +2 -2
- 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 +83 -5
- 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/apply-kill.js +1 -1
- package/dataflow/environments/built-in-props.d.ts +13 -2
- package/dataflow/environments/built-in-props.js +23 -1
- 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 +518 -11
- package/dataflow/environments/default-builtin-config.js +218 -23
- package/dataflow/environments/environment.d.ts +10 -2
- package/dataflow/environments/environment.js +25 -7
- package/dataflow/environments/identifier.d.ts +8 -2
- package/dataflow/environments/identifier.js +6 -1
- package/dataflow/environments/query-fn-props.d.ts +6 -0
- package/dataflow/environments/query-fn-props.js +22 -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 +44 -7
- 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 +5 -4
- package/dataflow/eval/resolve/resolve-strings.js +3 -3
- package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
- package/dataflow/eval/resolve/resolve-working-directory.js +3 -3
- 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.d.ts +3 -1
- package/dataflow/fn/exceptions-of-function.js +87 -39
- package/dataflow/fn/higher-order-function.js +5 -4
- package/dataflow/fn/strict-function.d.ts +40 -0
- package/dataflow/fn/strict-function.js +337 -0
- package/dataflow/graph/call-graph.js +14 -14
- package/dataflow/graph/df-helper.d.ts +24 -1
- package/dataflow/graph/df-helper.js +29 -7
- 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 +39 -3
- package/dataflow/graph/graph.js +75 -7
- package/dataflow/graph/vertex.d.ts +42 -6
- package/dataflow/graph/vertex.js +42 -6
- package/dataflow/info.d.ts +26 -0
- package/dataflow/info.js +28 -1
- 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.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +29 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.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 +44 -20
- 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-core.js +1 -1
- package/documentation/wiki-create-linting-rules.js +45 -45
- package/documentation/wiki-dataflow-graph.js +18 -18
- package/documentation/wiki-linter.js +1 -0
- 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-query.js +53 -0
- package/documentation/wiki-signature-database.js +3 -0
- package/linter/linter-output.js +1 -1
- package/linter/linter-rules.d.ts +24 -0
- package/linter/linter-rules.js +3 -1
- 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/network-functions.d.ts +1 -1
- package/linter/rules/no-leaked-credentials.js +2 -1
- package/linter/rules/stop-with-call-arg.js +4 -4
- package/linter/rules/unclosed-connection.d.ts +44 -0
- package/linter/rules/unclosed-connection.js +200 -0
- 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 +38 -51
- 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.d.ts +3 -3
- package/project/dependency-version-space.js +3 -4
- package/project/flowr-analyzer.js +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -4
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +36 -7
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- 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.d.ts +3 -1
- package/project/sigdb/manifest.js +68 -27
- package/project/sigdb/memory-source.d.ts +64 -0
- package/project/sigdb/memory-source.js +133 -0
- package/project/sigdb/reader.js +14 -14
- package/project/sigdb/schema.d.ts +2 -2
- package/project/sigdb/schema.js +2 -2
- 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 +3 -9
- 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/inspect-exceptions-query/inspect-exception-query-executor.js +2 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
- 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/queries/catalog/slice-query-options.d.ts +1 -1
- package/queries/catalog/slice-query-options.js +1 -1
- package/queries/query-function-filter.d.ts +8 -2
- package/queries/query-function-filter.js +11 -1
- package/queries/query.d.ts +11 -1
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/model.js +4 -4
- 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 -14
- package/search/search-executor/search-enrichers.js +4 -4
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +2 -2
- package/slicing/criterion/parse.js +5 -5
- package/slicing/static/fingerprint.js +1 -1
- 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/objects.d.ts +12 -0
- package/util/objects.js +48 -0
- package/util/quads.js +19 -6
- package/util/schema.js +2 -2
- package/util/simple-df/dfg-ascii.js +14 -3
- 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
|
@@ -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
|
}
|
|
@@ -76,7 +76,7 @@ function weakenName(env, name, cds) {
|
|
|
76
76
|
current.cache?.delete(plainName);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
current = current.
|
|
79
|
+
current = current.writableParent;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
/** attaches `cds` to every user definition in the current frame, except the re-defined names */
|
|
@@ -28,7 +28,14 @@ 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,
|
|
37
|
+
/** the open handle the call acts on, like `con` in `close(con)` */
|
|
38
|
+
Handle = 4096
|
|
32
39
|
}
|
|
33
40
|
/**
|
|
34
41
|
* What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
|
|
@@ -102,7 +109,9 @@ export declare enum CallProp {
|
|
|
102
109
|
/** yields the paths it matches at run time rather than one it was handed (`list.files`, `Sys.glob`); empty is an answer */
|
|
103
110
|
Glob = 33554432,
|
|
104
111
|
/** hands back what the program was invoked with, as `commandArgs` and the option parsers built on it do */
|
|
105
|
-
CommandLine = 67108864
|
|
112
|
+
CommandLine = 67108864,
|
|
113
|
+
/** hands back a handle the program is expected to close again, like `file` or `DBI::dbConnect` */
|
|
114
|
+
Opens = 134217728
|
|
106
115
|
}
|
|
107
116
|
/**
|
|
108
117
|
* The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
|
|
@@ -158,6 +167,8 @@ export declare const FnSig: {
|
|
|
158
167
|
/** The positions carrying any of the given roles; see {@link argsWith}. */
|
|
159
168
|
readonly posWith: typeof argsWith;
|
|
160
169
|
};
|
|
170
|
+
/** What a call states about itself, as words rather than as a bit mask, for anything showing it to a reader. */
|
|
171
|
+
export declare function callPropWords(props: CallProps | undefined): string[];
|
|
161
172
|
/**
|
|
162
173
|
* Semantics of a built-in that hold no matter which processor handles the call. The remaining facts already
|
|
163
174
|
* 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,13 @@ 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";
|
|
42
|
+
/** the open handle the call acts on, like `con` in `close(con)` */
|
|
43
|
+
ArgProp[ArgProp["Handle"] = 4096] = "Handle";
|
|
36
44
|
})(ArgProp || (exports.ArgProp = ArgProp = {}));
|
|
37
45
|
/**
|
|
38
46
|
* What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
|
|
@@ -108,6 +116,8 @@ var CallProp;
|
|
|
108
116
|
CallProp[CallProp["Glob"] = 33554432] = "Glob";
|
|
109
117
|
/** hands back what the program was invoked with, as `commandArgs` and the option parsers built on it do */
|
|
110
118
|
CallProp[CallProp["CommandLine"] = 67108864] = "CommandLine";
|
|
119
|
+
/** hands back a handle the program is expected to close again, like `file` or `DBI::dbConnect` */
|
|
120
|
+
CallProp[CallProp["Opens"] = 134217728] = "Opens";
|
|
111
121
|
})(CallProp || (exports.CallProp = CallProp = {}));
|
|
112
122
|
/**
|
|
113
123
|
* The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
|
|
@@ -116,7 +126,7 @@ var CallProp;
|
|
|
116
126
|
exports.ImpureProps = CallProp.MayPure | CallProp.Scope | CallProp.NonDet | CallProp.Random | CallProp.Ambient
|
|
117
127
|
| CallProp.File | CallProp.TempFile | CallProp.Network | CallProp.Process | CallProp.Ffi | CallProp.Lang
|
|
118
128
|
| CallProp.User | CallProp.Graphics | CallProp.Database | CallProp.Reads | CallProp.Writes | CallProp.Prints
|
|
119
|
-
| CallProp.Configures | CallProp.Closes | CallProp.CommandLine;
|
|
129
|
+
| CallProp.Configures | CallProp.Closes | CallProp.Opens | CallProp.CommandLine;
|
|
120
130
|
/**
|
|
121
131
|
* Which {@link CallProp} bits rule each other out, as `[bit, everything stating it forbids]`. A definition
|
|
122
132
|
* that carries the left bit must carry none of the right ones; a test checks the {@link DefaultBuiltinConfig}
|
|
@@ -165,6 +175,18 @@ exports.FnSig = {
|
|
|
165
175
|
/** The positions carrying any of the given roles; see {@link argsWith}. */
|
|
166
176
|
posWith: argsWith
|
|
167
177
|
};
|
|
178
|
+
/** the {@link CallProp} bits as the words a reader wants, in the order they are declared */
|
|
179
|
+
const CallPropNames = [
|
|
180
|
+
[CallProp.Pure, 'pure'], [CallProp.Throws, 'can throw'], [CallProp.Invisible, 'invisible'],
|
|
181
|
+
[CallProp.Generic, 'generic'], [CallProp.Method, 's3 method'], [CallProp.Scope, 'changes scope'],
|
|
182
|
+
[CallProp.NonDet, 'non deterministic'], [CallProp.Random, 'random'], [CallProp.Ambient, 'ambient state'],
|
|
183
|
+
[CallProp.File, 'file system'], [CallProp.Reads, 'reads'], [CallProp.Writes, 'writes'],
|
|
184
|
+
[CallProp.Network, 'network'], [CallProp.Prints, 'prints']
|
|
185
|
+
];
|
|
186
|
+
/** What a call states about itself, as words rather than as a bit mask, for anything showing it to a reader. */
|
|
187
|
+
function callPropWords(props) {
|
|
188
|
+
return props === undefined ? [] : CallPropNames.filter(([bit]) => (props & bit) !== 0).map(([, word]) => word);
|
|
189
|
+
}
|
|
168
190
|
const layouts = new WeakMap();
|
|
169
191
|
/**
|
|
170
192
|
* 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;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuiltIns = exports.BuiltInEvalHandlerMapper = exports.BuiltInProcessorMapper = void 0;
|
|
4
|
+
exports.statesNonStandardEvaluation = statesNonStandardEvaluation;
|
|
4
5
|
const known_call_handling_1 = require("../internal/process/functions/call/known-call-handling");
|
|
5
6
|
const built_in_access_1 = require("../internal/process/functions/call/built-in/built-in-access");
|
|
6
7
|
const built_in_if_then_else_1 = require("../internal/process/functions/call/built-in/built-in-if-then-else");
|
|
@@ -19,6 +20,7 @@ const built_in_expression_list_1 = require("../internal/process/functions/call/b
|
|
|
19
20
|
const built_in_get_1 = require("../internal/process/functions/call/built-in/built-in-get");
|
|
20
21
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
21
22
|
const r_symbol_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
23
|
+
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
22
24
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
23
25
|
const edge_1 = require("../graph/edge");
|
|
24
26
|
const built_in_library_1 = require("../internal/process/functions/call/built-in/built-in-library");
|
|
@@ -55,6 +57,39 @@ const built_in_namespace_access_1 = require("../internal/process/functions/call/
|
|
|
55
57
|
const built_in_load_1 = require("../internal/process/functions/call/built-in/built-in-load");
|
|
56
58
|
const built_in_string_template_1 = require("../internal/process/functions/call/built-in/built-in-string-template");
|
|
57
59
|
const built_in_props_1 = require("./built-in-props");
|
|
60
|
+
/**
|
|
61
|
+
* Whether the definition states that the call does not evaluate some of its arguments the standard way, either
|
|
62
|
+
* by quoting them or by handing them a data mask. Only such a definition changes what the arguments read, so
|
|
63
|
+
* only it has to run in place of the default processor.
|
|
64
|
+
*/
|
|
65
|
+
function statesNonStandardEvaluation(definition) {
|
|
66
|
+
const config = definition?.config;
|
|
67
|
+
return config?.markArgsAsNSE !== undefined || config?.markArgsAsMasked !== undefined;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The symbols handed to an {@link ArgProp.Atomic} argument directly: only data works there, so `id` in `id > 2`
|
|
71
|
+
* names a variable and not a function `id` that happens to be in scope, even though `>` may dispatch on the
|
|
72
|
+
* operand's class. Anything bubbling up from a nested call is left alone, that call decided it already.
|
|
73
|
+
*/
|
|
74
|
+
function dataArgumentSymbols(args, sig) {
|
|
75
|
+
const layout = sig === undefined ? undefined : built_in_props_1.FnSig.layout(sig);
|
|
76
|
+
if (layout === undefined || (layout.any & built_in_props_1.ArgProp.Atomic) === 0) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
let symbols;
|
|
80
|
+
for (let i = 0; i < args.length; i++) {
|
|
81
|
+
const arg = args[i];
|
|
82
|
+
const prop = built_in_props_1.FnSig.propAt(layout, i);
|
|
83
|
+
if (arg === r_function_call_1.EmptyArgument || (prop & built_in_props_1.ArgProp.Atomic) === 0 || (prop & (built_in_props_1.ArgProp.Callee | built_in_props_1.ArgProp.Nse)) !== 0) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const value = r_argument_1.RArgument.is(arg) ? arg.value : arg;
|
|
87
|
+
if (value !== undefined && r_symbol_1.RSymbol.is(value)) {
|
|
88
|
+
(symbols ??= new Set()).add(value.info.id);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return symbols;
|
|
92
|
+
}
|
|
58
93
|
function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }) {
|
|
59
94
|
/* a signature states per argument what the individual options state for all of them at once */
|
|
60
95
|
const layout = sig !== undefined ? built_in_props_1.FnSig.layout(sig) : undefined;
|
|
@@ -65,7 +100,9 @@ function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = bu
|
|
|
65
100
|
const nsePositions = nsePositionsOf(nse, args.length);
|
|
66
101
|
let lastEnv = data.environment;
|
|
67
102
|
const { information: res, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
68
|
-
name, args, rootId, data, forceArgs,
|
|
103
|
+
name, args, rootId, data, forceArgs,
|
|
104
|
+
origin: useAsProcessor,
|
|
105
|
+
nonFunction: dataArgumentSymbols(args, sig),
|
|
69
106
|
/* an unevaluated argument must not read the current frame, so it is analyzed in a clean env like `quote` */
|
|
70
107
|
patchData: nsePositions === undefined ? undefined : (d, index) => {
|
|
71
108
|
if (nsePositions.has(index)) {
|
|
@@ -181,8 +218,10 @@ function dropQuotedReferences(res, processedArguments, nsePositions, lastEnv) {
|
|
|
181
218
|
res.environment = lastEnv;
|
|
182
219
|
}
|
|
183
220
|
}
|
|
184
|
-
function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, forceArgs, markArgsAsNSE: nse, markArgsAsMasked: masked }) {
|
|
185
|
-
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
221
|
+
function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, forceArgs, markArgsAsNSE: nse, markArgsAsMasked: masked, sig }) {
|
|
222
|
+
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
223
|
+
name, args, rootId, data, forceArgs, origin: useAsProcessor, nonFunction: dataArgumentSymbols(args, sig)
|
|
224
|
+
});
|
|
186
225
|
const g = information.graph;
|
|
187
226
|
for (const arg of processedArguments) {
|
|
188
227
|
if (arg) {
|