@eagleoutice/flowr 2.15.9 → 2.16.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 +47 -41
- package/abstract-interpretation/absint-inference.d.ts +2 -2
- package/abstract-interpretation/absint-inference.js +32 -79
- package/abstract-interpretation/data-frame/arguments.js +11 -7
- package/benchmark/slicer.d.ts +0 -1
- package/benchmark/slicer.js +1 -2
- package/cli/repl/commands/repl-signature.js +12 -3
- package/config.d.ts +5 -1
- package/control-flow/cfg-properties.js +0 -22
- package/control-flow/happens-before.d.ts +7 -2
- package/control-flow/happens-before.js +55 -31
- package/control-flow/useless-loop.d.ts +1 -1
- package/control-flow/useless-loop.js +29 -42
- package/dataflow/environments/apply-kill.js +6 -2
- package/dataflow/environments/built-in-config.d.ts +2 -0
- package/dataflow/environments/built-in-props.d.ts +16 -1
- package/dataflow/environments/built-in-props.js +33 -20
- package/dataflow/environments/built-in.d.ts +8 -3
- package/dataflow/environments/built-in.js +52 -82
- package/dataflow/environments/default-builtin-config.d.ts +551 -21
- package/dataflow/environments/default-builtin-config.js +121 -45
- package/dataflow/environments/define.d.ts +3 -2
- package/dataflow/environments/define.js +4 -3
- package/dataflow/environments/deprecation-info.d.ts +45 -0
- package/dataflow/environments/deprecation-info.js +13 -0
- package/dataflow/environments/environment.d.ts +7 -5
- package/dataflow/environments/environment.js +55 -121
- package/dataflow/environments/identifier.d.ts +6 -2
- package/dataflow/environments/identifier.js +23 -69
- package/dataflow/environments/reference-to-maybe.d.ts +9 -0
- package/dataflow/environments/reference-to-maybe.js +23 -51
- package/dataflow/environments/resolve-by-name.js +37 -76
- package/dataflow/eval/resolve/resolve-argument.d.ts +3 -1
- package/dataflow/eval/resolve/resolve-argument.js +61 -64
- package/dataflow/eval/resolve/resolve-working-directory.d.ts +8 -2
- package/dataflow/eval/resolve/resolve-working-directory.js +12 -20
- package/dataflow/eval/resolve/resolve.d.ts +4 -0
- package/dataflow/eval/resolve/resolve.js +23 -14
- package/dataflow/extractor.js +180 -58
- package/dataflow/fn/class-declaration.d.ts +8 -13
- package/dataflow/fn/class-declaration.js +95 -116
- package/dataflow/fn/exceptions-of-function.js +68 -37
- package/dataflow/fn/frame-reflection.d.ts +12 -4
- package/dataflow/fn/frame-reflection.js +51 -41
- package/dataflow/fn/function-props.js +15 -33
- package/dataflow/fn/function-semantics.d.ts +11 -3
- package/dataflow/fn/function-semantics.js +6 -0
- package/dataflow/fn/higher-order-function.d.ts +9 -1
- package/dataflow/fn/higher-order-function.js +27 -24
- package/dataflow/fn/strict-function.d.ts +13 -0
- package/dataflow/fn/strict-function.js +291 -123
- package/dataflow/graph/call-graph.d.ts +7 -6
- package/dataflow/graph/call-graph.js +35 -46
- package/dataflow/graph/graph.d.ts +13 -1
- package/dataflow/graph/graph.js +74 -66
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/info.d.ts +8 -1
- package/dataflow/info.js +24 -30
- package/dataflow/internal/control-flow.d.ts +31 -4
- package/dataflow/internal/control-flow.js +61 -39
- package/dataflow/internal/linker.d.ts +17 -8
- package/dataflow/internal/linker.js +286 -213
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +179 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +874 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +60 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +135 -198
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +7 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +21 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +141 -146
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +56 -24
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +292 -253
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +30 -32
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +68 -67
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +91 -129
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +16 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -35
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +8 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +5 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +13 -31
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +42 -119
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +21 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +93 -102
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +173 -114
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +23 -26
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +119 -93
- package/dataflow/internal/process/functions/call/common.d.ts +4 -4
- package/dataflow/internal/process/functions/call/common.js +49 -71
- package/dataflow/internal/process/functions/call/deferred.d.ts +12 -2
- package/dataflow/internal/process/functions/call/deferred.js +81 -63
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +65 -68
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +3 -5
- package/dataflow/internal/process/functions/call/named-call-handling.js +48 -19
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
- package/dataflow/internal/process/functions/call/quoted.js +257 -154
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +17 -38
- package/dataflow/internal/process/functions/process-parameter.js +25 -32
- package/dataflow/internal/process/process-symbol.js +4 -3
- package/dataflow/internal/program-order.d.ts +26 -0
- package/dataflow/internal/program-order.js +49 -0
- package/documentation/data/faq/faqs.js +3 -3
- package/documentation/data/interface/doc-writing-code.js +1 -2
- package/documentation/data/server/doc-data-server-messages.js +7 -7
- package/documentation/doc-capabilities.js +80 -34
- package/documentation/doc-util/doc-query.d.ts +0 -3
- package/documentation/doc-util/doc-query.js +4 -3
- package/documentation/wiki-analyzer.js +1 -1
- package/documentation/wiki-cfg.js +5 -6
- package/documentation/wiki-core.js +8 -8
- package/documentation/wiki-dataflow-graph.js +10 -11
- package/documentation/wiki-interface.js +2 -2
- package/documentation/wiki-linting-and-testing.js +3 -3
- package/documentation/wiki-overview.js +6 -6
- package/documentation/wiki-query.js +9 -101
- package/documentation/wiki-setup.js +23 -0
- package/documentation/wiki-signature-database.js +1 -1
- package/linter/linter-rules.d.ts +18 -9
- package/linter/rules/absolute-path.js +63 -87
- package/linter/rules/deprecated-functions.d.ts +1 -45
- package/linter/rules/deprecated-functions.js +24 -33
- package/linter/rules/file-path-validity.d.ts +4 -2
- package/linter/rules/file-path-validity.js +114 -80
- package/linter/rules/namespace-access.js +21 -33
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +60 -48
- package/linter/rules/network-functions.js +11 -7
- package/linter/rules/no-leaked-credentials.js +15 -18
- package/linter/rules/problematic-inputs.d.ts +2 -1
- package/linter/rules/problematic-inputs.js +39 -59
- package/linter/rules/roxygen-arguments.d.ts +9 -4
- package/linter/rules/roxygen-arguments.js +29 -48
- package/linter/rules/seeded-randomness.d.ts +7 -4
- package/linter/rules/seeded-randomness.js +128 -89
- package/linter/rules/stop-with-call-arg.d.ts +4 -2
- package/linter/rules/stop-with-call-arg.js +25 -22
- package/linter/rules/unclosed-connection.js +31 -24
- package/linter/rules/undefined-symbol.d.ts +4 -6
- package/linter/rules/undefined-symbol.js +58 -75
- package/linter/rules/unescaped-arguments.js +18 -44
- package/linter/rules/unused-definition.d.ts +6 -0
- package/linter/rules/unused-definition.js +105 -145
- package/linter/rules/unused-import.d.ts +3 -0
- package/linter/rules/unused-import.js +25 -43
- package/package.json +5 -2
- package/project/flowr-analyzer.d.ts +2 -0
- package/project/flowr-analyzer.js +28 -1
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -2
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +8 -12
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -2
- package/project/plugins/file-plugins/files/flowr-rda-file.js +10 -55
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +7 -5
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +34 -56
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +2 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +22 -45
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- package/project/sigdb/build.js +4 -0
- package/project/sigdb/manifest.d.ts +2 -0
- package/project/sigdb/manifest.js +10 -1
- package/project/sigdb/reader.js +23 -61
- package/project/sigdb/sigdb-download.d.ts +29 -6
- package/project/sigdb/sigdb-download.js +212 -64
- package/queries/base-query-format.js +1 -2
- package/queries/catalog/absint-query/absint-query-format.js +1 -1
- package/queries/catalog/call-context-query/cascade-action.d.ts +3 -1
- package/queries/catalog/call-context-query/cascade-action.js +2 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -0
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +4 -7
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -114
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +5 -9
- package/queries/catalog/dependencies-query/function-info/library-functions.js +6 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/write-functions.js +7 -3
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +4 -4
- package/queries/catalog/input-sources-query/simple-input-classifier.js +192 -301
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -1
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +2 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/query.d.ts +1 -1
- package/r-bridge/data/data.d.ts +21 -14
- package/r-bridge/data/data.js +28 -20
- package/r-bridge/lang-4.x/ast/model/model.d.ts +3 -1
- package/r-bridge/lang-4.x/ast/model/model.js +19 -43
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -12
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +11 -2
- package/r-bridge/roxygen2/roxygen-parse.js +28 -42
- package/r-bridge/shell.js +6 -0
- package/search/search-executor/search-enrichers.js +25 -37
- package/slicing/static/slice-call.d.ts +4 -3
- package/slicing/static/slice-call.js +56 -88
- package/slicing/static/static-slicer.js +115 -79
- package/slicing/static/visiting-queue.d.ts +4 -6
- package/slicing/static/visiting-queue.js +9 -13
- package/util/files.d.ts +2 -0
- package/util/files.js +3 -1
- package/util/mermaid/mermaid.js +6 -2
- package/util/proc.js +2 -1
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +23 -13
- package/util/text/playground-link.d.ts +12 -3
- package/util/text/playground-link.js +18 -27
- package/util/version.js +4 -10
|
@@ -31,6 +31,7 @@ const built_in_rm_1 = require("../internal/process/functions/call/built-in/built
|
|
|
31
31
|
const built_in_eval_1 = require("../internal/process/functions/call/built-in/built-in-eval");
|
|
32
32
|
const vertex_1 = require("../graph/vertex");
|
|
33
33
|
const unknown_side_effect_1 = require("../graph/unknown-side-effect");
|
|
34
|
+
const built_in_ambient_state_1 = require("../internal/process/functions/call/built-in/built-in-ambient-state");
|
|
34
35
|
const resolve_1 = require("../eval/resolve/resolve");
|
|
35
36
|
const resolve_strings_1 = require("../eval/resolve/resolve-strings");
|
|
36
37
|
const resolve_operators_1 = require("../eval/resolve/resolve-operators");
|
|
@@ -80,28 +81,33 @@ function dataArgumentSymbols(args, sig) {
|
|
|
80
81
|
if (r_argument_1.RArgument.isEmpty(arg) || (prop & built_in_props_1.ArgProp.Atomic) === 0 || (prop & (built_in_props_1.ArgProp.Callee | built_in_props_1.ArgProp.Nse)) !== 0) {
|
|
81
82
|
continue;
|
|
82
83
|
}
|
|
83
|
-
const value = r_argument_1.RArgument.
|
|
84
|
-
if (
|
|
84
|
+
const value = r_argument_1.RArgument.valueOf(arg);
|
|
85
|
+
if (r_symbol_1.RSymbol.is(value)) {
|
|
85
86
|
(symbols ??= new Set()).add(value.info.id);
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
return symbols;
|
|
89
90
|
}
|
|
90
|
-
function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, readAllArguments, cfg, alternativeArgsFrom, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }) {
|
|
91
|
+
function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, readAllArguments, cfg, alternativeArgsFrom, hasUnknownSideEffects, ambient, scope, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }) {
|
|
92
|
+
if (scope !== undefined) {
|
|
93
|
+
return (0, built_in_ambient_state_1.processAmbientScope)(name, args, rootId, data, scope);
|
|
94
|
+
}
|
|
91
95
|
/* a signature states per argument what the individual options state for all of them at once */
|
|
92
96
|
const layout = sig !== undefined ? function_semantics_1.FunctionSemantics.call.signature.layout(sig) : undefined;
|
|
93
97
|
if (layout !== undefined) {
|
|
94
98
|
nse ??= (layout.any & built_in_props_1.ArgProp.Nse) !== 0 ? function_semantics_1.FunctionSemantics.call.signature.posWith(layout, args.length, built_in_props_1.ArgProp.Nse) : undefined;
|
|
95
99
|
}
|
|
96
|
-
const nsePositions =
|
|
100
|
+
const nsePositions = nse === undefined ? undefined : new Set((0, known_call_handling_1.nseArgumentPositions)(nse, args.length));
|
|
97
101
|
let lastEnv = data.environment;
|
|
102
|
+
/* `evalq(expr)` runs `expr` right here, in the frame it is called from */
|
|
103
|
+
const inPlace = args.length === 1 && identifier_1.Identifier.getName(name.content) === 'evalq';
|
|
98
104
|
const { information: res, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
99
105
|
name, args, rootId, data, sig, alternativeArgsFrom,
|
|
100
106
|
origin: useAsProcessor,
|
|
101
107
|
nonFunction: dataArgumentSymbols(args, sig),
|
|
102
108
|
/* an unevaluated argument must not read the current frame, so it is analyzed in a clean env like `quote` */
|
|
103
109
|
patchData: nsePositions === undefined ? undefined : (d, index) => {
|
|
104
|
-
if (nsePositions.has(index)) {
|
|
110
|
+
if (nsePositions.has(index) && !inPlace) {
|
|
105
111
|
lastEnv = d.environment;
|
|
106
112
|
return { ...d, environment: (0, scoping_1.cleanEnvOf)(d.environment) };
|
|
107
113
|
}
|
|
@@ -116,88 +122,49 @@ function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = bu
|
|
|
116
122
|
if (keepArgumentOut) {
|
|
117
123
|
res.out = [...res.out, ...processedArguments.flatMap(arg => arg?.out ?? [])];
|
|
118
124
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
res.graph.addEdge(rootId, arg.entryPoint, edge_1.EdgeType.Returns);
|
|
123
|
-
}
|
|
125
|
+
const alias = layout !== undefined && layout.alias >= 0 ? processedArguments[layout.alias] : undefined;
|
|
126
|
+
if (alias !== undefined) {
|
|
127
|
+
res.graph.addEdge(rootId, alias.entryPoint, edge_1.EdgeType.Returns);
|
|
124
128
|
}
|
|
125
129
|
if (readAllArguments) {
|
|
126
|
-
|
|
127
|
-
if (arg) {
|
|
128
|
-
res.graph.addEdge(rootId, arg.entryPoint, edge_1.EdgeType.Reads);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
130
|
+
readArguments(res.graph, rootId, processedArguments);
|
|
131
131
|
}
|
|
132
132
|
else if (layout !== undefined && (layout.any & (built_in_props_1.ArgProp.Value | built_in_props_1.ArgProp.Shape)) !== 0) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (arg) {
|
|
136
|
-
res.graph.addEdge(rootId, arg.entryPoint, edge_1.EdgeType.Reads);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
133
|
+
const valuePositions = function_semantics_1.FunctionSemantics.call.signature.posWith(layout, processedArguments.length, built_in_props_1.ArgProp.Value | built_in_props_1.ArgProp.Shape);
|
|
134
|
+
readArguments(res.graph, rootId, valuePositions.map(i => processedArguments[i]));
|
|
139
135
|
}
|
|
140
136
|
if (hasUnknownSideEffects) {
|
|
141
|
-
|
|
142
|
-
(0, unknown_side_effect_1.handleUnknownSideEffect)(res.graph, res.environment, rootId);
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
(0, unknown_side_effect_1.handleUnknownSideEffect)(res.graph, res.environment, rootId, hasUnknownSideEffects);
|
|
146
|
-
}
|
|
137
|
+
(0, unknown_side_effect_1.handleUnknownSideEffect)(res.graph, res.environment, rootId, hasUnknownSideEffects === true ? undefined : hasUnknownSideEffects);
|
|
147
138
|
}
|
|
148
|
-
const fnCallNames = treatAsFnCall?.[identifier_1.Identifier.getName(name.content)];
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
res.graph.updateToFunctionCall({
|
|
167
|
-
tag: vertex_1.VertexType.FunctionCall,
|
|
168
|
-
id: fnId,
|
|
169
|
-
name: fnName,
|
|
170
|
-
args: [],
|
|
171
|
-
environment: data.environment,
|
|
172
|
-
onlyBuiltin: false,
|
|
173
|
-
cds: data.cds,
|
|
174
|
-
origin: [useAsProcessor]
|
|
175
|
-
});
|
|
176
|
-
}
|
|
139
|
+
const fnCallNames = treatAsFnCall?.[identifier_1.Identifier.getName(name.content)] ?? [];
|
|
140
|
+
for (const arg of args) {
|
|
141
|
+
const rhs = arg !== r_function_call_1.EmptyArgument && fnCallNames.includes(arg.name?.content) ? arg.value : undefined;
|
|
142
|
+
if (r_string_1.RString.is(rhs) || r_symbol_1.RSymbol.is(rhs)) {
|
|
143
|
+
res.graph.updateToFunctionCall({
|
|
144
|
+
tag: vertex_1.VertexType.FunctionCall,
|
|
145
|
+
id: rhs.info.id,
|
|
146
|
+
name: r_string_1.RString.is(rhs) ? rhs.content.str : rhs.content,
|
|
147
|
+
args: [],
|
|
148
|
+
environment: data.environment,
|
|
149
|
+
onlyBuiltin: false,
|
|
150
|
+
cds: data.cds,
|
|
151
|
+
origin: [useAsProcessor]
|
|
152
|
+
});
|
|
177
153
|
}
|
|
178
154
|
}
|
|
179
155
|
if (cfg !== undefined) {
|
|
180
156
|
/* the call jumps, so it never falls through to whatever follows it */
|
|
181
157
|
const exitPoints = res.exitPoints.filter(e => e.type !== 0 /* ExitPointType.Default */ || e.nodeId !== rootId);
|
|
182
|
-
exitPoints
|
|
183
|
-
res.exitPoints = exitPoints;
|
|
158
|
+
res.exitPoints = [...exitPoints, { type: cfg, nodeId: rootId, cds: data.cds }];
|
|
184
159
|
}
|
|
185
|
-
return res;
|
|
160
|
+
return ambient === undefined ? res : (0, built_in_ambient_state_1.applyAmbientStateAccess)(res, args, rootId, data, ambient);
|
|
186
161
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
else if (typeof which !== 'string') {
|
|
193
|
-
return new Set(which);
|
|
194
|
-
}
|
|
195
|
-
const positions = new Set();
|
|
196
|
-
const end = which === known_call_handling_1.NseArguments.First ? Math.min(1, count) : count;
|
|
197
|
-
for (let i = which === known_call_handling_1.NseArguments.AllButFirst ? 1 : 0; i < end; i++) {
|
|
198
|
-
positions.add(i);
|
|
162
|
+
function readArguments(graph, rootId, args) {
|
|
163
|
+
for (const arg of args) {
|
|
164
|
+
if (arg) {
|
|
165
|
+
graph.addEdge(rootId, arg.entryPoint, edge_1.EdgeType.Reads);
|
|
166
|
+
}
|
|
199
167
|
}
|
|
200
|
-
return positions;
|
|
201
168
|
}
|
|
202
169
|
/** Whatever a quoted argument saw in its clean env must not be resolved in the caller's frame afterwards. */
|
|
203
170
|
function dropQuotedReferences(res, processedArguments, nsePositions, lastEnv) {
|
|
@@ -217,19 +184,21 @@ function dropQuotedReferences(res, processedArguments, nsePositions, lastEnv) {
|
|
|
217
184
|
res.environment = lastEnv;
|
|
218
185
|
}
|
|
219
186
|
}
|
|
220
|
-
function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, markArgsAsNSE: nse, markArgsAsMasked: masked, sig }) {
|
|
187
|
+
function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, markArgsAsNSE: nse, markArgsAsMasked: masked, sig, ambient }) {
|
|
221
188
|
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
222
189
|
name, args, rootId, data, sig, origin: useAsProcessor, nonFunction: dataArgumentSymbols(args, sig)
|
|
223
190
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
191
|
+
readArguments(information.graph, rootId, processedArguments);
|
|
192
|
+
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, nse);
|
|
193
|
+
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, masked, { kind: known_call_handling_1.NseKind.DataMasked });
|
|
194
|
+
return ambient === undefined ? information : (0, built_in_ambient_state_1.applyAmbientStateAccess)(information, args, rootId, data, ambient);
|
|
195
|
+
}
|
|
196
|
+
/** A call that reads or writes the files its arguments name accesses the {@link AmbientStateName.files|files on disk} as well. */
|
|
197
|
+
function withFileAccess(config) {
|
|
198
|
+
const { tags, ambient, sig } = (config ?? {});
|
|
199
|
+
const type = !tags?.includes(built_in_props_1.SemanticCallTag.File) ? undefined : tags.includes(built_in_props_1.SemanticCallTag.Writes) ? "write-files" /* AmbientStateAccessType.WriteFiles */ : tags.includes(built_in_props_1.SemanticCallTag.Reads) ? "read-files" /* AmbientStateAccessType.ReadFiles */ : undefined;
|
|
200
|
+
const stated = [ambient ?? []].flat();
|
|
201
|
+
return type === undefined || stated.some(a => a.type === type) ? config : { ...config, ambient: [...stated, { type, sig: tags?.includes(built_in_props_1.SemanticCallTag.Glob) ? undefined : sig }] };
|
|
233
202
|
}
|
|
234
203
|
exports.BuiltInProcessorMapper = {
|
|
235
204
|
[built_in_proc_name_1.BuiltInProcName.Access]: built_in_access_1.processAccess,
|
|
@@ -328,6 +297,7 @@ class BuiltIns {
|
|
|
328
297
|
(0, assert_1.guard)(mappedProcessor !== undefined, () => `Processor for ${processor} is undefined! Please pass a valid builtin name ${JSON.stringify(Object.keys(exports.BuiltInProcessorMapper))}!`);
|
|
329
298
|
const mappedEval = evalHandler === undefined ? undefined : exports.BuiltInEvalHandlerMapper[evalHandler];
|
|
330
299
|
(0, assert_1.guard)(evalHandler === undefined || mappedEval !== undefined, () => `Eval handler ${evalHandler} is unknown! Please pass a valid one of ${JSON.stringify(Object.keys(exports.BuiltInEvalHandlerMapper))}!`);
|
|
300
|
+
config = withFileAccess(config);
|
|
331
301
|
for (const name of names) {
|
|
332
302
|
const n = identifier_1.Identifier.getName(name);
|
|
333
303
|
const id = node_id_1.NodeId.toBuiltIn(n);
|