@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BuiltInEvalHandlerArgs } from '../../environments/built-in';
|
|
2
2
|
import { type Lift, Top, type Value, type ValueNumber, type ValueVector } from '../values/r-value';
|
|
3
3
|
/**
|
|
4
|
-
* Helper function used by {@link
|
|
4
|
+
* Helper function used by {@link Resolve.toValue}, please use that instead, if
|
|
5
5
|
* you want to resolve the value of an identifier / node
|
|
6
6
|
*
|
|
7
7
|
* This function converts an RNode to its Value, either directly for a constant or by handing the node
|
|
@@ -10,20 +10,20 @@ import { type Lift, Top, type Value, type ValueNumber, type ValueVector } from '
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function resolveNode(args: BuiltInEvalHandlerArgs): Value;
|
|
12
12
|
/**
|
|
13
|
-
* Helper function used by {@link
|
|
13
|
+
* Helper function used by {@link Resolve.toValue}, please use that instead, if
|
|
14
14
|
* you want to resolve the value of an identifier / node
|
|
15
15
|
*
|
|
16
16
|
* This function resolves a vector function call `c` to a {@link ValueVector}
|
|
17
|
-
* by recursively resolving the values of the arguments by calling {@link
|
|
17
|
+
* by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
|
|
18
18
|
* @returns ValueVector or Top
|
|
19
19
|
*/
|
|
20
20
|
export declare function resolveAsVector(args: BuiltInEvalHandlerArgs): ValueVector | typeof Top;
|
|
21
21
|
/**
|
|
22
|
-
* Helper function used by {@link
|
|
22
|
+
* Helper function used by {@link Resolve.toValue}, please use that instead, if
|
|
23
23
|
* you want to resolve the value of an identifier / node
|
|
24
24
|
*
|
|
25
25
|
* This function resolves a binary sequence operator `:` to a {@link ValueVector} of {@link ValueNumber}s
|
|
26
|
-
* by recursively resolving the values of the arguments by calling {@link
|
|
26
|
+
* by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
|
|
27
27
|
* @returns ValueVector of ValueNumbers or Top
|
|
28
28
|
*/
|
|
29
29
|
export declare function resolveAsSeq(args: BuiltInEvalHandlerArgs): ValueVector<Lift<ValueNumber[]>> | typeof Top;
|
|
@@ -11,12 +11,11 @@ const logical_constants_1 = require("../values/logical/logical-constants");
|
|
|
11
11
|
const r_value_2 = require("../values/r-value");
|
|
12
12
|
const string_constants_1 = require("../values/string/string-constants");
|
|
13
13
|
const vector_constants_1 = require("../values/vectors/vector-constants");
|
|
14
|
-
const alias_tracking_1 = require("./alias-tracking");
|
|
15
14
|
const scalar_constants_1 = require("../values/scalar/scalar-constants");
|
|
16
15
|
const identifier_1 = require("../../environments/identifier");
|
|
17
|
-
const resolve_by_name_1 = require("../../environments/resolve-by-name");
|
|
18
16
|
const df_helper_1 = require("../../graph/df-helper");
|
|
19
17
|
const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
18
|
+
const resolve_helper_1 = require("../../environments/resolve-helper");
|
|
20
19
|
/**
|
|
21
20
|
* The {@link BuiltInEvalHandler} the given name resolves to in the current environment, just like the
|
|
22
21
|
* {@link BuiltInIdentifierDefinition#processor} a call resolves to; `undefined` if the name is shadowed
|
|
@@ -24,7 +23,7 @@ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-
|
|
|
24
23
|
*/
|
|
25
24
|
function evalHandlerOf(name, environment, ctx) {
|
|
26
25
|
const defs = environment ?
|
|
27
|
-
|
|
26
|
+
resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.BuiltInFunction)
|
|
28
27
|
: ctx.env.builtInEnvironment.memory.get(identifier_1.Identifier.getName(name));
|
|
29
28
|
const def = defs?.length === 1 ? defs[0] : undefined;
|
|
30
29
|
return def?.type === identifier_1.ReferenceType.BuiltInFunction ? def.evalHandler : undefined;
|
|
@@ -60,7 +59,7 @@ function evalNameOf({ node, graph }) {
|
|
|
60
59
|
return name;
|
|
61
60
|
}
|
|
62
61
|
/**
|
|
63
|
-
* Helper function used by {@link
|
|
62
|
+
* Helper function used by {@link Resolve.toValue}, please use that instead, if
|
|
64
63
|
* you want to resolve the value of an identifier / node
|
|
65
64
|
*
|
|
66
65
|
* This function converts an RNode to its Value, either directly for a constant or by handing the node
|
|
@@ -87,11 +86,11 @@ function resolveNode(args) {
|
|
|
87
86
|
return handler?.(args) ?? r_value_2.Top;
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
|
-
* Helper function used by {@link
|
|
89
|
+
* Helper function used by {@link Resolve.toValue}, please use that instead, if
|
|
91
90
|
* you want to resolve the value of an identifier / node
|
|
92
91
|
*
|
|
93
92
|
* This function resolves a vector function call `c` to a {@link ValueVector}
|
|
94
|
-
* by recursively resolving the values of the arguments by calling {@link
|
|
93
|
+
* by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
|
|
95
94
|
* @returns ValueVector or Top
|
|
96
95
|
*/
|
|
97
96
|
function resolveAsVector(args) {
|
|
@@ -99,14 +98,14 @@ function resolveAsVector(args) {
|
|
|
99
98
|
if (node.type !== type_1.RType.FunctionCall) {
|
|
100
99
|
return r_value_2.Top;
|
|
101
100
|
}
|
|
102
|
-
return (0, vector_constants_1.vectorFrom)((0, vector_constants_1.flattenVectorElements)(node.arguments.map(arg => arg !== r_function_call_1.EmptyArgument ?
|
|
101
|
+
return (0, vector_constants_1.vectorFrom)((0, vector_constants_1.flattenVectorElements)(node.arguments.map(arg => arg !== r_function_call_1.EmptyArgument ? resolve_helper_1.Resolve.toValue(arg.value, args) : r_value_2.Top)));
|
|
103
102
|
}
|
|
104
103
|
/**
|
|
105
|
-
* Helper function used by {@link
|
|
104
|
+
* Helper function used by {@link Resolve.toValue}, please use that instead, if
|
|
106
105
|
* you want to resolve the value of an identifier / node
|
|
107
106
|
*
|
|
108
107
|
* This function resolves a binary sequence operator `:` to a {@link ValueVector} of {@link ValueNumber}s
|
|
109
|
-
* by recursively resolving the values of the arguments by calling {@link
|
|
108
|
+
* by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
|
|
110
109
|
* @returns ValueVector of ValueNumbers or Top
|
|
111
110
|
*/
|
|
112
111
|
function resolveAsSeq(args) {
|
|
@@ -114,8 +113,8 @@ function resolveAsSeq(args) {
|
|
|
114
113
|
if (operator.type !== type_1.RType.BinaryOp) {
|
|
115
114
|
return r_value_2.Top;
|
|
116
115
|
}
|
|
117
|
-
const leftValue = (0, r_value_1.unliftRValue)(
|
|
118
|
-
const rightValue = (0, r_value_1.unliftRValue)(
|
|
116
|
+
const leftValue = (0, r_value_1.unliftRValue)(resolve_helper_1.Resolve.toValue(operator.lhs, args));
|
|
117
|
+
const rightValue = (0, r_value_1.unliftRValue)(resolve_helper_1.Resolve.toValue(operator.rhs, args));
|
|
119
118
|
if ((0, r_value_1.isRNumberValue)(leftValue) && (0, r_value_1.isRNumberValue)(rightValue)) {
|
|
120
119
|
return (0, vector_constants_1.vectorFrom)(createNumberSequence(leftValue, rightValue).map(scalar_constants_1.liftScalar));
|
|
121
120
|
}
|
|
@@ -6,11 +6,14 @@ import { type Lift, type Value, type ValueSet, Bottom, Top } from './r-value';
|
|
|
6
6
|
export declare function bottomTopGuard(...a: Lift<unknown>[]): typeof Top | typeof Bottom | undefined;
|
|
7
7
|
/**
|
|
8
8
|
* Returns a value set, if a is not bottom or top, otherwise undefined.
|
|
9
|
-
* Useful when working with values returned by {@link
|
|
9
|
+
* Useful when working with values returned by {@link Resolve.toValue}
|
|
10
10
|
* @param a - value set to check
|
|
11
11
|
* @returns value set if a is not top or bottom
|
|
12
12
|
*/
|
|
13
13
|
export declare function valueSetGuard(a: Lift<ValueSet<Value[]>>): ValueSet<Value[]> | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* @useInstead {@link NodeValue.sole}
|
|
16
|
+
*/
|
|
14
17
|
export declare function soleValue(this: void, set: ValueSet<Value[]> | undefined): Value | undefined;
|
|
15
18
|
export declare function soleValue<T extends Value['type']>(this: void, set: ValueSet<Value[]> | undefined, type: T): Extract<Value, {
|
|
16
19
|
type: T;
|
|
@@ -24,7 +24,7 @@ function bottomTopGuard(...a) {
|
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Returns a value set, if a is not bottom or top, otherwise undefined.
|
|
27
|
-
* Useful when working with values returned by {@link
|
|
27
|
+
* Useful when working with values returned by {@link Resolve.toValue}
|
|
28
28
|
* @param a - value set to check
|
|
29
29
|
* @returns value set if a is not top or bottom
|
|
30
30
|
*/
|
package/dataflow/extractor.js
CHANGED
|
@@ -29,6 +29,7 @@ const quoted_1 = require("./internal/process/functions/call/quoted");
|
|
|
29
29
|
const range_1 = require("../util/range");
|
|
30
30
|
const logger_1 = require("./logger");
|
|
31
31
|
const gas_1 = require("../gas");
|
|
32
|
+
const df_helper_1 = require("./graph/df-helper");
|
|
32
33
|
/**
|
|
33
34
|
* The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
|
|
34
35
|
* Maps every {@link RType} in the normalized AST to a processor.
|
|
@@ -156,7 +157,7 @@ function produceDataFlowGraph(parser, completeAst, ctx) {
|
|
|
156
157
|
(0, built_in_function_definition_1.updateNestedFunctionCalls)(df.graph, df.environment, ctx);
|
|
157
158
|
const escapedNames = new Set();
|
|
158
159
|
for (let round = 0; round < transitiveSideEffectRounds; round++) {
|
|
159
|
-
const { environment, grew, escapedNames: roundNames } =
|
|
160
|
+
const { environment, grew, escapedNames: roundNames } = df_helper_1.Dataflow.sideEffects.propagateTransitive(df.graph, df.environment, ctx);
|
|
160
161
|
df.environment = environment;
|
|
161
162
|
for (const n of roundNames) {
|
|
162
163
|
escapedNames.add(n);
|
|
@@ -9,7 +9,9 @@ export interface ExceptionPoint {
|
|
|
9
9
|
* Collect exception sources of a function in the call graph.
|
|
10
10
|
* This returns the `NodeId`s of functions that may throw exceptions when called by the given function.
|
|
11
11
|
* Please be aware, that these are restricted to functions known by flowR.
|
|
12
|
-
* With `knownThrower` you can provide additional functions that are known to throw exceptions
|
|
12
|
+
* With `knownThrower` you can provide additional functions that are known to throw exceptions; the result of
|
|
13
|
+
* an earlier call serves as one, as every definition it passes gets an answer counting its callees.
|
|
14
|
+
* A `try` and its relatives end the search.
|
|
13
15
|
* @returns A record mapping all `NodeId`s of functions that may throw exceptions to their exception points.
|
|
14
16
|
*/
|
|
15
17
|
export declare function calculateExceptionsOfFunction(id: NodeId, graph: CallGraph, knownThrower?: Record<NodeId, ExceptionPoint[]>): Record<NodeId, ExceptionPoint[]>;
|
|
@@ -2,64 +2,112 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateExceptionsOfFunction = calculateExceptionsOfFunction;
|
|
4
4
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
5
|
-
const vertex_1 = require("../graph/vertex");
|
|
6
5
|
const built_in_proc_name_1 = require("../environments/built-in-proc-name");
|
|
6
|
+
const vertex_1 = require("../graph/vertex");
|
|
7
|
+
const graph_1 = require("../graph/graph");
|
|
7
8
|
const CatchHandlers = new Set([built_in_proc_name_1.BuiltInProcName.Try]);
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const collectedExceptions = {};
|
|
17
|
-
const mine = [];
|
|
18
|
-
const visited = new Set();
|
|
9
|
+
/** Whether the vertex catches what is raised below it, which ends the walk. */
|
|
10
|
+
function catches(vertex) {
|
|
11
|
+
return vertex_1.FunctionCallVertex.is(vertex) && vertex.origin !== 'unnamed' && vertex.origin.some(c => CatchHandlers.has(c));
|
|
12
|
+
}
|
|
13
|
+
function reach(id, graph, knownThrower) {
|
|
14
|
+
const calls = new Map();
|
|
15
|
+
const own = new Map();
|
|
16
|
+
const defs = new Set();
|
|
19
17
|
const toVisit = [id];
|
|
20
18
|
while (toVisit.length > 0) {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
19
|
+
const current = toVisit.pop();
|
|
20
|
+
if (calls.has(current)) {
|
|
23
21
|
continue;
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!mine.includes(e)) {
|
|
30
|
-
mine.push(e);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
23
|
+
const known = knownThrower[current];
|
|
24
|
+
if (known !== undefined) {
|
|
25
|
+
own.set(current, known);
|
|
26
|
+
calls.set(current, []);
|
|
33
27
|
continue;
|
|
34
28
|
}
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
29
|
+
const vertex = graph.getVertex(current);
|
|
30
|
+
if (vertex === undefined || node_id_1.NodeId.isBuiltIn(current)) {
|
|
31
|
+
calls.set(current, []);
|
|
37
32
|
continue;
|
|
38
33
|
}
|
|
39
|
-
if (
|
|
34
|
+
if (vertex_1.FunctionDefinitionVertex.is(vertex)) {
|
|
35
|
+
defs.add(current);
|
|
36
|
+
own.set(current, vertex.exitPoints.filter(e => e.type === 4 /* ExitPointType.Error */).map(e => ({ id: e.nodeId, cds: e.cds })));
|
|
37
|
+
}
|
|
38
|
+
else if (catches(vertex)) {
|
|
39
|
+
calls.set(current, []);
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const next = [...(graph.outgoingEdges(current) ?? graph_1.NoEdges).keys()];
|
|
43
|
+
calls.set(current, next);
|
|
44
|
+
for (const n of next) {
|
|
45
|
+
if (!calls.has(n)) {
|
|
46
|
+
toVisit.push(n);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return { calls, own, defs };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Collect exception sources of a function in the call graph.
|
|
54
|
+
* This returns the `NodeId`s of functions that may throw exceptions when called by the given function.
|
|
55
|
+
* Please be aware, that these are restricted to functions known by flowR.
|
|
56
|
+
* With `knownThrower` you can provide additional functions that are known to throw exceptions; the result of
|
|
57
|
+
* an earlier call serves as one, as every definition it passes gets an answer counting its callees.
|
|
58
|
+
* A `try` and its relatives end the search.
|
|
59
|
+
* @returns A record mapping all `NodeId`s of functions that may throw exceptions to their exception points.
|
|
60
|
+
*/
|
|
61
|
+
function calculateExceptionsOfFunction(id, graph, knownThrower = {}) {
|
|
62
|
+
const { calls, own, defs } = reach(id, graph, knownThrower);
|
|
63
|
+
const raised = new Map();
|
|
64
|
+
for (const node of calls.keys()) {
|
|
65
|
+
raised.set(node, new Map((own.get(node) ?? []).map(e => [e.id, e])));
|
|
66
|
+
}
|
|
67
|
+
const callers = new Map();
|
|
68
|
+
for (const [node, next] of calls) {
|
|
69
|
+
for (const call of next) {
|
|
70
|
+
const known = callers.get(call);
|
|
71
|
+
if (known === undefined) {
|
|
72
|
+
callers.set(call, [node]);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
known.push(node);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const pending = [...calls.keys()];
|
|
80
|
+
const queued = new Set(pending);
|
|
81
|
+
while (pending.length > 0) {
|
|
82
|
+
const node = pending.pop();
|
|
83
|
+
queued.delete(node);
|
|
84
|
+
const into = raised.get(node);
|
|
85
|
+
let grew = false;
|
|
86
|
+
for (const call of calls.get(node) ?? []) {
|
|
87
|
+
for (const [at, point] of raised.get(call) ?? NoPoints) {
|
|
88
|
+
if (!into.has(at)) {
|
|
89
|
+
into.set(at, point);
|
|
90
|
+
grew = true;
|
|
47
91
|
}
|
|
48
92
|
}
|
|
49
|
-
collectedExceptions[vtx.id] = es;
|
|
50
93
|
}
|
|
51
|
-
|
|
52
|
-
// skip the try-catch handlers as they catch all exceptions within their body
|
|
94
|
+
if (!grew) {
|
|
53
95
|
continue;
|
|
54
96
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
97
|
+
for (const caller of callers.get(node) ?? []) {
|
|
98
|
+
if (!queued.has(caller)) {
|
|
99
|
+
queued.add(caller);
|
|
100
|
+
pending.push(caller);
|
|
59
101
|
}
|
|
60
102
|
}
|
|
61
103
|
}
|
|
62
|
-
|
|
63
|
-
|
|
104
|
+
const result = {};
|
|
105
|
+
for (const [node, points] of raised) {
|
|
106
|
+
if (defs.has(node) || node === id) {
|
|
107
|
+
result[node] = [...points.values()];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
64
111
|
}
|
|
112
|
+
const NoPoints = new Map();
|
|
65
113
|
//# sourceMappingURL=exceptions-of-function.js.map
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isFunctionHigherOrder = isFunctionHigherOrder;
|
|
4
4
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
5
|
-
const resolve_by_name_1 = require("../environments/resolve-by-name");
|
|
6
5
|
const identifier_1 = require("../environments/identifier");
|
|
7
6
|
const vertex_1 = require("../graph/vertex");
|
|
8
7
|
const assert_1 = require("../../util/assert");
|
|
@@ -10,6 +9,8 @@ const edge_1 = require("../graph/edge");
|
|
|
10
9
|
const node_value_1 = require("../eval/resolve/node-value");
|
|
11
10
|
const config_1 = require("../../config");
|
|
12
11
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
12
|
+
const resolve_helper_1 = require("../environments/resolve-helper");
|
|
13
|
+
const graph_1 = require("../graph/graph");
|
|
13
14
|
function isAnyReturnAFunction(def, graph) {
|
|
14
15
|
const workingQueue = def.exitPoints.map(d => graph.getVertex(d.nodeId)).filter(assert_1.isNotUndefined);
|
|
15
16
|
const seen = new Set();
|
|
@@ -22,7 +23,7 @@ function isAnyReturnAFunction(def, graph) {
|
|
|
22
23
|
if (vertex_1.FunctionDefinitionVertex.is(current)) {
|
|
23
24
|
return true;
|
|
24
25
|
}
|
|
25
|
-
const next = graph.outgoingEdges(current.id) ??
|
|
26
|
+
const next = graph.outgoingEdges(current.id) ?? graph_1.NoEdges;
|
|
26
27
|
for (const [t, e] of next) {
|
|
27
28
|
if (edge_1.DfEdge.includesType(e, edge_1.EdgeType.Returns)) {
|
|
28
29
|
const v = graph.getVertex(t);
|
|
@@ -39,11 +40,11 @@ function isAnyReturnAFunction(def, graph) {
|
|
|
39
40
|
* hence no `function-definition` value to resolve to.
|
|
40
41
|
*/
|
|
41
42
|
function readsBuiltInFunction(id, graph, ctx) {
|
|
42
|
-
for (const [target, edge] of graph.outgoingEdges(id) ??
|
|
43
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
|
|
43
44
|
if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) || !node_id_1.NodeId.isBuiltIn(target)) {
|
|
44
45
|
continue;
|
|
45
46
|
}
|
|
46
|
-
const defs =
|
|
47
|
+
const defs = resolve_helper_1.Resolve.byNameAndType(node_id_1.NodeId.fromBuiltIn(target), ctx.env.makeCleanEnv(), identifier_1.ReferenceType.Function);
|
|
47
48
|
if (defs?.some(d => (0, identifier_1.isReferenceType)(d.type, identifier_1.ReferenceType.BuiltInFunction))) {
|
|
48
49
|
return true;
|
|
49
50
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
+
import type { DataflowGraph } from '../graph/graph';
|
|
3
|
+
import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
4
|
+
import { Ternary } from '../../util/logic';
|
|
5
|
+
/**
|
|
6
|
+
* How a function treats its parameters: R hands arguments over as promises, so a parameter is strict when
|
|
7
|
+
* calling the function is enough to force it.
|
|
8
|
+
*/
|
|
9
|
+
export interface FunctionStrictness {
|
|
10
|
+
/** whether every parameter is forced */
|
|
11
|
+
readonly strict: Ternary;
|
|
12
|
+
/** the same per parameter, keyed by the id of the parameter's name */
|
|
13
|
+
readonly parameters: Record<NodeId, Ternary>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Determines whether the function with the given id is strict, i.e., whether calling it forces its arguments.
|
|
17
|
+
* {@link Ternary#Always} says every call forces every parameter, {@link Ternary#Never} that no call forces
|
|
18
|
+
* all of them, and {@link Ternary#Maybe} that it depends on the path taken, on the caller, or on a function
|
|
19
|
+
* flowR could not resolve. A definition without parameters has nothing to leave unforced and is strict.
|
|
20
|
+
*
|
|
21
|
+
* The analysis follows an argument that is handed on into the function receiving it, and treats a read in a
|
|
22
|
+
* default, in a loop, in a branch, or in a nested definition as one that may not happen. What a built-in
|
|
23
|
+
* does with an argument is not guessed from its name: an argument stated {@link ArgProp.Nse} or
|
|
24
|
+
* {@link ArgProp.Presence} is never evaluated, one stated {@link ArgProp.Forced} always is, and the calls
|
|
25
|
+
* reaching an argument only on the way the run takes are the ones flowR hands to the processor that says so
|
|
26
|
+
* (`switch` picking a branch, `try` reaching a handler, a hook running at exit).
|
|
27
|
+
* For a generic, the methods reached by S3 dispatch decide: they agree on a parameter or it is left open,
|
|
28
|
+
* while the object the dispatch is on is forced by the dispatch itself. A `NextMethod` carries the same
|
|
29
|
+
* question on to the methods it reaches, matched by the position the parameter is written in.
|
|
30
|
+
* An argument in `...` is followed to the parameter it binds to, whereas the method of an object flowR
|
|
31
|
+
* cannot resolve (`obj$m(x)`) is one more thing it cannot claim anything about.
|
|
32
|
+
* Cyclic dependencies between functions and calls flowR cannot resolve answer {@link Ternary#Maybe}, so this
|
|
33
|
+
* only claims certainty where the code gives it.
|
|
34
|
+
* What a built-in does with an argument comes from the {@link ArgProp} bits its signature states, so a
|
|
35
|
+
* configured or overwritten built-in is the one that answers when the analyzer context is handed along.
|
|
36
|
+
* @see {@link strictnessOfFunctions} - to ask about several definitions at once, sharing the work
|
|
37
|
+
*/
|
|
38
|
+
export declare function strictnessOfFunction(id: NodeId, graph: DataflowGraph, ctx?: ReadOnlyFlowrAnalyzerContext): FunctionStrictness;
|
|
39
|
+
/** The {@link strictnessOfFunction|strictness} of several definitions, sharing the work between them. */
|
|
40
|
+
export declare function strictnessOfFunctions(ids: Iterable<NodeId>, graph: DataflowGraph, ctx?: ReadOnlyFlowrAnalyzerContext): Record<NodeId, FunctionStrictness>;
|