@eagleoutice/flowr 2.16.6 → 2.16.7
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 +21 -15
- package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +2 -0
- package/abstract-interpretation/data-frame/dataframe-semantics.js +3 -1
- package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -7
- package/abstract-interpretation/data-frame/resolve-args.js +2 -11
- package/cli/repl/commands/repl-cfg.js +5 -19
- package/cli/repl/commands/repl-code-command.d.ts +10 -0
- package/cli/repl/commands/repl-code-command.js +18 -0
- package/cli/repl/commands/repl-dataflow.js +34 -59
- package/cli/repl/commands/repl-normalize.js +24 -41
- package/cli/repl/commands/repl-query.js +10 -17
- package/config.js +3 -3
- package/control-flow/cfg-dead-code.js +15 -2
- package/control-flow/useless-loop.js +1 -2
- package/data/r-base-packages.generated.d.ts +1 -1
- package/data/r-base-packages.generated.js +3 -3
- package/dataflow/environments/ambient-state-name.d.ts +80 -0
- package/dataflow/environments/ambient-state-name.js +113 -0
- package/dataflow/environments/built-in-eval-name.d.ts +3 -1
- package/dataflow/environments/built-in-eval-name.js +2 -0
- package/dataflow/environments/built-in-props.d.ts +27 -7
- package/dataflow/environments/built-in-props.js +59 -44
- package/dataflow/environments/built-in.d.ts +5 -2
- package/dataflow/environments/built-in.js +22 -5
- package/dataflow/environments/default-builtin-config.d.ts +538 -14
- package/dataflow/environments/default-builtin-config.js +189 -123
- package/dataflow/environments/environment.d.ts +7 -1
- package/dataflow/environments/environment.js +19 -1
- package/dataflow/environments/identifier.d.ts +11 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +13 -3
- package/dataflow/eval/resolve/alias-tracking.js +66 -37
- package/dataflow/eval/resolve/resolve-argument.d.ts +4 -2
- package/dataflow/eval/resolve/resolve-argument.js +23 -11
- package/dataflow/eval/resolve/resolve.d.ts +5 -0
- package/dataflow/eval/resolve/resolve.js +25 -3
- package/dataflow/eval/values/r-value.d.ts +4 -2
- package/dataflow/eval/values/r-value.js +3 -1
- package/dataflow/eval/values/string/string-constants.d.ts +7 -1
- package/dataflow/eval/values/string/string-constants.js +38 -36
- package/dataflow/extractor.js +105 -2
- package/dataflow/fn/argument-roles.js +22 -8
- package/dataflow/fn/function-semantics.d.ts +3 -2
- package/dataflow/fn/strict-function.js +13 -2
- package/dataflow/graph/df-helper.d.ts +14 -1
- package/dataflow/graph/df-helper.js +37 -4
- package/dataflow/graph/graph.d.ts +6 -0
- package/dataflow/graph/graph.js +6 -0
- package/dataflow/internal/linker.d.ts +4 -1
- package/dataflow/internal/linker.js +11 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +88 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +19 -44
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +125 -158
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +35 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +10 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +21 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +8 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +3 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +5 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +6 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +42 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +11 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -4
- package/dataflow/internal/process/functions/call/common.js +3 -4
- package/dataflow/internal/process/functions/call/deferred.d.ts +3 -2
- package/dataflow/internal/process/functions/call/deferred.js +17 -9
- package/dataflow/internal/process/functions/call/quoted.js +1 -1
- package/documentation/doc-capabilities.js +3 -2
- package/documentation/doc-readme.js +1 -2
- package/documentation/doc-util/doc-dfg.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +3 -1
- package/documentation/doc-util/doc-query.js +4 -4
- package/documentation/wiki-create-linting-rules.js +1 -1
- package/documentation/wiki-linter.js +16 -206
- package/documentation/wiki-linting-and-testing.js +31 -64
- package/documentation/wiki-query.js +41 -0
- package/index.d.ts +1 -0
- package/index.js +5 -1
- package/linter/linter-format.d.ts +6 -0
- package/linter/linter-format.js +10 -0
- package/linter/linter-rules.d.ts +155 -103
- package/linter/linter-rules.js +2 -0
- package/linter/linter-util.d.ts +23 -0
- package/linter/linter-util.js +58 -0
- package/linter/rules/absolute-path.d.ts +2 -2
- package/linter/rules/absolute-path.js +1 -4
- package/linter/rules/cmd-check/bogus-return.d.ts +2 -2
- package/linter/rules/cmd-check/bogus-return.js +3 -7
- package/linter/rules/cmd-check/call-arguments.d.ts +2 -2
- package/linter/rules/cmd-check/class-string-comparison.d.ts +2 -2
- package/linter/rules/cmd-check/class-string-comparison.js +3 -7
- package/linter/rules/cmd-check/cmd-check-util.d.ts +8 -9
- package/linter/rules/cmd-check/cmd-check-util.js +14 -26
- package/linter/rules/cmd-check/compiled-code.d.ts +8 -3
- package/linter/rules/cmd-check/compiled-code.js +3 -13
- package/linter/rules/cmd-check/dependency-declaration.d.ts +2 -2
- package/linter/rules/cmd-check/dependency-declaration.js +6 -7
- package/linter/rules/cmd-check/description-metadata.d.ts +4 -4
- package/linter/rules/cmd-check/documentation-mismatch.d.ts +2 -2
- package/linter/rules/cmd-check/documentation-mismatch.js +4 -11
- package/linter/rules/cmd-check/file-checks.d.ts +19 -6
- package/linter/rules/cmd-check/file-checks.js +13 -5
- package/linter/rules/cmd-check/foreign-function-calls.d.ts +2 -2
- package/linter/rules/cmd-check/global-environment-modification.d.ts +2 -2
- package/linter/rules/cmd-check/global-environment-modification.js +3 -2
- package/linter/rules/cmd-check/namespace-tampering.d.ts +2 -2
- package/linter/rules/cmd-check/namespace-tampering.js +9 -9
- package/linter/rules/cmd-check/non-ascii-code.d.ts +2 -2
- package/linter/rules/cmd-check/package-data.d.ts +11 -5
- package/linter/rules/cmd-check/package-data.js +5 -12
- package/linter/rules/cmd-check/package-files.js +4 -10
- package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
- package/linter/rules/cmd-check/package-hooks.js +10 -8
- package/linter/rules/cmd-check/package-metafiles.d.ts +8 -3
- package/linter/rules/cmd-check/package-metafiles.js +3 -12
- package/linter/rules/cmd-check/package-runtime.d.ts +18 -5
- package/linter/rules/cmd-check/package-runtime.js +64 -20
- package/linter/rules/cmd-check/package-structure.d.ts +11 -5
- package/linter/rules/cmd-check/package-structure.js +4 -12
- package/linter/rules/cmd-check/rd-files.d.ts +8 -3
- package/linter/rules/cmd-check/rd-files.js +4 -14
- package/linter/rules/cmd-check/s-three-method-consistency.d.ts +2 -2
- package/linter/rules/cmd-check/s-three-method-consistency.js +3 -4
- package/linter/rules/cmd-check/true-false-abbreviation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.js +5 -8
- package/linter/rules/dead-code.d.ts +5 -4
- package/linter/rules/dead-code.js +25 -14
- package/linter/rules/deprecated-functions.d.ts +3 -3
- package/linter/rules/deprecated-functions.js +16 -23
- package/linter/rules/file-path-validity.d.ts +2 -2
- package/linter/rules/file-path-validity.js +3 -6
- package/linter/rules/function-finder-util.d.ts +3 -3
- package/linter/rules/function-finder-util.js +7 -14
- package/linter/rules/namespace-access.d.ts +2 -2
- package/linter/rules/namespace-access.js +6 -9
- package/linter/rules/naming-convention.d.ts +2 -2
- package/linter/rules/naming-convention.js +1 -4
- package/linter/rules/network-functions.d.ts +3 -3
- package/linter/rules/no-leaked-credentials.d.ts +2 -2
- package/linter/rules/no-leaked-credentials.js +1 -4
- package/linter/rules/overwritten-file.d.ts +38 -0
- package/linter/rules/overwritten-file.js +102 -0
- package/linter/rules/problematic-inputs.d.ts +16 -6
- package/linter/rules/problematic-inputs.js +78 -34
- package/linter/rules/roxygen-arguments.d.ts +2 -2
- package/linter/rules/roxygen-arguments.js +1 -4
- package/linter/rules/seeded-randomness.d.ts +3 -3
- package/linter/rules/seeded-randomness.js +6 -23
- package/linter/rules/software-has-license.d.ts +2 -2
- package/linter/rules/software-has-license.js +1 -4
- package/linter/rules/software-has-tests.d.ts +2 -2
- package/linter/rules/software-has-tests.js +1 -4
- package/linter/rules/stop-with-call-arg.d.ts +2 -2
- package/linter/rules/stop-with-call-arg.js +4 -11
- package/linter/rules/syntactically-valid.d.ts +4 -2
- package/linter/rules/syntactically-valid.js +29 -10
- package/linter/rules/unclosed-connection.d.ts +2 -2
- package/linter/rules/unclosed-connection.js +1 -4
- package/linter/rules/undefined-symbol.d.ts +2 -2
- package/linter/rules/undefined-symbol.js +25 -22
- package/linter/rules/unescaped-arguments.d.ts +2 -2
- package/linter/rules/unescaped-arguments.js +1 -4
- package/linter/rules/unused-definition.d.ts +2 -2
- package/linter/rules/unused-definition.js +37 -25
- package/linter/rules/unused-import.d.ts +2 -2
- package/linter/rules/unused-import.js +9 -14
- package/linter/rules/useless-loop.d.ts +7 -6
- package/linter/rules/useless-loop.js +4 -8
- package/package.json +5 -3
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +15 -11
- package/project/context/flowr-analyzer-files-context.d.ts +3 -0
- package/project/context/flowr-analyzer-files-context.js +6 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +6 -1
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +35 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +2 -1
- package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +26 -0
- package/project/plugins/file-plugins/files/flowr-rsession-file.js +44 -0
- package/project/plugins/file-plugins/files/r-session.d.ts +20 -0
- package/project/plugins/file-plugins/files/r-session.js +58 -0
- package/project/plugins/file-plugins/files/recorded-runs.d.ts +18 -0
- package/project/plugins/file-plugins/files/recorded-runs.js +8 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.d.ts +20 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.js +28 -0
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/project/sigdb/spec-query.d.ts +73 -0
- package/project/sigdb/spec-query.js +339 -0
- package/queries/base-query-format.d.ts +1 -1
- package/queries/base-query-format.js +2 -2
- package/queries/catalog/absint-query/absint-query-executor.js +3 -6
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +113 -73
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +2 -3
- package/queries/catalog/cluster-query/cluster-query-executor.js +2 -3
- package/queries/catalog/config-query/config-query-format.d.ts +0 -1
- package/queries/catalog/config-query/config-query-format.js +1 -2
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -4
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +0 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -2
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -3
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +7 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +72 -42
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +24 -6
- package/queries/catalog/dependencies-query/dependencies-query-format.js +108 -3
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +6 -6
- package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -7
- package/queries/catalog/dependencies-query/implicit-echo.js +21 -7
- package/queries/catalog/dice-query/dice-query-executor.js +2 -3
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -3
- package/queries/catalog/files-query/files-query-executor.js +2 -3
- package/queries/catalog/function-info-query/function-info-query-executor.js +2 -1
- package/queries/catalog/function-info-query/function-info-query-format.d.ts +0 -2
- package/queries/catalog/function-info-query/function-info-query-format.js +1 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +3 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +0 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -2
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -3
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +0 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -2
- package/queries/catalog/id-map-query/id-map-query-executor.js +2 -3
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +0 -1
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -2
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -4
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.js +60 -13
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -3
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +2 -3
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +2 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -7
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -9
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +8 -33
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +3 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +1 -7
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -7
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +8 -31
- package/queries/catalog/linter-query/linter-query-executor.js +2 -3
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -3
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +0 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -3
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +0 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -5
- package/queries/catalog/origin-query/origin-query-executor.js +3 -11
- package/queries/catalog/project-query/project-query-executor.js +23 -7
- package/queries/catalog/project-query/project-query-format.d.ts +5 -0
- package/queries/catalog/project-query/project-query-format.js +20 -2
- package/queries/catalog/provenance-query/provenance-query-executor.js +2 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +0 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -2
- package/queries/catalog/search-query/search-query-executor.js +2 -3
- package/queries/catalog/signature-query/signature-query-executor.js +39 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +7 -1
- package/queries/catalog/signature-query/signature-query-format.js +15 -1
- package/queries/catalog/signature-query/signature-query-render.js +2 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -3
- package/queries/query-function-property.d.ts +28 -0
- package/queries/query-function-property.js +48 -0
- package/queries/query-meta.d.ts +3 -0
- package/queries/query-meta.js +8 -0
- package/queries/query.d.ts +13 -18
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +4 -3
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +9 -0
- package/r-bridge/lang-4.x/ast/model/syntax-version.d.ts +8 -0
- package/r-bridge/lang-4.x/ast/model/syntax-version.js +49 -0
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/type.js +3 -0
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +4 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.js +1 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +1 -1
- package/reconstruct/reconstruct.js +35 -1
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/static/fingerprint.js +7 -3
- package/slicing/static/static-slicer.js +6 -0
- package/util/assert.js +2 -2
- package/util/collections/arrays.d.ts +4 -0
- package/util/collections/arrays.js +11 -0
- package/util/collections/defaultmap.d.ts +5 -1
- package/util/collections/defaultmap.js +6 -1
- package/util/files.js +26 -5
- package/util/flowr-version.d.ts +10 -0
- package/util/flowr-version.js +20 -0
- package/util/glob.js +6 -4
- package/util/r-regex.d.ts +6 -0
- package/util/r-regex.js +17 -0
- package/util/text/args.d.ts +5 -0
- package/util/text/args.js +28 -22
- package/util/text/name-rank.d.ts +2 -0
- package/util/text/name-rank.js +3 -1
- package/util/text/regex.d.ts +10 -0
- package/util/text/regex.js +29 -0
- package/util/version.d.ts +1 -6
- package/util/version.js +6 -14
- package/documentation/doc-util/doc-functions.d.ts +0 -24
- package/documentation/doc-util/doc-functions.js +0 -65
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { type BasicQueryData, type BaseQueryFormat, type BaseQueryResult } from './base-query-format';
|
|
3
|
+
import { criteriaQueryCompleter } from '../cli/repl/parser/slice-query-parser';
|
|
4
|
+
import { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
|
+
import type { SlicingCriterion } from '../slicing/criterion/parse';
|
|
6
|
+
/** The `filter` property shared by the `inspect-*` queries. */
|
|
7
|
+
export declare const FunctionFilterSchema: Joi.ArraySchema<string[]>;
|
|
8
|
+
/** Defines an `inspect-*` query that states one boolean property per function definition, stored under `resultKey`. */
|
|
9
|
+
export declare function functionPropertyQuery<const T extends string, const K extends string, Q extends BaseQueryFormat & {
|
|
10
|
+
readonly type: T;
|
|
11
|
+
readonly filter?: readonly SlicingCriterion[];
|
|
12
|
+
}>(spec: {
|
|
13
|
+
readonly type: T;
|
|
14
|
+
readonly title: string;
|
|
15
|
+
readonly noun: string;
|
|
16
|
+
readonly resultKey: K;
|
|
17
|
+
readonly phrase: string;
|
|
18
|
+
readonly compute: (data: BasicQueryData, queries: readonly Q[]) => Promise<Record<NodeId, boolean>>;
|
|
19
|
+
}): {
|
|
20
|
+
readonly title: string;
|
|
21
|
+
readonly executor: (data: BasicQueryData, queries: readonly Q[]) => Promise<BaseQueryResult & Record<K, Record<NodeId, boolean>>>;
|
|
22
|
+
readonly asciiSummarizer: (formatter: import("../util/text/ansi").OutputFormatter, processed: import("..").ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
|
|
23
|
+
readonly completer: typeof criteriaQueryCompleter;
|
|
24
|
+
readonly fromLine: (_output: import("../cli/repl/commands/repl-main").ReplOutput, line: readonly string[], _config: import("..").FlowrConfig) => import("./query").ParsedQueryLine<T>;
|
|
25
|
+
readonly syntax: `@${T} [(<crit>;...)] <code | file://path>`;
|
|
26
|
+
readonly schema: Joi.ObjectSchema<any>;
|
|
27
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
28
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FunctionFilterSchema = void 0;
|
|
7
|
+
exports.functionPropertyQuery = functionPropertyQuery;
|
|
8
|
+
const joi_1 = __importDefault(require("joi"));
|
|
9
|
+
const base_query_format_1 = require("./base-query-format");
|
|
10
|
+
const slice_query_parser_1 = require("../cli/repl/parser/slice-query-parser");
|
|
11
|
+
const ansi_1 = require("../util/text/ansi");
|
|
12
|
+
const query_meta_1 = require("./query-meta");
|
|
13
|
+
const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
14
|
+
const range_1 = require("../util/range");
|
|
15
|
+
/** The `filter` property shared by the `inspect-*` queries. */
|
|
16
|
+
exports.FunctionFilterSchema = joi_1.default.array().items(joi_1.default.string().required()).optional().description('If given, only function definitions that match one of the given slicing criteria are considered. Each criterion can be either `line:column`, `line@variable-name`, or `$id`, where the latter directly specifies the node id of the function definition to be considered.');
|
|
17
|
+
/** Defines an `inspect-*` query that states one boolean property per function definition, stored under `resultKey`. */
|
|
18
|
+
function functionPropertyQuery(spec) {
|
|
19
|
+
return {
|
|
20
|
+
title: spec.title,
|
|
21
|
+
executor: async (data, queries) => {
|
|
22
|
+
const start = Date.now();
|
|
23
|
+
return { ...(0, query_meta_1.metaSince)(start), [spec.resultKey]: await spec.compute(data, queries) };
|
|
24
|
+
},
|
|
25
|
+
asciiSummarizer: (async (formatter, processed, queryResults, result) => {
|
|
26
|
+
const out = queryResults;
|
|
27
|
+
result.push(`Query: ${(0, ansi_1.bold)(spec.type, formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
|
|
28
|
+
for (const [r, v] of Object.entries(out[spec.resultKey])) {
|
|
29
|
+
const node = (await processed.normalize()).idMap.get(node_id_1.NodeId.normalize(r));
|
|
30
|
+
const loc = node ? range_1.SourceLocation.fromNode(node) : undefined;
|
|
31
|
+
result.push(` - Function ${(0, ansi_1.bold)(r, formatter)} (${range_1.SourceLocation.format(loc)}) is ${v ? '' : 'not '}${spec.phrase}`);
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}),
|
|
35
|
+
completer: slice_query_parser_1.criteriaQueryCompleter,
|
|
36
|
+
fromLine: (0, base_query_format_1.filterLineParser)(spec.type),
|
|
37
|
+
syntax: `@${spec.type} [(<crit>;...)] <code | file://path>`,
|
|
38
|
+
schema: joi_1.default.object({
|
|
39
|
+
type: joi_1.default.string().valid(spec.type).required().description('The type of the query.'),
|
|
40
|
+
filter: exports.FunctionFilterSchema
|
|
41
|
+
}).description(`Either returns all function definitions alongside whether they are ${spec.noun}, or just those matching the filters.`),
|
|
42
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
43
|
+
const out = queryResults[spec.resultKey];
|
|
44
|
+
return Object.keys(out).filter(id => out[id]);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=query-function-property.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.metaSince = metaSince;
|
|
4
|
+
/** The `.meta` of a result whose computation started at `start` (a `Date.now()` value) */
|
|
5
|
+
function metaSince(start) {
|
|
6
|
+
return { '.meta': { timing: Date.now() - start } };
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=query-meta.js.map
|
package/queries/query.d.ts
CHANGED
|
@@ -77,9 +77,9 @@ export interface SupportedQuery<QueryType extends BaseQueryFormat['type'] = Base
|
|
|
77
77
|
schema: Joi.ObjectSchema;
|
|
78
78
|
/**
|
|
79
79
|
* Flattens the involved query nodes to be added to a flowR search when the {@link fromQuery} function is used based on the given result after this query is executed.
|
|
80
|
-
* If this query does not involve any nodes,
|
|
80
|
+
* If this query does not involve any nodes, this can be omitted.
|
|
81
81
|
*/
|
|
82
|
-
flattenInvolvedNodes
|
|
82
|
+
flattenInvolvedNodes?: (queryResults: BaseQueryResult, query: readonly Query[], certainty?: LintingResultCertainty) => NodeId[];
|
|
83
83
|
}
|
|
84
84
|
export declare const SupportedQueries: {
|
|
85
85
|
readonly 'call-context': {
|
|
@@ -97,7 +97,6 @@ export declare const SupportedQueries: {
|
|
|
97
97
|
readonly completer: (partialLine: readonly string[], startingNewArg: boolean, _config: FlowrConfig) => CommandCompletions;
|
|
98
98
|
readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"config">;
|
|
99
99
|
readonly schema: Joi.ObjectSchema<any>;
|
|
100
|
-
readonly flattenInvolvedNodes: () => never[];
|
|
101
100
|
};
|
|
102
101
|
readonly 'control-flow': {
|
|
103
102
|
readonly title: "Control-Flow Query";
|
|
@@ -134,7 +133,6 @@ export declare const SupportedQueries: {
|
|
|
134
133
|
readonly executor: typeof import("./catalog/dataflow-lens-query/dataflow-lens-query-executor").executeDataflowLensQuery;
|
|
135
134
|
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
136
135
|
readonly schema: Joi.ObjectSchema<any>;
|
|
137
|
-
readonly flattenInvolvedNodes: () => never[];
|
|
138
136
|
};
|
|
139
137
|
readonly absint: {
|
|
140
138
|
readonly title: "Abstract Interpretation Query";
|
|
@@ -162,14 +160,12 @@ export declare const SupportedQueries: {
|
|
|
162
160
|
readonly executor: typeof import("./catalog/id-map-query/id-map-query-executor").executeIdMapQuery;
|
|
163
161
|
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
164
162
|
readonly schema: Joi.ObjectSchema<any>;
|
|
165
|
-
readonly flattenInvolvedNodes: () => never[];
|
|
166
163
|
};
|
|
167
164
|
readonly 'normalized-ast': {
|
|
168
165
|
readonly title: "Normalized AST Query";
|
|
169
166
|
readonly executor: typeof import("./catalog/normalized-ast-query/normalized-ast-query-executor").executeNormalizedAstQuery;
|
|
170
167
|
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
171
168
|
readonly schema: Joi.ObjectSchema<any>;
|
|
172
|
-
readonly flattenInvolvedNodes: () => never[];
|
|
173
169
|
};
|
|
174
170
|
readonly 'dataflow-cluster': {
|
|
175
171
|
readonly title: "Dataflow Cluster Query";
|
|
@@ -211,7 +207,10 @@ export declare const SupportedQueries: {
|
|
|
211
207
|
readonly dependencies: {
|
|
212
208
|
readonly title: "Dependencies Query";
|
|
213
209
|
readonly executor: typeof import("./catalog/dependencies-query/dependencies-query-executor").executeDependenciesQuery;
|
|
214
|
-
readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[], queries: readonly Query[]) =>
|
|
210
|
+
readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[], queries: readonly Query[]) => Promise<boolean>;
|
|
211
|
+
readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"dependencies">;
|
|
212
|
+
readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
|
|
213
|
+
readonly syntax: "@dependencies (<crit>;...) <code | file://path>";
|
|
215
214
|
readonly schema: Joi.ObjectSchema<any>;
|
|
216
215
|
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult, query: readonly Query[]) => NodeId[];
|
|
217
216
|
};
|
|
@@ -223,7 +222,6 @@ export declare const SupportedQueries: {
|
|
|
223
222
|
readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
|
|
224
223
|
readonly syntax: "@location-map [(<crit>;...)] [token|full|statement] <code | file://path>";
|
|
225
224
|
readonly schema: Joi.ObjectSchema<any>;
|
|
226
|
-
readonly flattenInvolvedNodes: () => never[];
|
|
227
225
|
};
|
|
228
226
|
readonly search: {
|
|
229
227
|
readonly title: "Search Query";
|
|
@@ -237,7 +235,6 @@ export declare const SupportedQueries: {
|
|
|
237
235
|
readonly executor: typeof import("./catalog/happens-before-query/happens-before-query-executor").executeHappensBefore;
|
|
238
236
|
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
239
237
|
readonly schema: Joi.ObjectSchema<any>;
|
|
240
|
-
readonly flattenInvolvedNodes: () => never[];
|
|
241
238
|
};
|
|
242
239
|
readonly 'inspect-exception': {
|
|
243
240
|
readonly title: "Inspect Exceptions of Functions Query";
|
|
@@ -250,19 +247,20 @@ export declare const SupportedQueries: {
|
|
|
250
247
|
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
251
248
|
};
|
|
252
249
|
readonly 'inspect-higher-order': {
|
|
253
|
-
readonly title:
|
|
254
|
-
readonly executor:
|
|
250
|
+
readonly title: string;
|
|
251
|
+
readonly executor: (data: BasicQueryData, queries: readonly InspectHigherOrderQuery[]) => Promise<BaseQueryResult & Record<"higherOrder", Record<NodeId, boolean>>>;
|
|
255
252
|
readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
|
|
256
|
-
readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"inspect-higher-order">;
|
|
257
253
|
readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
|
|
254
|
+
readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"inspect-higher-order">;
|
|
258
255
|
readonly syntax: "@inspect-higher-order [(<crit>;...)] <code | file://path>";
|
|
259
256
|
readonly schema: Joi.ObjectSchema<any>;
|
|
260
257
|
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
261
258
|
};
|
|
262
259
|
readonly 'inspect-recursion': {
|
|
263
|
-
readonly title:
|
|
264
|
-
readonly executor:
|
|
260
|
+
readonly title: string;
|
|
261
|
+
readonly executor: (data: BasicQueryData, queries: readonly InspectRecursionQuery[]) => Promise<BaseQueryResult & Record<"recursive", Record<NodeId, boolean>>>;
|
|
265
262
|
readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
|
|
263
|
+
readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
|
|
266
264
|
readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"inspect-recursion">;
|
|
267
265
|
readonly syntax: "@inspect-recursion [(<crit>;...)] <code | file://path>";
|
|
268
266
|
readonly schema: Joi.ObjectSchema<any>;
|
|
@@ -285,7 +283,6 @@ export declare const SupportedQueries: {
|
|
|
285
283
|
readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
|
|
286
284
|
readonly syntax: "@resolve-value (<crit>;...) <code | file://path>";
|
|
287
285
|
readonly schema: Joi.ObjectSchema<any>;
|
|
288
|
-
readonly flattenInvolvedNodes: () => never[];
|
|
289
286
|
};
|
|
290
287
|
readonly project: {
|
|
291
288
|
readonly title: "Project Query";
|
|
@@ -300,7 +297,7 @@ export declare const SupportedQueries: {
|
|
|
300
297
|
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[], _query: readonly Query[]) => true;
|
|
301
298
|
readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"signature">;
|
|
302
299
|
readonly completer: typeof import("./catalog/signature-query/signature-query-executor").signatureQueryCompleter;
|
|
303
|
-
readonly syntax: "@signature [<pkg>[@<version>]] [<pkg>::<fn> | <fn>] [--param <name>[,...]] [--required <n>] [--cg] [--cg-max <n>] [--help]";
|
|
300
|
+
readonly syntax: "@signature [<pkg>[@<version>]] [<pkg>::<fn> | <fn>] [--param <name>[,...]] [--required <n>] [<name>(<arg>, [<role>], *) [<prop>]] [--cg] [--cg-max <n>] [--help]";
|
|
304
301
|
readonly schema: Joi.ObjectSchema<any>;
|
|
305
302
|
readonly flattenInvolvedNodes: () => NodeId[];
|
|
306
303
|
};
|
|
@@ -345,7 +342,6 @@ export declare const SupportedQueries: {
|
|
|
345
342
|
readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"guess-dep-versions">;
|
|
346
343
|
readonly syntax: "@guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--disabled <letters>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>";
|
|
347
344
|
readonly schema: Joi.ObjectSchema<any>;
|
|
348
|
-
readonly flattenInvolvedNodes: () => NodeId[];
|
|
349
345
|
};
|
|
350
346
|
readonly 'function-info': {
|
|
351
347
|
readonly title: "Function Info Query";
|
|
@@ -354,7 +350,6 @@ export declare const SupportedQueries: {
|
|
|
354
350
|
readonly syntax: "@function-info <name> [<package>...]";
|
|
355
351
|
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
356
352
|
readonly schema: Joi.ObjectSchema<any>;
|
|
357
|
-
readonly flattenInvolvedNodes: () => NodeId[];
|
|
358
353
|
};
|
|
359
354
|
};
|
|
360
355
|
export type SupportedQueryTypes = keyof typeof SupportedQueries;
|
|
@@ -26,9 +26,9 @@ export type IdGenerator<OtherInfo> = (data: RProject<OtherInfo> | RNode<OtherInf
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function deterministicCountingIdGenerator(id?: number): () => NodeId;
|
|
28
28
|
/**
|
|
29
|
-
* Generates ids with a fixed source path and location
|
|
29
|
+
* Generates ids with a fixed source path, and the location if given, as prefix and an incrementing counter.
|
|
30
30
|
*/
|
|
31
|
-
export declare function sourcedDeterministicCountingIdGenerator(path: string, location
|
|
31
|
+
export declare function sourcedDeterministicCountingIdGenerator(path: string, location?: SourceRange, start?: number): () => NodeId;
|
|
32
32
|
export interface ParentContextInfo extends MergeableRecord {
|
|
33
33
|
role: RoleInParent;
|
|
34
34
|
/**
|
|
@@ -26,12 +26,13 @@ function deterministicCountingIdGenerator(id = 0) {
|
|
|
26
26
|
return () => id++;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Generates ids with a fixed source path and location
|
|
29
|
+
* Generates ids with a fixed source path, and the location if given, as prefix and an incrementing counter.
|
|
30
30
|
*/
|
|
31
31
|
function sourcedDeterministicCountingIdGenerator(path, location, start = 0) {
|
|
32
32
|
let id = start;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
/* without a location the ids carry only `path`, as in `eval::13-0`, where the path already names the `eval` call */
|
|
34
|
+
const prefix = location === undefined ? path : `${path}:${location[0]}:${location[1]}`;
|
|
35
|
+
return () => `${prefix}-${id++}`;
|
|
35
36
|
}
|
|
36
37
|
const defaultParentContext = {
|
|
37
38
|
role: "root" /* RoleInParent.Root */,
|
|
@@ -85,6 +85,12 @@ export declare const NodeId: {
|
|
|
85
85
|
* @see {@link NodeId.recoverContent} - for what a call or a use stands for rather than how it is written
|
|
86
86
|
*/
|
|
87
87
|
readonly recoverName: (this: void, id: NodeId, idMap?: AstIdMap) => string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The name the {@link RNode|node} the id belongs to binds or reads, without the backticks or quotes R lets it be
|
|
90
|
+
* written in (`"x"` and `x` in backticks both name `x`), which is how the environments know it.
|
|
91
|
+
* @see {@link NodeId.recoverName} - for the lexeme as written
|
|
92
|
+
*/
|
|
93
|
+
readonly recoverBareName: (this: void, id: NodeId, idMap?: AstIdMap) => string | undefined;
|
|
88
94
|
/**
|
|
89
95
|
* What the node the id belongs to stands for: the name a call resolved to, the unquoted name of a use, and
|
|
90
96
|
* the lexeme of anything else.
|
|
@@ -118,6 +118,15 @@ exports.NodeId = {
|
|
|
118
118
|
recoverName(id, idMap) {
|
|
119
119
|
return idMap?.get(id)?.lexeme;
|
|
120
120
|
},
|
|
121
|
+
/**
|
|
122
|
+
* The name the {@link RNode|node} the id belongs to binds or reads, without the backticks or quotes R lets it be
|
|
123
|
+
* written in (`"x"` and `x` in backticks both name `x`), which is how the environments know it.
|
|
124
|
+
* @see {@link NodeId.recoverName} - for the lexeme as written
|
|
125
|
+
*/
|
|
126
|
+
recoverBareName(id, idMap) {
|
|
127
|
+
const lexeme = exports.NodeId.recoverName(id, idMap);
|
|
128
|
+
return lexeme === undefined ? undefined : r_string_1.RString.unquote(lexeme);
|
|
129
|
+
},
|
|
121
130
|
/**
|
|
122
131
|
* What the node the id belongs to stands for: the name a call resolved to, the unquoted name of a use, and
|
|
123
132
|
* the lexeme of anything else.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SemVer } from 'semver';
|
|
2
|
+
import { RNode } from './model';
|
|
3
|
+
/**
|
|
4
|
+
* The R version the syntax of `ast` needs at least, `undefined` if every R reads it: the native pipe `|>`, the
|
|
5
|
+
* lambda shorthand `\(x)` and raw strings `r"(...)"` need R 4.1, the placeholder `_` (`x |> f(y = _)`) R 4.2,
|
|
6
|
+
* and the placeholder at the head of an extraction (`x |> _$a`) R 4.3.
|
|
7
|
+
*/
|
|
8
|
+
export declare function minRVersionOf<Info>(ast: RNode<Info> | readonly RNode<Info>[]): SemVer | undefined;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.minRVersionOf = minRVersionOf;
|
|
4
|
+
const semver_1 = require("semver");
|
|
5
|
+
const model_1 = require("./model");
|
|
6
|
+
const r_pipe_1 = require("./nodes/r-pipe");
|
|
7
|
+
const r_string_1 = require("./nodes/r-string");
|
|
8
|
+
const r_access_1 = require("./nodes/r-access");
|
|
9
|
+
const r_symbol_1 = require("./nodes/r-symbol");
|
|
10
|
+
const r_function_definition_1 = require("./nodes/r-function-definition");
|
|
11
|
+
const versions_1 = require("./versions");
|
|
12
|
+
/**
|
|
13
|
+
* The R version the syntax of `ast` needs at least, `undefined` if every R reads it: the native pipe `|>`, the
|
|
14
|
+
* lambda shorthand `\(x)` and raw strings `r"(...)"` need R 4.1, the placeholder `_` (`x |> f(y = _)`) R 4.2,
|
|
15
|
+
* and the placeholder at the head of an extraction (`x |> _$a`) R 4.3.
|
|
16
|
+
*/
|
|
17
|
+
function minRVersionOf(ast) {
|
|
18
|
+
let needed;
|
|
19
|
+
const atLeast = (version) => {
|
|
20
|
+
const v = new semver_1.SemVer(version);
|
|
21
|
+
if (needed === undefined || v.compare(needed) > 0) {
|
|
22
|
+
needed = v;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const placeholders = (rhs) => model_1.RNode.visitAst(rhs, n => {
|
|
26
|
+
if (r_access_1.RAccess.is(n) && r_symbol_1.RSymbol.is(n.accessed) && n.accessed.lexeme === '_') {
|
|
27
|
+
atLeast(r_pipe_1.RPipe.hasAccessPlaceHolderFromRVersion());
|
|
28
|
+
}
|
|
29
|
+
else if (r_symbol_1.RSymbol.is(n) && n.lexeme === '_') {
|
|
30
|
+
atLeast(r_pipe_1.RPipe.hasPlaceHolderFromRVersion());
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
});
|
|
34
|
+
model_1.RNode.visitAst(ast, n => {
|
|
35
|
+
if (r_pipe_1.RPipe.is(n)) {
|
|
36
|
+
atLeast(r_pipe_1.RPipe.availableFromRVersion());
|
|
37
|
+
placeholders(n.rhs);
|
|
38
|
+
}
|
|
39
|
+
else if (r_function_definition_1.RFunctionDefinition.is(n) && (n.lexeme === '\\' || n.lexeme === '=>')) {
|
|
40
|
+
atLeast(n.lexeme === '\\' ? versions_1.MIN_VERSION_LAMBDA : versions_1.MIN_VERSION_PIPE_BIND);
|
|
41
|
+
}
|
|
42
|
+
else if (r_string_1.RString.is(n) && n.content.flag === 'raw') {
|
|
43
|
+
atLeast(r_string_1.RString.rawStringAvailableFromRVersion());
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
});
|
|
47
|
+
return needed;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=syntax-version.js.map
|
|
@@ -113,6 +113,8 @@ export declare enum RawRType {
|
|
|
113
113
|
SymbolSub = "SYMBOL_SUB",
|
|
114
114
|
/** T54 */
|
|
115
115
|
SymbolFormals = "SYMBOL_FORMALS",
|
|
116
|
+
/** the `_` of a pipe, `x |> f(y = _)`, which flowR reads as the symbol `_` */
|
|
117
|
+
Placeholder = "PLACEHOLDER",
|
|
116
118
|
/** T55 */
|
|
117
119
|
Comment = "COMMENT",
|
|
118
120
|
/** T56 */
|
|
@@ -118,6 +118,8 @@ var RawRType;
|
|
|
118
118
|
RawRType["SymbolSub"] = "SYMBOL_SUB";
|
|
119
119
|
/** T54 */
|
|
120
120
|
RawRType["SymbolFormals"] = "SYMBOL_FORMALS";
|
|
121
|
+
/** the `_` of a pipe, `x |> f(y = _)`, which flowR reads as the symbol `_` */
|
|
122
|
+
RawRType["Placeholder"] = "PLACEHOLDER";
|
|
121
123
|
/** T55 */
|
|
122
124
|
RawRType["Comment"] = "COMMENT";
|
|
123
125
|
/** T56 */
|
|
@@ -217,6 +219,7 @@ exports.ValidRTypes = new Set(Object.values(RType));
|
|
|
217
219
|
exports.ValidRTypesReverse = Object.fromEntries(Object.entries(RType).map(([k, v]) => [v, k]));
|
|
218
220
|
const validSymbolTypes = new Set([
|
|
219
221
|
RawRType.Symbol,
|
|
222
|
+
RawRType.Placeholder,
|
|
220
223
|
RawRType.SymbolPackage,
|
|
221
224
|
RawRType.SymbolFunctionCall,
|
|
222
225
|
RawRType.NullConst,
|
|
@@ -7,6 +7,7 @@ const assert_1 = require("../../../../../../../util/assert");
|
|
|
7
7
|
const type_1 = require("../../../../model/type");
|
|
8
8
|
const r_delimiter_1 = require("../../../../model/nodes/info/r-delimiter");
|
|
9
9
|
const normalize_single_node_1 = require("../structure/normalize-single-node");
|
|
10
|
+
const identifier_1 = require("../../../../../../../dataflow/environments/identifier");
|
|
10
11
|
/**
|
|
11
12
|
* Either parses `[SYMBOL_FORMALS]` or `[SYMBOL_FORMALS, EQ_FORMALS, expr]` as a parameter of a function definition in R.
|
|
12
13
|
* Probably directly called by the function definition parser as otherwise, we do not expect to find parameters.
|
|
@@ -34,7 +35,9 @@ function tryNormalizeParameter(data, objs) {
|
|
|
34
35
|
lexeme: content,
|
|
35
36
|
name: {
|
|
36
37
|
type: type_1.RType.Symbol,
|
|
37
|
-
location,
|
|
38
|
+
location,
|
|
39
|
+
/* a parameter written as `` `x` `` binds `x`, the name a read in the body uses */
|
|
40
|
+
content: identifier_1.Identifier.getName(identifier_1.Identifier.make(content)),
|
|
38
41
|
lexeme: content,
|
|
39
42
|
info: {
|
|
40
43
|
fullRange: location,
|
|
@@ -45,6 +45,7 @@ function normalizeSingleNode(data, elem) {
|
|
|
45
45
|
case type_1.RawRType.Next:
|
|
46
46
|
return (0, normalize_next_1.normalizeNext)(data, elem.content);
|
|
47
47
|
case type_1.RawRType.Symbol:
|
|
48
|
+
case type_1.RawRType.Placeholder:
|
|
48
49
|
case type_1.RawRType.SymbolFunctionCall:
|
|
49
50
|
case type_1.RawRType.Slot:
|
|
50
51
|
case type_1.RawRType.NullConst: {
|
|
@@ -528,7 +528,7 @@ function convertTreeNode(node) {
|
|
|
528
528
|
name: {
|
|
529
529
|
type: type_1.RType.Symbol,
|
|
530
530
|
location: nameRange,
|
|
531
|
-
content: nameText,
|
|
531
|
+
content: identifier_1.Identifier.getName(identifier_1.Identifier.make(nameText)),
|
|
532
532
|
lexeme: nameText,
|
|
533
533
|
info: {
|
|
534
534
|
fullRange: range,
|
|
@@ -358,6 +358,40 @@ function tryInlineSourceCall(call, config) {
|
|
|
358
358
|
}
|
|
359
359
|
return undefined;
|
|
360
360
|
}
|
|
361
|
+
function isBlock(n) {
|
|
362
|
+
return r_expression_list_1.RExpressionList.is(n) && n.grouping?.[0].content === '{';
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* A call handed a block, like `local({ x <- 1; y <- 2 })`, with only the statements of the block the slice selects;
|
|
366
|
+
* every other argument is kept as written.
|
|
367
|
+
*/
|
|
368
|
+
function reconstructCallOfBlock(call, args, config) {
|
|
369
|
+
const blocks = call.arguments.filter(a => a !== r_function_call_1.EmptyArgument && isBlock(a.value)).map(a => a.value);
|
|
370
|
+
/* a block the slice keeps whole stays as it is written */
|
|
371
|
+
if (blocks.every(b => b.children.every(c => isSelected(config, c)))) {
|
|
372
|
+
return undefined;
|
|
373
|
+
}
|
|
374
|
+
const parts = call.arguments.map((a, i) => {
|
|
375
|
+
if (a === r_function_call_1.EmptyArgument) {
|
|
376
|
+
return plain('');
|
|
377
|
+
}
|
|
378
|
+
else if (!isBlock(a.value)) {
|
|
379
|
+
const value = a.value === undefined ? '' : reconstructableSource(a.value);
|
|
380
|
+
return plain(a.name === undefined ? value : `${model_1.RNode.ownLexeme(a.name) ?? ''} = ${value}`);
|
|
381
|
+
}
|
|
382
|
+
const block = args[i];
|
|
383
|
+
const body = block === r_function_call_1.EmptyArgument || block.length === 0 ? plain('{}') : block;
|
|
384
|
+
return a.name === undefined ? body : [{ ...body[0], line: `${model_1.RNode.ownLexeme(a.name) ?? ''} = ${body[0].line}` }, ...body.slice(1)];
|
|
385
|
+
});
|
|
386
|
+
const lines = [{ line: `${model_1.RNode.ownLexeme(call.functionName) ?? reconstructableSource(call.functionName)}(`, indent: 0 }];
|
|
387
|
+
parts.forEach((part, i) => {
|
|
388
|
+
const last = lines[lines.length - 1];
|
|
389
|
+
last.line += (i > 0 ? ', ' : '') + part[0].line;
|
|
390
|
+
lines.push(...part.slice(1));
|
|
391
|
+
});
|
|
392
|
+
lines[lines.length - 1].line += ')';
|
|
393
|
+
return lines;
|
|
394
|
+
}
|
|
361
395
|
function reconstructFunctionCall(call, functionName, args, configuration) {
|
|
362
396
|
const selected = isSelected(configuration, call);
|
|
363
397
|
if (configuration.inlineSources && selected) {
|
|
@@ -379,7 +413,7 @@ function reconstructFunctionCall(call, functionName, args, configuration) {
|
|
|
379
413
|
return reconstructSpecialInfixFunctionCall(args, call);
|
|
380
414
|
}
|
|
381
415
|
if (call.named && selected) {
|
|
382
|
-
return foldToConst(call);
|
|
416
|
+
return reconstructCallOfBlock(call, args, configuration) ?? foldToConst(call);
|
|
383
417
|
}
|
|
384
418
|
if (functionName.length === 0 && args.every(a => a === undefined || a.length === 0)) {
|
|
385
419
|
return [];
|
|
@@ -90,7 +90,7 @@ async function generateFromQuery(input, args) {
|
|
|
90
90
|
}
|
|
91
91
|
const nodes = new Set();
|
|
92
92
|
const queryDef = query_1.SupportedQueries[query];
|
|
93
|
-
for (const node of queryDef.flattenInvolvedNodes(content, args.from, args.certainty)) {
|
|
93
|
+
for (const node of (queryDef.flattenInvolvedNodes?.(content, args.from, args.certainty) ?? [])) {
|
|
94
94
|
nodes.add({ node: idMap.get(node) });
|
|
95
95
|
}
|
|
96
96
|
nodesByQuery.set(query, nodes);
|
|
@@ -31,6 +31,10 @@ function definitionHash(definition) {
|
|
|
31
31
|
}
|
|
32
32
|
return hash;
|
|
33
33
|
}
|
|
34
|
+
/** digests plain strings and primitives as one string, which spares {@link objectHash} a reflective walk (and works in the browser, where `crypto` is stubbed) */
|
|
35
|
+
function digest(parts) {
|
|
36
|
+
return (0, object_hash_1.default)(JSON.stringify(parts), HashOptions);
|
|
37
|
+
}
|
|
34
38
|
function memoryHash(memory) {
|
|
35
39
|
let hash = memoryHashes.get(memory);
|
|
36
40
|
if (hash !== undefined) {
|
|
@@ -39,7 +43,7 @@ function memoryHash(memory) {
|
|
|
39
43
|
const lazy = memory instanceof frame_memory_1.Frame ? memory.lazy() : undefined;
|
|
40
44
|
if (lazy !== undefined) {
|
|
41
45
|
/* an attached package's exports: hashing what they bind would build a definition for every one of them */
|
|
42
|
-
hash = (
|
|
46
|
+
hash = digest([lazy.origin, ...lazy.keys()]);
|
|
43
47
|
}
|
|
44
48
|
else {
|
|
45
49
|
const entries = [];
|
|
@@ -47,7 +51,7 @@ function memoryHash(memory) {
|
|
|
47
51
|
entries.push(`${String(name)}=${definitions.map(definitionHash).join(',')}`);
|
|
48
52
|
}
|
|
49
53
|
entries.sort();
|
|
50
|
-
hash = (
|
|
54
|
+
hash = digest(entries);
|
|
51
55
|
}
|
|
52
56
|
memoryHashes.set(memory, hash);
|
|
53
57
|
return hash;
|
|
@@ -55,7 +59,7 @@ function memoryHash(memory) {
|
|
|
55
59
|
function frameHash(frame) {
|
|
56
60
|
let hash = frameHashes.get(frame);
|
|
57
61
|
if (hash === undefined) {
|
|
58
|
-
hash = (
|
|
62
|
+
hash = digest([frame.n, frame.t, frame.closure, frame.globalEnv === true, memoryHash(frame.memory)]);
|
|
59
63
|
frameHashes.set(frame, hash);
|
|
60
64
|
}
|
|
61
65
|
return hash;
|
|
@@ -48,6 +48,8 @@ function staticSlice(options) {
|
|
|
48
48
|
/* the unknown side effects every slice keeps are seeds as well, so what they reach is not cut off as running too late */
|
|
49
49
|
const effects = [...graph.unknownSideEffects].filter((id) => typeof id !== 'object');
|
|
50
50
|
const missesSeeds = sliceGraph === undefined ? outsideSeedRun([...ids, ...effects], idMap, direction, graph) : undefined;
|
|
51
|
+
const separatedWrite = (id) => info.graph.fileWritesPerCall?.has(id) === true
|
|
52
|
+
&& !openedBodies.has(model_1.RNode.findEnclosing(id, idMap, r_function_definition_1.RFunctionDefinition.is));
|
|
51
53
|
const enqueue = (id, env, print) => {
|
|
52
54
|
if (!queue.hasId(id)) {
|
|
53
55
|
queue.add(id, env, print, true);
|
|
@@ -151,6 +153,10 @@ function staticSlice(options) {
|
|
|
151
153
|
updatePotentialAddition(queue, id, target, baseEnvironment, baseEnvFingerprint);
|
|
152
154
|
continue;
|
|
153
155
|
case 1 /* TraverseEdge.SideEffect */:
|
|
156
|
+
/* a file write's readers read the calls writing their file, only a slice starting in its body needs them all */
|
|
157
|
+
if (direction === slice_direction_1.SliceDirection.Backward && separatedWrite(id)) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
154
160
|
queue.add(target, baseEnvironment, baseEnvFingerprint, true);
|
|
155
161
|
continue;
|
|
156
162
|
default:
|
package/util/assert.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.getGuardIssueUrl = getGuardIssueUrl;
|
|
|
9
9
|
exports.guard = guard;
|
|
10
10
|
exports.guardNesting = guardNesting;
|
|
11
11
|
/* v8 ignore next */
|
|
12
|
-
const
|
|
12
|
+
const flowr_version_1 = require("./flowr-version");
|
|
13
13
|
/**
|
|
14
14
|
* Verifies, that the given code path is never reached.
|
|
15
15
|
* @example
|
|
@@ -98,7 +98,7 @@ function getGuardIssueUrl(message) {
|
|
|
98
98
|
<!-- Automatically generated issue metadata, please do not edit or delete content below this line -->
|
|
99
99
|
---
|
|
100
100
|
|
|
101
|
-
flowR version: ${(0,
|
|
101
|
+
flowR version: ${(0, flowr_version_1.flowrVersion)().toString()}
|
|
102
102
|
node version: ${process.version}
|
|
103
103
|
node arch: ${process.arch}
|
|
104
104
|
node platform: ${process.platform}
|
|
@@ -95,6 +95,10 @@ export declare function uniqueArrayMerge<T>(left: readonly T[], right: readonly
|
|
|
95
95
|
* Returns a duplicate-free array.
|
|
96
96
|
*/
|
|
97
97
|
export declare function uniqueArray<T>(a: Iterable<T>): T[];
|
|
98
|
+
/**
|
|
99
|
+
* Returns the elements of the given array without those whose key an earlier element already has.
|
|
100
|
+
*/
|
|
101
|
+
export declare function uniqueArrayBy<T, K>(a: readonly T[], keyFn: (elem: T) => K): T[];
|
|
98
102
|
/**
|
|
99
103
|
* Groups the elements of the given array by the key returned by the given key function.
|
|
100
104
|
*/
|
|
@@ -11,6 +11,7 @@ exports.equidistantSampling = equidistantSampling;
|
|
|
11
11
|
exports.cartesianProduct = cartesianProduct;
|
|
12
12
|
exports.uniqueArrayMerge = uniqueArrayMerge;
|
|
13
13
|
exports.uniqueArray = uniqueArray;
|
|
14
|
+
exports.uniqueArrayBy = uniqueArrayBy;
|
|
14
15
|
exports.arraysGroupBy = arraysGroupBy;
|
|
15
16
|
const assert_1 = require("../assert");
|
|
16
17
|
/**
|
|
@@ -212,6 +213,16 @@ function uniqueArrayMerge(left, right) {
|
|
|
212
213
|
function uniqueArray(a) {
|
|
213
214
|
return Array.from(new Set(a));
|
|
214
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Returns the elements of the given array without those whose key an earlier element already has.
|
|
218
|
+
*/
|
|
219
|
+
function uniqueArrayBy(a, keyFn) {
|
|
220
|
+
const seen = new Set();
|
|
221
|
+
return a.filter(e => {
|
|
222
|
+
const key = keyFn(e);
|
|
223
|
+
return !seen.has(key) && seen.add(key) !== undefined;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
215
226
|
/**
|
|
216
227
|
* Groups the elements of the given array by the key returned by the given key function.
|
|
217
228
|
*/
|
|
@@ -35,5 +35,9 @@ export declare class DefaultMap<K, V = K> {
|
|
|
35
35
|
/**
|
|
36
36
|
* `fn`, answered once per key and remembered from then on -- an answer of `undefined` included, which is
|
|
37
37
|
* what separates this from a {@link DefaultMap} generator.
|
|
38
|
+
* For a recursive `fn`, `reentry` is the answer for a key asked again while its own answer is worked out,
|
|
39
|
+
* like `false` for whether a call `f <- function() f()` returns a data frame.
|
|
38
40
|
*/
|
|
39
|
-
export declare function memoize<K, V>(fn: (key: K) => V
|
|
41
|
+
export declare function memoize<K, V>(fn: (key: K) => V, reentry?: {
|
|
42
|
+
readonly answer: V;
|
|
43
|
+
}): (key: K) => V;
|
|
@@ -66,11 +66,16 @@ exports.DefaultMap = DefaultMap;
|
|
|
66
66
|
/**
|
|
67
67
|
* `fn`, answered once per key and remembered from then on -- an answer of `undefined` included, which is
|
|
68
68
|
* what separates this from a {@link DefaultMap} generator.
|
|
69
|
+
* For a recursive `fn`, `reentry` is the answer for a key asked again while its own answer is worked out,
|
|
70
|
+
* like `false` for whether a call `f <- function() f()` returns a data frame.
|
|
69
71
|
*/
|
|
70
|
-
function memoize(fn) {
|
|
72
|
+
function memoize(fn, reentry) {
|
|
71
73
|
const known = new Map();
|
|
72
74
|
return key => {
|
|
73
75
|
if (!known.has(key)) {
|
|
76
|
+
if (reentry !== undefined) {
|
|
77
|
+
known.set(key, reentry.answer);
|
|
78
|
+
}
|
|
74
79
|
known.set(key, fn(key));
|
|
75
80
|
}
|
|
76
81
|
return known.get(key);
|