@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
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.argForImpl = argForImpl;
|
|
8
|
-
exports.argFor = argFor;
|
|
9
8
|
exports.classDeclarationOfImpl = classDeclarationOfImpl;
|
|
10
9
|
exports.declaredClassesImpl = declaredClassesImpl;
|
|
11
|
-
exports.declaredClasses = declaredClasses;
|
|
12
10
|
exports.superClassesOfImpl = superClassesOfImpl;
|
|
13
11
|
exports.toSigClassesImpl = toSigClassesImpl;
|
|
14
|
-
exports.
|
|
12
|
+
exports.s3DispatchClassesOf = s3DispatchClassesOf;
|
|
13
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
15
14
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
16
15
|
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
17
16
|
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
@@ -21,6 +20,11 @@ const edge_1 = require("../graph/edge");
|
|
|
21
20
|
const assert_1 = require("../../util/assert");
|
|
22
21
|
const objects_1 = require("../../util/objects");
|
|
23
22
|
const vertex_1 = require("../graph/vertex");
|
|
23
|
+
const built_in_proc_name_1 = require("../environments/built-in-proc-name");
|
|
24
|
+
const node_value_1 = require("../eval/resolve/node-value");
|
|
25
|
+
const string_constants_1 = require("../eval/values/string/string-constants");
|
|
26
|
+
const r_value_1 = require("../eval/values/r-value");
|
|
27
|
+
const frame_reflection_1 = require("./frame-reflection");
|
|
24
28
|
/** the class name R uses to mark a class as non-instantiable */
|
|
25
29
|
const VirtualClass = 'VIRTUAL';
|
|
26
30
|
/** The argument `ref` names, by name when the call gives one and by position among the unnamed ones otherwise. */
|
|
@@ -28,46 +32,24 @@ function argForImpl(args, ref) {
|
|
|
28
32
|
if (ref === undefined) {
|
|
29
33
|
return undefined;
|
|
30
34
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return named.value;
|
|
35
|
-
}
|
|
35
|
+
const named = ref.name === undefined ? undefined : args.find(a => !r_argument_1.RArgument.isEmpty(a) && a.name?.content === ref.name);
|
|
36
|
+
if (named !== undefined) {
|
|
37
|
+
return r_argument_1.RArgument.valueOf(named);
|
|
36
38
|
}
|
|
37
39
|
if (ref.idx === undefined) {
|
|
38
40
|
return undefined;
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (r_argument_1.RArgument.isEmpty(a) || a.name !== undefined) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (pos++ === ref.idx) {
|
|
46
|
-
return a.value;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* The argument `ref` names, by name when the call gives one and by position among the unnamed ones otherwise.
|
|
53
|
-
* Exported so `built-in-s-four.ts` can drop its own copy of this instead of hand-rolling it again; that file
|
|
54
|
-
* already imports {@link ClassArgRef} from here, so the reverse import would cycle.
|
|
55
|
-
* @deprecated use {@link argForImpl} instead
|
|
56
|
-
*/
|
|
57
|
-
function argFor(args, ref) {
|
|
58
|
-
return argForImpl(args, ref);
|
|
42
|
+
const unnamed = args.filter(a => !r_argument_1.RArgument.isEmpty(a) && a.name === undefined);
|
|
43
|
+
return r_argument_1.RArgument.valueOf(unnamed[ref.idx]);
|
|
59
44
|
}
|
|
60
45
|
/** The string a node states literally, `undefined` for anything that is not a literal (a variable, a call, ...). */
|
|
61
46
|
function literal(node) {
|
|
62
|
-
return
|
|
47
|
+
return r_string_1.RString.is(node) ? node.content.str : undefined;
|
|
63
48
|
}
|
|
64
49
|
/** The character vector a node states: a literal, or the literals of a `c(...)`/`list(...)` around them. */
|
|
65
50
|
function literalVector(node) {
|
|
66
51
|
const values = [];
|
|
67
52
|
const byVariable = [];
|
|
68
|
-
if (node === undefined) {
|
|
69
|
-
return { values, byVariable };
|
|
70
|
-
}
|
|
71
53
|
const collect = (n) => {
|
|
72
54
|
const str = literal(n);
|
|
73
55
|
if (str !== undefined) {
|
|
@@ -78,11 +60,7 @@ function literalVector(node) {
|
|
|
78
60
|
byVariable.push(n.lexeme);
|
|
79
61
|
}
|
|
80
62
|
else if (r_function_call_1.RFunctionCall.isNamed(n)) {
|
|
81
|
-
|
|
82
|
-
if (!r_argument_1.RArgument.isEmpty(arg) && arg.value !== undefined) {
|
|
83
|
-
collect(arg.value);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
63
|
+
n.arguments.forEach(a => collect(r_argument_1.RArgument.valueOf(a)));
|
|
86
64
|
}
|
|
87
65
|
};
|
|
88
66
|
collect(node);
|
|
@@ -93,14 +71,11 @@ function literalVector(node) {
|
|
|
93
71
|
* element, plus the bare strings such a call may carry (an RC `fields = c("x", "y")`, or a `"VIRTUAL"` marker).
|
|
94
72
|
*/
|
|
95
73
|
function membersOf(node, ref) {
|
|
96
|
-
const members = [];
|
|
97
|
-
let virtual = false;
|
|
98
|
-
if (node === undefined) {
|
|
99
|
-
return { members, virtual };
|
|
100
|
-
}
|
|
101
74
|
if (!r_function_call_1.RFunctionCall.isNamed(node)) {
|
|
102
|
-
return { members, virtual: literal(node) === VirtualClass };
|
|
75
|
+
return { members: [], virtual: literal(node) === VirtualClass };
|
|
103
76
|
}
|
|
77
|
+
const members = [];
|
|
78
|
+
let virtual = false;
|
|
104
79
|
for (const arg of node.arguments) {
|
|
105
80
|
if (r_argument_1.RArgument.isEmpty(arg) || arg.value === undefined) {
|
|
106
81
|
continue;
|
|
@@ -133,15 +108,10 @@ function isTrue(node) {
|
|
|
133
108
|
* An argument that resolves to no literal contributes a {@link ClassDeclaration.byVariable|by-variable} name, or nothing.
|
|
134
109
|
*/
|
|
135
110
|
function classDeclarationOfImpl(config, args) {
|
|
136
|
-
const byVariable = [];
|
|
137
111
|
const nameNode = argForImpl(args, config.nameArg);
|
|
138
112
|
const name = literal(nameNode);
|
|
139
|
-
if (name === undefined && nameNode !== undefined && r_symbol_1.RSymbol.is(nameNode)) {
|
|
140
|
-
byVariable.push(nameNode.lexeme);
|
|
141
|
-
}
|
|
142
113
|
const parents = literalVector(argForImpl(args, config.containsArg));
|
|
143
|
-
byVariable.
|
|
144
|
-
const contains = parents.values.filter(c => c !== VirtualClass);
|
|
114
|
+
const byVariable = name === undefined && r_symbol_1.RSymbol.is(nameNode) ? [nameNode.lexeme, ...parents.byVariable] : parents.byVariable;
|
|
145
115
|
let virtual = parents.values.includes(VirtualClass) || isTrue(argForImpl(args, config.virtualArg));
|
|
146
116
|
const members = [];
|
|
147
117
|
for (const ref of config.memberArgs ?? []) {
|
|
@@ -149,15 +119,14 @@ function classDeclarationOfImpl(config, args) {
|
|
|
149
119
|
members.push(...found.members);
|
|
150
120
|
virtual ||= found.virtual;
|
|
151
121
|
}
|
|
152
|
-
const union =
|
|
153
|
-
const prototype = config.prototypeArg
|
|
154
|
-
: membersOf(argForImpl(args, config.prototypeArg), config.prototypeArg).members.map(m => m.name);
|
|
122
|
+
const union = literalVector(argForImpl(args, config.unionArg)).values;
|
|
123
|
+
const prototype = membersOf(argForImpl(args, config.prototypeArg), config.prototypeArg ?? {}).members.map(m => m.name);
|
|
155
124
|
/* a class union is virtual by construction: it exists to be extended, never to be instantiated */
|
|
156
|
-
const isUnion = union
|
|
125
|
+
const isUnion = union.length > 0;
|
|
157
126
|
return (0, objects_1.compactRecord)({
|
|
158
127
|
system: config.system,
|
|
159
128
|
name,
|
|
160
|
-
contains,
|
|
129
|
+
contains: parents.values.filter(c => c !== VirtualClass),
|
|
161
130
|
members,
|
|
162
131
|
virtual: virtual || isUnion ? true : undefined,
|
|
163
132
|
union: isUnion ? union : undefined,
|
|
@@ -169,65 +138,54 @@ function classDeclarationOfImpl(config, args) {
|
|
|
169
138
|
/** Every class the graph declares, keyed by name. A later declaration of the same name wins, as it would in R. */
|
|
170
139
|
function declaredClassesImpl(graph) {
|
|
171
140
|
const classes = new Map();
|
|
172
|
-
for (const [id,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
continue;
|
|
141
|
+
for (const [id, { classDecl }] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
142
|
+
if (classDecl?.name !== undefined && classDecl.relation === undefined) {
|
|
143
|
+
classes.set(classDecl.name, { ...classDecl, id, name: classDecl.name });
|
|
176
144
|
}
|
|
177
|
-
classes.set(decl.name, { ...decl, id, name: decl.name });
|
|
178
145
|
}
|
|
146
|
+
const addSuper = (sub, sup) => {
|
|
147
|
+
const existing = classes.get(sub);
|
|
148
|
+
if (existing !== undefined && sup !== undefined && !existing.contains.includes(sup)) {
|
|
149
|
+
classes.set(sub, { ...existing, contains: [...existing.contains, sup] });
|
|
150
|
+
}
|
|
151
|
+
};
|
|
179
152
|
/* R6 and S7 name their parent by the generator *variable*, so `Employee <- R6Class(inherit = Person)`
|
|
180
153
|
only says "Person"; the assignment that bound the generator says which class that is */
|
|
181
154
|
const byGenerator = generatorVariables(graph, classes);
|
|
182
155
|
for (const [name, declared] of classes) {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
156
|
+
for (const sup of declared.byVariable.map(v => byGenerator.get(v))) {
|
|
157
|
+
if (sup !== name) {
|
|
158
|
+
addSuper(name, sup);
|
|
159
|
+
}
|
|
187
160
|
}
|
|
188
161
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const decl = vertex.classDecl;
|
|
192
|
-
if (decl?.name === undefined) {
|
|
162
|
+
for (const [, { classDecl }] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
163
|
+
if (classDecl?.name === undefined) {
|
|
193
164
|
continue;
|
|
194
165
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
classes.set(member, { ...existing, contains: [...existing.contains, decl.name] });
|
|
199
|
-
}
|
|
166
|
+
/* a `setClassUnion` states its members as subclasses, which is the same fact written the other way round */
|
|
167
|
+
for (const member of classDecl.union ?? []) {
|
|
168
|
+
addSuper(member, classDecl.name);
|
|
200
169
|
}
|
|
201
170
|
/* `setIs(class1, class2)` states the same is-a relation `contains` does */
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
const existing = classes.get(sub);
|
|
205
|
-
if (existing !== undefined && sup !== undefined && !existing.contains.includes(sup)) {
|
|
206
|
-
classes.set(sub, { ...existing, contains: [...existing.contains, sup] });
|
|
207
|
-
}
|
|
171
|
+
if (classDecl.relation === 'is') {
|
|
172
|
+
addSuper(classDecl.name, classDecl.contains[0]);
|
|
208
173
|
}
|
|
209
174
|
}
|
|
210
175
|
return classes;
|
|
211
176
|
}
|
|
212
|
-
/** @deprecated use {@link declaredClassesImpl} instead */
|
|
213
|
-
function declaredClasses(graph) {
|
|
214
|
-
return declaredClassesImpl(graph);
|
|
215
|
-
}
|
|
216
177
|
/** Variable name to the class its generator declares, for the `Cls <- R6Class(...)`/`Cls <- new_class(...)` bindings. */
|
|
217
178
|
function generatorVariables(graph, classes) {
|
|
218
|
-
const
|
|
219
|
-
for (const declared of classes.values()) {
|
|
220
|
-
byName.set(declared.id, declared.name);
|
|
221
|
-
}
|
|
179
|
+
const classOfId = new Map(classes.values().map(d => [d.id, d.name]));
|
|
222
180
|
const generators = new Map();
|
|
223
181
|
for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
|
|
224
182
|
const lexeme = graph.idMap?.get(id)?.lexeme;
|
|
225
183
|
if (lexeme === undefined) {
|
|
226
184
|
continue;
|
|
227
185
|
}
|
|
228
|
-
for (const
|
|
229
|
-
const cls =
|
|
230
|
-
if (cls !== undefined
|
|
186
|
+
for (const target of (0, frame_reflection_1.edgeTargets)(graph, id, edge_1.EdgeType.DefinedBy)) {
|
|
187
|
+
const cls = classOfId.get(target);
|
|
188
|
+
if (cls !== undefined) {
|
|
231
189
|
generators.set(lexeme, cls);
|
|
232
190
|
}
|
|
233
191
|
}
|
|
@@ -239,54 +197,75 @@ function generatorVariables(graph, classes) {
|
|
|
239
197
|
* analysis never saw declared ends the chain, so what another package contributes is simply not in the answer.
|
|
240
198
|
*/
|
|
241
199
|
function superClassesOfImpl(name, classes) {
|
|
242
|
-
const chain = [];
|
|
243
200
|
const seen = new Set([name]);
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
continue;
|
|
201
|
+
/* a set iteration also visits what is added during it, so this walks the hierarchy breadth first */
|
|
202
|
+
for (const next of seen) {
|
|
203
|
+
for (const sup of classes.get(next)?.contains ?? []) {
|
|
204
|
+
seen.add(sup);
|
|
249
205
|
}
|
|
250
|
-
seen.add(next);
|
|
251
|
-
chain.push(next);
|
|
252
|
-
queue.push(...(classes.get(next)?.contains ?? []));
|
|
253
206
|
}
|
|
254
|
-
|
|
207
|
+
seen.delete(name);
|
|
208
|
+
return [...seen];
|
|
255
209
|
}
|
|
256
210
|
/**
|
|
257
211
|
* The {@link SigClassInfo} records the signature database stores for the classes an analysis found. A class
|
|
258
212
|
* the analysis declared carries no `package`; a referenced class `ownerOf` can place becomes a `foreign` record.
|
|
259
213
|
*/
|
|
260
214
|
function toSigClassesImpl(classes, ownerOf) {
|
|
261
|
-
const records =
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
union: declared.union !== undefined ? true : undefined
|
|
270
|
-
}));
|
|
271
|
-
}
|
|
215
|
+
const records = classes.values().map(declared => (0, objects_1.compactRecord)({
|
|
216
|
+
name: declared.name,
|
|
217
|
+
system: declared.system,
|
|
218
|
+
supers: declared.union ?? declared.contains,
|
|
219
|
+
slots: declared.members.filter(m => !m.method).map(m => (0, objects_1.compactRecord)({ name: m.name, type: m.type })),
|
|
220
|
+
virtual: declared.virtual ? true : undefined,
|
|
221
|
+
union: declared.union !== undefined ? true : undefined
|
|
222
|
+
})).toArray();
|
|
272
223
|
if (ownerOf === undefined) {
|
|
273
224
|
return records;
|
|
274
225
|
}
|
|
275
226
|
/* a superclass the analysis never declared belongs to whoever does define it, which is what makes an
|
|
276
227
|
inherited class distinguishable from one the package owns */
|
|
277
228
|
for (const referenced of new Set(records.flatMap(r => r.supers))) {
|
|
278
|
-
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
const owner = ownerOf(referenced);
|
|
229
|
+
const owner = classes.has(referenced) ? undefined : ownerOf(referenced);
|
|
282
230
|
if (owner !== undefined) {
|
|
283
231
|
records.push({ name: referenced, system: 's4', supers: [], slots: [], package: owner });
|
|
284
232
|
}
|
|
285
233
|
}
|
|
286
234
|
return records;
|
|
287
235
|
}
|
|
288
|
-
/**
|
|
289
|
-
function
|
|
290
|
-
|
|
236
|
+
/** The class vector S3 dispatch sees for the value at `id`: a `structure(..., class = )` or a constant, `undefined` if not statically known. */
|
|
237
|
+
function s3ClassOfValue(id, info) {
|
|
238
|
+
const node = info.idMap.get(id);
|
|
239
|
+
if (r_function_call_1.RFunctionCall.is(node) && (0, frame_reflection_1.hasEdgeOfType)(info.graph, id, node_id_1.NodeId.toBuiltIn('structure'), edge_1.EdgeType.Calls)) {
|
|
240
|
+
const cls = node_value_1.NodeValue.soleOf(argForImpl(node.arguments, { name: 'class' }), info);
|
|
241
|
+
const strings = cls?.type === 'string' ? (0, string_constants_1.collectStrings)([cls]) : cls?.type === 'vector' && (0, r_value_1.isValue)(cls.elements) ? (0, string_constants_1.collectStrings)(cls.elements) : undefined;
|
|
242
|
+
return strings?.length ? strings : undefined;
|
|
243
|
+
}
|
|
244
|
+
const value = node_value_1.NodeValue.soleOf(id, info);
|
|
245
|
+
if (value?.type === 'string') {
|
|
246
|
+
return ['character'];
|
|
247
|
+
}
|
|
248
|
+
else if (value?.type === 'logical') {
|
|
249
|
+
return ['logical'];
|
|
250
|
+
}
|
|
251
|
+
else if (value?.type === 'number' && (0, r_value_1.isValue)(value.value)) {
|
|
252
|
+
return value.value.complexNumber ? ['complex'] : value.value.markedAsInt ? ['integer', 'numeric'] : ['double', 'numeric'];
|
|
253
|
+
}
|
|
254
|
+
return undefined;
|
|
255
|
+
}
|
|
256
|
+
/** The value a plain assignment binds to the definition `def`, `undefined` for any other kind of definition (`class(x) <- `, `assign`, a parameter, ...). */
|
|
257
|
+
function assignedValueOf(def, graph) {
|
|
258
|
+
const vertex = graph.getVertex(def);
|
|
259
|
+
const byAssignment = (0, frame_reflection_1.edgeTargets)(graph, def, edge_1.EdgeType.DefinedBy).some(t => vertex_1.DfgVertex.hasOrigin(graph.getVertex(t), built_in_proc_name_1.BuiltInProcName.Assignment));
|
|
260
|
+
return vertex_1.DfgVertex.isVariableDefinition(vertex) && byAssignment && vertex.source?.length === 1 ? vertex.source[0] : undefined;
|
|
261
|
+
}
|
|
262
|
+
/** The class vectors S3 dispatch may see for the argument at `id`, one per reaching definition, `undefined` unless all are known. */
|
|
263
|
+
function s3DispatchClassesOf(id, info) {
|
|
264
|
+
const { graph } = info;
|
|
265
|
+
const value = r_argument_1.RArgument.valueOf(info.idMap.get(id))?.info.id;
|
|
266
|
+
const isRead = value !== undefined && vertex_1.DfgVertex.isUse(graph.getVertex(value));
|
|
267
|
+
const values = isRead ? (0, frame_reflection_1.edgeTargets)(graph, value, edge_1.EdgeType.Reads).map(def => assignedValueOf(def, graph)) : [value];
|
|
268
|
+
const classes = values.map(v => v === undefined ? undefined : s3ClassOfValue(v, info));
|
|
269
|
+
return classes.length > 0 && classes.every(assert_1.isNotUndefined) ? classes : undefined;
|
|
291
270
|
}
|
|
292
271
|
//# sourceMappingURL=class-declaration.js.map
|
|
@@ -11,15 +11,14 @@ const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes
|
|
|
11
11
|
const built_in_props_1 = require("../environments/built-in-props");
|
|
12
12
|
const query_fn_props_1 = require("../environments/query-fn-props");
|
|
13
13
|
const condition_handlers_1 = require("./condition-handlers");
|
|
14
|
-
const
|
|
15
|
-
const CatchHandlers = new Set([built_in_proc_name_1.BuiltInProcName.Try]);
|
|
14
|
+
const defaultmap_1 = require("../../util/collections/defaultmap");
|
|
16
15
|
/**
|
|
17
16
|
* Whether the vertex catches an error raised below it, which ends the walk. A construct declaring no condition
|
|
18
17
|
* handler of its own (`try`) catches whatever arrives; one that matches handlers by condition class
|
|
19
18
|
* (`tryCatch`) catches only what the names written for it say.
|
|
20
19
|
*/
|
|
21
20
|
function catches(vertex, graph, info) {
|
|
22
|
-
if (!vertex_1.DfgVertex.isFunctionCall(vertex) ||
|
|
21
|
+
if (!vertex_1.DfgVertex.isFunctionCall(vertex) || !vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Try)) {
|
|
23
22
|
return false;
|
|
24
23
|
}
|
|
25
24
|
const sig = info(vertex.name)?.sig;
|
|
@@ -37,8 +36,8 @@ function catches(vertex, graph, info) {
|
|
|
37
36
|
*/
|
|
38
37
|
function guarded(id, graph, info) {
|
|
39
38
|
const idMap = graph.idMap;
|
|
40
|
-
let node = idMap
|
|
41
|
-
while (node !== undefined && !r_function_definition_1.RFunctionDefinition.is(node)) {
|
|
39
|
+
let node = idMap?.get(id);
|
|
40
|
+
while (idMap !== undefined && node !== undefined && !r_function_definition_1.RFunctionDefinition.is(node)) {
|
|
42
41
|
const parent = model_1.RNode.directParent(node, idMap);
|
|
43
42
|
if (r_argument_1.RArgument.isUnnamed(node) && r_function_call_1.RFunctionCall.is(parent) && catches(graph.getVertex(parent.info.id), graph, info)) {
|
|
44
43
|
return true;
|
|
@@ -49,7 +48,7 @@ function guarded(id, graph, info) {
|
|
|
49
48
|
}
|
|
50
49
|
function reach(id, graph, knownThrower) {
|
|
51
50
|
const info = (0, query_fn_props_1.builtInLookup)();
|
|
52
|
-
const isGuarded =
|
|
51
|
+
const isGuarded = (0, defaultmap_1.memoize)((n) => guarded(n, graph, info));
|
|
53
52
|
const calls = new Map();
|
|
54
53
|
const own = new Map();
|
|
55
54
|
const defs = new Set();
|
|
@@ -75,22 +74,72 @@ function reach(id, graph, knownThrower) {
|
|
|
75
74
|
own.set(current, vertex.exitPoints.filter(e => e.type === 4 /* ExitPointType.Error */).map(e => ({ id: e.nodeId, cds: e.cds })));
|
|
76
75
|
}
|
|
77
76
|
/* a guarded call is only ever reached through the construct guarding it, which ends the walk of its own */
|
|
78
|
-
const next = [...
|
|
79
|
-
let known = isGuarded.get(n);
|
|
80
|
-
if (known === undefined) {
|
|
81
|
-
known = guarded(n, graph, info);
|
|
82
|
-
isGuarded.set(n, known);
|
|
83
|
-
}
|
|
84
|
-
return !known;
|
|
85
|
-
});
|
|
77
|
+
const next = [...graph.edgesFrom(current).keys()].filter(n => !isGuarded(n));
|
|
86
78
|
calls.set(current, next);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
toVisit.push(...next);
|
|
80
|
+
}
|
|
81
|
+
return { calls, own, defs };
|
|
82
|
+
}
|
|
83
|
+
/** What each node may raise, its callees included; Tarjan yields the call cycles callees first, so each is settled once. */
|
|
84
|
+
function raisedPerNode(calls, own) {
|
|
85
|
+
const raised = new Map();
|
|
86
|
+
const index = new Map();
|
|
87
|
+
const low = new Map();
|
|
88
|
+
const stack = [];
|
|
89
|
+
const onStack = new Set();
|
|
90
|
+
const lower = (node, to) => low.set(node, Math.min(low.get(node), to));
|
|
91
|
+
for (const root of calls.keys()) {
|
|
92
|
+
if (index.has(root)) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
/* each frame is a node and how many of its callees have been looked at */
|
|
96
|
+
const frames = [[root, 0]];
|
|
97
|
+
while (frames.length > 0) {
|
|
98
|
+
const frame = frames[frames.length - 1];
|
|
99
|
+
const [node, at] = frame;
|
|
100
|
+
if (at === 0) {
|
|
101
|
+
low.set(node, index.size);
|
|
102
|
+
index.set(node, index.size);
|
|
103
|
+
stack.push(node);
|
|
104
|
+
onStack.add(node);
|
|
105
|
+
}
|
|
106
|
+
const callee = calls.get(node)?.[at];
|
|
107
|
+
if (callee !== undefined) {
|
|
108
|
+
frame[1]++;
|
|
109
|
+
if (!index.has(callee)) {
|
|
110
|
+
frames.push([callee, 0]);
|
|
111
|
+
}
|
|
112
|
+
else if (onStack.has(callee)) {
|
|
113
|
+
lower(node, index.get(callee));
|
|
114
|
+
}
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
frames.pop();
|
|
118
|
+
if (frames.length > 0) {
|
|
119
|
+
lower(frames[frames.length - 1][0], low.get(node));
|
|
120
|
+
}
|
|
121
|
+
if (low.get(node) === index.get(node)) {
|
|
122
|
+
/* the node roots a component: its members are what lies on the stack above it, taken off top first */
|
|
123
|
+
const members = stack.splice(stack.lastIndexOf(node)).reverse();
|
|
124
|
+
const points = new Map();
|
|
125
|
+
for (const m of members) {
|
|
126
|
+
for (const e of own.get(m) ?? []) {
|
|
127
|
+
points.set(e.id, e);
|
|
128
|
+
}
|
|
129
|
+
for (const callee of calls.get(m) ?? []) {
|
|
130
|
+
for (const [at, point] of raised.get(callee) ?? []) {
|
|
131
|
+
points.set(at, point);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (const m of members) {
|
|
136
|
+
onStack.delete(m);
|
|
137
|
+
raised.set(m, points);
|
|
138
|
+
}
|
|
90
139
|
}
|
|
91
140
|
}
|
|
92
141
|
}
|
|
93
|
-
return
|
|
142
|
+
return raised;
|
|
94
143
|
}
|
|
95
144
|
/**
|
|
96
145
|
* The `NodeId`s of functions that may throw exceptions when called by `id`, restricted to functions known by
|
|
@@ -99,30 +148,12 @@ function reach(id, graph, knownThrower) {
|
|
|
99
148
|
*/
|
|
100
149
|
function exceptionsOfFunction(id, graph, { knownThrower = {} } = {}) {
|
|
101
150
|
const { calls, own, defs } = reach(id, graph, knownThrower);
|
|
102
|
-
const raised = new Map();
|
|
103
|
-
for (const node of calls.keys()) {
|
|
104
|
-
raised.set(node, new Map((own.get(node) ?? []).map(e => [e.id, e])));
|
|
105
|
-
}
|
|
106
|
-
(0, function_props_1.propagateToFixpoint)(calls.keys(), calls, node => {
|
|
107
|
-
const into = raised.get(node);
|
|
108
|
-
let grew = false;
|
|
109
|
-
for (const call of calls.get(node) ?? []) {
|
|
110
|
-
for (const [at, point] of raised.get(call) ?? NoPoints) {
|
|
111
|
-
if (!into.has(at)) {
|
|
112
|
-
into.set(at, point);
|
|
113
|
-
grew = true;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return grew;
|
|
118
|
-
});
|
|
119
151
|
const result = {};
|
|
120
|
-
for (const [node, points] of
|
|
152
|
+
for (const [node, points] of raisedPerNode(calls, own)) {
|
|
121
153
|
if (defs.has(node) || node === id) {
|
|
122
154
|
result[node] = [...points.values()];
|
|
123
155
|
}
|
|
124
156
|
}
|
|
125
157
|
return result;
|
|
126
158
|
}
|
|
127
|
-
const NoPoints = new Map();
|
|
128
159
|
//# sourceMappingURL=exceptions-of-function.js.map
|
|
@@ -3,19 +3,27 @@ import { EdgeType } from '../graph/edge';
|
|
|
3
3
|
import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexFunctionDefinition } from '../graph/vertex';
|
|
4
4
|
import type { ArgProps, BuiltInFnInfo } from '../environments/built-in-props';
|
|
5
5
|
import type { Identifier } from '../environments/identifier';
|
|
6
|
-
import type
|
|
6
|
+
import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
|
+
import { DefaultMap } from '../../util/collections/defaultmap';
|
|
7
8
|
/** What flowR states about the built-in a call names, see {@link BuiltInFnInfo}. */
|
|
8
9
|
export type BuiltInLookup = (name: Identifier) => BuiltInFnInfo | undefined;
|
|
9
10
|
/** The nodes at the far end of `node`'s outgoing edges of any of `types`, shared by every walk here and in the sibling analyses that follow specific edge kinds. */
|
|
10
11
|
export declare function edgeTargets(this: void, graph: DataflowGraph, node: NodeId, types: EdgeType): NodeId[];
|
|
12
|
+
/** The function-definition vertices a `call` resolves to (via {@link EdgeType.Calls}). */
|
|
13
|
+
export declare function calledDefinitions(this: void, graph: DataflowGraph, call: NodeId): NodeId[];
|
|
14
|
+
/** The nodes at the near end of `node`'s incoming edges of any of `types`, see {@link edgeTargets}. */
|
|
15
|
+
export declare function edgeSources(this: void, graph: DataflowGraph, node: NodeId, types: EdgeType): NodeId[];
|
|
16
|
+
/** Every variable definition by its unquoted name, in a single pass. */
|
|
17
|
+
export declare function definitionsByName(this: void, graph: DataflowGraph): DefaultMap<string, NodeId[]>;
|
|
18
|
+
/** Whether an edge from `from` to `to` carries any of `types`. */
|
|
19
|
+
export declare function hasEdgeOfType(this: void, graph: DataflowGraph, from: NodeId, to: NodeId, types: EdgeType): boolean;
|
|
11
20
|
/** The calls a definition's body reaches, id and vertex paired; shared by every walk here and in the sibling analyses that visit them all. */
|
|
12
21
|
export declare function callsIn(definition: DataflowGraphVertexFunctionDefinition, graph: DataflowGraph): Generator<[NodeId, DataflowGraphVertexFunctionCall]>;
|
|
13
22
|
/**
|
|
14
23
|
* Recomputes `recompute(id)` for every node reachable from `seed` along the reverse of `successors`, so a
|
|
15
24
|
* change at a node is carried on to whatever points at it, until nothing grows anymore. `recompute` updates
|
|
16
|
-
* its node's value itself and reports whether it grew; shared by {@link propagateOverCalls} and
|
|
17
|
-
* {@link
|
|
18
|
-
* by {@link carriersOf} below, which grows a set rather than a bitfield.
|
|
25
|
+
* its node's value itself and reports whether it grew; shared by {@link propagateOverCalls} and by
|
|
26
|
+
* {@link carriersOf} below, which grows a set rather than a bitfield.
|
|
19
27
|
*/
|
|
20
28
|
export declare function propagateToFixpoint(seed: Iterable<NodeId>, successors: ReadonlyMap<NodeId, readonly NodeId[]>, recompute: (id: NodeId) => boolean): void;
|
|
21
29
|
/** What to ask for beyond the definition itself, see {@link reflectiveRolesOf}. */
|