@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
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;
|
|
@@ -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) {
|