@eagleoutice/flowr 2.17.5 → 2.17.6
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 +13 -51
- package/abstract-interpretation/absint-inference.d.ts +4 -4
- package/abstract-interpretation/absint-inference.js +11 -11
- package/abstract-interpretation/abstract-semantics.d.ts +2 -1
- package/abstract-interpretation/branch-paths-interpreter.d.ts +1 -0
- package/abstract-interpretation/branch-paths-interpreter.js +60 -0
- package/abstract-interpretation/branch-paths.d.ts +60 -0
- package/abstract-interpretation/branch-paths.js +120 -0
- package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +6 -1
- package/abstract-interpretation/data-frame/dataframe-semantics.js +60 -1
- package/abstract-interpretation/data-frame/semantics.js +4 -10
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
- package/cli/repl/core.js +51 -0
- package/control-flow/cfg-dead-code.js +12 -7
- package/data/packed.d.ts +10 -0
- package/data/packed.js +33 -0
- package/data/r-base-guards.generated.d.ts +7 -0
- package/data/r-base-guards.generated.js +12 -0
- package/data/r-datasets.generated.d.ts +4 -0
- package/data/r-datasets.generated.js +10 -0
- package/data/r-formals.generated.d.ts +4 -0
- package/data/r-formals.generated.js +10 -0
- package/data/r-group-method-guards.generated.d.ts +3 -0
- package/data/r-group-method-guards.generated.js +8 -0
- package/dataflow/environments/ambient-effect.d.ts +1000 -0
- package/dataflow/environments/ambient-effect.js +234 -0
- package/dataflow/environments/ambient-state-name.d.ts +45 -2
- package/dataflow/environments/ambient-state-name.js +61 -3
- package/dataflow/environments/apply-kill.js +11 -4
- package/dataflow/environments/built-in-kinds.d.ts +4 -46
- package/dataflow/environments/built-in-kinds.js +6 -2
- package/dataflow/environments/built-in-props.d.ts +16 -4
- package/dataflow/environments/built-in-props.js +11 -3
- package/dataflow/environments/built-in.d.ts +6 -1
- package/dataflow/environments/built-in.js +13 -36
- package/dataflow/environments/default-builtin-config/base-functions.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/base-functions.js +110 -52
- package/dataflow/environments/default-builtin-config/base-language.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/base-language.js +11 -8
- package/dataflow/environments/default-builtin-config/dev-tooling.js +1 -1
- package/dataflow/environments/default-builtin-config/file-io.js +6 -4
- package/dataflow/environments/default-builtin-config/graphics-devices.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/graphics-devices.js +24 -14
- package/dataflow/environments/default-builtin-config/guard-builders.d.ts +16 -0
- package/dataflow/environments/default-builtin-config/guard-builders.js +29 -0
- package/dataflow/environments/default-builtin-config/guards-primitive-lang.d.ts +15 -0
- package/dataflow/environments/default-builtin-config/guards-primitive-lang.js +228 -0
- package/dataflow/environments/default-builtin-config/guards-primitive-ops.d.ts +11 -0
- package/dataflow/environments/default-builtin-config/guards-primitive-ops.js +154 -0
- package/dataflow/environments/default-builtin-config/guards.d.ts +9 -0
- package/dataflow/environments/default-builtin-config/guards.js +211 -0
- package/dataflow/environments/default-builtin-config/index.d.ts +3 -3
- package/dataflow/environments/default-builtin-config/index.js +22 -7
- package/dataflow/environments/default-builtin-config/media-formats.js +4 -4
- package/dataflow/environments/default-builtin-config/package-spatial.js +2 -1
- package/dataflow/environments/default-builtin-config/package-tidyverse.js +3 -2
- package/dataflow/environments/default-builtin-config/package-utils.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/package-utils.js +5 -2
- package/dataflow/environments/default-builtin-config/parallel-execution.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/parallel-execution.js +3 -1
- package/dataflow/environments/default-builtin-config/r-formals.d.ts +13 -0
- package/dataflow/environments/default-builtin-config/r-formals.js +110 -0
- package/dataflow/environments/default-builtin-config/shared-configs.d.ts +138 -77
- package/dataflow/environments/default-builtin-config/shared-configs.js +52 -88
- package/dataflow/environments/default-builtin-config/statistics.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/statistics.js +4 -1
- package/dataflow/environments/diff.js +5 -2
- package/dataflow/environments/environment.d.ts +20 -0
- package/dataflow/environments/environment.js +39 -4
- package/dataflow/environments/group-generics.d.ts +5 -1
- package/dataflow/environments/group-generics.js +13 -3
- package/dataflow/environments/guard-facts.d.ts +169 -0
- package/dataflow/environments/guard-facts.js +26 -0
- package/dataflow/environments/identifier.d.ts +9 -1
- package/dataflow/environments/identifier.js +5 -0
- package/dataflow/environments/pkg-name.d.ts +1 -0
- package/dataflow/environments/query-fn-props.d.ts +3 -5
- package/dataflow/environments/query-fn-props.js +44 -21
- package/dataflow/environments/removal-marker.d.ts +2 -0
- package/dataflow/environments/removal-marker.js +5 -0
- package/dataflow/eval/resolve/resolve-strings.d.ts +2 -5
- package/dataflow/eval/resolve/resolve-strings.js +2 -2
- package/dataflow/extractor.js +24 -15
- package/dataflow/fn/condition-handlers.d.ts +2 -0
- package/dataflow/fn/condition-handlers.js +3 -1
- package/dataflow/fn/frame-reflection.d.ts +4 -2
- package/dataflow/fn/frame-reflection.js +16 -0
- package/dataflow/fn/function-props.js +15 -22
- package/dataflow/fn/function-semantics.d.ts +31 -1
- package/dataflow/fn/function-semantics.js +15 -0
- package/dataflow/fn/guards/built-in-guards.d.ts +112 -0
- package/dataflow/fn/guards/built-in-guards.js +199 -0
- package/dataflow/fn/guards/call-contracts.d.ts +97 -0
- package/dataflow/fn/guards/call-contracts.js +331 -0
- package/dataflow/fn/guards/condition-grouping.d.ts +20 -0
- package/dataflow/fn/guards/condition-grouping.js +135 -0
- package/dataflow/fn/guards/function-guards.d.ts +112 -0
- package/dataflow/fn/guards/function-guards.js +1549 -0
- package/dataflow/fn/guards/group-method-guards.d.ts +28 -0
- package/dataflow/fn/guards/group-method-guards.js +56 -0
- package/dataflow/fn/guards/guard-claims.d.ts +125 -0
- package/dataflow/fn/guards/guard-claims.js +678 -0
- package/dataflow/fn/guards/guard-knowledge.d.ts +41 -0
- package/dataflow/fn/guards/guard-knowledge.js +180 -0
- package/dataflow/fn/guards/guard-term-syntax.d.ts +9 -0
- package/dataflow/fn/guards/guard-term-syntax.js +210 -0
- package/dataflow/fn/guards/guard-term.d.ts +136 -0
- package/dataflow/fn/guards/guard-term.js +550 -0
- package/dataflow/fn/guards/stated-guards.d.ts +13 -0
- package/dataflow/fn/guards/stated-guards.js +35 -0
- package/dataflow/fn/higher-order-function.d.ts +2 -0
- package/dataflow/fn/higher-order-function.js +1 -0
- package/dataflow/fn/strict-function.d.ts +4 -0
- package/dataflow/fn/strict-function.js +66 -17
- package/dataflow/graph/ambient-access.d.ts +4 -1
- package/dataflow/graph/ambient-access.js +8 -2
- package/dataflow/graph/closure-frames.js +1 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.js +2 -2
- package/dataflow/graph/df-helper.d.ts +6 -0
- package/dataflow/graph/df-helper.js +15 -0
- package/dataflow/graph/graph.d.ts +12 -6
- package/dataflow/graph/graph.js +21 -28
- package/dataflow/info.d.ts +2 -1
- package/dataflow/info.js +3 -1
- package/dataflow/internal/dispatch-linking.d.ts +3 -1
- package/dataflow/internal/dispatch-linking.js +1 -0
- package/dataflow/internal/linker.d.ts +2 -0
- package/dataflow/internal/linker.js +115 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +19 -57
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +471 -295
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +13 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +106 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +24 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.js +33 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +23 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +19 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +347 -46
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +5 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +110 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +9 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +28 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +16 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +37 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +19 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +55 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +11 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +8 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +64 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +160 -20
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +6 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +142 -4
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
- package/dataflow/internal/process/functions/call/quoted.js +23 -4
- package/dataflow/processor.d.ts +2 -0
- package/documentation/data/dfg/doc-ambient.d.ts +4 -0
- package/documentation/data/dfg/doc-ambient.js +74 -0
- package/documentation/wiki-dataflow-graph.js +10 -4
- package/documentation/wiki-linter.js +12 -0
- package/documentation/wiki-query.js +112 -1
- package/linter/linter-rules.d.ts +41 -1
- package/linter/linter-rules.js +5 -1
- package/linter/rules/call-contracts.d.ts +40 -0
- package/linter/rules/call-contracts.js +56 -0
- package/linter/rules/cmd-check/bogus-return.js +1 -1
- package/linter/rules/cmd-check/call-arguments.js +5 -6
- package/linter/rules/cmd-check/cmd-check-util.d.ts +0 -6
- package/linter/rules/cmd-check/cmd-check-util.js +0 -28
- package/linter/rules/cmd-check/package-hooks.js +2 -1
- package/linter/rules/cmd-check/s-three-method-consistency.js +1 -1
- package/linter/rules/interactive-functions.d.ts +30 -0
- package/linter/rules/interactive-functions.js +87 -0
- package/linter/rules/process-state-in-session.js +1 -1
- package/linter/rules/undefined-symbol-util.d.ts +1 -1
- package/linter/rules/undefined-symbol-util.js +8 -2
- package/linter/rules/undefined-symbol.js +18 -7
- package/linter/rules/useless-loop.d.ts +1 -1
- package/package.json +1 -1
- package/project/context/flowr-analyzer-dependencies-context.js +2 -1
- package/project/flowr-analyzer.d.ts +1 -0
- package/project/flowr-analyzer.js +5 -5
- package/project/sigdb/build.js +14 -4
- package/project/sigdb/decode.d.ts +3 -0
- package/project/sigdb/decode.js +10 -1
- package/project/sigdb/guarded-source.d.ts +6 -0
- package/project/sigdb/guarded-source.js +29 -0
- package/project/sigdb/reader.d.ts +5 -0
- package/project/sigdb/reader.js +27 -1
- package/project/sigdb/schema.d.ts +24 -2
- package/queries/catalog/absint-query/absint-query-format.d.ts +6 -3
- package/queries/catalog/absint-query/absint-query-format.js +57 -2
- package/queries/catalog/ambient-access-query/ambient-access-query-format.d.ts +6 -2
- package/queries/catalog/ambient-access-query/ambient-access-query-format.js +48 -3
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +5 -2
- package/queries/catalog/cluster-query/cluster-query-format.js +19 -2
- package/queries/catalog/code-clones-query/code-clones-query-format.d.ts +5 -2
- package/queries/catalog/code-clones-query/code-clones-query-format.js +34 -2
- package/queries/catalog/config-query/config-query-format.d.ts +5 -2
- package/queries/catalog/config-query/config-query-format.js +41 -2
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +5 -2
- package/queries/catalog/control-flow-query/control-flow-query-format.js +19 -2
- package/queries/catalog/data-columns-query/data-columns-query-format.d.ts +72 -0
- package/queries/catalog/data-columns-query/data-columns-query-format.js +215 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +5 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +38 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +5 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.js +18 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +8 -3
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/tagged-functions.d.ts +11 -0
- package/queries/catalog/dependencies-query/function-info/tagged-functions.js +18 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +7 -2
- package/queries/catalog/dice-query/dice-query-format.js +34 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -4
- package/queries/catalog/does-call-query/does-call-query-format.js +114 -2
- package/queries/catalog/files-query/files-query-format.d.ts +5 -2
- package/queries/catalog/files-query/files-query-format.js +45 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +6 -3
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +303 -2
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +8 -4
- package/queries/catalog/happens-before-query/happens-before-query-format.js +37 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +5 -2
- package/queries/catalog/id-map-query/id-map-query-format.js +18 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +5 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +29 -2
- package/queries/catalog/inspect-fn-guards-query/inspect-fn-guards-query-format.d.ts +37 -0
- package/queries/catalog/inspect-fn-guards-query/inspect-fn-guards-query-format.js +125 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +3 -2
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +54 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +23 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +15 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +8 -2
- package/queries/catalog/linter-query/linter-query-format.js +69 -4
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +7 -3
- package/queries/catalog/location-map-query/location-map-query-format.js +70 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +5 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +18 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +6 -3
- package/queries/catalog/origin-query/origin-query-format.js +29 -2
- package/queries/catalog/project-query/project-query-format.d.ts +6 -3
- package/queries/catalog/project-query/project-query-format.js +98 -2
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +6 -3
- package/queries/catalog/provenance-query/provenance-query-format.js +30 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +9 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +38 -2
- package/queries/catalog/search-query/search-query-format.d.ts +5 -2
- package/queries/catalog/search-query/search-query-format.js +23 -2
- package/queries/catalog/signature-query/signature-query-executor.js +3 -1
- package/queries/catalog/signature-query/signature-query-format.d.ts +3 -0
- package/queries/catalog/signature-query/signature-query-render.js +23 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +13 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.js +55 -2
- package/queries/catalog/taint-query/taint-query-format.d.ts +6 -3
- package/queries/catalog/taint-query/taint-query-format.js +28 -2
- package/queries/query.d.ts +48 -27
- package/queries/query.js +6 -4
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -0
- package/r-bridge/shell.js +7 -2
- package/reconstruct/reconstruct.js +18 -3
- package/slicing/static/removal-slice.js +4 -3
- package/slicing/static/slice-call.d.ts +11 -0
- package/slicing/static/slice-call.js +43 -2
- package/slicing/static/static-slicer.d.ts +2 -0
- package/slicing/static/static-slicer.js +137 -21
- package/slicing/static/visiting-queue.d.ts +2 -0
- package/slicing/static/visiting-queue.js +4 -0
- package/util/flowr-version.d.ts +1 -1
- package/util/flowr-version.js +2 -2
- package/util/objects.d.ts +2 -0
- package/util/objects.js +5 -0
- package/util/r-datasets.d.ts +27 -0
- package/util/r-datasets.js +45 -0
- package/util/text/playground-link.d.ts +2 -0
- package/util/text/playground-link.js +2 -0
- package/queries/catalog/absint-query/absint-query-executor.d.ts +0 -6
- package/queries/catalog/absint-query/absint-query-executor.js +0 -61
- package/queries/catalog/ambient-access-query/ambient-access-query-executor.d.ts +0 -6
- package/queries/catalog/ambient-access-query/ambient-access-query-executor.js +0 -50
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +0 -6
- package/queries/catalog/cluster-query/cluster-query-executor.js +0 -21
- package/queries/catalog/code-clones-query/code-clones-query-executor.d.ts +0 -6
- package/queries/catalog/code-clones-query/code-clones-query-executor.js +0 -38
- package/queries/catalog/config-query/config-query-executor.d.ts +0 -6
- package/queries/catalog/config-query/config-query-executor.js +0 -45
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +0 -6
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +0 -21
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +0 -6
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +0 -40
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +0 -6
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +0 -20
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +0 -9
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +0 -18
- package/queries/catalog/dice-query/dice-query-executor.d.ts +0 -8
- package/queries/catalog/dice-query/dice-query-executor.js +0 -37
- package/queries/catalog/does-call-query/does-call-query-executor.d.ts +0 -6
- package/queries/catalog/does-call-query/does-call-query-executor.js +0 -116
- package/queries/catalog/files-query/files-query-executor.d.ts +0 -6
- package/queries/catalog/files-query/files-query-executor.js +0 -47
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +0 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +0 -307
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +0 -7
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +0 -40
- package/queries/catalog/id-map-query/id-map-query-executor.d.ts +0 -6
- package/queries/catalog/id-map-query/id-map-query-executor.js +0 -20
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -6
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +0 -31
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +0 -4
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +0 -58
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +0 -7
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +0 -25
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +0 -7
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +0 -17
- package/queries/catalog/linter-query/linter-query-executor.d.ts +0 -9
- package/queries/catalog/linter-query/linter-query-executor.js +0 -62
- package/queries/catalog/location-map-query/location-map-query-executor.d.ts +0 -7
- package/queries/catalog/location-map-query/location-map-query-executor.js +0 -73
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +0 -6
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +0 -20
- package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -6
- package/queries/catalog/origin-query/origin-query-executor.js +0 -31
- package/queries/catalog/project-query/project-query-executor.d.ts +0 -6
- package/queries/catalog/project-query/project-query-executor.js +0 -103
- package/queries/catalog/provenance-query/provenance-query-executor.d.ts +0 -6
- package/queries/catalog/provenance-query/provenance-query-executor.js +0 -33
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +0 -10
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +0 -40
- package/queries/catalog/search-query/search-query-executor.d.ts +0 -6
- package/queries/catalog/search-query/search-query-executor.js +0 -25
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +0 -14
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +0 -59
- package/queries/catalog/taint-query/taint-query-executor.d.ts +0 -7
- package/queries/catalog/taint-query/taint-query-executor.js +0 -30
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { BaseQueryFormat, BaseQueryResult, BasicQueryData } from '../../base-query-format';
|
|
2
|
+
import type { OutputFormatter } from '../../../util/text/ansi';
|
|
3
|
+
import Joi from 'joi';
|
|
4
|
+
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
|
+
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
6
|
+
import type { FlowrConfig } from '../../../config';
|
|
7
|
+
import type { ParsedQueryLine } from '../../query';
|
|
8
|
+
import { criteriaQueryCompleter } from '../../../cli/repl/parser/slice-query-parser';
|
|
9
|
+
/**
|
|
10
|
+
* Executes data columns queries: the data frame shape inference runs once for all of them.
|
|
11
|
+
*/
|
|
12
|
+
export declare function executeDataColumnsQuery({ analyzer }: BasicQueryData, queries: readonly DataColumnsQuery[]): Promise<DataColumnsQueryResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Asks which columns of a data frame can be written at a position of the code, as an editor offers them to complete:
|
|
15
|
+
* after `df$` or `df[["`, and in every argument a call evaluates within its data, as `filter(penguins, bi)`,
|
|
16
|
+
* `penguins |> mutate(r = bi)`, `subset(mtcars, mpg > 20)`, `with(iris, ...)`, or `ggplot(penguins, aes(x = bi))`.
|
|
17
|
+
*/
|
|
18
|
+
export interface DataColumnsQuery extends BaseQueryFormat {
|
|
19
|
+
readonly type: 'data-columns';
|
|
20
|
+
/**
|
|
21
|
+
* The positions to ask about, as `line:column` (both starting at 1) of the cursor, which may stand just past the
|
|
22
|
+
* name typed so far. The position has to fall within a node: an editor completing nothing typed yet inserts a
|
|
23
|
+
* placeholder name there first, as `filter(penguins, )` is no different from `filter(penguins)`.
|
|
24
|
+
*/
|
|
25
|
+
readonly positions: readonly string[];
|
|
26
|
+
/** The file the positions are in, as flowR names it, if the analysis holds more than one. */
|
|
27
|
+
readonly file?: string;
|
|
28
|
+
}
|
|
29
|
+
/** How the columns can be written at the position. */
|
|
30
|
+
export declare enum DataColumnsContext {
|
|
31
|
+
/** as the name accessed of a data frame, `df$col` or `df[["col"]]` */
|
|
32
|
+
Access = "access",
|
|
33
|
+
/** as a name a call evaluates within its data, `filter(df, col > 1)` */
|
|
34
|
+
Masked = "masked"
|
|
35
|
+
}
|
|
36
|
+
/** One data frame whose columns can be written at a position. */
|
|
37
|
+
export interface DataColumnsFrame {
|
|
38
|
+
/** the node of the data frame, e.g. the `penguins` of `filter(penguins, ...)` */
|
|
39
|
+
readonly id: NodeId;
|
|
40
|
+
/** the code of the node, if it has any of its own */
|
|
41
|
+
readonly lexeme?: string;
|
|
42
|
+
/** the columns it surely has */
|
|
43
|
+
readonly must: readonly string[];
|
|
44
|
+
/** the columns it may have as well */
|
|
45
|
+
readonly may: readonly string[];
|
|
46
|
+
/** whether it has no other columns than these */
|
|
47
|
+
readonly exact: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** The columns that can be written at one position. */
|
|
50
|
+
export interface DataColumnsAt {
|
|
51
|
+
/** how the columns are written there, absent where no data frame is in reach */
|
|
52
|
+
readonly context?: DataColumnsContext;
|
|
53
|
+
/** every column of the {@link frames}, those they surely have first */
|
|
54
|
+
readonly columns: readonly string[];
|
|
55
|
+
readonly frames: readonly DataColumnsFrame[];
|
|
56
|
+
}
|
|
57
|
+
export interface DataColumnsQueryResult extends BaseQueryResult {
|
|
58
|
+
/** the columns at each position asked about, by the position as given */
|
|
59
|
+
readonly results: Record<string, DataColumnsAt>;
|
|
60
|
+
}
|
|
61
|
+
declare function dataColumnsLineParser(_output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'data-columns'>;
|
|
62
|
+
export declare const DataColumnsQueryDefinition: {
|
|
63
|
+
readonly title: "Data Columns Query";
|
|
64
|
+
readonly executor: typeof executeDataColumnsQuery;
|
|
65
|
+
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[]) => true;
|
|
66
|
+
readonly fromLine: typeof dataColumnsLineParser;
|
|
67
|
+
readonly completer: typeof criteriaQueryCompleter;
|
|
68
|
+
readonly syntax: "@data-columns (<line:col>;...) <code | file://path>";
|
|
69
|
+
readonly schema: Joi.ObjectSchema<any>;
|
|
70
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
71
|
+
};
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,215 @@
|
|
|
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.DataColumnsQueryDefinition = exports.DataColumnsContext = void 0;
|
|
7
|
+
exports.executeDataColumnsQuery = executeDataColumnsQuery;
|
|
8
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
+
const joi_1 = __importDefault(require("joi"));
|
|
10
|
+
const query_print_1 = require("../../query-print");
|
|
11
|
+
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
12
|
+
const absint_inference_1 = require("../../../abstract-interpretation/absint-inference");
|
|
13
|
+
const shape_inference_1 = require("../../../abstract-interpretation/data-frame/shape-inference");
|
|
14
|
+
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
15
|
+
const r_access_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
|
|
16
|
+
const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
17
|
+
const r_binary_op_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
|
|
18
|
+
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
19
|
+
const r_pipe_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-pipe");
|
|
20
|
+
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
21
|
+
const arrays_1 = require("../../../util/collections/arrays");
|
|
22
|
+
const query_meta_1 = require("../../query-meta");
|
|
23
|
+
/** the pipes that hand their left side to the call on their right as its data */
|
|
24
|
+
const Pipes = new Set(['|>', '%>%', '%<>%', '%T>%', '%$%']);
|
|
25
|
+
/** the operators binding a value to a name, whose sides are no data of the call that is evaluated within */
|
|
26
|
+
const Assignments = new Set(['<-', '=', '<<-', '->', '->>', ':=']);
|
|
27
|
+
/** the innermost node whose code holds `line`:`col`, where a cursor just past a name still counts as within it */
|
|
28
|
+
function innermostAt(idMap, line, col, file) {
|
|
29
|
+
let best;
|
|
30
|
+
let size = Infinity;
|
|
31
|
+
for (const node of idMap.values()) {
|
|
32
|
+
const range = model_1.RNode.span(node);
|
|
33
|
+
if (range === undefined || (file !== undefined && node.info.file !== undefined && node.info.file !== file)) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const [sl, sc, el, ec] = range;
|
|
37
|
+
if (line < sl || line > el || (line === sl && col < sc) || (line === el && col > ec + 1)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const extent = (el - sl) * 100_000 + (ec - sc);
|
|
41
|
+
if (extent < size) {
|
|
42
|
+
best = node;
|
|
43
|
+
size = extent;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return best;
|
|
47
|
+
}
|
|
48
|
+
/** the arguments of a call or an operator, as the nodes of their values */
|
|
49
|
+
function operandsOf(node) {
|
|
50
|
+
if (r_function_call_1.RFunctionCall.is(node)) {
|
|
51
|
+
return node.arguments.flatMap(arg => r_argument_1.RArgument.valueOf(arg) ?? []);
|
|
52
|
+
}
|
|
53
|
+
else if (r_binary_op_1.RBinaryOp.is(node) || r_pipe_1.RPipe.is(node)) {
|
|
54
|
+
return [node.lhs, node.rhs];
|
|
55
|
+
}
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
/** the name of a call or an operator, `%>%` for both its forms */
|
|
59
|
+
function operatorOf(node) {
|
|
60
|
+
if (r_pipe_1.RPipe.is(node)) {
|
|
61
|
+
return '|>';
|
|
62
|
+
}
|
|
63
|
+
else if (r_binary_op_1.RBinaryOp.is(node)) {
|
|
64
|
+
return node.operator;
|
|
65
|
+
}
|
|
66
|
+
else if (r_function_call_1.RFunctionCall.isNamed(node)) {
|
|
67
|
+
return String(identifier_1.Identifier.getName(node.functionName.content));
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
/** what a layered call like `ggplot(df) + geom_point(aes(...))` takes its data from: the operands of the calls to the left */
|
|
72
|
+
function leftLayers(node) {
|
|
73
|
+
const found = [];
|
|
74
|
+
let at = node;
|
|
75
|
+
while (r_binary_op_1.RBinaryOp.is(at) && at.operator === '+') {
|
|
76
|
+
at = at.lhs;
|
|
77
|
+
}
|
|
78
|
+
if (at !== undefined) {
|
|
79
|
+
found.push(...operandsOf(at));
|
|
80
|
+
}
|
|
81
|
+
return found;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The data frames whose columns can be written at `node`, nearest first: after `$` the accessed frame, and within
|
|
85
|
+
* an argument flowR knows a call to evaluate within its data (as it does for every quoting call, whether it is
|
|
86
|
+
* `filter`, `subset`, `with`, or `aes`) the other operands of that call, of a pipe into it, and of the layers left of it.
|
|
87
|
+
*/
|
|
88
|
+
function framesFor(node, idMap, dfg) {
|
|
89
|
+
const parent = idMap.get(node.info.parent);
|
|
90
|
+
const access = r_argument_1.RArgument.is(parent) ? idMap.get(parent.info.parent) : undefined;
|
|
91
|
+
if (r_access_1.RAccess.is(access) && (access.operator === '$' || access.operator === '@' || access.operator === '[[') && access.accessed !== node) {
|
|
92
|
+
return { context: DataColumnsContext.Access, candidates: [[access.accessed]] };
|
|
93
|
+
}
|
|
94
|
+
if (!dfg.isQuoted(node.info.id)) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
const candidates = [];
|
|
98
|
+
let child = node;
|
|
99
|
+
for (const ancestor of model_1.RNode.iterateParents(node, idMap)) {
|
|
100
|
+
const op = operatorOf(ancestor);
|
|
101
|
+
if (r_function_call_1.RFunctionCall.is(ancestor) || r_binary_op_1.RBinaryOp.is(ancestor) || r_pipe_1.RPipe.is(ancestor)) {
|
|
102
|
+
const around = ancestor.info.parent === undefined ? undefined : idMap.get(ancestor.info.parent);
|
|
103
|
+
const outer = r_argument_1.RArgument.is(around) ? idMap.get(around.info.parent) : around;
|
|
104
|
+
/* the other quoted operands are written in the same data mask (`y = mpg` next to `x = wt` in `aes`), and name columns, not data */
|
|
105
|
+
const level = operandsOf(ancestor).filter(operand => operand !== child && !model_1.RNode.iterateParents(child, idMap).some(p => p === operand) && !dfg.isQuoted(operand.info.id));
|
|
106
|
+
/* the pipe hands its left side on as the first argument */
|
|
107
|
+
if (outer !== undefined && Pipes.has(operatorOf(outer) ?? '') && r_argument_1.RArgument.valueOf(operandsOf(outer)[1]) === ancestor) {
|
|
108
|
+
level.unshift(operandsOf(outer)[0]);
|
|
109
|
+
}
|
|
110
|
+
if (outer !== undefined && r_binary_op_1.RBinaryOp.is(outer) && outer.operator === '+' && outer.rhs === ancestor) {
|
|
111
|
+
level.push(...leftLayers(outer.lhs));
|
|
112
|
+
}
|
|
113
|
+
if (!(op !== undefined && (Pipes.has(op) || Assignments.has(op)))) {
|
|
114
|
+
candidates.push(level);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
child = ancestor;
|
|
118
|
+
}
|
|
119
|
+
return { context: DataColumnsContext.Masked, candidates };
|
|
120
|
+
}
|
|
121
|
+
/** the shape of a frame, if flowR knows any of its columns */
|
|
122
|
+
function frameOf(node, value) {
|
|
123
|
+
if (value === undefined || !value.colnames.isValue()) {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
const must = [...value.colnames.must];
|
|
127
|
+
const may = value.colnames.isFinite() ? [...value.colnames.may] : [];
|
|
128
|
+
if (must.length + may.length === 0) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
return { id: node.info.id, lexeme: model_1.RNode.lexeme(node), must, may, exact: value.colnames.isFinite() && may.length === 0 };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Executes data columns queries: the data frame shape inference runs once for all of them.
|
|
135
|
+
*/
|
|
136
|
+
async function executeDataColumnsQuery({ analyzer }, queries) {
|
|
137
|
+
const ast = await analyzer.normalize();
|
|
138
|
+
const dfg = (await analyzer.dataflow()).graph;
|
|
139
|
+
const cfg = await analyzer.controlflow();
|
|
140
|
+
const start = Date.now();
|
|
141
|
+
let interpreter;
|
|
142
|
+
const shapeOf = (node) => {
|
|
143
|
+
if (interpreter === undefined) {
|
|
144
|
+
interpreter = new absint_inference_1.AbstractInterpreter({ controlFlow: cfg, dfg, normalizedAst: ast, ctx: analyzer.inspectContext() }, new shape_inference_1.DataFrameShapeAnalysis({ trackOperations: false }));
|
|
145
|
+
interpreter.start();
|
|
146
|
+
}
|
|
147
|
+
return frameOf(node, interpreter.getAbstractValue(node, 'dataFrame'));
|
|
148
|
+
};
|
|
149
|
+
const results = {};
|
|
150
|
+
for (const query of queries) {
|
|
151
|
+
for (const position of query.positions) {
|
|
152
|
+
const [line, col] = position.split(':').map(Number);
|
|
153
|
+
const node = innermostAt(ast.idMap, line, col, query.file);
|
|
154
|
+
const found = node === undefined ? undefined : framesFor(node, ast.idMap, dfg);
|
|
155
|
+
let frames = [];
|
|
156
|
+
/* the nearest call with a data frame of known columns is what the name is evaluated within */
|
|
157
|
+
for (const level of found?.candidates ?? []) {
|
|
158
|
+
frames = level.flatMap(candidate => shapeOf(candidate) ?? []);
|
|
159
|
+
if (frames.length > 0) {
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
results[position] = frames.length === 0 ? { columns: [], frames: [] } : {
|
|
164
|
+
context: found?.context,
|
|
165
|
+
columns: (0, arrays_1.uniqueArray)([...frames.flatMap(f => f.must), ...frames.flatMap(f => f.may)]),
|
|
166
|
+
frames
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return { ...(0, query_meta_1.metaSince)(start), results };
|
|
171
|
+
}
|
|
172
|
+
/** How the columns can be written at the position. */
|
|
173
|
+
var DataColumnsContext;
|
|
174
|
+
(function (DataColumnsContext) {
|
|
175
|
+
/** as the name accessed of a data frame, `df$col` or `df[["col"]]` */
|
|
176
|
+
DataColumnsContext["Access"] = "access";
|
|
177
|
+
/** as a name a call evaluates within its data, `filter(df, col > 1)` */
|
|
178
|
+
DataColumnsContext["Masked"] = "masked";
|
|
179
|
+
})(DataColumnsContext || (exports.DataColumnsContext = DataColumnsContext = {}));
|
|
180
|
+
function dataColumnsLineParser(_output, line, _config) {
|
|
181
|
+
const positions = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
|
|
182
|
+
return {
|
|
183
|
+
query: { type: 'data-columns', positions: positions ?? [] },
|
|
184
|
+
rCode: (0, slice_query_parser_1.queryLineCode)(line, positions ? 1 : 0)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
exports.DataColumnsQueryDefinition = {
|
|
188
|
+
title: 'Data Columns Query',
|
|
189
|
+
executor: executeDataColumnsQuery,
|
|
190
|
+
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
191
|
+
const out = queryResults;
|
|
192
|
+
result.push((0, query_print_1.queryHeader)('data-columns', formatter, out['.meta'].timing));
|
|
193
|
+
for (const [position, at] of Object.entries(out.results)) {
|
|
194
|
+
if (at.context === undefined) {
|
|
195
|
+
result.push(` ╰ ${(0, ansi_1.bold)(position, formatter)}: ${(0, ansi_1.italic)('no data frame in reach', formatter)}`);
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
const frames = at.frames.map(f => f.lexeme ?? String(f.id)).join(', ');
|
|
199
|
+
result.push(` ╰ ${(0, ansi_1.bold)(position, formatter)} (${at.context} of ${frames}): ${at.columns.join(', ')}`);
|
|
200
|
+
}
|
|
201
|
+
return true;
|
|
202
|
+
},
|
|
203
|
+
fromLine: dataColumnsLineParser,
|
|
204
|
+
completer: slice_query_parser_1.criteriaQueryCompleter,
|
|
205
|
+
syntax: '@data-columns (<line:col>;...) <code | file://path>',
|
|
206
|
+
schema: joi_1.default.object({
|
|
207
|
+
type: joi_1.default.string().valid('data-columns').required().description('The type of the query.'),
|
|
208
|
+
positions: joi_1.default.array().items(joi_1.default.string().pattern(/^\d+:\d+$/)).min(1).required().description('The positions to ask about, as `line:column` of the cursor.'),
|
|
209
|
+
file: joi_1.default.string().optional().description('The file the positions are in, if the analysis holds more than one.')
|
|
210
|
+
}).description('The data columns query returns the columns of a data frame that can be written at a position, after `df$` or within the arguments a call evaluates within its data.'),
|
|
211
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
212
|
+
return Object.values(queryResults.results).flatMap(at => at.frames.map(f => f.id));
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
//# sourceMappingURL=data-columns-query-format.js.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
1
|
+
import type { BaseQueryFormat, BaseQueryResult, BasicQueryData } from '../../base-query-format';
|
|
2
2
|
import type { DataflowGraph } from '../../../dataflow/graph/graph';
|
|
3
|
-
import { executeDataflowLensQuery } from './dataflow-lens-query-executor';
|
|
4
3
|
import Joi from 'joi';
|
|
4
|
+
/**
|
|
5
|
+
* Executes the given dataflow lens queries using the provided analyzer.
|
|
6
|
+
*/
|
|
7
|
+
export declare function executeDataflowLensQuery({ analyzer }: BasicQueryData, queries: readonly DataflowLensQuery[]): Promise<DataflowLensQueryResult>;
|
|
5
8
|
/**
|
|
6
9
|
* Returns a simplified view on the dataflow graph of the analysis
|
|
7
10
|
*/
|
|
@@ -4,13 +4,49 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DataflowLensQueryDefinition = void 0;
|
|
7
|
+
exports.executeDataflowLensQuery = executeDataflowLensQuery;
|
|
7
8
|
const query_print_1 = require("../../query-print");
|
|
8
|
-
const dataflow_lens_query_executor_1 = require("./dataflow-lens-query-executor");
|
|
9
9
|
const joi_1 = __importDefault(require("joi"));
|
|
10
10
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
11
|
+
const log_1 = require("../../../util/log");
|
|
12
|
+
const query_meta_1 = require("../../query-meta");
|
|
13
|
+
const dfg_view_1 = require("../../../util/simple-df/dfg-view");
|
|
14
|
+
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
15
|
+
const arguments_1 = require("../../../abstract-interpretation/data-frame/arguments");
|
|
16
|
+
const base_operators_1 = require("../../../dataflow/environments/default-builtin-config/base-operators");
|
|
17
|
+
/**
|
|
18
|
+
* The lens hides syntax: every operator R has, the native pipe (which {@link BuiltInOperators.byName} does not list), and the
|
|
19
|
+
* control-flow keywords. None of them names anything, unlike the built-in *functions* (`print`, `ifelse`) it keeps.
|
|
20
|
+
* Anchored and escaped, as most of these are regex syntax themselves and an unanchored alternative would also drop
|
|
21
|
+
* every lexeme merely *containing* one (`if` in `identifier`).
|
|
22
|
+
*/
|
|
23
|
+
const HiddenLexemes = `^(${[...Object.keys(base_operators_1.BuiltInOperators.byName), '|>', 'function', 'repeat', 'if', 'next', 'break']
|
|
24
|
+
.map(name => (0, arguments_1.escapeRegExp)(name)).join('|')})$`;
|
|
25
|
+
/**
|
|
26
|
+
* Executes the given dataflow lens queries using the provided analyzer.
|
|
27
|
+
*/
|
|
28
|
+
async function executeDataflowLensQuery({ analyzer }, queries) {
|
|
29
|
+
if (queries.length !== 1) {
|
|
30
|
+
log_1.log.warn('Dataflow query expects only up to one query, but got', queries.length);
|
|
31
|
+
}
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
const simplifiedGraph = (0, dfg_view_1.reduceDfg)((await analyzer.dataflow()).graph, {
|
|
34
|
+
vertices: {
|
|
35
|
+
keepEnv: false,
|
|
36
|
+
keepCd: true,
|
|
37
|
+
tags: [vertex_1.VertexType.Use, vertex_1.VertexType.VariableDefinition, vertex_1.VertexType.FunctionDefinition, vertex_1.VertexType.FunctionCall],
|
|
38
|
+
nameRegex: HiddenLexemes,
|
|
39
|
+
blacklistWithName: true
|
|
40
|
+
}
|
|
41
|
+
}, analyzer.inspectContext().env.makeCleanEnv());
|
|
42
|
+
return {
|
|
43
|
+
...(0, query_meta_1.metaSince)(now),
|
|
44
|
+
simplifiedGraph
|
|
45
|
+
};
|
|
46
|
+
}
|
|
11
47
|
exports.DataflowLensQueryDefinition = {
|
|
12
48
|
title: 'Dataflow Lens Query',
|
|
13
|
-
executor:
|
|
49
|
+
executor: executeDataflowLensQuery,
|
|
14
50
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
15
51
|
const out = queryResults;
|
|
16
52
|
result.push((0, query_print_1.queryHeader)('dataflow-lens', formatter, out['.meta'].timing));
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
1
|
+
import type { BaseQueryFormat, BaseQueryResult, BasicQueryData } from '../../base-query-format';
|
|
2
2
|
import type { DataflowGraph } from '../../../dataflow/graph/graph';
|
|
3
|
-
import { executeDataflowQuery } from './dataflow-query-executor';
|
|
4
3
|
import Joi from 'joi';
|
|
5
4
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
|
+
/**
|
|
6
|
+
* Executes the given dataflow queries.
|
|
7
|
+
*/
|
|
8
|
+
export declare function executeDataflowQuery({ analyzer }: BasicQueryData, queries: readonly DataflowQuery[]): Promise<DataflowQueryResult>;
|
|
6
9
|
/**
|
|
7
10
|
* Simple re-returns the dataflow graph of the analysis.
|
|
8
11
|
*/
|
|
@@ -4,15 +4,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DataflowQueryDefinition = void 0;
|
|
7
|
+
exports.executeDataflowQuery = executeDataflowQuery;
|
|
7
8
|
const query_print_1 = require("../../query-print");
|
|
8
|
-
const dataflow_query_executor_1 = require("./dataflow-query-executor");
|
|
9
9
|
const joi_1 = __importDefault(require("joi"));
|
|
10
10
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
11
|
+
const log_1 = require("../../../util/log");
|
|
12
|
+
const query_meta_1 = require("../../query-meta");
|
|
13
|
+
/**
|
|
14
|
+
* Executes the given dataflow queries.
|
|
15
|
+
*/
|
|
16
|
+
async function executeDataflowQuery({ analyzer }, queries) {
|
|
17
|
+
if (queries.length !== 1) {
|
|
18
|
+
log_1.log.warn('Dataflow query expects only up to one query, but got', queries.length);
|
|
19
|
+
}
|
|
20
|
+
const startTime = Date.now();
|
|
21
|
+
const { graph } = await analyzer.dataflow();
|
|
22
|
+
return {
|
|
23
|
+
...(0, query_meta_1.metaSince)(startTime),
|
|
24
|
+
graph: queries.every(q => q.environments === false) ? graph.withoutEnvironments() : graph
|
|
25
|
+
};
|
|
26
|
+
}
|
|
11
27
|
/** Above this many characters, the mermaid.live link is dropped from the REPL output (large graphs produce megabyte-sized base64 urls). */
|
|
12
28
|
const MaxMermaidUrlLength = 8000;
|
|
13
29
|
exports.DataflowQueryDefinition = {
|
|
14
30
|
title: 'Dataflow Query',
|
|
15
|
-
executor:
|
|
31
|
+
executor: executeDataflowQuery,
|
|
16
32
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
17
33
|
const out = queryResults;
|
|
18
34
|
result.push((0, query_print_1.queryHeader)('dataflow', formatter, out['.meta'].timing));
|
|
@@ -33,7 +33,7 @@ export interface DependencyCategorySettings {
|
|
|
33
33
|
additionalAnalysis?: (data: BasicQueryData, ignoreDefault: boolean, functions: readonly FunctionInfo[], queryResults: CallContextQueryResult, result: DependencyInfo[]) => AsyncOrSync<void>;
|
|
34
34
|
}
|
|
35
35
|
/** the built-in categories; what each searches for is derived per configuration, see {@link defaultDependencyCategories} */
|
|
36
|
-
export declare const DefaultDependencyCategoryNames: readonly ["library", "remote", "source", "read", "write", "visualize", "transform", "test", "statistics"];
|
|
36
|
+
export declare const DefaultDependencyCategoryNames: readonly ["library", "remote", "source", "read", "write", "visualize", "transform", "test", "statistics", "interactive"];
|
|
37
37
|
export type DefaultDependencyCategoryName = typeof DefaultDependencyCategoryNames[number];
|
|
38
38
|
/**
|
|
39
39
|
* The categories flowR searches for by default. The functions of the categories flowR derives from its
|
|
@@ -26,7 +26,8 @@ const read_functions_1 = require("./function-info/read-functions");
|
|
|
26
26
|
const write_functions_1 = require("./function-info/write-functions");
|
|
27
27
|
const visualize_functions_1 = require("./function-info/visualize-functions");
|
|
28
28
|
const transform_functions_1 = require("./function-info/transform-functions");
|
|
29
|
-
const
|
|
29
|
+
const tagged_functions_1 = require("./function-info/tagged-functions");
|
|
30
|
+
const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
|
|
30
31
|
const test_functions_1 = require("./function-info/test-functions");
|
|
31
32
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
32
33
|
const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
@@ -44,7 +45,7 @@ Object.defineProperty(exports, "Unknown", { enumerable: true, get: function () {
|
|
|
44
45
|
/** {@link DependencyInfo#functionName} for an assumed base package: nothing in the code names it, so there is no call to report as `functionName`. */
|
|
45
46
|
exports.Attached = '<attached>';
|
|
46
47
|
/** the built-in categories; what each searches for is derived per configuration, see {@link defaultDependencyCategories} */
|
|
47
|
-
exports.DefaultDependencyCategoryNames = ['library', 'remote', 'source', 'read', 'write', 'visualize', 'transform', 'test', 'statistics'];
|
|
48
|
+
exports.DefaultDependencyCategoryNames = ['library', 'remote', 'source', 'read', 'write', 'visualize', 'transform', 'test', 'statistics', 'interactive'];
|
|
48
49
|
/** a definition or call reached again while working it out makes nothing new */
|
|
49
50
|
const NothingNew = { answer: false };
|
|
50
51
|
/**
|
|
@@ -217,7 +218,11 @@ const dependencyCategoriesOf = (env) => ({
|
|
|
217
218
|
},
|
|
218
219
|
'statistics': {
|
|
219
220
|
queryDisplayName: 'Statistics',
|
|
220
|
-
functions: (0,
|
|
221
|
+
functions: (0, tagged_functions_1.functionsTagged)(env.builtInIndex, built_in_props_1.SemanticCallTag.Statistics)
|
|
222
|
+
},
|
|
223
|
+
'interactive': {
|
|
224
|
+
queryDisplayName: 'Interactive Use',
|
|
225
|
+
functions: (0, tagged_functions_1.functionsTagged)(env.builtInIndex, built_in_props_1.SemanticCallTag.Interactive)
|
|
221
226
|
}
|
|
222
227
|
});
|
|
223
228
|
function printResultSection(title, infos, result, formatter) {
|
|
@@ -19,7 +19,7 @@ exports.OtherPathFunctions = [
|
|
|
19
19
|
{ package: 'base', name: 'file.symlink', argIdx: 0, argName: 'from', resolveValue: true },
|
|
20
20
|
{ package: 'base', name: 'file.link', argIdx: 0, argName: 'from', resolveValue: true },
|
|
21
21
|
{ package: 'base', name: 'Sys.junction', argIdx: 0, argName: 'from', resolveValue: true },
|
|
22
|
-
{ package: 'base', name: 'dir.exists', argIdx: 0, argName: '
|
|
22
|
+
{ package: 'base', name: 'dir.exists', argIdx: 0, argName: 'paths', resolveValue: true },
|
|
23
23
|
{ package: 'base', name: 'list.files', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
|
|
24
24
|
{ package: 'base', name: 'list.dirs', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
|
|
25
25
|
{ package: 'base', name: 'dir', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FunctionInfo } from './function-info';
|
|
2
|
+
import type { SemanticCallTag } from '../../../../dataflow/environments/built-in-props';
|
|
3
|
+
import type { BuiltInIndex } from '../../../../dataflow/environments/query-fn-props';
|
|
4
|
+
/**
|
|
5
|
+
* The built-ins labeled `tag`, as the entries of a dependency category, so the dependency query and the built-in
|
|
6
|
+
* configuration cannot disagree about them: the statistical tests are the ones labeled {@link SemanticCallTag.Statistics},
|
|
7
|
+
* the calls needing an interactive session those labeled {@link SemanticCallTag.Interactive}. Every one of them names
|
|
8
|
+
* the package it belongs to, which is what keeps `stats::t.test` a test and drops a `t.test` of somebody else's package.
|
|
9
|
+
* Label a built-in with the tag and it shows up in the category.
|
|
10
|
+
*/
|
|
11
|
+
export declare function functionsTagged(index: BuiltInIndex, tag: SemanticCallTag): FunctionInfo[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.functionsTagged = functionsTagged;
|
|
4
|
+
const identifier_1 = require("../../../../dataflow/environments/identifier");
|
|
5
|
+
/**
|
|
6
|
+
* The built-ins labeled `tag`, as the entries of a dependency category, so the dependency query and the built-in
|
|
7
|
+
* configuration cannot disagree about them: the statistical tests are the ones labeled {@link SemanticCallTag.Statistics},
|
|
8
|
+
* the calls needing an interactive session those labeled {@link SemanticCallTag.Interactive}. Every one of them names
|
|
9
|
+
* the package it belongs to, which is what keeps `stats::t.test` a test and drops a `t.test` of somebody else's package.
|
|
10
|
+
* Label a built-in with the tag and it shows up in the category.
|
|
11
|
+
*/
|
|
12
|
+
function functionsTagged(index, tag) {
|
|
13
|
+
return index.with(tag).map(call => ({
|
|
14
|
+
name: identifier_1.Identifier.getName(call),
|
|
15
|
+
package: identifier_1.Identifier.getNamespace(call)
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=tagged-functions.js.map
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import { type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
|
|
1
|
+
import { type BasicQueryData, type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
|
|
2
2
|
import type { SlicingCriteria } from '../../../slicing/criterion/parse';
|
|
3
3
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import type { ParsedQueryLine } from '../../query';
|
|
5
5
|
import Joi from 'joi';
|
|
6
|
-
import { executeDiceQuery } from './dice-query-executor';
|
|
7
6
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
8
7
|
import type { CommandCompletions } from '../../../cli/repl/completion';
|
|
9
8
|
import type { FlowrConfig } from '../../../config';
|
|
10
9
|
import { type SliceQueryOptions } from '../slice-query-options';
|
|
10
|
+
/**
|
|
11
|
+
* Execute dice queries. Each dice computes the intersection of a forward slice from `from`
|
|
12
|
+
* and a backward slice from `to`, yielding only those program points that lie on a path
|
|
13
|
+
* from the start criteria to the end criteria.
|
|
14
|
+
*/
|
|
15
|
+
export declare function executeDiceQuery({ analyzer }: BasicQueryData, queries: readonly DiceQuery[]): Promise<DiceQueryResult>;
|
|
11
16
|
/**
|
|
12
17
|
* Computes a program dice: only those parts that lie on a path from the given start nodes to the given end nodes.
|
|
13
18
|
* Equivalent to the intersection of a forward slice from `from` and a backward slice from `to`.
|
|
@@ -4,11 +4,43 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DiceQueryDefinition = void 0;
|
|
7
|
+
exports.executeDiceQuery = executeDiceQuery;
|
|
7
8
|
const base_query_format_1 = require("../../base-query-format");
|
|
8
9
|
const joi_1 = __importDefault(require("joi"));
|
|
9
|
-
const dice_query_executor_1 = require("./dice-query-executor");
|
|
10
10
|
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
11
11
|
const slice_query_options_1 = require("../slice-query-options");
|
|
12
|
+
const query_meta_1 = require("../../query-meta");
|
|
13
|
+
const static_slicer_1 = require("../../../slicing/static/static-slicer");
|
|
14
|
+
const log_1 = require("../../../util/log");
|
|
15
|
+
/**
|
|
16
|
+
* Execute dice queries. Each dice computes the intersection of a forward slice from `from`
|
|
17
|
+
* and a backward slice from `to`, yielding only those program points that lie on a path
|
|
18
|
+
* from the start criteria to the end criteria.
|
|
19
|
+
*/
|
|
20
|
+
async function executeDiceQuery({ analyzer }, queries) {
|
|
21
|
+
const start = Date.now();
|
|
22
|
+
const results = {};
|
|
23
|
+
const ast = await analyzer.normalize();
|
|
24
|
+
const df = await analyzer.dataflow();
|
|
25
|
+
const keys = (0, slice_query_options_1.sliceResultKeys)(queries, query => `${query.from.join(',')}->${query.to.join(',')}`);
|
|
26
|
+
for (const [at, query] of queries.entries()) {
|
|
27
|
+
const key = keys[at];
|
|
28
|
+
if (results[key]) {
|
|
29
|
+
log_1.log.warn(`Duplicate key for dice-query: ${key}, skipping...`);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const { from, to, includeCallees } = query;
|
|
33
|
+
const startIds = (0, slice_query_options_1.resolveSliceCriteria)(from, ast);
|
|
34
|
+
const endIds = (0, slice_query_options_1.resolveSliceCriteria)(to, ast);
|
|
35
|
+
const sliceStart = Date.now();
|
|
36
|
+
const slice = (0, static_slicer_1.staticDice)(analyzer.inspectContext(), df, ast, startIds, endIds, analyzer.flowrConfig.solver.slicer?.threshold, includeCallees);
|
|
37
|
+
results[key] = (0, slice_query_options_1.timedSliceEntry)(query, slice, Date.now() - sliceStart, () => (0, slice_query_options_1.reconstructSlice)(ast, df.graph, slice.result, query));
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
...(0, query_meta_1.metaSince)(start),
|
|
41
|
+
results
|
|
42
|
+
};
|
|
43
|
+
}
|
|
12
44
|
const diceFormat = '(from1;from2->to1;to2)';
|
|
13
45
|
function diceQueryLineParser(output, line, _config) {
|
|
14
46
|
const parsed = (0, slice_query_parser_1.diceCriteriaParser)(line[0]);
|
|
@@ -46,7 +78,7 @@ function diceQueryCompleter(line, startingNewArg, _config) {
|
|
|
46
78
|
}
|
|
47
79
|
exports.DiceQueryDefinition = {
|
|
48
80
|
title: 'Dice Query',
|
|
49
|
-
executor:
|
|
81
|
+
executor: executeDiceQuery,
|
|
50
82
|
perQueryResults: true,
|
|
51
83
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => (0, slice_query_options_1.summarizeSliceResults)(formatter, 'dice', queryResults, result, (_, q) => q ? `Dice from {${q.from.join(', ')}} to {${q.to.join(', ')}}` : 'Dice'),
|
|
52
84
|
fromLine: diceQueryLineParser,
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
|
|
1
|
+
import { type BasicQueryData, type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
|
|
2
2
|
import Joi from 'joi';
|
|
3
3
|
import type { ParsedQueryLine } from '../../query';
|
|
4
|
-
import { executeDoesCallQuery } from './does-call-query-executor';
|
|
5
|
-
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
|
-
import type { SlicingCriterion } from '../../../slicing/criterion/parse';
|
|
7
4
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
8
5
|
import type { FlowrConfig } from '../../../config';
|
|
6
|
+
import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
|
+
import { SlicingCriterion } from '../../../slicing/criterion/parse';
|
|
8
|
+
/**
|
|
9
|
+
* Execute does call queries on the given analyzer.
|
|
10
|
+
*/
|
|
11
|
+
export declare function executeDoesCallQuery({ analyzer }: BasicQueryData, queries: readonly DoesCallQuery[]): Promise<DoesCallQueryResult>;
|
|
9
12
|
interface CallsIdConstraint {
|
|
10
13
|
readonly type: 'calls-id';
|
|
11
14
|
/** The id of the function being called. */
|