@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
|
@@ -13,8 +13,10 @@ export interface ResolvedFunctionArgument {
|
|
|
13
13
|
readonly functionName: Identifier;
|
|
14
14
|
readonly anonymous: boolean;
|
|
15
15
|
readonly asString: boolean;
|
|
16
|
+
/** the name is computed by the argument (`paste0("f_", k)`), whose own vertex therefore cannot become the call */
|
|
17
|
+
readonly computed?: boolean;
|
|
16
18
|
}
|
|
17
|
-
/** Resolve the function an argument stands for: a string literal, a symbol, or an inline definition; `undefined` if none. */
|
|
19
|
+
/** Resolve the function an argument stands for: a string (literal or computed), a symbol, or an inline definition; `undefined` if none. */
|
|
18
20
|
export declare function resolveFunctionArgument<OtherInfo>(val: RNode<OtherInfo & ParentInformation>, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, opts: {
|
|
19
21
|
readonly unquoteFunction?: boolean;
|
|
20
22
|
readonly resolveValue?: boolean;
|
|
@@ -18,7 +18,10 @@ const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/
|
|
|
18
18
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
19
19
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
20
20
|
const r_function_definition_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
21
|
-
|
|
21
|
+
const built_in_ambient_state_1 = require("./built-in-ambient-state");
|
|
22
|
+
const built_in_props_1 = require("../../../../../environments/built-in-props");
|
|
23
|
+
const resolve_helper_1 = require("../../../../../environments/resolve-helper");
|
|
24
|
+
/** Resolve the function an argument stands for: a string (literal or computed), a symbol, or an inline definition; `undefined` if none. */
|
|
22
25
|
function resolveFunctionArgument(val, data, opts) {
|
|
23
26
|
if (opts.unquoteFunction && r_string_1.RString.is(val)) {
|
|
24
27
|
return { functionId: val.info.id, functionName: val.content.str, anonymous: false, asString: true };
|
|
@@ -26,6 +29,11 @@ function resolveFunctionArgument(val, data, opts) {
|
|
|
26
29
|
if (r_function_definition_1.RFunctionDefinition.is(val)) {
|
|
27
30
|
return { functionId: val.info.id, functionName: `${unnamed_call_handling_1.UnnamedFunctionCallPrefix}${val.info.id}`, anonymous: true, asString: false };
|
|
28
31
|
}
|
|
32
|
+
/* `do.call(paste0("f_", 1 + 2))` and `do.call(name)` with a string in `name` call the function so named */
|
|
33
|
+
const named = opts.unquoteFunction ? node_value_1.NodeValue.singleStringOf(val.info.id, data) : undefined;
|
|
34
|
+
if (named !== undefined) {
|
|
35
|
+
return { functionId: val.info.id, functionName: named, anonymous: false, asString: true, computed: !r_symbol_1.RSymbol.is(val) };
|
|
36
|
+
}
|
|
29
37
|
if (!r_symbol_1.RSymbol.is(val)) {
|
|
30
38
|
return undefined;
|
|
31
39
|
}
|
|
@@ -43,34 +51,15 @@ function processApply(name, args, rootId, data, config) {
|
|
|
43
51
|
const resFn = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
44
52
|
name, args, rootId, data, sig: function_semantics_1.FunctionSemantics.call.signature.only(indexOfFunction, nameOfFunctionArgument ?? 'FUN'), origin: built_in_proc_name_1.BuiltInProcName.Apply
|
|
45
53
|
});
|
|
54
|
+
const { processedArguments } = resFn;
|
|
46
55
|
let information = resFn.information;
|
|
47
56
|
if (hasUnknownSideEffects) {
|
|
48
57
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
49
58
|
}
|
|
50
|
-
const processedArguments = resFn.processedArguments;
|
|
51
|
-
let index = indexOfFunction;
|
|
52
59
|
/* search, if one of the arguments actually contains the argument name if given in the config */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
index = mayFn;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// shift the index to point to the index'd unnamed argument
|
|
60
|
-
let posArgsFound = 0;
|
|
61
|
-
for (let i = 0; i < args.length; i++) {
|
|
62
|
-
const arg = args[i];
|
|
63
|
-
if (arg !== r_function_call_1.EmptyArgument && arg.name) {
|
|
64
|
-
// do nothing
|
|
65
|
-
}
|
|
66
|
-
else if (posArgsFound === index) {
|
|
67
|
-
index = i;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
posArgsFound++;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
60
|
+
const named = nameOfFunctionArgument === undefined ? -1
|
|
61
|
+
: args.findIndex(arg => arg !== r_function_call_1.EmptyArgument && arg.name?.content === nameOfFunctionArgument);
|
|
62
|
+
const index = positionOfUnnamed(args, named >= 0 ? named : indexOfFunction);
|
|
74
63
|
/* validate, that we indeed have so many arguments to fill this one :D */
|
|
75
64
|
if (index >= args.length) {
|
|
76
65
|
logger_1.dataflowLogger.warn(`Function argument at index ${index} not found, skipping`);
|
|
@@ -82,33 +71,39 @@ function processApply(name, args, rootId, data, config) {
|
|
|
82
71
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
83
72
|
return information;
|
|
84
73
|
}
|
|
85
|
-
const
|
|
86
|
-
const resolvedFn = resolveFunctionArgument(val, data, { unquoteFunction, resolveValue });
|
|
74
|
+
const resolvedFn = resolveFunctionArgument(arg.value, data, { unquoteFunction, resolveValue });
|
|
87
75
|
if (resolvedFn === undefined) {
|
|
88
|
-
logger_1.dataflowLogger.warn(`Expected symbol or string as function argument at index ${index}, but got ${JSON.stringify(
|
|
76
|
+
logger_1.dataflowLogger.warn(`Expected symbol or string as function argument at index ${index}, but got ${JSON.stringify(arg.value)} instead.`);
|
|
89
77
|
// the called function is dynamic and unresolvable: reached-but-unknown rather than dropped
|
|
90
78
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
91
79
|
return information;
|
|
92
80
|
}
|
|
93
|
-
const { functionName, anonymous, asString } = resolvedFn;
|
|
81
|
+
const { functionName, anonymous, asString, computed } = resolvedFn;
|
|
94
82
|
let functionId = resolvedFn.functionId;
|
|
83
|
+
if (computed) {
|
|
84
|
+
/* the call the computed name stands for gets a vertex of its own, which reads the name */
|
|
85
|
+
const nameId = functionId;
|
|
86
|
+
functionId = `${nameId}-call`;
|
|
87
|
+
/* a use for now, made the call below like any other function handed over */
|
|
88
|
+
information.graph.addVertex({ tag: vertex_1.VertexType.Use, id: functionId, cds: data.cds }, data.ctx.env.cleanEnv);
|
|
89
|
+
information.graph.addEdge(rootId, functionId, edge_1.EdgeType.Calls | edge_1.EdgeType.Argument);
|
|
90
|
+
information.graph.addEdge(functionId, nameId, edge_1.EdgeType.Reads);
|
|
91
|
+
}
|
|
95
92
|
if (asString) {
|
|
96
93
|
information.in = [...information.in, { type: identifier_1.ReferenceType.Function, name: functionName, cds: data.cds, nodeId: functionId }];
|
|
97
94
|
}
|
|
98
95
|
const allOtherArguments = processedArguments.map((arg, i) => {
|
|
99
96
|
const counterpart = args[i];
|
|
100
|
-
if (arg
|
|
101
|
-
return {
|
|
102
|
-
name: counterpart.name?.content,
|
|
103
|
-
valueId: counterpart.value?.info.id,
|
|
104
|
-
cds: data.cds,
|
|
105
|
-
type: identifier_1.ReferenceType.Argument,
|
|
106
|
-
nodeId: arg.entryPoint
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
97
|
+
if (!arg || counterpart === r_function_call_1.EmptyArgument) {
|
|
110
98
|
return r_function_call_1.EmptyArgument;
|
|
111
99
|
}
|
|
100
|
+
return {
|
|
101
|
+
name: counterpart.name?.content,
|
|
102
|
+
valueId: counterpart.value?.info.id,
|
|
103
|
+
cds: data.cds,
|
|
104
|
+
type: identifier_1.ReferenceType.Argument,
|
|
105
|
+
nodeId: arg.entryPoint
|
|
106
|
+
};
|
|
112
107
|
}).filter((_, i) => i !== index);
|
|
113
108
|
if (anonymous) {
|
|
114
109
|
const rootFnId = functionId;
|
|
@@ -140,7 +135,12 @@ function processApply(name, args, rootId, data, config) {
|
|
|
140
135
|
}
|
|
141
136
|
}
|
|
142
137
|
else {
|
|
143
|
-
|
|
138
|
+
information = (0, built_in_ambient_state_1.applyAmbientStateOfCallee)(information, functionId, functionName, data);
|
|
139
|
+
/* a callee binding names (`do.call("assign", ...)`) does so with arguments we cannot see here; loading a package is handled on its own */
|
|
140
|
+
if (resolve_helper_1.Resolve.byNameAndType(functionName, data.environment, identifier_1.ReferenceType.Function)?.some(t => t.type === identifier_1.ReferenceType.BuiltInFunction
|
|
141
|
+
&& built_in_props_1.CallProps.hasAny(t.config, built_in_props_1.CallProp.Scope) && !built_in_props_1.CallProps.hasAny(t.config, built_in_props_1.SemanticCallTag.LoadsPackage))) {
|
|
142
|
+
information.graph.markIdForUnknownSideEffects(rootId);
|
|
143
|
+
}
|
|
144
144
|
information.graph.updateToFunctionCall({
|
|
145
145
|
tag: vertex_1.VertexType.FunctionCall,
|
|
146
146
|
id: functionId,
|
|
@@ -157,16 +157,28 @@ function processApply(name, args, rootId, data, config) {
|
|
|
157
157
|
information.graph.addEdge(functionId, arg.entryPoint, edge_1.EdgeType.Argument);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
if (resolveInEnvironment
|
|
161
|
-
// remove from open ingoing references
|
|
162
|
-
return {
|
|
163
|
-
...information,
|
|
164
|
-
in: information.in.filter(ref => ref.nodeId !== functionId),
|
|
165
|
-
unknownReferences: information.unknownReferences.filter(ref => ref.nodeId !== functionId)
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
160
|
+
if (resolveInEnvironment !== 'global') {
|
|
169
161
|
return information;
|
|
170
162
|
}
|
|
163
|
+
// remove from open ingoing references
|
|
164
|
+
return {
|
|
165
|
+
...information,
|
|
166
|
+
in: information.in.filter(ref => ref.nodeId !== functionId),
|
|
167
|
+
unknownReferences: information.unknownReferences.filter(ref => ref.nodeId !== functionId)
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/** The position in `args` of the `n`-th unnamed argument (counting empty ones), `n` itself if there are fewer. */
|
|
171
|
+
function positionOfUnnamed(args, n) {
|
|
172
|
+
let unnamedSeen = 0;
|
|
173
|
+
for (const [i, arg] of args.entries()) {
|
|
174
|
+
if (arg !== r_function_call_1.EmptyArgument && arg.name) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (unnamedSeen === n) {
|
|
178
|
+
return i;
|
|
179
|
+
}
|
|
180
|
+
unnamedSeen++;
|
|
181
|
+
}
|
|
182
|
+
return n;
|
|
171
183
|
}
|
|
172
184
|
//# sourceMappingURL=built-in-apply.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DataflowProcessorInformation } from '../../../../../processor';
|
|
2
2
|
import type { DataflowInformation } from '../../../../../info';
|
|
3
3
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
-
import
|
|
4
|
+
import { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
|
|
5
5
|
import { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
6
|
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
7
7
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
@@ -9,7 +9,7 @@ import { Identifier, type InGraphIdentifierDefinition } from '../../../../../env
|
|
|
9
9
|
import type { DataflowGraphVertexFunctionDefinition } from '../../../../../graph/vertex';
|
|
10
10
|
import type { REnvironmentInformation } from '../../../../../environments/environment';
|
|
11
11
|
import type { DataflowGraph } from '../../../../../graph/graph';
|
|
12
|
-
import type
|
|
12
|
+
import { type FnSig } from '../../../../../environments/built-in-props';
|
|
13
13
|
export interface AssignmentConfiguration {
|
|
14
14
|
readonly superAssignment?: boolean;
|
|
15
15
|
readonly swapSourceAndTarget?: boolean;
|
|
@@ -21,6 +21,8 @@ export interface AssignmentConfiguration {
|
|
|
21
21
|
readonly replacement?: boolean;
|
|
22
22
|
/** is the target a variable pointing at the actual name? */
|
|
23
23
|
readonly targetVariable?: boolean;
|
|
24
|
+
/** appended to a target named by a string (`setReplaceMethod("f", ...)` binds `f<-`) */
|
|
25
|
+
readonly targetSuffix?: string;
|
|
24
26
|
/** does the call use the old value of its target (e.g. `setNames(x, nm)`), so that the target reads its previous definition? */
|
|
25
27
|
readonly readTarget?: boolean;
|
|
26
28
|
readonly mayHaveMoreArgs?: boolean;
|