@eagleoutice/flowr 2.13.13 → 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 +31 -28
- package/abstract-interpretation/data-frame/resolve-args.js +11 -12
- package/benchmark/calibration.d.ts +18 -0
- package/benchmark/calibration.js +63 -0
- package/benchmark/slicer.d.ts +19 -0
- package/benchmark/slicer.js +84 -1
- package/benchmark/stats/feature-counts.d.ts +6 -0
- package/benchmark/stats/feature-counts.js +61 -0
- package/benchmark/stats/print.js +20 -0
- package/benchmark/stats/sigdb-counts.d.ts +7 -0
- package/benchmark/stats/sigdb-counts.js +219 -0
- package/benchmark/stats/size-of.d.ts +6 -0
- package/benchmark/stats/size-of.js +8 -0
- package/benchmark/stats/stats.d.ts +79 -0
- package/benchmark/stats/stats.js +7 -1
- package/benchmark/stopwatch.d.ts +4 -0
- package/benchmark/stopwatch.js +12 -1
- package/benchmark/summarizer/data.d.ts +17 -1
- package/benchmark/summarizer/first-phase/input.js +5 -0
- package/benchmark/summarizer/first-phase/process.js +12 -2
- package/benchmark/summarizer/second-phase/graph.d.ts +24 -1
- package/benchmark/summarizer/second-phase/graph.js +249 -18
- package/benchmark/summarizer/second-phase/process.js +56 -0
- package/benchmark/summarizer/summarizer.js +1 -2
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +2 -1
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +12 -2
- package/cli/common/options.d.ts +10 -0
- package/cli/common/options.js +3 -1
- package/cli/common/scripts-info.d.ts +10 -0
- 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-builder.d.ts +30 -0
- package/control-flow/cfg-builder.js +79 -0
- package/control-flow/cfg-dead-code.js +5 -29
- package/control-flow/diff-cfg.js +2 -56
- package/control-flow/extract-cfg.js +17 -10
- 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/apply-kill.d.ts +3 -3
- package/dataflow/environments/apply-kill.js +60 -31
- 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/environments/reference-to-maybe.d.ts +5 -3
- package/dataflow/environments/reference-to-maybe.js +17 -52
- package/dataflow/environments/resolve-helper.d.ts +2 -1
- package/dataflow/environments/resolve-helper.js +2 -1
- 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/df-helper.d.ts +2 -1
- 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/info.d.ts +7 -1
- package/dataflow/info.js +36 -7
- 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-expression-list.js +33 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -1
- 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-local.js +6 -2
- 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-repeat-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +7 -2
- 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 +9 -28
- 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-readme.js +5 -2
- package/documentation/doc-util/doc-issue.d.ts +2 -0
- package/documentation/doc-util/doc-issue.js +3 -1
- package/documentation/doc-util/doc-types.js +15 -9
- package/documentation/wiki-dataflow-graph.js +4 -0
- package/documentation/wiki-faq.js +6 -2
- package/documentation/wiki-onboarding.js +11 -1
- package/documentation/wiki-setup.js +2 -1
- 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 +9 -4
- 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/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +11 -9
- 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/slicing/static/slice-call.js +4 -4
- package/util/diff-graph.d.ts +13 -0
- package/util/diff-graph.js +64 -1
- package/util/files.js +9 -8
- package/util/node-version.d.ts +4 -0
- package/util/node-version.js +29 -0
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +3 -1
- package/util/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagleoutice/flowr",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.15",
|
|
4
4
|
"description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22"
|
|
7
|
+
},
|
|
5
8
|
"types": "dist/src/index.d.ts",
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
@@ -12,7 +15,7 @@
|
|
|
12
15
|
"url": "https://github.com/flowr-analysis/flowr/issues"
|
|
13
16
|
},
|
|
14
17
|
"scripts": {
|
|
15
|
-
"setup:dev": "
|
|
18
|
+
"setup:dev": "npm ci && ts-node --transpile-only scripts/setup-dev.ts",
|
|
16
19
|
"main": "npm run build:bundle-flowr && node dist/src/cli/flowr.min.js",
|
|
17
20
|
"flowr": "npm run main --",
|
|
18
21
|
"flowr:dev": "npm run sync:sigdb && npm run gen:base-packages && npm run main-dev --",
|
|
@@ -23,6 +26,8 @@
|
|
|
23
26
|
"benchmark-helper": "ts-node src/cli/benchmark-helper-app.ts",
|
|
24
27
|
"benchmark": "npm run build-dev && node dist/src/cli/benchmark-app.js",
|
|
25
28
|
"summarizer": "ts-node src/cli/summarizer-app.ts",
|
|
29
|
+
"benchmark:test-counts": "ts-node --transpile-only scripts/test-label-counts.ts",
|
|
30
|
+
"benchmark:compact": "ts-node --transpile-only scripts/compact-benchmark-data.ts",
|
|
26
31
|
"export-quads": "ts-node src/cli/export-quads-app.ts",
|
|
27
32
|
"capabilities-markdown": "ts-node src/documentation/doc-capabilities.ts",
|
|
28
33
|
"wiki": "ts-node src/cli/wiki.ts",
|
|
@@ -48,8 +53,8 @@
|
|
|
48
53
|
"test:coverage": "npm run test -- --coverage",
|
|
49
54
|
"test:full": "npm run test-full",
|
|
50
55
|
"test:bench": "vitest bench --config test/vitest.config.mts",
|
|
51
|
-
"test-full": "npm run test:coverage -- --no-watch -- --make-summary --test-installation",
|
|
52
|
-
"performance-test": "func() { cd test/performance/ && bash run-all-suites.sh
|
|
56
|
+
"test-full": "npm run test:coverage -- --no-watch --reporter=default --reporter=json --outputFile.json=coverage/flowr-test-results.json -- --make-summary --test-installation",
|
|
57
|
+
"performance-test": "func() { cd test/performance/ && bash run-all-suites.sh \"$@\"; }; func",
|
|
53
58
|
"test:performance": "npm run performance-test --",
|
|
54
59
|
"test:docker": "func() { b() { docker build ${1:+--network=$1} -t flowr-docker-test -f \"$2\" .; }; r() { docker run --rm ${1:+--network=$1} flowr-docker-test --version; }; for df in scripts/Dockerfile scripts/Dockerfile-NoR; do echo \"=== building $df ===\"; b '' \"$df\" || { echo '(retrying with --network=host: bridge networking unavailable)'; b host \"$df\"; } || return 1; echo \"=== smoke-testing $df ===\"; r '' || r host || return 1; done; }; func",
|
|
55
60
|
"detect-circular-deps": "npx madge --extensions ts,tsx --circular src/",
|
|
@@ -5,6 +5,12 @@ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context'
|
|
|
5
5
|
import { FlowrDescriptionFile } from './files/flowr-description-file';
|
|
6
6
|
import { type FlowrFileProvider } from '../../context/flowr-file';
|
|
7
7
|
export declare const descriptionFileLog: import("tslog").Logger<import("tslog").ILogObj>;
|
|
8
|
+
/** Access to the `DESCRIPTION` file of the analyzed project. */
|
|
9
|
+
export declare const DescriptionFile: {
|
|
10
|
+
readonly name: "DescriptionFile";
|
|
11
|
+
/** The project's only `DESCRIPTION` file, `undefined` if there is none; `missing` states what cannot be done then. */
|
|
12
|
+
readonly single: (this: void, ctx: FlowrAnalyzerContext, missing: string) => FlowrDescriptionFile | undefined;
|
|
13
|
+
};
|
|
8
14
|
/**
|
|
9
15
|
* This plugin provides support for R `DESCRIPTION` files.
|
|
10
16
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowrAnalyzerDescriptionFilePlugin = exports.descriptionFileLog = void 0;
|
|
3
|
+
exports.FlowrAnalyzerDescriptionFilePlugin = exports.DescriptionFile = exports.descriptionFileLog = void 0;
|
|
4
4
|
const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
|
|
5
5
|
const semver_1 = require("semver");
|
|
6
6
|
const log_1 = require("../../../util/log");
|
|
@@ -9,6 +9,22 @@ const flowr_file_1 = require("../../context/flowr-file");
|
|
|
9
9
|
const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
10
10
|
exports.descriptionFileLog = log_1.log.getSubLogger({ name: 'flowr-analyzer-loading-order-description-file-plugin' });
|
|
11
11
|
const DescriptionFilePattern = /^DESCRIPTION(\.(txt|in))?$/i;
|
|
12
|
+
/** Access to the `DESCRIPTION` file of the analyzed project. */
|
|
13
|
+
exports.DescriptionFile = {
|
|
14
|
+
name: 'DescriptionFile',
|
|
15
|
+
/** The project's only `DESCRIPTION` file, `undefined` if there is none; `missing` states what cannot be done then. */
|
|
16
|
+
single(ctx, missing) {
|
|
17
|
+
const descFiles = ctx.files.getFilesByRole(flowr_file_1.FileRole.Description);
|
|
18
|
+
if (descFiles.length === 0) {
|
|
19
|
+
exports.descriptionFileLog.debug(missing);
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
else if (descFiles.length > 1) {
|
|
23
|
+
exports.descriptionFileLog.warn(`Found ${descFiles.length} description files, expected exactly one.`);
|
|
24
|
+
}
|
|
25
|
+
return descFiles[0];
|
|
26
|
+
}
|
|
27
|
+
};
|
|
12
28
|
/**
|
|
13
29
|
* This plugin provides support for R `DESCRIPTION` files.
|
|
14
30
|
*/
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SemVer } from 'semver';
|
|
3
|
-
import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-context';
|
|
4
|
-
import type { FlowrFileProvider } from '../../../context/flowr-file';
|
|
5
|
-
import { FlowrAnalyzerFilePlugin } from '../flowr-analyzer-file-plugin';
|
|
6
|
-
import { FlowrRMarkdownFile } from '../files/flowr-rmarkdown-file';
|
|
1
|
+
import { FlowrAnalyzerRMarkdownFilePlugin } from './flowr-analyzer-rmarkdown-file-plugin';
|
|
7
2
|
/**
|
|
8
3
|
* The plugin provides support for Quarto R Markdown (`.qmd`) files
|
|
9
4
|
*/
|
|
10
|
-
export declare class FlowrAnalyzerQmdFilePlugin extends
|
|
5
|
+
export declare class FlowrAnalyzerQmdFilePlugin extends FlowrAnalyzerRMarkdownFilePlugin {
|
|
11
6
|
readonly name = "qmd-file-plugin";
|
|
12
7
|
readonly description = "Parses Quarto R Markdown files";
|
|
13
|
-
readonly version: SemVer;
|
|
14
|
-
private readonly pattern;
|
|
15
8
|
/**
|
|
16
9
|
* Creates a new instance of the Quarto R Markdown file plugin.
|
|
17
10
|
* @param filePattern - The pattern to identify Quarto R Markdown files, see {@link QmdPattern} for the default pattern.
|
|
18
11
|
*/
|
|
19
12
|
constructor(filePattern?: RegExp);
|
|
20
|
-
applies(file: PathLike): boolean;
|
|
21
|
-
protected process(ctx: FlowrAnalyzerContext, arg: FlowrFileProvider<string>): FlowrRMarkdownFile;
|
|
22
13
|
}
|
|
@@ -1,32 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowrAnalyzerQmdFilePlugin = void 0;
|
|
4
|
-
const
|
|
5
|
-
const flowr_analyzer_file_plugin_1 = require("../flowr-analyzer-file-plugin");
|
|
6
|
-
const flowr_rmarkdown_file_1 = require("../files/flowr-rmarkdown-file");
|
|
7
|
-
const built_in_source_1 = require("../../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
4
|
+
const flowr_analyzer_rmarkdown_file_plugin_1 = require("./flowr-analyzer-rmarkdown-file-plugin");
|
|
8
5
|
const QmdPattern = /\.qmd$/i;
|
|
9
6
|
/**
|
|
10
7
|
* The plugin provides support for Quarto R Markdown (`.qmd`) files
|
|
11
8
|
*/
|
|
12
|
-
class FlowrAnalyzerQmdFilePlugin extends
|
|
9
|
+
class FlowrAnalyzerQmdFilePlugin extends flowr_analyzer_rmarkdown_file_plugin_1.FlowrAnalyzerRMarkdownFilePlugin {
|
|
13
10
|
name = 'qmd-file-plugin';
|
|
14
11
|
description = 'Parses Quarto R Markdown files';
|
|
15
|
-
version = new semver_1.SemVer('0.1.0');
|
|
16
|
-
pattern;
|
|
17
12
|
/**
|
|
18
13
|
* Creates a new instance of the Quarto R Markdown file plugin.
|
|
19
14
|
* @param filePattern - The pattern to identify Quarto R Markdown files, see {@link QmdPattern} for the default pattern.
|
|
20
15
|
*/
|
|
21
16
|
constructor(filePattern = QmdPattern) {
|
|
22
|
-
super();
|
|
23
|
-
this.pattern = filePattern;
|
|
24
|
-
}
|
|
25
|
-
applies(file) {
|
|
26
|
-
return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
|
|
27
|
-
}
|
|
28
|
-
process(ctx, arg) {
|
|
29
|
-
return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg, ctx);
|
|
17
|
+
super(filePattern);
|
|
30
18
|
}
|
|
31
19
|
}
|
|
32
20
|
exports.FlowrAnalyzerQmdFilePlugin = FlowrAnalyzerQmdFilePlugin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PathLike } from 'fs';
|
|
2
|
+
import { SemVer } from 'semver';
|
|
3
|
+
import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-context';
|
|
4
|
+
import type { FlowrFileProvider } from '../../../context/flowr-file';
|
|
5
|
+
import { FlowrAnalyzerFilePlugin } from '../flowr-analyzer-file-plugin';
|
|
6
|
+
import { FlowrRMarkdownFile } from '../files/flowr-rmarkdown-file';
|
|
7
|
+
/**
|
|
8
|
+
* Common base of the plugins reading an R Markdown flavor, which differ only in the files they claim.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class FlowrAnalyzerRMarkdownFilePlugin extends FlowrAnalyzerFilePlugin {
|
|
11
|
+
readonly version: SemVer;
|
|
12
|
+
private readonly pattern;
|
|
13
|
+
protected constructor(filePattern: RegExp);
|
|
14
|
+
applies(file: PathLike): boolean;
|
|
15
|
+
protected process(ctx: FlowrAnalyzerContext, arg: FlowrFileProvider<string>): FlowrRMarkdownFile;
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowrAnalyzerRMarkdownFilePlugin = void 0;
|
|
4
|
+
const semver_1 = require("semver");
|
|
5
|
+
const flowr_analyzer_file_plugin_1 = require("../flowr-analyzer-file-plugin");
|
|
6
|
+
const flowr_rmarkdown_file_1 = require("../files/flowr-rmarkdown-file");
|
|
7
|
+
const built_in_source_1 = require("../../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
8
|
+
/**
|
|
9
|
+
* Common base of the plugins reading an R Markdown flavor, which differ only in the files they claim.
|
|
10
|
+
*/
|
|
11
|
+
class FlowrAnalyzerRMarkdownFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
|
|
12
|
+
version = new semver_1.SemVer('0.1.0');
|
|
13
|
+
pattern;
|
|
14
|
+
constructor(filePattern) {
|
|
15
|
+
super();
|
|
16
|
+
this.pattern = filePattern;
|
|
17
|
+
}
|
|
18
|
+
applies(file) {
|
|
19
|
+
return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
|
|
20
|
+
}
|
|
21
|
+
process(ctx, arg) {
|
|
22
|
+
return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg, ctx);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.FlowrAnalyzerRMarkdownFilePlugin = FlowrAnalyzerRMarkdownFilePlugin;
|
|
26
|
+
//# sourceMappingURL=flowr-analyzer-rmarkdown-file-plugin.js.map
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SemVer } from 'semver';
|
|
3
|
-
import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-context';
|
|
4
|
-
import type { FlowrFileProvider } from '../../../context/flowr-file';
|
|
5
|
-
import { FlowrAnalyzerFilePlugin } from '../flowr-analyzer-file-plugin';
|
|
6
|
-
import { FlowrRMarkdownFile } from '../files/flowr-rmarkdown-file';
|
|
1
|
+
import { FlowrAnalyzerRMarkdownFilePlugin } from './flowr-analyzer-rmarkdown-file-plugin';
|
|
7
2
|
export declare const RmdPattern: RegExp;
|
|
8
3
|
/**
|
|
9
4
|
* The plugin provides support for R Markdown (`.rmd`) files
|
|
10
5
|
*/
|
|
11
|
-
export declare class FlowrAnalyzerRmdFilePlugin extends
|
|
6
|
+
export declare class FlowrAnalyzerRmdFilePlugin extends FlowrAnalyzerRMarkdownFilePlugin {
|
|
12
7
|
readonly name = "rmd-file-plugin";
|
|
13
8
|
readonly description = "Parses R Markdown files";
|
|
14
|
-
readonly version: SemVer;
|
|
15
|
-
private readonly pattern;
|
|
16
9
|
/**
|
|
17
10
|
* Creates a new instance of the R Markdown file plugin.
|
|
18
11
|
* @param filePattern - The pattern to identify R Markdown files, see {@link RmdPattern} for the default pattern.
|
|
19
12
|
*/
|
|
20
13
|
constructor(filePattern?: RegExp);
|
|
21
|
-
applies(file: PathLike): boolean;
|
|
22
|
-
protected process(ctx: FlowrAnalyzerContext, arg: FlowrFileProvider<string>): FlowrRMarkdownFile;
|
|
23
14
|
}
|
|
@@ -1,33 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowrAnalyzerRmdFilePlugin = exports.RmdPattern = void 0;
|
|
4
|
-
const
|
|
5
|
-
const flowr_analyzer_file_plugin_1 = require("../flowr-analyzer-file-plugin");
|
|
6
|
-
const flowr_rmarkdown_file_1 = require("../files/flowr-rmarkdown-file");
|
|
7
|
-
const built_in_source_1 = require("../../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
4
|
+
const flowr_analyzer_rmarkdown_file_plugin_1 = require("./flowr-analyzer-rmarkdown-file-plugin");
|
|
8
5
|
/* `.Rmarkdown` is the knitr-only variant used by blogdown and quarto */
|
|
9
6
|
exports.RmdPattern = /\.(rmd|rmarkdown)$/i;
|
|
10
7
|
/**
|
|
11
8
|
* The plugin provides support for R Markdown (`.rmd`) files
|
|
12
9
|
*/
|
|
13
|
-
class FlowrAnalyzerRmdFilePlugin extends
|
|
10
|
+
class FlowrAnalyzerRmdFilePlugin extends flowr_analyzer_rmarkdown_file_plugin_1.FlowrAnalyzerRMarkdownFilePlugin {
|
|
14
11
|
name = 'rmd-file-plugin';
|
|
15
12
|
description = 'Parses R Markdown files';
|
|
16
|
-
version = new semver_1.SemVer('0.1.0');
|
|
17
|
-
pattern;
|
|
18
13
|
/**
|
|
19
14
|
* Creates a new instance of the R Markdown file plugin.
|
|
20
15
|
* @param filePattern - The pattern to identify R Markdown files, see {@link RmdPattern} for the default pattern.
|
|
21
16
|
*/
|
|
22
17
|
constructor(filePattern = exports.RmdPattern) {
|
|
23
|
-
super();
|
|
24
|
-
this.pattern = filePattern;
|
|
25
|
-
}
|
|
26
|
-
applies(file) {
|
|
27
|
-
return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
|
|
28
|
-
}
|
|
29
|
-
process(ctx, arg) {
|
|
30
|
-
return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg, ctx);
|
|
18
|
+
super(filePattern);
|
|
31
19
|
}
|
|
32
20
|
}
|
|
33
21
|
exports.FlowrAnalyzerRmdFilePlugin = FlowrAnalyzerRmdFilePlugin;
|
|
@@ -4,7 +4,6 @@ exports.FlowrAnalyzerLoadingOrderDescriptionFilePlugin = void 0;
|
|
|
4
4
|
const flowr_analyzer_description_file_plugin_1 = require("../file-plugins/flowr-analyzer-description-file-plugin");
|
|
5
5
|
const semver_1 = require("semver");
|
|
6
6
|
const flowr_analyzer_loading_order_plugin_1 = require("./flowr-analyzer-loading-order-plugin");
|
|
7
|
-
const flowr_file_1 = require("../../context/flowr-file");
|
|
8
7
|
/**
|
|
9
8
|
* This plugin extracts loading order information from R `DESCRIPTION` files.
|
|
10
9
|
* It looks at the `Collate` field to determine the order in which files should be loaded.
|
|
@@ -15,16 +14,11 @@ class FlowrAnalyzerLoadingOrderDescriptionFilePlugin extends flowr_analyzer_load
|
|
|
15
14
|
description = 'Orders the files by the Collate field of a DESCRIPTION file.';
|
|
16
15
|
version = new semver_1.SemVer('0.1.0');
|
|
17
16
|
process(ctx) {
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
flowr_analyzer_description_file_plugin_1.descriptionFileLog.debug('No description file found, cannot determine loading order from Collate field.');
|
|
17
|
+
const deps = flowr_analyzer_description_file_plugin_1.DescriptionFile.single(ctx, 'No description file found, cannot determine loading order from Collate field.');
|
|
18
|
+
if (deps === undefined) {
|
|
21
19
|
return;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
flowr_analyzer_description_file_plugin_1.descriptionFileLog.warn(`Found ${descFiles.length} description files, expected exactly one.`);
|
|
25
|
-
}
|
|
26
|
-
/** this will do the caching etc. for me */
|
|
27
|
-
const collate = descFiles[0].collate();
|
|
21
|
+
const collate = deps.collate();
|
|
28
22
|
if (collate) {
|
|
29
23
|
/* we probably have to do some more guesswork here */
|
|
30
24
|
const unordered = ctx.files.loadingOrder.getUnorderedRequests();
|
|
@@ -50,7 +44,7 @@ class FlowrAnalyzerLoadingOrderDescriptionFilePlugin extends flowr_analyzer_load
|
|
|
50
44
|
ctx.files.loadingOrder.addGuess(sorted, true);
|
|
51
45
|
}
|
|
52
46
|
else {
|
|
53
|
-
flowr_analyzer_description_file_plugin_1.descriptionFileLog.info(`No Collate field in DESCRIPTION file ${
|
|
47
|
+
flowr_analyzer_description_file_plugin_1.descriptionFileLog.info(`No Collate field in DESCRIPTION file ${deps.path().toString()}`);
|
|
54
48
|
}
|
|
55
49
|
}
|
|
56
50
|
}
|
package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.FlowrAnalyzerMetaDescriptionFilePlugin = void 0;
|
|
|
4
4
|
const flowr_analyzer_package_versions_plugin_1 = require("./flowr-analyzer-package-versions-plugin");
|
|
5
5
|
const flowr_analyzer_description_file_plugin_1 = require("../file-plugins/flowr-analyzer-description-file-plugin");
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
|
-
const flowr_file_1 = require("../../context/flowr-file");
|
|
8
7
|
const flowr_analyzer_meta_context_1 = require("../../context/flowr-analyzer-meta-context");
|
|
9
8
|
/**
|
|
10
9
|
* This plugin extracts package meta information from R `DESCRIPTION` files.
|
|
@@ -14,16 +13,10 @@ class FlowrAnalyzerMetaDescriptionFilePlugin extends flowr_analyzer_package_vers
|
|
|
14
13
|
description = 'Extracts package meta information from DESCRIPTION files.';
|
|
15
14
|
version = new semver_1.SemVer('0.1.0');
|
|
16
15
|
process(ctx) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
flowr_analyzer_description_file_plugin_1.descriptionFileLog.debug('No description file found, cannot extract package versions.');
|
|
16
|
+
const deps = flowr_analyzer_description_file_plugin_1.DescriptionFile.single(ctx, 'No description file found, cannot extract package versions.');
|
|
17
|
+
if (deps === undefined) {
|
|
20
18
|
return;
|
|
21
19
|
}
|
|
22
|
-
else if (descFiles.length > 1) {
|
|
23
|
-
flowr_analyzer_description_file_plugin_1.descriptionFileLog.warn(`Found ${descFiles.length} description files, expected exactly one.`);
|
|
24
|
-
}
|
|
25
|
-
/** this will do the caching etc. for me */
|
|
26
|
-
const deps = descFiles[0];
|
|
27
20
|
const pkg = deps.packageName();
|
|
28
21
|
ctx.meta.contribute({
|
|
29
22
|
name: pkg,
|
|
@@ -4,7 +4,6 @@ exports.FlowrAnalyzerPackageVersionsDescriptionFilePlugin = void 0;
|
|
|
4
4
|
const flowr_analyzer_package_versions_plugin_1 = require("./flowr-analyzer-package-versions-plugin");
|
|
5
5
|
const flowr_analyzer_description_file_plugin_1 = require("../file-plugins/flowr-analyzer-description-file-plugin");
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
|
-
const flowr_file_1 = require("../../context/flowr-file");
|
|
8
7
|
/**
|
|
9
8
|
* This plugin extracts package versions from R `DESCRIPTION` files.
|
|
10
9
|
* It looks at the `Depends` and `Imports` fields to find package names and their version constraints.
|
|
@@ -14,16 +13,10 @@ class FlowrAnalyzerPackageVersionsDescriptionFilePlugin extends flowr_analyzer_p
|
|
|
14
13
|
description = 'Extracts package versions from DESCRIPTION files.';
|
|
15
14
|
version = new semver_1.SemVer('0.1.0');
|
|
16
15
|
process(ctx) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
flowr_analyzer_description_file_plugin_1.descriptionFileLog.debug('No description file found, cannot extract package versions.');
|
|
16
|
+
const deps = flowr_analyzer_description_file_plugin_1.DescriptionFile.single(ctx, 'No description file found, cannot extract package versions.');
|
|
17
|
+
if (deps === undefined) {
|
|
20
18
|
return;
|
|
21
19
|
}
|
|
22
|
-
else if (descFiles.length > 1) {
|
|
23
|
-
flowr_analyzer_description_file_plugin_1.descriptionFileLog.warn(`Found ${descFiles.length} description files, expected exactly one.`);
|
|
24
|
-
}
|
|
25
|
-
/** this will do the caching etc. for me */
|
|
26
|
-
const deps = descFiles[0];
|
|
27
20
|
this.retrieveVersionsFromField(ctx, deps.depends() ?? []);
|
|
28
21
|
this.retrieveVersionsFromField(ctx, deps.imports() ?? []);
|
|
29
22
|
}
|
package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js
CHANGED
|
@@ -323,7 +323,7 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
323
323
|
const seen = new Set();
|
|
324
324
|
const owners = [];
|
|
325
325
|
for (const src of sources) {
|
|
326
|
-
for (const pkg of
|
|
326
|
+
for (const pkg of src.packagesExporting(name)) {
|
|
327
327
|
if (!seen.has(pkg) && !this.isSelfPackage(pkg)) {
|
|
328
328
|
seen.add(pkg);
|
|
329
329
|
owners.push(pkg);
|
|
@@ -26,6 +26,12 @@ export interface PackageSignatureSource {
|
|
|
26
26
|
* {@link LibraryExports.s4Classes}); S3 ownership wins a tie. `undefined` if none does. Without `version`, backed
|
|
27
27
|
* by a reverse index over every package's latest version, built once and cached.
|
|
28
28
|
*/
|
|
29
|
+
/**
|
|
30
|
+
* The packages exporting `name`, ordered by downloads (descending, ties by name). Answered without building
|
|
31
|
+
* a reverse index: a name the database never stores is rejected outright, and only the blobs that may hold
|
|
32
|
+
* it are decoded.
|
|
33
|
+
*/
|
|
34
|
+
packagesExporting(name: string): readonly string[];
|
|
29
35
|
classOwner(className: string, version?: string): string | undefined;
|
|
30
36
|
/** rich per-function view (signatures + call graphs) of a package version */
|
|
31
37
|
functions(pkg: string, version?: string): DecodedFunction[] | undefined;
|
|
@@ -94,6 +100,7 @@ export declare class MergedSignatureSource implements PackageSignatureSource {
|
|
|
94
100
|
hasVersion(pkg: string, version: string): boolean;
|
|
95
101
|
isCranVersion(pkg: string, version: string): boolean;
|
|
96
102
|
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
103
|
+
packagesExporting(name: string): readonly string[];
|
|
97
104
|
classOwner(className: string, version?: string): string | undefined;
|
|
98
105
|
functions(pkg: string, version?: string): DecodedFunction[] | undefined;
|
|
99
106
|
functionByName(pkg: string, name: string, version?: string): DecodedFunction | undefined;
|
|
@@ -195,6 +202,7 @@ export declare class SigDatabase implements PackageSignatureSource {
|
|
|
195
202
|
/** whether a version is a current CRAN release (not in the package's `noncran`/removed set) */
|
|
196
203
|
isCranVersion(pkg: string, version: string): boolean;
|
|
197
204
|
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
205
|
+
packagesExporting(name: string): readonly string[];
|
|
198
206
|
classOwner(className: string, version?: string): string | undefined;
|
|
199
207
|
/** resolve a package version to its blob and the function-record indices of that version (the shared prologue of {@link functions}/{@link functionByName}) */
|
|
200
208
|
private versionFns;
|
|
@@ -296,6 +304,7 @@ export declare class SigDatabaseSet implements PackageSignatureSource {
|
|
|
296
304
|
/** the first non-empty result from the shards that can serve `pkg` (in preferred order: current before full) */
|
|
297
305
|
private firstOf;
|
|
298
306
|
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
307
|
+
packagesExporting(name: string): readonly string[];
|
|
299
308
|
classOwner(className: string, version?: string): string | undefined;
|
|
300
309
|
functions(pkg: string, version?: string): DecodedFunction[] | undefined;
|
|
301
310
|
functionByName(pkg: string, name: string, version?: string): DecodedFunction | undefined;
|
package/project/sigdb/reader.js
CHANGED
|
@@ -183,6 +183,15 @@ class MergedSignatureSource {
|
|
|
183
183
|
lookup(pkg, version) {
|
|
184
184
|
return this.pick(pkg, version)?.lookup(pkg, version);
|
|
185
185
|
}
|
|
186
|
+
packagesExporting(name) {
|
|
187
|
+
const found = new Set();
|
|
188
|
+
for (const s of this.sources) {
|
|
189
|
+
for (const pkg of s.packagesExporting(name)) {
|
|
190
|
+
found.add(pkg);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return [...found].sort((a, b) => this.downloads(b) - this.downloads(a) || a.localeCompare(b));
|
|
194
|
+
}
|
|
186
195
|
classOwner(className, version) {
|
|
187
196
|
for (const s of this.sources) {
|
|
188
197
|
const owner = s.classOwner(className, version);
|
|
@@ -455,6 +464,18 @@ class SigDatabase {
|
|
|
455
464
|
}
|
|
456
465
|
return (0, decode_1.deriveLibraryExports)(this.strings, blob, meta, pkg, version, this.cranBase);
|
|
457
466
|
}
|
|
467
|
+
packagesExporting(name) {
|
|
468
|
+
if (this.nameId(name) < 0) {
|
|
469
|
+
return [];
|
|
470
|
+
}
|
|
471
|
+
const found = [];
|
|
472
|
+
for (const pkg of this.packageNames()) {
|
|
473
|
+
if (this.mayOffer(pkg, name) && this.lookup(pkg)?.exported.includes(name)) {
|
|
474
|
+
found.push(pkg);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return found.sort((a, b) => this.downloads(b) - this.downloads(a) || a.localeCompare(b));
|
|
478
|
+
}
|
|
458
479
|
classOwner(className, version) {
|
|
459
480
|
if (version !== undefined) {
|
|
460
481
|
return classOwnerAtVersion(this, className, version);
|
|
@@ -819,6 +840,15 @@ class SigDatabaseSet {
|
|
|
819
840
|
lookup(pkg, version) {
|
|
820
841
|
return this.firstOf(pkg, version, db => db.lookup(pkg, version));
|
|
821
842
|
}
|
|
843
|
+
packagesExporting(name) {
|
|
844
|
+
const found = new Set();
|
|
845
|
+
for (const idx of this.indices.keys()) {
|
|
846
|
+
for (const pkg of this.shard(idx)?.packagesExporting(name) ?? []) {
|
|
847
|
+
found.add(pkg);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return [...found].sort((a, b) => this.downloads(b) - this.downloads(a) || a.localeCompare(b));
|
|
851
|
+
}
|
|
822
852
|
classOwner(className, version) {
|
|
823
853
|
if (version !== undefined) {
|
|
824
854
|
return classOwnerAtVersion(this, className, version);
|
|
@@ -53,7 +53,7 @@ exports.DefaultInputClassifierConfig = {
|
|
|
53
53
|
function inputSourcesQueryLineParser(output, line, _config) {
|
|
54
54
|
const criterion = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
|
|
55
55
|
if (!criterion || criterion.length !== 1) {
|
|
56
|
-
output.stderr(output.formatter.format('Invalid
|
|
56
|
+
output.stderr(output.formatter.format('Invalid input sources query format, a single slicing criterion must be given in the form "(criterion1)"', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
57
57
|
return { query: [] };
|
|
58
58
|
}
|
|
59
59
|
return { query: [{
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import type { InspectExceptionQuery, InspectExceptionQueryResult } from './inspect-exception-query-format';
|
|
2
2
|
import type { BasicQueryData } from '../../base-query-format';
|
|
3
|
-
import { SlicingCriterion } from '../../../slicing/criterion/parse';
|
|
4
|
-
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
|
-
import type { ReadonlyFlowrAnalysisProvider } from '../../../project/flowr-analyzer';
|
|
6
|
-
/**
|
|
7
|
-
* Get the functions to consider in the call graph based on the given queries.
|
|
8
|
-
*/
|
|
9
|
-
export declare function getFunctionsToConsiderInCallGraph(queries: readonly {
|
|
10
|
-
filter?: readonly SlicingCriterion[];
|
|
11
|
-
}[], analyzer: ReadonlyFlowrAnalysisProvider, onlyDefinitions?: boolean): Promise<{
|
|
12
|
-
cg: import("../../../dataflow/graph/call-graph").CallGraph;
|
|
13
|
-
fns: MapIterator<[NodeId, Required<import("../../../dataflow/graph/vertex").DataflowGraphVertexFunctionCall | import("../../../dataflow/graph/vertex").DataflowGraphVertexFunctionDefinition>]>;
|
|
14
|
-
}>;
|
|
15
3
|
/**
|
|
16
4
|
* Execute exception function inspection queries on the given analyzer.
|
|
17
5
|
*/
|
|
@@ -1,49 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFunctionsToConsiderInCallGraph = getFunctionsToConsiderInCallGraph;
|
|
4
3
|
exports.executeExceptionQuery = executeExceptionQuery;
|
|
5
|
-
const
|
|
6
|
-
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
4
|
+
const query_function_filter_1 = require("../../query-function-filter");
|
|
7
5
|
const exceptions_of_function_1 = require("../../../dataflow/fn/exceptions-of-function");
|
|
8
|
-
/**
|
|
9
|
-
* Get the functions to consider in the call graph based on the given queries.
|
|
10
|
-
*/
|
|
11
|
-
async function getFunctionsToConsiderInCallGraph(queries, analyzer, onlyDefinitions = true) {
|
|
12
|
-
let filters = undefined;
|
|
13
|
-
// filter will remain undefined if at least one of the queries wants all functions
|
|
14
|
-
for (const q of queries) {
|
|
15
|
-
if (q.filter === undefined) {
|
|
16
|
-
filters = undefined;
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
filters ??= [];
|
|
21
|
-
filters = filters.concat(q.filter);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const ast = await analyzer.normalize();
|
|
25
|
-
const filterFor = new Set();
|
|
26
|
-
if (filters) {
|
|
27
|
-
for (const f of filters) {
|
|
28
|
-
const i = parse_1.SlicingCriterion.tryParse(f, ast.idMap);
|
|
29
|
-
if (i !== undefined) {
|
|
30
|
-
filterFor.add(i);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const cg = await analyzer.callGraph();
|
|
35
|
-
let fns = (onlyDefinitions || filterFor.size === 0 ? cg.verticesOfType(vertex_1.VertexType.FunctionDefinition) : cg.vertices(true));
|
|
36
|
-
if (filterFor.size > 0) {
|
|
37
|
-
fns = fns.filter(([id]) => filterFor.has(id));
|
|
38
|
-
}
|
|
39
|
-
return { cg, fns };
|
|
40
|
-
}
|
|
41
6
|
/**
|
|
42
7
|
* Execute exception function inspection queries on the given analyzer.
|
|
43
8
|
*/
|
|
44
9
|
async function executeExceptionQuery({ analyzer }, queries) {
|
|
45
10
|
const start = Date.now();
|
|
46
|
-
const { cg, fns } = await
|
|
11
|
+
const { cg, fns } = await query_function_filter_1.QueryFunctionFilter.inCallGraph(queries, analyzer);
|
|
47
12
|
const result = {};
|
|
48
13
|
for (const [id] of fns) {
|
|
49
14
|
if (result[id]) {
|
|
@@ -2,36 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeHigherOrderQuery = executeHigherOrderQuery;
|
|
4
4
|
const higher_order_function_1 = require("../../../dataflow/fn/higher-order-function");
|
|
5
|
-
const parse_1 = require("../../../slicing/criterion/parse");
|
|
6
5
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
7
6
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
7
|
+
const query_function_filter_1 = require("../../query-function-filter");
|
|
8
8
|
/**
|
|
9
9
|
* Execute higher-order function inspection queries on the given analyzer.
|
|
10
10
|
*/
|
|
11
11
|
async function executeHigherOrderQuery({ analyzer }, queries) {
|
|
12
12
|
const start = Date.now();
|
|
13
|
-
|
|
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
|
-
}
|
|
13
|
+
const filterFor = await query_function_filter_1.QueryFunctionFilter.criteria(queries, analyzer);
|
|
35
14
|
const graph = (await analyzer.dataflow()).graph;
|
|
36
15
|
const fns = graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)
|
|
37
16
|
.filter(([, v]) => filterFor.size === 0 || filterFor.has(v.id));
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeRecursionQuery = executeRecursionQuery;
|
|
4
4
|
const recursive_function_1 = require("../../../dataflow/fn/recursive-function");
|
|
5
|
-
const
|
|
5
|
+
const query_function_filter_1 = require("../../query-function-filter");
|
|
6
6
|
/**
|
|
7
7
|
* Execute recursion function inspection queries on the given analyzer.
|
|
8
8
|
*/
|
|
9
9
|
async function executeRecursionQuery({ analyzer }, queries) {
|
|
10
10
|
const start = Date.now();
|
|
11
|
-
const { cg, fns } = await
|
|
11
|
+
const { cg, fns } = await query_function_filter_1.QueryFunctionFilter.inCallGraph(queries, analyzer);
|
|
12
12
|
const result = {};
|
|
13
13
|
for (const [id] of fns) {
|
|
14
14
|
result[id] = (0, recursive_function_1.isFunctionRecursive)(id, cg);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
+
import type { ReadonlyFlowrAnalysisProvider } from '../project/flowr-analyzer';
|
|
3
|
+
import { SlicingCriterion } from '../slicing/criterion/parse';
|
|
4
|
+
/** A query that may restrict the functions it inspects to a set of slicing criteria. */
|
|
5
|
+
interface FunctionFilteringQuery {
|
|
6
|
+
filter?: readonly SlicingCriterion[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the function filter shared by the inspection queries (`inspect-*`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const QueryFunctionFilter: {
|
|
12
|
+
readonly name: "QueryFunctionFilter";
|
|
13
|
+
/** The ids the given queries restrict themselves to; empty if at least one query wants all functions. */
|
|
14
|
+
readonly criteria: (this: void, queries: readonly FunctionFilteringQuery[], analyzer: ReadonlyFlowrAnalysisProvider) => Promise<ReadonlySet<NodeId>>;
|
|
15
|
+
/** The call graph together with the functions the given queries want to inspect. */
|
|
16
|
+
readonly inCallGraph: (this: void, queries: readonly FunctionFilteringQuery[], analyzer: ReadonlyFlowrAnalysisProvider, onlyDefinitions?: boolean) => Promise<{
|
|
17
|
+
cg: import("../dataflow/graph/call-graph").CallGraph;
|
|
18
|
+
fns: MapIterator<[NodeId, Required<import("../dataflow/graph/vertex").DataflowGraphVertexFunctionCall | import("../dataflow/graph/vertex").DataflowGraphVertexFunctionDefinition>]>;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|