@eagleoutice/flowr 2.11.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -260
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +6 -2
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +3 -1
- package/benchmark/summarizer/second-phase/graph.js +5 -0
- package/cli/common/options.d.ts +8 -0
- package/cli/common/options.js +2 -0
- package/cli/common/scripts-info.d.ts +8 -0
- package/cli/flowr.js +1 -1
- package/cli/repl/commands/repl-commands.d.ts +1 -0
- package/cli/repl/commands/repl-commands.js +69 -17
- package/cli/repl/commands/repl-dataflow.js +48 -4
- package/cli/repl/commands/repl-main.d.ts +2 -0
- package/cli/repl/commands/repl-main.js +5 -0
- package/cli/repl/commands/repl-query.d.ts +4 -1
- package/cli/repl/commands/repl-query.js +72 -22
- package/cli/repl/commands/repl-signature.d.ts +7 -0
- package/cli/repl/commands/repl-signature.js +119 -0
- package/cli/repl/core.d.ts +8 -1
- package/cli/repl/core.js +46 -6
- package/cli/repl/ghost-hint.d.ts +37 -0
- package/cli/repl/ghost-hint.js +72 -0
- package/cli/repl/parser/slice-query-parser.d.ts +11 -1
- package/cli/repl/parser/slice-query-parser.js +45 -16
- package/cli/repl/print-version.d.ts +2 -4
- package/cli/repl/print-version.js +41 -23
- package/cli/repl/server/connection.js +19 -17
- package/cli/slicer-app.d.ts +2 -0
- package/cli/slicer-app.js +3 -3
- package/cli/wiki.d.ts +2 -2
- package/cli/wiki.js +2 -2
- package/config.d.ts +70 -13
- package/config.js +65 -7
- package/control-flow/cfg-dead-code.js +0 -1
- package/control-flow/control-flow-graph.js +6 -6
- package/control-flow/diff-cfg.js +2 -2
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/core/print/slice-diff-ansi.js +8 -8
- package/core/steps/all/core/20-dataflow.d.ts +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +5 -0
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +7 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +6 -2
- package/core/steps/pipeline/default-pipelines.d.ts +20 -16
- package/data/r-base-packages.generated.d.ts +44 -0
- package/data/r-base-packages.generated.js +32 -0
- package/data/r-base-primitives.generated.d.ts +1 -0
- package/data/r-base-primitives.generated.js +15 -0
- package/data/sigdb/sigdb.remote.json +112 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in.d.ts +14 -4
- package/dataflow/environments/built-in.js +13 -2
- package/dataflow/environments/data-masking-functions.d.ts +12 -0
- package/dataflow/environments/data-masking-functions.js +46 -0
- package/dataflow/environments/default-builtin-config.d.ts +72 -19
- package/dataflow/environments/default-builtin-config.js +48 -14
- package/dataflow/environments/diff.js +1 -1
- package/dataflow/environments/environment.js +1 -2
- package/dataflow/environments/identifier.d.ts +11 -4
- package/dataflow/environments/identifier.js +28 -10
- package/dataflow/environments/resolve-by-name.js +16 -2
- package/dataflow/extractor.js +6 -3
- package/dataflow/graph/call-graph.d.ts +2 -2
- package/dataflow/graph/df-helper.d.ts +4 -4
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/edge.d.ts +3 -3
- package/dataflow/graph/edge.js +3 -3
- package/dataflow/graph/graph-helper.d.ts +2 -2
- package/dataflow/internal/linker.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -49
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +111 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +12 -4
- package/dataflow/internal/process/functions/call/common.js +8 -1
- package/dataflow/internal/process/functions/call/default-call-handling.js +6 -0
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +17 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +32 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +29 -7
- package/dataflow/internal/process/functions/process-argument.js +12 -1
- package/dataflow/internal/process/process-named-call.d.ts +18 -1
- package/dataflow/internal/process/process-named-call.js +94 -0
- package/dataflow/processor.d.ts +18 -0
- package/documentation/data/faq/faqs.js +5 -1
- package/documentation/doc-capabilities.js +1 -1
- package/documentation/doc-util/doc-cli-option.d.ts +10 -0
- package/documentation/doc-util/doc-cli-option.js +23 -0
- package/documentation/doc-util/doc-dfg.js +2 -1
- package/documentation/doc-util/doc-query.d.ts +9 -3
- package/documentation/doc-util/doc-query.js +9 -4
- package/documentation/wiki-dataflow-graph.js +8 -5
- package/documentation/wiki-interface.js +3 -2
- package/documentation/wiki-linter.js +1 -1
- package/documentation/wiki-linting-and-testing.js +4 -1
- package/documentation/wiki-mk/doc-context.d.ts +14 -0
- package/documentation/wiki-mk/doc-context.js +3 -0
- package/documentation/wiki-mk/doc-maker.js +3 -1
- package/documentation/wiki-query.js +19 -1
- package/documentation/wiki-setup.js +10 -7
- package/documentation/wiki-signature-database.d.ts +16 -0
- package/documentation/wiki-signature-database.js +293 -0
- package/linter/linter-format.d.ts +7 -0
- package/linter/linter-rules.d.ts +10 -9
- package/linter/rules/naming-convention.d.ts +1 -0
- package/linter/rules/naming-convention.js +2 -0
- package/linter/rules/no-leaked-credentials.js +1 -2
- package/linter/rules/roxygen-arguments.js +18 -5
- package/linter/rules/stop-with-call-arg.js +2 -2
- package/linter/rules/undefined-symbol-util.d.ts +36 -0
- package/linter/rules/undefined-symbol-util.js +149 -0
- package/linter/rules/undefined-symbol.d.ts +58 -17
- package/linter/rules/undefined-symbol.js +143 -33
- package/linter/rules/unused-definition.d.ts +8 -1
- package/linter/rules/unused-definition.js +126 -1
- package/package.json +23 -10
- package/project/context/abstract-flowr-analyzer-context.js +7 -1
- package/project/context/flowr-analyzer-context.d.ts +8 -0
- package/project/context/flowr-analyzer-context.js +10 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +28 -4
- package/project/context/flowr-analyzer-dependencies-context.js +53 -1
- package/project/context/flowr-analyzer-files-context.d.ts +1 -0
- package/project/context/flowr-analyzer-files-context.js +2 -1
- package/project/context/flowr-analyzer-functions-context.js +1 -1
- package/project/context/flowr-file.d.ts +5 -0
- package/project/context/flowr-file.js +5 -0
- package/project/flowr-analyzer-builder.js +12 -2
- package/project/plugins/file-plugins/files/flowr-description-file.js +6 -3
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +9 -3
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +26 -0
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +39 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +18 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +19 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +120 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +518 -0
- package/project/plugins/package-version-plugins/package.d.ts +5 -3
- package/project/plugins/package-version-plugins/package.js +27 -25
- package/project/plugins/plugin-registry.d.ts +3 -2
- package/project/plugins/plugin-registry.js +4 -2
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +7 -2
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +3 -1
- package/project/sigdb/build.d.ts +131 -0
- package/project/sigdb/build.js +628 -0
- package/project/sigdb/codec.d.ts +51 -0
- package/project/sigdb/codec.js +122 -0
- package/project/sigdb/decode.d.ts +58 -0
- package/project/sigdb/decode.js +129 -0
- package/project/sigdb/decompress.d.ts +44 -0
- package/project/sigdb/decompress.js +176 -0
- package/project/sigdb/hash.d.ts +9 -0
- package/project/sigdb/hash.js +54 -0
- package/project/sigdb/index-format.d.ts +40 -0
- package/project/sigdb/index-format.js +28 -0
- package/project/sigdb/manifest.d.ts +68 -0
- package/project/sigdb/manifest.js +146 -0
- package/project/sigdb/reader.d.ts +250 -0
- package/project/sigdb/reader.js +692 -0
- package/project/sigdb/schema.d.ts +196 -0
- package/project/sigdb/schema.js +33 -0
- package/project/sigdb/sigdb-download.d.ts +65 -0
- package/project/sigdb/sigdb-download.js +237 -0
- package/project/sigdb/signature-match.d.ts +26 -0
- package/project/sigdb/signature-match.js +40 -0
- package/project/sigdb/version.d.ts +20 -0
- package/project/sigdb/version.js +55 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -3
- package/queries/catalog/config-query/config-query-format.d.ts +3 -1
- package/queries/catalog/config-query/config-query-format.js +68 -9
- package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +2 -0
- package/queries/catalog/linter-query/linter-query-executor.js +6 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +2 -1
- package/queries/catalog/linter-query/linter-query-format.js +40 -8
- package/queries/catalog/project-query/project-query-executor.d.ts +15 -0
- package/queries/catalog/project-query/project-query-executor.js +96 -4
- package/queries/catalog/project-query/project-query-format.d.ts +44 -0
- package/queries/catalog/project-query/project-query-format.js +33 -2
- package/queries/catalog/signature-query/signature-query-executor.d.ts +29 -0
- package/queries/catalog/signature-query/signature-query-executor.js +461 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +138 -0
- package/queries/catalog/signature-query/signature-query-format.js +76 -0
- package/queries/catalog/signature-query/signature-query-render.d.ts +15 -0
- package/queries/catalog/signature-query/signature-query-render.js +155 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +9 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +10 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +19 -1
- package/queries/query-print.js +5 -0
- package/queries/query.d.ts +10 -1
- package/queries/query.js +5 -2
- package/r-bridge/init.js +5 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +10 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +55 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +16 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +27 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +89 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -1
- package/r-bridge/parser.d.ts +2 -0
- package/r-bridge/retriever.js +4 -1
- package/r-bridge/roxygen2/documentation-provider.js +2 -1
- package/r-bridge/shell.d.ts +5 -0
- package/r-bridge/shell.js +17 -1
- package/reconstruct/inline/source-inline-map.d.ts +48 -0
- package/reconstruct/inline/source-inline-map.js +94 -0
- package/reconstruct/reconstruct.d.ts +19 -2
- package/reconstruct/reconstruct.js +79 -16
- package/search/search-executor/search-generators.js +5 -22
- package/search/search-executor/search-transformer.js +10 -6
- package/slicing/criterion/parse.d.ts +22 -4
- package/slicing/criterion/parse.js +125 -18
- package/slicing/static/slice-call.d.ts +24 -1
- package/slicing/static/slice-call.js +90 -0
- package/slicing/static/static-slicer.d.ts +7 -0
- package/slicing/static/static-slicer.js +38 -3
- package/util/collections/arrays.d.ts +4 -5
- package/util/collections/arrays.js +7 -18
- package/util/hash.d.ts +14 -0
- package/util/hash.js +31 -0
- package/util/mermaid/dfg.d.ts +7 -2
- package/util/mermaid/dfg.js +53 -13
- package/util/r-base-packages.d.ts +19 -0
- package/util/r-base-packages.js +72 -0
- package/util/r-license.js +2 -10
- package/util/r-version.d.ts +45 -15
- package/util/r-version.js +97 -36
- package/util/range.d.ts +15 -0
- package/util/range.js +39 -0
- package/util/schema.d.ts +10 -0
- package/util/schema.js +22 -0
- package/util/text/ansi.d.ts +13 -1
- package/util/text/ansi.js +27 -4
- package/util/text/args.js +1 -2
- package/util/version.js +28 -8
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/documentation/wiki-package-database.d.ts +0 -9
- package/documentation/wiki-package-database.js +0 -63
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +0 -63
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +0 -174
- package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
- package/project/plugins/package-version-plugins/pkgdb.js +0 -370
package/cli/slicer-app.js
CHANGED
|
@@ -22,6 +22,7 @@ const options = (0, script_1.processCommandLineArgs)('slicer', ['input', 'criter
|
|
|
22
22
|
// why double escaped :C
|
|
23
23
|
'{bold -c} {italic "3@a"} {bold -r} {italic "a <- 3\\\\nb <- 4\\\\nprint(a)"} {bold --diff}',
|
|
24
24
|
'{bold -i} {italic example.R} {bold --stats} {bold --criterion} {italic "8:3;3:1;12@product"}',
|
|
25
|
+
'{bold -c} {italic "5@result"} {bold --inline} {italic main.R}',
|
|
25
26
|
'{bold --help}'
|
|
26
27
|
]
|
|
27
28
|
});
|
|
@@ -32,7 +33,7 @@ async function getSlice() {
|
|
|
32
33
|
const config = config_1.FlowrConfig.fromFile();
|
|
33
34
|
await slicer.init(options['input-is-text']
|
|
34
35
|
? { request: 'text', content: options.input.replaceAll('\\n', '\n') }
|
|
35
|
-
: { request: 'file', content: options.input }, config, options['no-magic-comments'] ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect));
|
|
36
|
+
: { request: 'file', content: options.input }, config, options['no-magic-comments'] ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect), undefined, options.inline, options['include-callees']);
|
|
36
37
|
let mappedSlices = [];
|
|
37
38
|
let reconstruct = undefined;
|
|
38
39
|
const doSlicing = options.criterion.trim() !== '';
|
|
@@ -76,8 +77,7 @@ async function getSlice() {
|
|
|
76
77
|
if (doSlicing && options.diff) {
|
|
77
78
|
let originalCode = options.input;
|
|
78
79
|
if (!options['input-is-text']) {
|
|
79
|
-
|
|
80
|
-
originalCode = request.request === 'text' ? request.content : fs_1.default.readFileSync(request.content).toString();
|
|
80
|
+
originalCode = fs_1.default.readFileSync(options.input).toString();
|
|
81
81
|
}
|
|
82
82
|
console.log((0, slice_diff_ansi_1.sliceDiffAnsi)(slice.result, normalize, new Set(mappedSlices.map(({ id }) => id)), originalCode));
|
|
83
83
|
}
|
package/cli/wiki.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import { WikiSetup } from '../documentation/wiki-setup';
|
|
|
10
10
|
import { WikiOverview } from '../documentation/wiki-overview';
|
|
11
11
|
import { WikiAbsint } from '../documentation/wiki-absint';
|
|
12
12
|
import { WikiCreateLintingRules } from '../documentation/wiki-create-linting-rules';
|
|
13
|
-
import {
|
|
14
|
-
export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, WikiCreateLintingRules,
|
|
13
|
+
import { WikiSignatureDatabase } from '../documentation/wiki-signature-database';
|
|
14
|
+
export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, WikiCreateLintingRules, WikiSignatureDatabase, IssueLintingRule, DocReadme, DocCapabilities];
|
|
15
15
|
export type ValidWikiDocumentTargets = ReturnType<typeof AllWikiDocuments[number]['getTarget']>;
|
|
16
16
|
export type ValidWikiDocumentTargetsNoSuffix = ValidWikiDocumentTargets extends `${infer Name}.${string}` ? Name : never;
|
|
17
17
|
/**
|
package/cli/wiki.js
CHANGED
|
@@ -28,7 +28,7 @@ const wiki_setup_1 = require("../documentation/wiki-setup");
|
|
|
28
28
|
const wiki_overview_1 = require("../documentation/wiki-overview");
|
|
29
29
|
const wiki_absint_1 = require("../documentation/wiki-absint");
|
|
30
30
|
const wiki_create_linting_rules_1 = require("../documentation/wiki-create-linting-rules");
|
|
31
|
-
const
|
|
31
|
+
const wiki_signature_database_1 = require("../documentation/wiki-signature-database");
|
|
32
32
|
exports.AllWikiDocuments = [
|
|
33
33
|
new wiki_faq_1.WikiFaq(),
|
|
34
34
|
new documentation_1.WikiSearch(),
|
|
@@ -47,7 +47,7 @@ exports.AllWikiDocuments = [
|
|
|
47
47
|
new wiki_linter_1.WikiLinter(),
|
|
48
48
|
new wiki_absint_1.WikiAbsint(),
|
|
49
49
|
new wiki_create_linting_rules_1.WikiCreateLintingRules(),
|
|
50
|
-
new
|
|
50
|
+
new wiki_signature_database_1.WikiSignatureDatabase(),
|
|
51
51
|
new issue_linting_rule_1.IssueLintingRule(),
|
|
52
52
|
new doc_readme_1.DocReadme(),
|
|
53
53
|
new documentation_1.DocCapabilities()
|
package/config.d.ts
CHANGED
|
@@ -16,6 +16,18 @@ export declare enum VariableResolve {
|
|
|
16
16
|
/** Only resolve directly assigned builtin constants */
|
|
17
17
|
Builtin = "builtin"
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* How a constrained dependency (e.g. `Imports: quantmod (>= 0.4-9)`) is resolved to a concrete version
|
|
21
|
+
* against the signature database (see `solver.sigdb.versionSelection`).
|
|
22
|
+
*/
|
|
23
|
+
export declare enum VersionSelection {
|
|
24
|
+
/** Resolve to the newest version satisfying the constraint (default; preserves the historic behavior). */
|
|
25
|
+
Newest = "newest",
|
|
26
|
+
/** Resolve to the oldest version satisfying the constraint. */
|
|
27
|
+
Oldest = "oldest",
|
|
28
|
+
/** Resolve to the version installed on the analyzing system (needs R; falls back to `newest` when unavailable). */
|
|
29
|
+
System = "system"
|
|
30
|
+
}
|
|
19
31
|
/**
|
|
20
32
|
* How to infer the working directory from a script
|
|
21
33
|
*/
|
|
@@ -117,12 +129,19 @@ export interface FlowrConfig extends MergeableRecord {
|
|
|
117
129
|
quickStats: boolean;
|
|
118
130
|
/** This instruments the dataflow processors to count how often each processor is called */
|
|
119
131
|
dfProcessorHeat: boolean;
|
|
132
|
+
/** Whether to show dim inline hints (e.g. `:help`) on the empty prompt; automatically disabled on non-interactive terminals */
|
|
133
|
+
hints: boolean;
|
|
120
134
|
/** Plugins to load in REPL mode */
|
|
121
135
|
plugins: (ConfigPlugin<string> | 'flowr:default')[];
|
|
122
136
|
};
|
|
123
137
|
readonly project: {
|
|
124
138
|
/** Whether to resolve unknown paths loaded by the r project disk when trying to source/analyze files */
|
|
125
139
|
resolveUnknownPathsOnDisk: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* The packages considered part of R itself, used e.g. by the project query to classify dependencies. If
|
|
142
|
+
* unset, flowR derives them (for the assumed R version) from the signature database via `baseRPackages`.
|
|
143
|
+
*/
|
|
144
|
+
basePackages?: string[];
|
|
126
145
|
};
|
|
127
146
|
/**
|
|
128
147
|
* The engines to use for interacting with R code. Currently, supports {@link TreeSitterEngineConfig} and {@link RShellEngineConfig}.
|
|
@@ -149,19 +168,43 @@ export interface FlowrConfig extends MergeableRecord {
|
|
|
149
168
|
* When disabled all envir-style calls fall through to the conservative global treatment.
|
|
150
169
|
*/
|
|
151
170
|
readonly trackEnvironments: boolean;
|
|
152
|
-
/**
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
171
|
+
/** Resolving `library()`/`use()` exports from a signature database (e.g. the bundled `flowr-sigdb`). */
|
|
172
|
+
readonly sigdb: {
|
|
173
|
+
/** Resolve library exports from a package database (default `true`); when `false` no database is consulted. */
|
|
174
|
+
readonly enabled: boolean;
|
|
175
|
+
/** Load the project's declared dependencies from its metadata files (`DESCRIPTION` Imports/Depends, `renv.lock`, `rv.lock`) into the dependency context (default `true`); when `false` these files are not read, so neither the undefined-symbol linter nor {@link linkDescriptionDependencies} sees any project-declared dependency. */
|
|
176
|
+
readonly loadProjectDependencies: boolean;
|
|
177
|
+
/** Parse the database up front rather than on the first package load (default `false`, ignored if disabled). */
|
|
178
|
+
readonly eagerlyLoad: boolean;
|
|
179
|
+
/** Add a vertex for every export on load rather than on demand (default `false`); keeps the graph small. */
|
|
180
|
+
readonly eagerlyLoadExports: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* The R version analysis assumes when resolving versioned (base-R) package exports: a pin like `"4.5"`,
|
|
183
|
+
* or `"auto"` to detect the locally installed R (falling back to {@link DefaultAssumedRVersion} when the
|
|
184
|
+
* engine reports none, e.g. the tree-sitter engine). Resolve it with {@link resolveAssumedRVersion}.
|
|
185
|
+
*/
|
|
186
|
+
readonly assumedRVersion?: string;
|
|
187
|
+
/** Eagerly attach base-R namespaces (from a signature database) so bare base calls resolve without `library()` (default `false`; changes every analysis; needs a base-R signature database). */
|
|
188
|
+
readonly linkBaseR: boolean;
|
|
189
|
+
/** Eagerly attach the namespaces of the project's declared `DESCRIPTION` dependencies (Imports/Depends) so their exports resolve without an explicit `library()` (default `false`; changes every analysis; needs a signature database resolving the declared packages). */
|
|
190
|
+
readonly linkDescriptionDependencies: boolean;
|
|
191
|
+
/** Add a lightweight `Reads` edge from a bare base-R call to its signature-database function vertex (`built-in:pkg:fn`); base-R qualification stays edge-free unless this is on (default `false`; adds edges to every base call). */
|
|
192
|
+
readonly linkBaseRCalls?: boolean;
|
|
193
|
+
/** Add a lightweight `Reads` edge from a resolved package call (`pkg::fn`/attached export) to its signature-database function vertex (default `false`). */
|
|
194
|
+
readonly linkPackageCalls?: boolean;
|
|
195
|
+
/** Decompress the hot shards (base + most-downloaded) in a background task on startup, so the first `library()` lookup is warm (default `false`; useful for long-running servers/REPLs, not one-shot runs). */
|
|
196
|
+
readonly warmInBackground?: boolean;
|
|
197
|
+
/** Extra directories (or bundle/manifest files) searched for signature databases, alongside the shipped default and `$FLOWR_SIGDB_DIR`. A downloaded full-history bundle placed here is mounted automatically. */
|
|
198
|
+
readonly additionalPaths?: string[];
|
|
199
|
+
/** GitHub `owner/repo` the full-history bundle is downloaded from (`:signature download`); default `flowr-analysis/flowr`, release tag `sigdb-v<flowR-version>`. */
|
|
200
|
+
readonly downloadRepo?: string;
|
|
201
|
+
/** On startup, compare the cache against the committed `sigdb.remote.json` link file and re-download changed shards in the background (default `false`; needs network, so opt-in — a `git pull` that updates the pointer then re-syncs automatically). */
|
|
202
|
+
readonly autoSync?: boolean;
|
|
203
|
+
/** When a project constrains a dependency, resolve to the `newest` (default) or `oldest` version satisfying the constraint, or the `system`-installed version (needs R; falls back to `newest` when unavailable). Base-R packages always resolve against the assumed R version. */
|
|
204
|
+
readonly versionSelection?: VersionSelection;
|
|
205
|
+
/** Force an exact version for specific packages (mapping a package name to a version), overriding both the project constraint and the {@link versionSelection} policy; a version missing from the database falls back with a warning (default `{}`). */
|
|
206
|
+
readonly versionOverrides?: Record<string, string>;
|
|
207
|
+
};
|
|
165
208
|
/** These keys are only intended for use within code, allowing to instrument the dataflow analyzer! */
|
|
166
209
|
readonly instrument: {
|
|
167
210
|
/**
|
|
@@ -234,6 +277,20 @@ export interface FlowrConfig extends MergeableRecord {
|
|
|
234
277
|
export type ValidFlowrConfigPaths = Paths<FlowrConfig, {
|
|
235
278
|
depth: 9;
|
|
236
279
|
}>;
|
|
280
|
+
/** Whether library exports should be resolved from a signature database (`solver.sigdb.enabled`). */
|
|
281
|
+
export declare function isSigDbEnabled(config: FlowrConfig | undefined): boolean;
|
|
282
|
+
/**
|
|
283
|
+
* R version assumed for analysis when `solver.sigdb.assumedRVersion` is `"auto"` and none could be detected.
|
|
284
|
+
* Kept in step with the newest base-R release in the bundled sigdb (see `newestRVersion` in the generated
|
|
285
|
+
* base-package cache) so the default hits the precomputed base-package fast path.
|
|
286
|
+
*/
|
|
287
|
+
export declare const DefaultAssumedRVersion = "4.5.3";
|
|
288
|
+
/**
|
|
289
|
+
* The R version analysis should assume when resolving versioned (base-R) exports (see `solver.sigdb.assumedRVersion`):
|
|
290
|
+
* an explicit pin wins, otherwise a real `detected` version (from the engine's `rVersion()`, ignoring `none`/`unknown`),
|
|
291
|
+
* otherwise {@link DefaultAssumedRVersion}. Pure and synchronous, so a resolver can call it per lookup.
|
|
292
|
+
*/
|
|
293
|
+
export declare function resolveAssumedRVersion(config: FlowrConfig | undefined, detected?: string): string;
|
|
237
294
|
export interface TreeSitterEngineConfig extends MergeableRecord {
|
|
238
295
|
readonly type: 'tree-sitter';
|
|
239
296
|
/**
|
package/config.js
CHANGED
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FlowrConfig = exports.FlowrDefaultPlugins = exports.DropPathsOption = exports.InferWorkingDirectory = exports.VariableResolve = void 0;
|
|
6
|
+
exports.FlowrConfig = exports.FlowrDefaultPlugins = exports.DefaultAssumedRVersion = exports.DropPathsOption = exports.InferWorkingDirectory = exports.VersionSelection = exports.VariableResolve = void 0;
|
|
7
|
+
exports.isSigDbEnabled = isSigDbEnabled;
|
|
8
|
+
exports.resolveAssumedRVersion = resolveAssumedRVersion;
|
|
7
9
|
const objects_1 = require("./util/objects");
|
|
8
10
|
const path_1 = __importDefault(require("path"));
|
|
9
11
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -21,6 +23,19 @@ var VariableResolve;
|
|
|
21
23
|
/** Only resolve directly assigned builtin constants */
|
|
22
24
|
VariableResolve["Builtin"] = "builtin";
|
|
23
25
|
})(VariableResolve || (exports.VariableResolve = VariableResolve = {}));
|
|
26
|
+
/**
|
|
27
|
+
* How a constrained dependency (e.g. `Imports: quantmod (>= 0.4-9)`) is resolved to a concrete version
|
|
28
|
+
* against the signature database (see `solver.sigdb.versionSelection`).
|
|
29
|
+
*/
|
|
30
|
+
var VersionSelection;
|
|
31
|
+
(function (VersionSelection) {
|
|
32
|
+
/** Resolve to the newest version satisfying the constraint (default; preserves the historic behavior). */
|
|
33
|
+
VersionSelection["Newest"] = "newest";
|
|
34
|
+
/** Resolve to the oldest version satisfying the constraint. */
|
|
35
|
+
VersionSelection["Oldest"] = "oldest";
|
|
36
|
+
/** Resolve to the version installed on the analyzing system (needs R; falls back to `newest` when unavailable). */
|
|
37
|
+
VersionSelection["System"] = "system";
|
|
38
|
+
})(VersionSelection || (exports.VersionSelection = VersionSelection = {}));
|
|
24
39
|
/**
|
|
25
40
|
* How to infer the working directory from a script
|
|
26
41
|
*/
|
|
@@ -47,6 +62,31 @@ var DropPathsOption;
|
|
|
47
62
|
/** try to drop every folder of the path */
|
|
48
63
|
DropPathsOption["All"] = "all";
|
|
49
64
|
})(DropPathsOption || (exports.DropPathsOption = DropPathsOption = {}));
|
|
65
|
+
/** Whether library exports should be resolved from a signature database (`solver.sigdb.enabled`). */
|
|
66
|
+
function isSigDbEnabled(config) {
|
|
67
|
+
return config?.solver.sigdb.enabled === true;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* R version assumed for analysis when `solver.sigdb.assumedRVersion` is `"auto"` and none could be detected.
|
|
71
|
+
* Kept in step with the newest base-R release in the bundled sigdb (see `newestRVersion` in the generated
|
|
72
|
+
* base-package cache) so the default hits the precomputed base-package fast path.
|
|
73
|
+
*/
|
|
74
|
+
exports.DefaultAssumedRVersion = '4.5.3';
|
|
75
|
+
/**
|
|
76
|
+
* The R version analysis should assume when resolving versioned (base-R) exports (see `solver.sigdb.assumedRVersion`):
|
|
77
|
+
* an explicit pin wins, otherwise a real `detected` version (from the engine's `rVersion()`, ignoring `none`/`unknown`),
|
|
78
|
+
* otherwise {@link DefaultAssumedRVersion}. Pure and synchronous, so a resolver can call it per lookup.
|
|
79
|
+
*/
|
|
80
|
+
function resolveAssumedRVersion(config, detected) {
|
|
81
|
+
const assumed = config?.solver.sigdb.assumedRVersion;
|
|
82
|
+
if (assumed && assumed !== 'auto') {
|
|
83
|
+
return assumed;
|
|
84
|
+
}
|
|
85
|
+
if (detected && detected !== 'none' && detected !== 'unknown') {
|
|
86
|
+
return detected;
|
|
87
|
+
}
|
|
88
|
+
return exports.DefaultAssumedRVersion;
|
|
89
|
+
}
|
|
50
90
|
const defaultEngineConfigs = {
|
|
51
91
|
'tree-sitter': { type: 'tree-sitter' },
|
|
52
92
|
'r-shell': { type: 'r-shell' }
|
|
@@ -54,13 +94,14 @@ const defaultEngineConfigs = {
|
|
|
54
94
|
exports.FlowrDefaultPlugins = [
|
|
55
95
|
'file:description',
|
|
56
96
|
'versions:description',
|
|
57
|
-
'versions:
|
|
97
|
+
'versions:sigdb',
|
|
58
98
|
'versions:renv',
|
|
59
99
|
'versions:rv',
|
|
60
100
|
'loading-order:description',
|
|
61
101
|
'meta:description',
|
|
62
102
|
'files:vignette',
|
|
63
103
|
'files:test',
|
|
104
|
+
'files:inst',
|
|
64
105
|
'file:rmd',
|
|
65
106
|
'file:qmd',
|
|
66
107
|
'file:rnw',
|
|
@@ -94,6 +135,7 @@ exports.FlowrConfig = {
|
|
|
94
135
|
repl: {
|
|
95
136
|
quickStats: false,
|
|
96
137
|
dfProcessorHeat: false,
|
|
138
|
+
hints: true,
|
|
97
139
|
plugins: ['flowr:default'],
|
|
98
140
|
},
|
|
99
141
|
project: {
|
|
@@ -105,8 +147,7 @@ exports.FlowrConfig = {
|
|
|
105
147
|
variables: VariableResolve.Alias,
|
|
106
148
|
evalStrings: true,
|
|
107
149
|
trackEnvironments: true,
|
|
108
|
-
|
|
109
|
-
eagerlyLoadPackageDatabase: false,
|
|
150
|
+
sigdb: { enabled: true, loadProjectDependencies: true, eagerlyLoad: false, eagerlyLoadExports: false, assumedRVersion: 'auto', linkBaseR: false, linkDescriptionDependencies: false, linkBaseRCalls: false, linkPackageCalls: false, warmInBackground: false, additionalPaths: [], autoSync: false, versionSelection: VersionSelection.Newest, versionOverrides: {} },
|
|
110
151
|
resolveSource: {
|
|
111
152
|
dropPaths: DropPathsOption.No,
|
|
112
153
|
ignoreCapitalization: true,
|
|
@@ -158,10 +199,12 @@ exports.FlowrConfig = {
|
|
|
158
199
|
repl: joi_1.default.object({
|
|
159
200
|
quickStats: joi_1.default.boolean().optional().description('Whether to show quick stats in the REPL after each evaluation.'),
|
|
160
201
|
dfProcessorHeat: joi_1.default.boolean().optional().description('This instruments the dataflow processors to count how often each processor is called.'),
|
|
202
|
+
hints: joi_1.default.boolean().optional().description('Whether to show dim inline hints on the empty prompt (automatically disabled on non-interactive terminals).'),
|
|
161
203
|
plugins: joi_1.default.array().items(joi_1.default.alternatives().try(joi_1.default.string(), joi_1.default.array().ordered(joi_1.default.string(), joi_1.default.array().items(joi_1.default.any())).length(2))).optional().description('The plugins to load in REPL mode')
|
|
162
204
|
}).description('Configuration options for the REPL.'),
|
|
163
205
|
project: joi_1.default.object({
|
|
164
|
-
resolveUnknownPathsOnDisk: joi_1.default.boolean().optional().description('Whether to resolve unknown paths loaded by the r project disk when trying to source/analyze files.')
|
|
206
|
+
resolveUnknownPathsOnDisk: joi_1.default.boolean().optional().description('Whether to resolve unknown paths loaded by the r project disk when trying to source/analyze files.'),
|
|
207
|
+
basePackages: joi_1.default.array().items(joi_1.default.string()).optional().description('The packages considered part of R itself (base and recommended); if unset, flowR uses its built-in list.')
|
|
165
208
|
}).description('Project specific configuration options.'),
|
|
166
209
|
engines: joi_1.default.array().items(joi_1.default.alternatives(joi_1.default.object({
|
|
167
210
|
type: joi_1.default.string().required().valid('tree-sitter').description('Use the tree sitter engine.'),
|
|
@@ -177,8 +220,23 @@ exports.FlowrConfig = {
|
|
|
177
220
|
variables: joi_1.default.string().valid(...Object.values(VariableResolve)).description('How to resolve variables and their values.'),
|
|
178
221
|
evalStrings: joi_1.default.boolean().description('Should we include eval(parse(text="...")) calls in the dataflow graph?'),
|
|
179
222
|
trackEnvironments: joi_1.default.boolean().optional().description('Track user-created environments (new.env, assign/get/local with envir=, dollar-assign, attach). When false, all envir-style calls fall through conservatively.'),
|
|
180
|
-
|
|
181
|
-
|
|
223
|
+
sigdb: joi_1.default.object({
|
|
224
|
+
enabled: joi_1.default.boolean().optional().description('Resolve library()/use() exports from a signature database (default true); when false no database is consulted.'),
|
|
225
|
+
loadProjectDependencies: joi_1.default.boolean().optional().description('Load the project\'s declared dependencies from its metadata files (DESCRIPTION Imports/Depends, renv.lock, rv.lock) (default true); when false these files are not read for dependencies.'),
|
|
226
|
+
eagerlyLoad: joi_1.default.boolean().optional().description('Parse the database up front rather than on the first package load (default false, ignored if disabled).'),
|
|
227
|
+
eagerlyLoadExports: joi_1.default.boolean().optional().description('Add a vertex for every export on load rather than on demand (default false); keeps the dataflow graph small.'),
|
|
228
|
+
assumedRVersion: joi_1.default.string().optional().description('R version assumed when resolving versioned (base-R) exports: a pin like "4.5" or "auto" to detect the installed R (default "auto").'),
|
|
229
|
+
linkBaseR: joi_1.default.boolean().optional().description('Eagerly attach base-R namespaces so bare base calls resolve without library() (default false).'),
|
|
230
|
+
linkBaseRCalls: joi_1.default.boolean().optional().description('Add a lightweight Reads edge from a bare base-R call to its signature-database function vertex (default false; base-R qualification is edge-free otherwise).'),
|
|
231
|
+
linkPackageCalls: joi_1.default.boolean().optional().description('Add a lightweight Reads edge from a resolved package call to its signature-database function vertex (default false).'),
|
|
232
|
+
linkDescriptionDependencies: joi_1.default.boolean().optional().description('Eagerly attach the namespaces of the project\'s declared DESCRIPTION dependencies (Imports/Depends) so their exports resolve without an explicit library() (default false).'),
|
|
233
|
+
warmInBackground: joi_1.default.boolean().optional().description('Decompress the hot shards (base + most-downloaded) in a background task on startup so the first library() lookup is warm (default false; for long-running servers/REPLs).'),
|
|
234
|
+
additionalPaths: joi_1.default.array().items(joi_1.default.string()).optional().description('Extra directories or bundle/manifest files searched for signature databases (alongside the shipped default and $FLOWR_SIGDB_DIR); a downloaded full-history bundle placed here is mounted automatically.'),
|
|
235
|
+
downloadRepo: joi_1.default.string().optional().description('GitHub owner/repo the full-history bundle is downloaded from via ":signature download" (default "flowr-analysis/flowr", release tag "sigdb-v<flowR-version>").'),
|
|
236
|
+
autoSync: joi_1.default.boolean().optional().description('On startup, re-download shards whose committed sigdb.remote.json hash no longer matches the cache, in the background (default false; opt-in network sync after a git pull).'),
|
|
237
|
+
versionSelection: joi_1.default.string().valid(...Object.values(VersionSelection)).optional().description('When a project constrains a dependency, resolve to the newest (default), oldest, or system-installed version satisfying it; system needs R and falls back to newest. Base-R packages always resolve against the assumed R version.'),
|
|
238
|
+
versionOverrides: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.string()).optional().description('Force an exact version for specific packages (name -> version), overriding both the project constraint and the versionSelection policy (default {}).')
|
|
239
|
+
}).description('Resolving library exports from a signature database.'),
|
|
182
240
|
instrument: joi_1.default.object({
|
|
183
241
|
dataflowExtractors: joi_1.default.any().optional().description('These keys are only intended for use within code, allowing to instrument the dataflow analyzer!')
|
|
184
242
|
}),
|
|
@@ -15,7 +15,6 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
|
|
|
15
15
|
cachedConditions = new Map();
|
|
16
16
|
cachedStatements = new Map();
|
|
17
17
|
inTry = new Set();
|
|
18
|
-
invertedCfg;
|
|
19
18
|
getValue(id) {
|
|
20
19
|
const has = this.cachedConditions.get(id);
|
|
21
20
|
if (has) {
|
|
@@ -689,6 +689,12 @@ class ControlFlowGraph {
|
|
|
689
689
|
* @see {@link ControlFlowGraph#removeEdge|removeEdge()} - to remove a specific edge
|
|
690
690
|
*/
|
|
691
691
|
removeVertex(id) {
|
|
692
|
+
for (const to of this.edgeInfos.get(id)?.keys() ?? []) {
|
|
693
|
+
this.revEdgeInfos.get(to)?.delete(id);
|
|
694
|
+
}
|
|
695
|
+
for (const from of this.revEdgeInfos.get(id)?.keys() ?? []) {
|
|
696
|
+
this.edgeInfos.get(from)?.delete(id);
|
|
697
|
+
}
|
|
692
698
|
this.vtxInfos.delete(id);
|
|
693
699
|
this.edgeInfos.delete(id);
|
|
694
700
|
this.revEdgeInfos.delete(id);
|
|
@@ -699,12 +705,6 @@ class ControlFlowGraph {
|
|
|
699
705
|
this.bbChildren.delete(a);
|
|
700
706
|
}
|
|
701
707
|
}
|
|
702
|
-
for (const edges of this.edgeInfos.values()) {
|
|
703
|
-
edges.delete(id);
|
|
704
|
-
}
|
|
705
|
-
for (const edges of this.revEdgeInfos.values()) {
|
|
706
|
-
edges.delete(id);
|
|
707
|
-
}
|
|
708
708
|
this.roots.delete(id);
|
|
709
709
|
return this;
|
|
710
710
|
}
|
package/control-flow/diff-cfg.js
CHANGED
|
@@ -31,8 +31,8 @@ function diffRootVertices(ctx) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
function diffVertices(ctx) {
|
|
34
|
-
const lVert = ctx.left.vertices(false).entries()
|
|
35
|
-
const rVert = ctx.right.vertices(false).entries()
|
|
34
|
+
const lVert = [...ctx.left.vertices(false).entries()];
|
|
35
|
+
const rVert = [...ctx.right.vertices(false).entries()];
|
|
36
36
|
if (lVert.length < rVert.length && !ctx.config.leftIsSubgraph
|
|
37
37
|
|| lVert.length > rVert.length && !ctx.config.rightIsSubgraph) {
|
|
38
38
|
ctx.report.addComment(`Detected different number of vertices! ${ctx.leftname} has ${lVert.length}, ${ctx.rightname} has ${rVert.length}`);
|
|
@@ -262,6 +262,8 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
262
262
|
case built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs:
|
|
263
263
|
case built_in_proc_name_1.BuiltInProcName.Function:
|
|
264
264
|
case built_in_proc_name_1.BuiltInProcName.FunctionDefinition:
|
|
265
|
+
case built_in_proc_name_1.BuiltInProcName.S7MakeConstructor:
|
|
266
|
+
case built_in_proc_name_1.BuiltInProcName.DefineArgument:
|
|
265
267
|
return this.onDefaultFunctionCall({ call });
|
|
266
268
|
default:
|
|
267
269
|
(0, assert_1.assertUnreachable)(origin);
|
|
@@ -9,17 +9,17 @@ function grayOut() {
|
|
|
9
9
|
}
|
|
10
10
|
function mergeJointRangesInSorted(loc) {
|
|
11
11
|
return loc.reduce((acc, curr) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
];
|
|
12
|
+
const last = acc[acc.length - 1];
|
|
13
|
+
if (range_1.SourceRange.overlap(last.location, curr.location)) {
|
|
14
|
+
acc[acc.length - 1] = {
|
|
15
|
+
selected: curr.selected || last.selected,
|
|
16
|
+
location: range_1.SourceRange.merge([last.location, curr.location])
|
|
17
|
+
};
|
|
19
18
|
}
|
|
20
19
|
else {
|
|
21
|
-
|
|
20
|
+
acc.push(curr);
|
|
22
21
|
}
|
|
22
|
+
return acc;
|
|
23
23
|
}, [loc[0]]);
|
|
24
24
|
}
|
|
25
25
|
function highlight(s, selected) {
|
|
@@ -23,8 +23,8 @@ export declare const STATIC_DATAFLOW: {
|
|
|
23
23
|
readonly 0: typeof internalPrinter;
|
|
24
24
|
readonly 2: typeof dataflowGraphToJson;
|
|
25
25
|
readonly 5: typeof dataflowGraphToQuads;
|
|
26
|
-
readonly 3: (this: void, graph: import("../../../../dataflow/graph/graph").DataflowGraph | import("../../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
|
|
27
|
-
readonly 4: (this: void, graph: import("../../../../dataflow/graph/graph").DataflowGraph | import("../../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
|
|
26
|
+
readonly 3: (this: void, graph: import("../../../../dataflow/graph/graph").DataflowGraph | import("../../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
27
|
+
readonly 4: (this: void, graph: import("../../../../dataflow/graph/graph").DataflowGraph | import("../../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
28
28
|
};
|
|
29
29
|
readonly dependencies: readonly ["normalize"];
|
|
30
30
|
};
|
|
@@ -14,6 +14,11 @@ export interface SliceRequiredInput {
|
|
|
14
14
|
readonly direction?: SliceDirection;
|
|
15
15
|
/** The context of the analysis */
|
|
16
16
|
readonly context?: ReadOnlyFlowrAnalyzerContext;
|
|
17
|
+
/**
|
|
18
|
+
* If set (and slicing backward), continue the slice past a function-definition boundary, also including
|
|
19
|
+
* the definition's binding and call sites. Defaults to `false`.
|
|
20
|
+
*/
|
|
21
|
+
readonly includeCallees?: boolean;
|
|
17
22
|
}
|
|
18
23
|
declare function processor(results: {
|
|
19
24
|
dataflow?: DataflowInformation;
|
|
@@ -9,7 +9,7 @@ function processor(results, input) {
|
|
|
9
9
|
const direction = input.direction ?? slice_direction_1.SliceDirection.Backward;
|
|
10
10
|
const threshold = input.threshold ?? input.context?.config.solver.slicer?.threshold;
|
|
11
11
|
const n = results.normalize;
|
|
12
|
-
return (0, static_slicer_1.staticSlice)({ ctx: input.context, info: results.dataflow, ast: n, ids: parse_1.SlicingCriteria.convertAll(input.criterion, n.idMap), direction, threshold });
|
|
12
|
+
return (0, static_slicer_1.staticSlice)({ ctx: input.context, info: results.dataflow, ast: n, ids: parse_1.SlicingCriteria.convertAll(input.criterion, n.idMap), direction, threshold, includeCallees: input.includeCallees });
|
|
13
13
|
}
|
|
14
14
|
exports.STATIC_SLICE = {
|
|
15
15
|
name: 'slice',
|
|
@@ -3,6 +3,7 @@ import { PipelineStepStage } from '../../pipeline-step';
|
|
|
3
3
|
import type { SliceResult } from '../../../../slicing/static/slicer-types';
|
|
4
4
|
import type { NormalizedAst } from '../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
5
|
import type { AutoSelectPredicate } from '../../../../reconstruct/auto-select/auto-select-defaults';
|
|
6
|
+
import type { DataflowInformation } from '../../../../dataflow/info';
|
|
6
7
|
export interface ReconstructRequiredInput {
|
|
7
8
|
autoSelectIf?: AutoSelectPredicate;
|
|
8
9
|
/**
|
|
@@ -13,10 +14,16 @@ export interface ReconstructRequiredInput {
|
|
|
13
14
|
* Either you can set this to `'all'` to reconstruct all files or provide an array of file indices in the files context to reconstruct only those files.
|
|
14
15
|
*/
|
|
15
16
|
reconstructFiles?: 'all' | number[];
|
|
17
|
+
/**
|
|
18
|
+
* Inline resolvable `source()` calls into the reconstruction so the result is a single self-contained R text.
|
|
19
|
+
* Cyclic and unresolvable `source()` calls are kept verbatim and reported via `reconstruct.inlineWarnings`.
|
|
20
|
+
*/
|
|
21
|
+
inlineSources?: boolean;
|
|
16
22
|
}
|
|
17
23
|
declare function processor(results: {
|
|
18
24
|
normalize?: NormalizedAst;
|
|
19
25
|
slice?: SliceResult;
|
|
26
|
+
dataflow?: DataflowInformation;
|
|
20
27
|
}, input: Partial<ReconstructRequiredInput>): import("../../../../reconstruct/reconstruct").ReconstructionResult;
|
|
21
28
|
export declare const NAIVE_RECONSTRUCT: {
|
|
22
29
|
readonly name: "reconstruct";
|
|
@@ -3,10 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NAIVE_RECONSTRUCT = void 0;
|
|
4
4
|
const print_1 = require("../../../print/print");
|
|
5
5
|
const reconstruct_1 = require("../../../../reconstruct/reconstruct");
|
|
6
|
+
const source_inline_map_1 = require("../../../../reconstruct/inline/source-inline-map");
|
|
6
7
|
function processor(results, input) {
|
|
7
|
-
|
|
8
|
+
const normalize = results.normalize;
|
|
9
|
+
return (0, reconstruct_1.reconstructToCode)(normalize, {
|
|
8
10
|
nodes: results.slice.result,
|
|
9
|
-
reconstructFiles: input.reconstructFiles
|
|
11
|
+
reconstructFiles: input.reconstructFiles,
|
|
12
|
+
inlineSources: input.inlineSources,
|
|
13
|
+
sourceMap: input.inlineSources ? source_inline_map_1.SourceInlineMap.build(normalize, results.dataflow.graph) : undefined
|
|
10
14
|
}, input.autoSelectIf);
|
|
11
15
|
}
|
|
12
16
|
exports.NAIVE_RECONSTRUCT = {
|