@eagleoutice/flowr 2.13.14 → 2.13.15
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 +23 -23
- package/abstract-interpretation/data-frame/resolve-args.js +11 -12
- package/benchmark/summarizer/second-phase/graph.d.ts +23 -0
- package/benchmark/summarizer/second-phase/graph.js +47 -14
- package/cli/repl/commands/repl-cfg.js +2 -42
- package/cli/repl/commands/repl-clipboard.d.ts +7 -0
- package/cli/repl/commands/repl-clipboard.js +53 -0
- package/cli/repl/commands/repl-dataflow.js +5 -70
- package/cli/repl/commands/repl-normalize.js +3 -51
- package/control-flow/cfg-dead-code.js +5 -29
- package/control-flow/diff-cfg.js +2 -56
- package/control-flow/semantic-cfg-guided-visitor.d.ts +7 -0
- package/control-flow/semantic-cfg-guided-visitor.js +14 -0
- package/control-flow/useless-loop.js +4 -26
- package/core/steps/all/core/10-normalize.d.ts +8 -0
- package/core/steps/all/core/10-normalize.js +10 -8
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +5 -7
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -9
- package/data/r-base-packages.generated.d.ts +1 -0
- package/data/r-base-packages.generated.js +5 -3
- package/dataflow/environments/built-in-config.d.ts +9 -1
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in-props.d.ts +4 -0
- package/dataflow/environments/built-in-props.js +3 -3
- package/dataflow/environments/built-in.d.ts +4 -2
- package/dataflow/environments/built-in.js +53 -3
- package/dataflow/environments/data-masking-functions.d.ts +3 -4
- package/dataflow/environments/data-masking-functions.js +7 -8
- package/dataflow/environments/default-builtin-config.d.ts +92 -12
- package/dataflow/environments/default-builtin-config.js +86 -43
- package/dataflow/environments/environment.d.ts +5 -0
- package/dataflow/environments/environment.js +17 -12
- package/dataflow/environments/identifier.d.ts +3 -0
- package/dataflow/eval/resolve/alias-tracking.js +4 -7
- package/dataflow/eval/resolve/node-value.d.ts +51 -0
- package/dataflow/eval/resolve/node-value.js +71 -0
- package/dataflow/eval/resolve/resolve-argument.js +10 -7
- package/dataflow/eval/resolve/resolve-operators.js +1 -2
- package/dataflow/eval/values/general.d.ts +4 -0
- package/dataflow/eval/values/general.js +11 -0
- package/dataflow/eval/values/r-value.d.ts +15 -0
- package/dataflow/eval/values/r-value.js +27 -1
- package/dataflow/extractor.js +2 -0
- package/dataflow/fn/higher-order-function.js +2 -3
- package/dataflow/graph/diff-dataflow-graph.js +3 -55
- package/dataflow/graph/graph.d.ts +5 -0
- package/dataflow/graph/graph.js +27 -0
- package/dataflow/internal/linker.d.ts +23 -0
- package/dataflow/internal/linker.js +70 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +39 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +10 -22
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +29 -53
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +19 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +3 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +69 -52
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +2 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +5 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +23 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +7 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +20 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +105 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +1 -27
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +1 -1
- package/dataflow/internal/process/functions/call/deferred.d.ts +41 -0
- package/dataflow/internal/process/functions/call/deferred.js +127 -0
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -12
- package/dataflow/internal/process/functions/call/known-call-handling.js +35 -35
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +8 -4
- package/dataflow/internal/process/functions/call/nse.d.ts +28 -0
- package/dataflow/internal/process/functions/call/nse.js +87 -0
- package/dataflow/internal/process/functions/call/quoted.d.ts +29 -0
- package/dataflow/internal/process/functions/call/quoted.js +188 -0
- package/documentation/doc-util/doc-types.js +15 -9
- package/linter/rules/deprecated-functions.js +9 -3
- package/linter/rules/seeded-randomness.js +2 -3
- package/linter/rules/undefined-symbol.js +10 -1
- package/package.json +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +6 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +17 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +2 -11
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +3 -15
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +16 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +26 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -11
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +3 -15
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +4 -10
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -9
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +2 -9
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +1 -1
- package/project/sigdb/reader.d.ts +9 -0
- package/project/sigdb/reader.js +30 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -12
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -37
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -23
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
- package/queries/query-function-filter.d.ts +21 -0
- package/queries/query-function-filter.js +48 -0
- package/r-bridge/data/data.d.ts +13 -3
- package/r-bridge/data/data.js +15 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +4 -0
- package/search/flowr-search-filters.d.ts +5 -1
- package/search/flowr-search-filters.js +31 -21
- package/search/search-executor/search-enrichers.d.ts +24 -4
- package/search/search-executor/search-enrichers.js +22 -9
- package/search/search-executor/search-transformer.js +1 -1
- package/util/diff-graph.d.ts +13 -0
- package/util/diff-graph.js +64 -1
- package/util/files.js +9 -8
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +3 -1
- package/util/version.js +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryFunctionFilter = void 0;
|
|
4
|
+
const parse_1 = require("../slicing/criterion/parse");
|
|
5
|
+
const vertex_1 = require("../dataflow/graph/vertex");
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the function filter shared by the inspection queries (`inspect-*`).
|
|
8
|
+
*/
|
|
9
|
+
exports.QueryFunctionFilter = {
|
|
10
|
+
name: 'QueryFunctionFilter',
|
|
11
|
+
/** The ids the given queries restrict themselves to; empty if at least one query wants all functions. */
|
|
12
|
+
async criteria(queries, analyzer) {
|
|
13
|
+
let filters = undefined;
|
|
14
|
+
// filter will remain undefined if at least one of the queries wants all functions
|
|
15
|
+
for (const q of queries) {
|
|
16
|
+
if (q.filter === undefined) {
|
|
17
|
+
filters = undefined;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
filters ??= [];
|
|
22
|
+
filters = filters.concat(q.filter);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const ast = await analyzer.normalize();
|
|
26
|
+
const filterFor = new Set();
|
|
27
|
+
if (filters) {
|
|
28
|
+
for (const f of filters) {
|
|
29
|
+
const i = parse_1.SlicingCriterion.tryParse(f, ast.idMap);
|
|
30
|
+
if (i !== undefined) {
|
|
31
|
+
filterFor.add(i);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return filterFor;
|
|
36
|
+
},
|
|
37
|
+
/** The call graph together with the functions the given queries want to inspect. */
|
|
38
|
+
async inCallGraph(queries, analyzer, onlyDefinitions = true) {
|
|
39
|
+
const filterFor = await exports.QueryFunctionFilter.criteria(queries, analyzer);
|
|
40
|
+
const cg = await analyzer.callGraph();
|
|
41
|
+
let fns = (onlyDefinitions || filterFor.size === 0 ? cg.verticesOfType(vertex_1.VertexType.FunctionDefinition) : cg.vertices(true));
|
|
42
|
+
if (filterFor.size > 0) {
|
|
43
|
+
fns = fns.filter(([id]) => filterFor.has(id));
|
|
44
|
+
}
|
|
45
|
+
return { cg, fns };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=query-function-filter.js.map
|
package/r-bridge/data/data.d.ts
CHANGED
|
@@ -435,7 +435,7 @@ export declare const flowrCapabilities: {
|
|
|
435
435
|
readonly name: "Promises";
|
|
436
436
|
readonly id: "formals-promises";
|
|
437
437
|
readonly supported: "partially";
|
|
438
|
-
readonly description: "_Handle `function(x = y) { y <- 3; x }`, `function(x = { x <- 3; x}) { x * x }`, ..._ We
|
|
438
|
+
readonly description: "_Handle `function(x = y) { y <- 3; x }`, `function(x = { x <- 3; x}) { x * x }`, ..._ A default argument resolves in the function's own environment and an argument passed in resolves in the caller's, both as R does it. We do not model _when_ a promise is forced: a `delayedAssign`ed expression is linked to every binding it may be forced against, which never misses the one that feeds it but may name others as well. What forcing _does_ is not modelled either, so the writes a promise performs when it is forced (`delayedAssign(\"x\", { x <- 99; 2 })`, where reading `x` yields `2` and leaves `x` at `99`) do not reach the reads that follow.";
|
|
439
439
|
}];
|
|
440
440
|
}, {
|
|
441
441
|
readonly name: "Implicit Return";
|
|
@@ -498,12 +498,17 @@ export declare const flowrCapabilities: {
|
|
|
498
498
|
readonly name: "Quoting";
|
|
499
499
|
readonly id: "built-in-quoting";
|
|
500
500
|
readonly supported: "partially";
|
|
501
|
-
readonly description: "_Handle `quote`, `substitute`, `bquote`, ..._ We
|
|
501
|
+
readonly description: "_Handle `quote`, `substitute`, `bquote`, ..._ A quoted argument is marked as [non-standard evaluation](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#non-standard-evaluation) as a whole, so nothing within it counts as read. We model the escapes back to standard evaluation that a quoting function offers: rlang's `!!`/`!!!` (in `expr`, `quo`, `enquo`, ... and in data-masking arguments) and `bquote`'s `.()`. Base `quote`/`substitute` have no such escape, and `substitute` does not reach the caller's expression when used on a function argument.";
|
|
502
502
|
}, {
|
|
503
503
|
readonly name: "Evaluation";
|
|
504
504
|
readonly id: "built-in-evaluation";
|
|
505
505
|
readonly supported: "partially";
|
|
506
|
-
readonly description: "_Handle `eval`, `evalq`, `eval.parent`, ..._
|
|
506
|
+
readonly description: "_Handle `eval`, `evalq`, `eval.parent`, ..._ `eval` of a string we can resolve is analyzed as if it were written in its place. A language object reaches the `eval` that forces it even across assignments, branches, loop iterations, and function calls, and its names resolve in the scope evaluating it, as R does. `eval(expr, envir)` runs elsewhere, so we mark the call as an unknown side effect instead of guessing. `evalq` quotes its first argument and we do not follow it into the given environment.";
|
|
507
|
+
}, {
|
|
508
|
+
readonly name: "String Templates";
|
|
509
|
+
readonly id: "string-templates";
|
|
510
|
+
readonly supported: "partially";
|
|
511
|
+
readonly description: "_Handle `glue::glue(\"{x}\")`, `cli::cli_alert_info(\"{.val {x}}\")`, `stringr::str_glue`/`str_interp`, ..._ The `{...}` of a template carries R code that runs where the call is, so we analyze it as if it were written there: it reads, it writes, and its side effects land in the calling scope. Doubled delimiters escape, `.open`/`.close` are honored when they are literal, and cli markup (`{.cls ...}`) contributes only the interpolations nested in it. A template aimed at another scope (`.envir`, `.con`, `glue_data`) is marked as an unknown side effect instead.";
|
|
507
512
|
}, {
|
|
508
513
|
readonly name: "Parsing";
|
|
509
514
|
readonly id: "built-in-parsing";
|
|
@@ -552,6 +557,11 @@ export declare const flowrCapabilities: {
|
|
|
552
557
|
readonly name: "Non-Standard Evaluations/Semantics";
|
|
553
558
|
readonly id: "non-standard-evaluations-semantics";
|
|
554
559
|
readonly capabilities: readonly [{
|
|
560
|
+
readonly name: "Data Masking";
|
|
561
|
+
readonly id: "data-masking";
|
|
562
|
+
readonly supported: "partially";
|
|
563
|
+
readonly description: "_Handle `subset(d, col > 1)`, dplyr verbs, `ggplot2::aes`, data.table `:=`, ..._ In a masked argument, a name the caller binds is read as that variable and any other name is taken to come from the data. Which names a data frame actually offers is unknown to us, so a column shadowing a variable of the same name still resolves to the variable. rlang's `!!`/`!!!` and its `:=` name-value pair are recognised; `[` on a `data.table` does not mask its `j`/`by` yet.";
|
|
564
|
+
}, {
|
|
555
565
|
readonly name: "Recycling";
|
|
556
566
|
readonly id: "recycling";
|
|
557
567
|
readonly supported: "not";
|
package/r-bridge/data/data.js
CHANGED
|
@@ -551,7 +551,7 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
|
551
551
|
name: 'Promises',
|
|
552
552
|
id: 'formals-promises',
|
|
553
553
|
supported: 'partially',
|
|
554
|
-
description: '_Handle `function(x = y) { y <- 3; x }`, `function(x = { x <- 3; x}) { x * x }`, ..._ We
|
|
554
|
+
description: '_Handle `function(x = y) { y <- 3; x }`, `function(x = { x <- 3; x}) { x * x }`, ..._ A default argument resolves in the function\'s own environment and an argument passed in resolves in the caller\'s, both as R does it. We do not model _when_ a promise is forced: a `delayedAssign`ed expression is linked to every binding it may be forced against, which never misses the one that feeds it but may name others as well. What forcing _does_ is not modelled either, so the writes a promise performs when it is forced (`delayedAssign("x", { x <- 99; 2 })`, where reading `x` yields `2` and leaves `x` at `99`) do not reach the reads that follow.'
|
|
555
555
|
}
|
|
556
556
|
]
|
|
557
557
|
},
|
|
@@ -629,13 +629,19 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
|
629
629
|
name: 'Quoting',
|
|
630
630
|
id: 'built-in-quoting',
|
|
631
631
|
supported: 'partially',
|
|
632
|
-
description: '_Handle `quote`, `substitute`, `bquote`, ..._ We
|
|
632
|
+
description: '_Handle `quote`, `substitute`, `bquote`, ..._ A quoted argument is marked as [non-standard evaluation](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#non-standard-evaluation) as a whole, so nothing within it counts as read. We model the escapes back to standard evaluation that a quoting function offers: rlang\'s `!!`/`!!!` (in `expr`, `quo`, `enquo`, ... and in data-masking arguments) and `bquote`\'s `.()`. Base `quote`/`substitute` have no such escape, and `substitute` does not reach the caller\'s expression when used on a function argument.'
|
|
633
633
|
},
|
|
634
634
|
{
|
|
635
635
|
name: 'Evaluation',
|
|
636
636
|
id: 'built-in-evaluation',
|
|
637
637
|
supported: 'partially',
|
|
638
|
-
description: '_Handle `eval`, `evalq`, `eval.parent`, ..._
|
|
638
|
+
description: '_Handle `eval`, `evalq`, `eval.parent`, ..._ `eval` of a string we can resolve is analyzed as if it were written in its place. A language object reaches the `eval` that forces it even across assignments, branches, loop iterations, and function calls, and its names resolve in the scope evaluating it, as R does. `eval(expr, envir)` runs elsewhere, so we mark the call as an unknown side effect instead of guessing. `evalq` quotes its first argument and we do not follow it into the given environment.'
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
name: 'String Templates',
|
|
642
|
+
id: 'string-templates',
|
|
643
|
+
supported: 'partially',
|
|
644
|
+
description: '_Handle `glue::glue("{x}")`, `cli::cli_alert_info("{.val {x}}")`, `stringr::str_glue`/`str_interp`, ..._ The `{...}` of a template carries R code that runs where the call is, so we analyze it as if it were written there: it reads, it writes, and its side effects land in the calling scope. Doubled delimiters escape, `.open`/`.close` are honored when they are literal, and cli markup (`{.cls ...}`) contributes only the interpolations nested in it. A template aimed at another scope (`.envir`, `.con`, `glue_data`) is marked as an unknown side effect instead.'
|
|
639
645
|
},
|
|
640
646
|
{
|
|
641
647
|
name: 'Parsing',
|
|
@@ -699,6 +705,12 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
|
699
705
|
name: 'Non-Standard Evaluations/Semantics',
|
|
700
706
|
id: 'non-standard-evaluations-semantics',
|
|
701
707
|
capabilities: [
|
|
708
|
+
{
|
|
709
|
+
name: 'Data Masking',
|
|
710
|
+
id: 'data-masking',
|
|
711
|
+
supported: 'partially',
|
|
712
|
+
description: '_Handle `subset(d, col > 1)`, dplyr verbs, `ggplot2::aes`, data.table `:=`, ..._ In a masked argument, a name the caller binds is read as that variable and any other name is taken to come from the data. Which names a data frame actually offers is unknown to us, so a column shadowing a variable of the same name still resolves to the variable. rlang\'s `!!`/`!!!` and its `:=` name-value pair are recognised; `[` on a `data.table` does not mask its `j`/`by` yet.'
|
|
713
|
+
},
|
|
702
714
|
{
|
|
703
715
|
name: 'Recycling',
|
|
704
716
|
id: 'recycling',
|
|
@@ -54,6 +54,8 @@ export declare const RFunctionCall: {
|
|
|
54
54
|
* An empty argument (`f(1, ,3)`) takes its formal but never appears in the map, as there is nothing to bind.
|
|
55
55
|
*/
|
|
56
56
|
readonly matchArgsToParams: <Info = object>(this: void, args: readonly PotentiallyEmptyRArgument<Info>[], paramNames: readonly string[]) => ReadonlyMap<string, RArgument<Info>>;
|
|
57
|
+
/** The one argument a call was given, `undefined` unless there is exactly one and it is not empty. */
|
|
58
|
+
readonly soleArgument: <Info = object>(this: void, args: readonly PotentiallyEmptyRArgument<Info>[]) => RArgument<Info> | undefined;
|
|
57
59
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
58
60
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
59
61
|
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
@@ -45,6 +45,10 @@ exports.RFunctionCall = {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
return bound;
|
|
48
|
+
},
|
|
49
|
+
/** The one argument a call was given, `undefined` unless there is exactly one and it is not empty. */
|
|
50
|
+
soleArgument(args) {
|
|
51
|
+
return args.length === 1 && args[0] !== exports.EmptyArgument ? args[0] : undefined;
|
|
48
52
|
}
|
|
49
53
|
};
|
|
50
54
|
//# sourceMappingURL=r-function-call.js.map
|
|
@@ -162,13 +162,17 @@ interface FilterData {
|
|
|
162
162
|
dataflow: DataflowInformation;
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
+
/** A filter expression resolved to the function testing one element. */
|
|
166
|
+
export type PreparedFilter = (element: FlowrSearchElement<ParentInformation>, data: {
|
|
167
|
+
dataflow: DataflowInformation;
|
|
168
|
+
}) => boolean;
|
|
165
169
|
/**
|
|
166
170
|
* Resolve a filter expression to the function that tests one element.
|
|
167
171
|
* Nothing here depends on the element, so a search over `n` elements should do this once instead of `n` times:
|
|
168
172
|
* a bare {@link VertexType}/{@link RType} filter otherwise builds a {@link FlowrFilterCombinator} per element.
|
|
169
173
|
* @see {@link evalFilter} - the one-shot form, if you only test a single element
|
|
170
174
|
*/
|
|
171
|
-
export declare function prepareFilter<Filter extends FlowrFilter>(filter: FlowrFilterExpression<Filter>):
|
|
175
|
+
export declare function prepareFilter<Filter extends FlowrFilter>(filter: FlowrFilterExpression<Filter>): PreparedFilter;
|
|
172
176
|
/**
|
|
173
177
|
* Evaluates the given filter expression against the provided data.
|
|
174
178
|
* @see {@link prepareFilter} - resolve once when testing more than one element
|
|
@@ -210,26 +210,38 @@ function treeToStringImpl(tree, depth) {
|
|
|
210
210
|
function isBinaryTree(tree) {
|
|
211
211
|
return typeof tree === 'object' && tree !== null && 'tree' in tree;
|
|
212
212
|
}
|
|
213
|
-
const
|
|
214
|
-
and: ({ left, right }
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
213
|
+
const compileVisit = {
|
|
214
|
+
and: ({ left, right }) => {
|
|
215
|
+
const l = compileTree(left), r = compileTree(right);
|
|
216
|
+
return (e, d) => l(e, d) && r(e, d);
|
|
217
|
+
},
|
|
218
|
+
or: ({ left, right }) => {
|
|
219
|
+
const l = compileTree(left), r = compileTree(right);
|
|
220
|
+
return (e, d) => l(e, d) || r(e, d);
|
|
221
|
+
},
|
|
222
|
+
xor: ({ left, right }) => {
|
|
223
|
+
const l = compileTree(left), r = compileTree(right);
|
|
224
|
+
return (e, d) => l(e, d) !== r(e, d);
|
|
225
|
+
},
|
|
226
|
+
not: ({ operand }) => {
|
|
227
|
+
const o = compileTree(operand);
|
|
228
|
+
return (e, d) => !o(e, d);
|
|
229
|
+
},
|
|
230
|
+
'r-type': ({ value }) => e => e.node.type === value,
|
|
231
|
+
'vertex-type': ({ value }) => (e, d) => d.dataflow.graph.getVertex(e.node.info.id)?.tag === value,
|
|
232
|
+
'special': ({ value }) => {
|
|
221
233
|
const name = typeof value === 'string' ? value : value.name;
|
|
222
234
|
const args = typeof value === 'string' ? undefined : value.args;
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
|
|
235
|
+
const handler = exports.FlowrFilters[name];
|
|
236
|
+
if (!handler) {
|
|
237
|
+
throw new Error(`Couldn't find special filter with name ${name}`);
|
|
226
238
|
}
|
|
227
|
-
|
|
239
|
+
return (e, d) => handler(e, args, d);
|
|
228
240
|
}
|
|
229
241
|
};
|
|
230
|
-
function
|
|
242
|
+
function compileTree(tree) {
|
|
231
243
|
/* we ensure that the types fit */
|
|
232
|
-
return
|
|
244
|
+
return compileVisit[tree.type](tree);
|
|
233
245
|
}
|
|
234
246
|
/**
|
|
235
247
|
* Resolve a filter expression to the function that tests one element.
|
|
@@ -239,21 +251,19 @@ function evalTree(tree, data) {
|
|
|
239
251
|
*/
|
|
240
252
|
function prepareFilter(filter) {
|
|
241
253
|
if (filter instanceof FlowrFilterCombinator) {
|
|
242
|
-
|
|
243
|
-
return data => evalTree(tree, data);
|
|
254
|
+
return compileTree(filter.get());
|
|
244
255
|
}
|
|
245
256
|
else if (typeof filter === 'string' && exports.ValidFlowrFilters.has(filter)) {
|
|
246
257
|
const handler = exports.FlowrFilters[filter];
|
|
247
|
-
return
|
|
258
|
+
return (e, d) => handler(e, undefined, d);
|
|
248
259
|
}
|
|
249
260
|
else if (typeof filter === 'object' && 'name' in filter) {
|
|
250
261
|
const handler = exports.FlowrFilters[filter.name];
|
|
251
262
|
const args = ('args' in filter ? filter.args : undefined);
|
|
252
|
-
return
|
|
263
|
+
return (e, d) => handler(e, args, d);
|
|
253
264
|
}
|
|
254
265
|
else {
|
|
255
|
-
|
|
256
|
-
return data => evalTree(tree, data);
|
|
266
|
+
return compileTree(FlowrFilterCombinator.is(filter).get());
|
|
257
267
|
}
|
|
258
268
|
}
|
|
259
269
|
/**
|
|
@@ -261,6 +271,6 @@ function prepareFilter(filter) {
|
|
|
261
271
|
* @see {@link prepareFilter} - resolve once when testing more than one element
|
|
262
272
|
*/
|
|
263
273
|
function evalFilter(filter, data) {
|
|
264
|
-
return prepareFilter(filter)(data);
|
|
274
|
+
return prepareFilter(filter)(data.element, data.data);
|
|
265
275
|
}
|
|
266
276
|
//# sourceMappingURL=flowr-search-filters.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FlowrSearchElement, FlowrSearchElements } from '../flowr-search';
|
|
2
|
-
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
|
+
import type { NormalizedAst, ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
|
+
import type { DataflowInformation } from '../../dataflow/info';
|
|
3
4
|
import { type MergeableRecord } from '../../util/objects';
|
|
4
5
|
import type { LinkToLastCall } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
5
6
|
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
@@ -43,9 +44,18 @@ export interface CallTargetsContent extends MergeableRecord {
|
|
|
43
44
|
*/
|
|
44
45
|
targets: (FlowrSearchElement<ParentInformation> | string)[];
|
|
45
46
|
}
|
|
47
|
+
/** Analysis artifacts resolved once for the whole search rather than once per element. */
|
|
48
|
+
export interface CallTargetsSearchContent extends MergeableRecord {
|
|
49
|
+
dfg: DataflowInformation;
|
|
50
|
+
ast: NormalizedAst;
|
|
51
|
+
}
|
|
46
52
|
export interface LastCallContent extends MergeableRecord {
|
|
47
53
|
linkedIds: FlowrSearchElement<ParentInformation>[];
|
|
48
54
|
}
|
|
55
|
+
/** @see {@link CallTargetsSearchContent} */
|
|
56
|
+
export interface LastCallSearchContent extends CallTargetsSearchContent {
|
|
57
|
+
cfg: ControlFlowInformation;
|
|
58
|
+
}
|
|
49
59
|
export interface CfgInformationElementContent extends MergeableRecord {
|
|
50
60
|
/**
|
|
51
61
|
* Whether the current node is a root node in the CFG, which is a node that is not contained inside of a function definition.
|
|
@@ -84,6 +94,10 @@ export interface RoxygenElementContent extends MergeableRecord {
|
|
|
84
94
|
})[];
|
|
85
95
|
};
|
|
86
96
|
}
|
|
97
|
+
/** @see {@link CallTargetsSearchContent} */
|
|
98
|
+
export interface RoxygenSearchContent extends MergeableRecord {
|
|
99
|
+
ast: NormalizedAst;
|
|
100
|
+
}
|
|
87
101
|
export interface QueryDataElementContent extends MergeableRecord {
|
|
88
102
|
/** The name of the query that this element originated from. To get each query's data, see {@link QueryDataSearchContent}. */
|
|
89
103
|
query: Query['type'];
|
|
@@ -99,14 +113,19 @@ export interface QueryDataSearchContent extends MergeableRecord {
|
|
|
99
113
|
*/
|
|
100
114
|
export declare const Enrichments: {
|
|
101
115
|
readonly "call-targets": {
|
|
102
|
-
|
|
116
|
+
enrichSearch: (_search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, data: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, _args: {
|
|
117
|
+
onlyBuiltin?: boolean;
|
|
118
|
+
qualifyNames?: boolean;
|
|
119
|
+
} | undefined, prev: CallTargetsSearchContent | undefined) => Promise<CallTargetsSearchContent>;
|
|
120
|
+
enrichElement: (e: FlowrSearchElement<ParentInformation>, s: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, analyzer: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, args: {
|
|
103
121
|
onlyBuiltin?: boolean;
|
|
104
122
|
qualifyNames?: boolean;
|
|
105
123
|
} | undefined, prev: CallTargetsContent | undefined) => Promise<CallTargetsContent>;
|
|
106
124
|
mapper: ({ targets }: CallTargetsContent) => FlowrSearchElement<ParentInformation>[];
|
|
107
125
|
};
|
|
108
126
|
readonly "last-call": {
|
|
109
|
-
|
|
127
|
+
enrichSearch: (_search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, data: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, _args: Omit<LinkToLastCall<import("../../queries/catalog/call-context-query/call-context-query-format").CallNameTypes>, "type">[] | undefined, prev: LastCallSearchContent | undefined) => Promise<LastCallSearchContent>;
|
|
128
|
+
enrichElement: (e: FlowrSearchElement<ParentInformation>, s: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, analyzer: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, args: Omit<LinkToLastCall<import("../../queries/catalog/call-context-query/call-context-query-format").CallNameTypes>, "type">[] | undefined, prev: LastCallContent | undefined) => Promise<LastCallContent>;
|
|
110
129
|
mapper: ({ linkedIds }: LastCallContent) => FlowrSearchElement<ParentInformation>[];
|
|
111
130
|
};
|
|
112
131
|
readonly "cfg-information": {
|
|
@@ -117,7 +136,8 @@ export declare const Enrichments: {
|
|
|
117
136
|
enrichSearch: (_search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, data: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, args: CfgInformationArguments | undefined, prev: CfgInformationSearchContent | undefined) => Promise<CfgInformationSearchContent>;
|
|
118
137
|
};
|
|
119
138
|
readonly roxygen: {
|
|
120
|
-
|
|
139
|
+
enrichSearch: (_search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, data: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, _args: undefined, prev: RoxygenSearchContent | undefined) => Promise<RoxygenSearchContent>;
|
|
140
|
+
enrichElement: (e: FlowrSearchElement<ParentInformation>, search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, analyzer: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, _args: undefined, prev: RoxygenElementContent | undefined) => Promise<{
|
|
121
141
|
[x: string]: unknown;
|
|
122
142
|
documentation: ({
|
|
123
143
|
value: string[];
|
|
@@ -32,11 +32,16 @@ var Enrichment;
|
|
|
32
32
|
*/
|
|
33
33
|
exports.Enrichments = {
|
|
34
34
|
[Enrichment.CallTargets]: {
|
|
35
|
-
|
|
35
|
+
enrichSearch: async (_search, data, _args, prev) => prev ?? {
|
|
36
|
+
dfg: await data.dataflow(),
|
|
37
|
+
ast: await data.normalize()
|
|
38
|
+
},
|
|
39
|
+
enrichElement: async (e, s, analyzer, args, prev) => {
|
|
36
40
|
// we don't resolve aliases here yet!
|
|
37
41
|
const content = { targets: [] };
|
|
38
|
-
const
|
|
39
|
-
const
|
|
42
|
+
const shared = s.enrichmentContent(Enrichment.CallTargets);
|
|
43
|
+
const df = shared?.dfg ?? await analyzer.dataflow();
|
|
44
|
+
const n = shared?.ast ?? await analyzer.normalize();
|
|
40
45
|
const callVertex = df.graph.getVertex(e.node.info.id);
|
|
41
46
|
if (callVertex?.tag === vertex_1.VertexType.FunctionCall) {
|
|
42
47
|
const origins = df_helper_1.Dataflow.origin(df.graph, callVertex.id);
|
|
@@ -95,14 +100,20 @@ exports.Enrichments = {
|
|
|
95
100
|
mapper: ({ targets }) => targets.map(t => t).filter(t => t.node !== undefined)
|
|
96
101
|
},
|
|
97
102
|
[Enrichment.LastCall]: {
|
|
98
|
-
|
|
103
|
+
enrichSearch: async (_search, data, _args, prev) => prev ?? {
|
|
104
|
+
dfg: await data.dataflow(),
|
|
105
|
+
ast: await data.normalize(),
|
|
106
|
+
cfg: await data.controlflow(undefined, cfg_kind_1.CfgKind.Quick)
|
|
107
|
+
},
|
|
108
|
+
enrichElement: async (e, s, analyzer, args, prev) => {
|
|
99
109
|
(0, assert_1.guard)(args && args.length, `${Enrichment.LastCall} enrichment requires at least one argument`);
|
|
100
110
|
const content = prev ?? { linkedIds: [] };
|
|
101
|
-
const
|
|
111
|
+
const shared = s.enrichmentContent(Enrichment.LastCall);
|
|
112
|
+
const df = (shared?.dfg ?? await analyzer.dataflow()).graph;
|
|
102
113
|
const vertex = df.getVertex(e.node.info.id);
|
|
103
114
|
if (vertex?.tag === vertex_1.VertexType.FunctionCall) {
|
|
104
|
-
const n = await analyzer.normalize();
|
|
105
|
-
const cfg = (await analyzer.controlflow(undefined, cfg_kind_1.CfgKind.Quick)).graph;
|
|
115
|
+
const n = shared?.ast ?? await analyzer.normalize();
|
|
116
|
+
const cfg = (shared?.cfg ?? await analyzer.controlflow(undefined, cfg_kind_1.CfgKind.Quick)).graph;
|
|
106
117
|
for (const arg of args) {
|
|
107
118
|
const lastCalls = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelationSync)(vertex.id, cfg, df, {
|
|
108
119
|
...arg,
|
|
@@ -149,12 +160,14 @@ exports.Enrichments = {
|
|
|
149
160
|
}
|
|
150
161
|
},
|
|
151
162
|
[Enrichment.Roxygen]: {
|
|
152
|
-
|
|
163
|
+
enrichSearch: async (_search, data, _args, prev) => prev ?? { ast: await data.normalize() },
|
|
164
|
+
enrichElement: async (e, search, analyzer, _args, prev) => {
|
|
153
165
|
const content = (prev ?? {
|
|
154
166
|
documentation: [],
|
|
155
167
|
tags: {}
|
|
156
168
|
});
|
|
157
|
-
const
|
|
169
|
+
const shared = search.enrichmentContent(Enrichment.Roxygen);
|
|
170
|
+
const normalize = shared?.ast ?? await analyzer.normalize();
|
|
158
171
|
const roxygen = (0, documentation_provider_1.getDocumentationOf)(e.node.info.id, normalize.idMap);
|
|
159
172
|
if (roxygen !== undefined) {
|
|
160
173
|
const comments = (Array.isArray(roxygen) ? roxygen : [roxygen]);
|
|
@@ -100,7 +100,7 @@ async function getFilter(data, elements, { filter }) {
|
|
|
100
100
|
// neither depends on the element, so build them once rather than n times
|
|
101
101
|
const test = (0, flowr_search_filters_1.prepareFilter)(filter);
|
|
102
102
|
const shared = { dataflow };
|
|
103
|
-
return elements.mutate(e => e.filter(e => test(
|
|
103
|
+
return elements.mutate(e => e.filter(e => test(e, shared)));
|
|
104
104
|
}
|
|
105
105
|
async function getWith(input, elements, { info, args }) {
|
|
106
106
|
return (await elements.enrich(input, info, args)).mutate(async (s) => await Promise.all(s.map(e => (0, search_enrichers_1.enrichElement)(e, elements, input, info, args))));
|
package/util/diff-graph.d.ts
CHANGED
|
@@ -43,4 +43,17 @@ export interface GraphDiffContext<Graph = DataflowGraph> extends GenericDifferen
|
|
|
43
43
|
* Create the context for differencing two graphs
|
|
44
44
|
*/
|
|
45
45
|
export declare function initDiffContext<Graph>(left: NamedGraph<Graph>, right: NamedGraph<Graph>, config?: Partial<GenericDiffConfiguration>): GraphDiffContext<Graph>;
|
|
46
|
+
/** The minimum a graph has to offer for {@link GraphDiff} to compare its edges. */
|
|
47
|
+
interface EdgeIndexedGraph<EdgeMap> {
|
|
48
|
+
edges(): Iterable<readonly [NodeId, EdgeMap]>;
|
|
49
|
+
hasVertex(id: NodeId): boolean;
|
|
50
|
+
}
|
|
51
|
+
/** The edge-differencing steps shared by the dataflow and the control flow graph diff. */
|
|
52
|
+
export declare const GraphDiff: {
|
|
53
|
+
readonly name: "GraphDiff";
|
|
54
|
+
/** Compares all edges of both graphs vertex by vertex, handing each pair to `diffEdges`. */
|
|
55
|
+
readonly outgoingEdges: <EdgeMap, Graph extends EdgeIndexedGraph<EdgeMap>>(this: void, ctx: GraphDiffContext<Graph>, diffEdges: (ctx: GraphDiffContext<Graph>, id: NodeId, lEdges: EdgeMap | undefined, rEdges: EdgeMap | undefined) => void) => void;
|
|
56
|
+
/** Compares the outgoing edges of a single vertex, handing each pair of edges to `diffEdge`. */
|
|
57
|
+
readonly edges: <Edge, Graph>(this: void, ctx: GraphDiffContext<Graph>, id: NodeId, lEdges: ReadonlyMap<NodeId, Edge> | undefined, rEdges: ReadonlyMap<NodeId, Edge> | undefined, diffEdge: (edge: Edge, otherEdge: Edge, ctx: GraphDiffContext<Graph>, id: NodeId, target: NodeId) => void) => void;
|
|
58
|
+
};
|
|
46
59
|
export {};
|
package/util/diff-graph.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GraphDifferenceReport = void 0;
|
|
3
|
+
exports.GraphDiff = exports.GraphDifferenceReport = void 0;
|
|
4
4
|
exports.initDiffContext = initDiffContext;
|
|
5
|
+
const json_1 = require("./json");
|
|
5
6
|
/**
|
|
6
7
|
* To be produced by a function differencing two graphs (e.g., {@link DataflowGraph|DFGs} or {@link ControlFlowGraph|CFGs}).
|
|
7
8
|
* @see {@link GraphDifferenceReport#isEqual|isEqual} - to check whether the graphs are equal
|
|
@@ -57,4 +58,66 @@ function initDiffContext(left, right, config) {
|
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
60
|
}
|
|
61
|
+
/** The edge-differencing steps shared by the dataflow and the control flow graph diff. */
|
|
62
|
+
exports.GraphDiff = {
|
|
63
|
+
name: 'GraphDiff',
|
|
64
|
+
/** Compares all edges of both graphs vertex by vertex, handing each pair to `diffEdges`. */
|
|
65
|
+
outgoingEdges(ctx, diffEdges) {
|
|
66
|
+
const lEdges = new Map(ctx.left.edges());
|
|
67
|
+
const rEdges = new Map(ctx.right.edges());
|
|
68
|
+
if (lEdges.size < rEdges.size && !ctx.config.leftIsSubgraph || lEdges.size > rEdges.size && !ctx.config.rightIsSubgraph) {
|
|
69
|
+
ctx.report.addComment(`Detected different number of edges! ${ctx.leftname} has ${lEdges.size} (${JSON.stringify(lEdges, json_1.jsonReplacer)}). ${ctx.rightname} has ${rEdges.size} ${JSON.stringify(rEdges, json_1.jsonReplacer)}`);
|
|
70
|
+
}
|
|
71
|
+
for (const [id, edge] of lEdges) {
|
|
72
|
+
/* This has nothing to do with the subset relation as we verify this in the same graph.
|
|
73
|
+
* Yet we still do the check as a subgraph may not have to have all source vertices for edges.
|
|
74
|
+
*/
|
|
75
|
+
if (!ctx.left.hasVertex(id)) {
|
|
76
|
+
if (!ctx.config.leftIsSubgraph) {
|
|
77
|
+
ctx.report.addComment(`The source ${id} of edges ${JSON.stringify(edge, json_1.jsonReplacer)} is not present in ${ctx.leftname}. This means that the graph contains an edge but not the corresponding vertex.`);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
diffEdges(ctx, id, edge, rEdges.get(id));
|
|
82
|
+
}
|
|
83
|
+
// just to make it both ways in case the length differs
|
|
84
|
+
for (const [id, edge] of rEdges) {
|
|
85
|
+
if (!ctx.right.hasVertex(id)) {
|
|
86
|
+
if (!ctx.config.rightIsSubgraph) {
|
|
87
|
+
ctx.report.addComment(`The source ${id} of edges ${JSON.stringify(edge, json_1.jsonReplacer)} is not present in ${ctx.rightname}. This means that the graph contains an edge but not the corresponding vertex.`);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (!ctx.config.leftIsSubgraph && !lEdges.has(id)) {
|
|
92
|
+
diffEdges(ctx, id, undefined, edge);
|
|
93
|
+
}
|
|
94
|
+
/* otherwise, we already cover the edge above */
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
/** Compares the outgoing edges of a single vertex, handing each pair of edges to `diffEdge`. */
|
|
98
|
+
edges(ctx, id, lEdges, rEdges, diffEdge) {
|
|
99
|
+
if (lEdges === undefined || rEdges === undefined) {
|
|
100
|
+
if ((lEdges === undefined && !ctx.config.leftIsSubgraph)
|
|
101
|
+
|| (rEdges === undefined && !ctx.config.rightIsSubgraph)) {
|
|
102
|
+
ctx.report.addComment(`Vertex ${id} has undefined outgoing edges. ${ctx.leftname}: ${JSON.stringify(lEdges, json_1.jsonReplacer)} vs ${ctx.rightname}: ${JSON.stringify(rEdges, json_1.jsonReplacer)}`, { tag: 'vertex', id });
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (lEdges.size < rEdges.size && !ctx.config.leftIsSubgraph
|
|
107
|
+
|| lEdges.size > rEdges.size && !ctx.config.rightIsSubgraph) {
|
|
108
|
+
ctx.report.addComment(`Vertex ${id} differs in number of outgoing edges. ${ctx.leftname}: [${[...lEdges.keys()].join(',')}] vs ${ctx.rightname}: [${[...rEdges.keys()].join(',')}] `, { tag: 'vertex', id });
|
|
109
|
+
}
|
|
110
|
+
// order independent compare
|
|
111
|
+
for (const [target, edge] of lEdges) {
|
|
112
|
+
const otherEdge = rEdges.get(target);
|
|
113
|
+
if (otherEdge === undefined) {
|
|
114
|
+
if (!ctx.config.rightIsSubgraph) {
|
|
115
|
+
ctx.report.addComment(`Target of ${id}->${target} in ${ctx.leftname} is not present in ${ctx.rightname}`, { tag: 'edge', from: id, to: target });
|
|
116
|
+
}
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
diffEdge(edge, otherEdge, ctx, id, target);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
60
123
|
//# sourceMappingURL=diff-graph.js.map
|
package/util/files.js
CHANGED
|
@@ -52,6 +52,13 @@ const fs_1 = __importStar(require("fs"));
|
|
|
52
52
|
const path_1 = __importDefault(require("path"));
|
|
53
53
|
const log_1 = require("./log");
|
|
54
54
|
const n_readlines_1 = __importDefault(require("n-readlines"));
|
|
55
|
+
/** Rethrows if the caller asked for it, otherwise reports the directory as skipped. */
|
|
56
|
+
function skipUnreadableDir(dir, e, throwOnError) {
|
|
57
|
+
if (throwOnError) {
|
|
58
|
+
throw e;
|
|
59
|
+
}
|
|
60
|
+
log_1.log.warn(`Skipping '${dir}' during file discovery: ${e instanceof Error ? e.message : String(e)}`);
|
|
61
|
+
}
|
|
55
62
|
/**
|
|
56
63
|
* Retrieves all files in the given directory recursively
|
|
57
64
|
* @param dir - Directory path to start the search from
|
|
@@ -66,10 +73,7 @@ async function* getAllFiles(dir, suffix = /.*/, throwOnError = false) {
|
|
|
66
73
|
entries = await fs_1.promises.readdir(dir, { withFileTypes: true, recursive: false });
|
|
67
74
|
}
|
|
68
75
|
catch (e) {
|
|
69
|
-
|
|
70
|
-
throw e;
|
|
71
|
-
}
|
|
72
|
-
log_1.log.warn(`Skipping '${dir}' during file discovery: ${e instanceof Error ? e.message : String(e)}`);
|
|
76
|
+
skipUnreadableDir(dir, e, throwOnError);
|
|
73
77
|
return;
|
|
74
78
|
}
|
|
75
79
|
for (const subEntries of entries) {
|
|
@@ -98,10 +102,7 @@ function* getAllFilesSync(dir, suffix = /.*/, ignoreDirs = undefined, relativeTo
|
|
|
98
102
|
entries = fs_1.default.readdirSync(dir, { withFileTypes: true, recursive: false });
|
|
99
103
|
}
|
|
100
104
|
catch (e) {
|
|
101
|
-
|
|
102
|
-
throw e;
|
|
103
|
-
}
|
|
104
|
-
log_1.log.warn(`Skipping '${dir}' during file discovery: ${e instanceof Error ? e.message : String(e)}`);
|
|
105
|
+
skipUnreadableDir(dir, e, throwOnError);
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
108
|
for (const subEntries of entries) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** the base packages R attaches to the search path on startup, so their exports are usable without a `library` call */
|
|
2
2
|
export declare const AttachedBasePackages: readonly string[];
|
|
3
|
+
/** {@link AttachedBasePackages} for membership tests, which happen far more often than iteration. */
|
|
4
|
+
export declare const AttachedBasePackageSet: ReadonlySet<string>;
|
|
3
5
|
/**
|
|
4
6
|
* The base packages available at the assumed R version (all of them if omitted). A package counts as
|
|
5
7
|
* available when that R release lies within the range it was part of core; e.g. `parallel` (added in R
|
package/util/r-base-packages.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AttachedBasePackages = void 0;
|
|
3
|
+
exports.AttachedBasePackageSet = exports.AttachedBasePackages = void 0;
|
|
4
4
|
exports.baseRPackages = baseRPackages;
|
|
5
5
|
exports.baseRExportOwner = baseRExportOwner;
|
|
6
6
|
exports.isBaseRPackage = isBaseRPackage;
|
|
@@ -9,6 +9,8 @@ const r_base_primitives_generated_1 = require("../data/r-base-primitives.generat
|
|
|
9
9
|
const r_version_1 = require("./r-version");
|
|
10
10
|
/** the base packages R attaches to the search path on startup, so their exports are usable without a `library` call */
|
|
11
11
|
exports.AttachedBasePackages = ['base', 'stats', 'graphics', 'grDevices', 'utils', 'datasets', 'methods'];
|
|
12
|
+
/** {@link AttachedBasePackages} for membership tests, which happen far more often than iteration. */
|
|
13
|
+
exports.AttachedBasePackageSet = new Set(exports.AttachedBasePackages);
|
|
12
14
|
/** clamp `rVersion` to the newest R release the store knows about (so a future R version stays answerable) */
|
|
13
15
|
function effective(rVersion) {
|
|
14
16
|
return r_version_1.RVersion.compare(rVersion, r_base_packages_generated_1.RBasePackageStore.newestRVersion) > 0 ? r_base_packages_generated_1.RBasePackageStore.newestRVersion : rVersion;
|
package/util/version.js
CHANGED
|
@@ -42,7 +42,7 @@ const assert_1 = require("./assert");
|
|
|
42
42
|
const sigdb_download_1 = require("../project/sigdb/sigdb-download");
|
|
43
43
|
const doc_files_1 = require("../documentation/doc-util/doc-files");
|
|
44
44
|
// this is automatically replaced with the current version by release-it
|
|
45
|
-
const version = '2.13.
|
|
45
|
+
const version = '2.13.15';
|
|
46
46
|
// this is automatically replaced with the release date by release-it (regex-bumper, see package.json)
|
|
47
47
|
const versionDate = '2026-07-15T07:13:44Z';
|
|
48
48
|
/**
|