@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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.strictnessOfEach = strictnessOfEach;
|
|
4
|
+
exports.promiseForcingPoints = promiseForcingPoints;
|
|
4
5
|
exports.promiseDependencies = promiseDependencies;
|
|
6
|
+
exports.promiseRaises = promiseRaises;
|
|
5
7
|
exports.promiseForcing = promiseForcing;
|
|
6
8
|
exports.settleDefinitionsInPromises = settleDefinitionsInPromises;
|
|
7
9
|
exports.settleJumpsInPromises = settleJumpsInPromises;
|
|
@@ -13,6 +15,7 @@ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id"
|
|
|
13
15
|
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
14
16
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
15
17
|
const info_1 = require("../info");
|
|
18
|
+
const linker_1 = require("../internal/linker");
|
|
16
19
|
const edge_1 = require("../graph/edge");
|
|
17
20
|
const node_value_1 = require("../eval/resolve/node-value");
|
|
18
21
|
const resolve_helper_1 = require("../environments/resolve-helper");
|
|
@@ -360,11 +363,9 @@ function computeStrictness(id, state) {
|
|
|
360
363
|
function strictnessOfEach(ids, graph, { ctx } = {}) {
|
|
361
364
|
const state = strictnessStateOf(graph, ctx);
|
|
362
365
|
const result = {};
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
});
|
|
366
|
+
for (const id of ids) {
|
|
367
|
+
result[id] = strictnessOf(id, state);
|
|
368
|
+
}
|
|
368
369
|
return result;
|
|
369
370
|
}
|
|
370
371
|
/** Where the promises bound to `params` may be forced: their reads, calls of closures capturing them, and the callees they are handed to. */
|
|
@@ -379,8 +380,10 @@ function forcingPointsOf(params, graph, idMap, seen = new Set()) {
|
|
|
379
380
|
const element = isElementRead(param, graph);
|
|
380
381
|
const binding = element ? df_helper_1.Dataflow.targetsOf(graph, param, edge_1.EdgeType.Reads).find(t => idMap.get(t)?.info.role === "param-n" /* RoleInParent.ParameterName */) : param;
|
|
381
382
|
const owner = idMap.get(idMap.get(binding ?? -1)?.info.parent ?? -1)?.info.parent;
|
|
382
|
-
|
|
383
|
-
|
|
383
|
+
/* a promise bound outside of every function (`delayedAssign`) is forced by each call running a closure reading it */
|
|
384
|
+
const global = !element && !vertex_1.DfgVertex.isFunctionDefinition(graph.getVertex(owner ?? ''));
|
|
385
|
+
for (const read of element ? [param] : df_helper_1.Dataflow.sourcesOf(graph, param, global ? edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall : edge_1.EdgeType.Reads)) {
|
|
386
|
+
found.push(read, ...global ? callersOf(read, graph, idMap) : []);
|
|
384
387
|
/* only a closure within the function owning the parameter captures it, a read elsewhere is no call of one */
|
|
385
388
|
const closures = [];
|
|
386
389
|
let closure = model_1.RNode.findEnclosing(read, idMap, r_function_definition_1.RFunctionDefinition.is);
|
|
@@ -407,6 +410,19 @@ function forcingPointsOf(params, graph, idMap, seen = new Set()) {
|
|
|
407
410
|
}
|
|
408
411
|
return found;
|
|
409
412
|
}
|
|
413
|
+
/** The calls running the closures holding `id`, and those running the closures holding these calls in turn. */
|
|
414
|
+
function callersOf(id, graph, idMap, seen = new Set()) {
|
|
415
|
+
const closure = model_1.RNode.strictlyEnclosingFunction(id, idMap);
|
|
416
|
+
if (closure === undefined || seen.has(closure)) {
|
|
417
|
+
return [];
|
|
418
|
+
}
|
|
419
|
+
seen.add(closure);
|
|
420
|
+
return df_helper_1.Dataflow.sourcesOf(graph, closure, edge_1.EdgeType.Calls).flatMap(call => [call, ...callersOf(call, graph, idMap, seen)]);
|
|
421
|
+
}
|
|
422
|
+
/** Where the promise bound to `binding` may be forced, see {@link promiseDependencies}. */
|
|
423
|
+
function promiseForcingPoints(binding, graph) {
|
|
424
|
+
return graph.idMap === undefined ? [] : forcingPointsOf([binding], graph, graph.idMap);
|
|
425
|
+
}
|
|
410
426
|
/** What a node within promises depends on to run: the holder of each `byPromise` dependency and where that promise may be forced. */
|
|
411
427
|
function promiseDependencies(id, graph) {
|
|
412
428
|
const idMap = graph.idMap;
|
|
@@ -415,21 +431,48 @@ function promiseDependencies(id, graph) {
|
|
|
415
431
|
return found;
|
|
416
432
|
}
|
|
417
433
|
for (const cd of graph.getVertex(id)?.cds ?? []) {
|
|
418
|
-
if (cd.byPromise
|
|
419
|
-
|
|
434
|
+
if (cd.byPromise === true) {
|
|
435
|
+
const forcing = forcingPointsOfPromise(cd.id, id, graph, idMap);
|
|
436
|
+
found.push(...vertex_1.DfgVertex.isFunctionCall(graph.getVertex(cd.id)) ? [cd.id] : [], ...forcing, ...forcing.flatMap(at => catchersOf(at, idMap, graph)));
|
|
420
437
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
438
|
+
}
|
|
439
|
+
return found;
|
|
440
|
+
}
|
|
441
|
+
/** The calls catching what is raised at `at` before it leaves its function, as `try(a)` does for what forcing the promise `a` raises. */
|
|
442
|
+
function catchersOf(at, idMap, graph) {
|
|
443
|
+
const found = [];
|
|
444
|
+
for (const node of model_1.RNode.iterateParents(idMap.get(at), idMap)) {
|
|
445
|
+
if (r_function_definition_1.RFunctionDefinition.is(node)) {
|
|
446
|
+
break;
|
|
426
447
|
}
|
|
427
|
-
else {
|
|
428
|
-
found.push(
|
|
448
|
+
else if (vertex_1.DfgVertex.hasOrigin(graph.getVertex(node.info.id), built_in_proc_name_1.BuiltInProcName.Try)) {
|
|
449
|
+
found.push(node.info.id);
|
|
429
450
|
}
|
|
430
451
|
}
|
|
431
452
|
return found;
|
|
432
453
|
}
|
|
454
|
+
/** Where the promise that `holder` (a call handed it, or the binding of a `delayedAssign`) holds and `inner` lies in may be forced. */
|
|
455
|
+
function forcingPointsOfPromise(holder, inner, graph, idMap) {
|
|
456
|
+
const call = graph.getVertex(holder);
|
|
457
|
+
if (!vertex_1.DfgVertex.isFunctionCall(call)) {
|
|
458
|
+
return forcingPointsOf([holder], graph, idMap);
|
|
459
|
+
}
|
|
460
|
+
const argument = model_1.RNode.findEnclosing(inner, idMap, n => n.info.parent === holder);
|
|
461
|
+
return forcingPointsOf(argument === undefined ? [] : boundParameters(call, argument, idMap, graph) ?? [], graph, idMap);
|
|
462
|
+
}
|
|
463
|
+
/** Whether an error raised within the promise may be caught where it is forced, as `tryCatch(x, error = ...)` does within the callee. */
|
|
464
|
+
function caughtWhereForced(holder, inner, graph) {
|
|
465
|
+
const idMap = graph.idMap;
|
|
466
|
+
return idMap === undefined || forcingPointsOfPromise(holder, inner, graph, idMap).some(at => {
|
|
467
|
+
const fn = idMap.get(model_1.RNode.findEnclosing(at, idMap, r_function_definition_1.RFunctionDefinition.is) ?? '');
|
|
468
|
+
return !(0, linker_1.errorEscapes)(at, r_function_definition_1.RFunctionDefinition.is(fn) ? fn.body.info.id : undefined, idMap, graph);
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
/** Whether an error raised by `inner` within the promise of `holder` surely leaves the holder: the holder always forces it and nowhere catches it. */
|
|
472
|
+
function promiseRaises(graph, options = {}) {
|
|
473
|
+
const forcing = promiseForcing(graph, options);
|
|
474
|
+
return (holder, inner) => forcing(holder, inner) === logic_1.Ternary.Always && !caughtWhereForced(holder, inner, graph);
|
|
475
|
+
}
|
|
433
476
|
/** How surely the holder of a promise forces it, asked for a node `inner` within the promise. */
|
|
434
477
|
function promiseForcing(graph, { ctx, constantBranches, knownOnly } = {}) {
|
|
435
478
|
const idMap = graph.idMap;
|
|
@@ -504,13 +547,19 @@ function settleDefinitionsInPromises(graph, { ctx } = {}) {
|
|
|
504
547
|
program_order_1.ProgramOrder.replaceEarlier(id, statement, graph, false);
|
|
505
548
|
}
|
|
506
549
|
}
|
|
550
|
+
function isParameterName(id, graph) {
|
|
551
|
+
const node = graph.idMap?.get(id);
|
|
552
|
+
const parent = node === undefined ? undefined : graph.idMap?.get(node.info.parent);
|
|
553
|
+
return r_parameter_1.RParameter.is(parent) && parent.name === node;
|
|
554
|
+
}
|
|
507
555
|
/** Drops the resume of a jump within a promise ({@link ControlFlow.promise}) once the linked holder surely forces it. */
|
|
508
556
|
function settleJumpsInPromises(graph, topLevel, { ctx } = {}) {
|
|
509
557
|
const forcing = promiseForcing(graph, { ctx });
|
|
510
558
|
const definitions = graph.verticesOfType(vertex_1.VertexType.FunctionDefinition).map(([, definition]) => definition.exitPoints);
|
|
511
559
|
for (const exit of [topLevel, ...definitions].flat()) {
|
|
512
560
|
for (const cd of exit.cds ?? []) {
|
|
513
|
-
|
|
561
|
+
/* a default sits in front of the body in the control flow, but R forces it where the parameter is first read, so the body before that read still runs */
|
|
562
|
+
if (cd.byPromise === true && !isParameterName(cd.id, graph) && forcing(cd.id, exit.nodeId) === logic_1.Ternary.Always && (exit.type !== 4 /* ExitPointType.Error */ || !caughtWhereForced(cd.id, exit.nodeId, graph))) {
|
|
514
563
|
graph.removeEdgeType(exit.nodeId, cd.id, edge_1.EdgeType.FlowEdge);
|
|
515
564
|
}
|
|
516
565
|
}
|
|
@@ -12,7 +12,9 @@ export declare enum AmbientAccessKind {
|
|
|
12
12
|
/** the state is only assumed changed by a body flowR cannot see, like `#rng` for `function(f) f()` */
|
|
13
13
|
Assumed = "assumed",
|
|
14
14
|
/** the code changes the state in the current frame only */
|
|
15
|
-
Local = "local"
|
|
15
|
+
Local = "local",
|
|
16
|
+
/** the code ends the state, like `dev.off()` the active device or `sink()` the last diversion */
|
|
17
|
+
Kill = "kills"
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* What code accesses of the global state, for a single call (see {@link DataflowGraph#ambientAccessOf}) just like for a function or any other part of a program (see {@link Dataflow.sideEffects.ambientAccess}).
|
|
@@ -23,6 +25,7 @@ export interface AmbientAccess {
|
|
|
23
25
|
readonly [AmbientAccessKind.Write]: Relation<AmbientStateName, NodeId>;
|
|
24
26
|
readonly [AmbientAccessKind.Assumed]: Relation<AmbientStateName, NodeId>;
|
|
25
27
|
readonly [AmbientAccessKind.Local]: Relation<AmbientStateName, NodeId>;
|
|
28
|
+
readonly [AmbientAccessKind.Kill]: Relation<AmbientStateName, NodeId>;
|
|
26
29
|
/** the global variables the functions the code calls may bind, by `x <<- 1` reaching the global frame or `assign("x", 1, envir = .GlobalEnv)`, with the ids of these definitions; the graph does not know them for a single call */
|
|
27
30
|
readonly variables: Relation<BrandedIdentifier, NodeId>;
|
|
28
31
|
/** the calls tagged {@link SemanticCallTag.Graphics} (`plot`, `lines`, `par`, ...), which write the canvas only if `semantics.ambient.drawingWritesDevice` is set; the graph does not know them for a single call */
|
|
@@ -14,6 +14,8 @@ var AmbientAccessKind;
|
|
|
14
14
|
AmbientAccessKind["Assumed"] = "assumed";
|
|
15
15
|
/** the code changes the state in the current frame only */
|
|
16
16
|
AmbientAccessKind["Local"] = "local";
|
|
17
|
+
/** the code ends the state, like `dev.off()` the active device or `sink()` the last diversion */
|
|
18
|
+
AmbientAccessKind["Kill"] = "kills";
|
|
17
19
|
})(AmbientAccessKind || (exports.AmbientAccessKind = AmbientAccessKind = {}));
|
|
18
20
|
const Kinds = Object.values(AmbientAccessKind);
|
|
19
21
|
const Empty = {
|
|
@@ -21,6 +23,7 @@ const Empty = {
|
|
|
21
23
|
[AmbientAccessKind.Write]: relation_1.Relation.empty(),
|
|
22
24
|
[AmbientAccessKind.Assumed]: relation_1.Relation.empty(),
|
|
23
25
|
[AmbientAccessKind.Local]: relation_1.Relation.empty(),
|
|
26
|
+
[AmbientAccessKind.Kill]: relation_1.Relation.empty(),
|
|
24
27
|
variables: relation_1.Relation.empty(),
|
|
25
28
|
draws: new Set()
|
|
26
29
|
};
|
|
@@ -37,6 +40,7 @@ function concatAll(accesses) {
|
|
|
37
40
|
[AmbientAccessKind.Write]: writes,
|
|
38
41
|
[AmbientAccessKind.Assumed]: relation_1.Relation.withoutKeysOf(union(AmbientAccessKind.Assumed), writes),
|
|
39
42
|
[AmbientAccessKind.Local]: union(AmbientAccessKind.Local),
|
|
43
|
+
[AmbientAccessKind.Kill]: union(AmbientAccessKind.Kill),
|
|
40
44
|
variables: relation_1.Relation.unionAll(given.map(a => a.variables)),
|
|
41
45
|
draws: new Set(given.flatMap(a => [...a.draws]))
|
|
42
46
|
};
|
|
@@ -60,7 +64,8 @@ exports.AmbientAccess = {
|
|
|
60
64
|
[AmbientAccessKind.Read]: ofKind(AmbientAccessKind.Read),
|
|
61
65
|
[AmbientAccessKind.Write]: ofKind(AmbientAccessKind.Write),
|
|
62
66
|
[AmbientAccessKind.Assumed]: ofKind(AmbientAccessKind.Assumed),
|
|
63
|
-
[AmbientAccessKind.Local]: ofKind(AmbientAccessKind.Local)
|
|
67
|
+
[AmbientAccessKind.Local]: ofKind(AmbientAccessKind.Local),
|
|
68
|
+
[AmbientAccessKind.Kill]: ofKind(AmbientAccessKind.Kill)
|
|
64
69
|
};
|
|
65
70
|
},
|
|
66
71
|
/** The state of each kind `access` accesses, without who accesses it. Mind that the order of names is not stable, so use {@link AmbientAccess.equals} to compare them. */
|
|
@@ -69,7 +74,8 @@ exports.AmbientAccess = {
|
|
|
69
74
|
[AmbientAccessKind.Read]: [...access[AmbientAccessKind.Read].keys()],
|
|
70
75
|
[AmbientAccessKind.Write]: [...access[AmbientAccessKind.Write].keys()],
|
|
71
76
|
[AmbientAccessKind.Assumed]: [...access[AmbientAccessKind.Assumed].keys()],
|
|
72
|
-
[AmbientAccessKind.Local]: [...access[AmbientAccessKind.Local].keys()]
|
|
77
|
+
[AmbientAccessKind.Local]: [...access[AmbientAccessKind.Local].keys()],
|
|
78
|
+
[AmbientAccessKind.Kill]: [...access[AmbientAccessKind.Kill].keys()]
|
|
73
79
|
};
|
|
74
80
|
},
|
|
75
81
|
/** Whether both access the same state in the same way, no matter by which calls. */
|
|
@@ -202,7 +202,7 @@ function boundAround(closure, graph, environment, name) {
|
|
|
202
202
|
let frame = made.subflow.environment.current.parent;
|
|
203
203
|
for (let level = made.subflow.environment.level - 1; level > 0 && frame !== undefined; level--, frame = frame.parent) {
|
|
204
204
|
/* the body of a function sees the frames around it emptied, standing in for what they bound */
|
|
205
|
-
const bound = frame.
|
|
205
|
+
const bound = frame.boundForSuper(name);
|
|
206
206
|
if (bound !== undefined) {
|
|
207
207
|
return bound;
|
|
208
208
|
}
|
|
@@ -40,7 +40,7 @@ export declare class DataflowGraphBuilder<Vertex extends DataflowGraphVertexInfo
|
|
|
40
40
|
}, asRoot?: boolean): this;
|
|
41
41
|
/** automatically adds argument links if they do not already exist */
|
|
42
42
|
private addArgumentLinks;
|
|
43
|
-
/** States that R prints the top-level values `ids` by an implicit `print`, which reads the printing options, or every option for a value a method may print (`dispatched`), see {@link autoPrintReads}. */
|
|
43
|
+
/** States that R prints the top-level values `ids` by an implicit `print`, which reads the printing options, or every option for a value a method may print (`dispatched`), and prints into the diversion of the output, see {@link autoPrintReads}. */
|
|
44
44
|
autoPrints(ids: readonly NodeId[], dispatched?: boolean): this;
|
|
45
45
|
/** Adds a **vertex** for a **variable definition** (V4). */
|
|
46
46
|
defineVariable(id: NodeId, name?: BrandedIdentifier, info?: {
|
|
@@ -103,10 +103,10 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
/** States that R prints the top-level values `ids` by an implicit `print`, which reads the printing options, or every option for a value a method may print (`dispatched`), see {@link autoPrintReads}. */
|
|
106
|
+
/** States that R prints the top-level values `ids` by an implicit `print`, which reads the printing options, or every option for a value a method may print (`dispatched`), and prints into the diversion of the output, see {@link autoPrintReads}. */
|
|
107
107
|
autoPrints(ids, dispatched = false) {
|
|
108
108
|
for (const id of ids) {
|
|
109
|
-
this.recordAmbientAccess(id, { reads: (0, built_in_ambient_state_1.autoPrintReads)(dispatched) });
|
|
109
|
+
this.recordAmbientAccess(id, { reads: (0, built_in_ambient_state_1.autoPrintReads)(dispatched), writes: built_in_ambient_state_1.PrintWrites });
|
|
110
110
|
}
|
|
111
111
|
return this;
|
|
112
112
|
}
|
|
@@ -11,6 +11,8 @@ import { type LinkedFunctionResolver } from '../internal/linker';
|
|
|
11
11
|
import type { FlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
12
12
|
import { type AttachSpec } from '../internal/process/functions/call/built-in/built-in-library';
|
|
13
13
|
import { type Environment, type REnvironmentInformation } from '../environments/environment';
|
|
14
|
+
import { RFunctionDefinition } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition';
|
|
15
|
+
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
14
16
|
/**
|
|
15
17
|
* This is the root helper object to work with the {@link DataflowGraph}.
|
|
16
18
|
* @helper dataflow This is the root helper object to work with the DataflowGraph.
|
|
@@ -42,6 +44,8 @@ export declare const Dataflow: {
|
|
|
42
44
|
readonly hasEdge: (this: void, graph: DataflowGraph, from: NodeId, to: NodeId, types: EdgeType) => boolean;
|
|
43
45
|
/** The ids of the function definitions a call is linked to by a {@link EdgeType.Calls} edge (empty if none, e.g. for built-ins). */
|
|
44
46
|
readonly calleeIdsOf: (this: void, graph: DataflowGraph, call: NodeId) => NodeId[];
|
|
47
|
+
/** The function definitions (as nodes of the normalized AST) a call is linked to by a {@link EdgeType.Calls} edge, see {@link Dataflow.calleeIdsOf}. */
|
|
48
|
+
readonly calleeDefinitionsOf: (this: void, graph: DataflowGraph, call: NodeId) => RFunctionDefinition<ParentInformation>[];
|
|
45
49
|
/** All known targets of a call, as well as the name sources which define them (empty if there are none). */
|
|
46
50
|
readonly callTargetsOf: (this: void, call: NodeId, graph: DataflowGraph, environment?: REnvironmentInformation, resolver?: LinkedFunctionResolver) => NodeId[];
|
|
47
51
|
/** Whether every function the call may run is a built-in or one the program defines, so that what flowR knows about those functions is all there is to know about the call. */
|
|
@@ -79,6 +83,8 @@ export declare const Dataflow: {
|
|
|
79
83
|
readonly reduceAndInvertGraph: <G extends DataflowGraph>(this: void, graph: G, select: ReadonlySet<NodeId>, cleanEnv: REnvironmentInformation) => G;
|
|
80
84
|
/** See {@link DataflowGraph#isQuoted}, which this answers for `graph`. */
|
|
81
85
|
readonly isQuoted: (this: void, id: NodeId, graph: DataflowGraph, withOutgoing?: boolean) => boolean;
|
|
86
|
+
/** Whether the node or one of its AST ancestors is quoted or evaluated elsewhere (`quote(...)`, a data mask), see {@link DataflowGraph#isQuoted}. */
|
|
87
|
+
readonly isWithinQuoted: (this: void, id: NodeId, graph: DataflowGraph) => boolean;
|
|
82
88
|
/** Given the id of a vertex (usually a variable use), this returns a reachable provenance set by calculating a non-interprocedural and non-context sensitive backward slice, but stopping at the given ids! */
|
|
83
89
|
readonly provenance: (this: void, id: NodeId, graph: DataflowGraph, consider?: ReadonlySet<NodeId>, followEdges?: number | undefined) => Set<NodeId>;
|
|
84
90
|
/** A simple visitor akin to {@link RNode.visitAst} to traverse the dataflow graph starting from the start id and only respecting edge direction. */
|
|
@@ -24,6 +24,7 @@ const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-fun
|
|
|
24
24
|
const attached_packages_1 = require("../../project/attached-packages");
|
|
25
25
|
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
26
26
|
const r_binary_op_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
|
|
27
|
+
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
27
28
|
/**
|
|
28
29
|
* This is the root helper object to work with the {@link DataflowGraph}.
|
|
29
30
|
* @helper dataflow This is the root helper object to work with the DataflowGraph.
|
|
@@ -109,6 +110,10 @@ exports.Dataflow = {
|
|
|
109
110
|
calleeIdsOf(graph, call) {
|
|
110
111
|
return exports.Dataflow.targetsOf(graph, call, edge_1.EdgeType.Calls).filter(t => vertex_1.DfgVertex.isFunctionDefinition(graph.getVertex(t)));
|
|
111
112
|
},
|
|
113
|
+
/** The function definitions (as nodes of the normalized AST) a call is linked to by a {@link EdgeType.Calls} edge, see {@link Dataflow.calleeIdsOf}. */
|
|
114
|
+
calleeDefinitionsOf(graph, call) {
|
|
115
|
+
return exports.Dataflow.calleeIdsOf(graph, call).map(id => graph.idMap?.get(id)).filter(r_function_definition_1.RFunctionDefinition.is);
|
|
116
|
+
},
|
|
112
117
|
/** All known targets of a call, as well as the name sources which define them (empty if there are none). */
|
|
113
118
|
callTargetsOf(call, graph, environment, resolver) {
|
|
114
119
|
return (0, linker_1.getAllFunctionCallTargets)(call, graph, environment, resolver);
|
|
@@ -289,6 +294,16 @@ exports.Dataflow = {
|
|
|
289
294
|
isQuoted(id, graph, withOutgoing = false) {
|
|
290
295
|
return graph.isQuoted(id, withOutgoing);
|
|
291
296
|
},
|
|
297
|
+
/** Whether the node or one of its AST ancestors is quoted or evaluated elsewhere (`quote(...)`, a data mask), see {@link DataflowGraph#isQuoted}. */
|
|
298
|
+
isWithinQuoted(id, graph) {
|
|
299
|
+
const idMap = graph.idMap;
|
|
300
|
+
for (let cur = idMap?.get(id); cur !== undefined; cur = cur.info.parent === undefined ? undefined : idMap?.get(cur.info.parent)) {
|
|
301
|
+
if (graph.isQuoted(cur.info.id)) {
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return false;
|
|
306
|
+
},
|
|
292
307
|
/** Given the id of a vertex (usually a variable use), this returns a reachable provenance set by calculating a non-interprocedural and non-context sensitive backward slice, but stopping at the given ids! */
|
|
293
308
|
provenance(id, graph, consider, followEdges = edge_1.EdgeType.Calls | edge_1.EdgeType.Reads | edge_1.EdgeType.Returns | edge_1.EdgeType.Argument | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall) {
|
|
294
309
|
return exports.Dataflow.reachable(graph, id, { follow: followEdges, consider, cds: true });
|
|
@@ -160,13 +160,19 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
160
160
|
private resolveInto;
|
|
161
161
|
/** set by a `consume` merge, see {@link DataflowGraph#mergeWith|mergeWith()}; the graph must not change after that */
|
|
162
162
|
private consumed;
|
|
163
|
-
/** how many {@link DataflowGraph#
|
|
164
|
-
private
|
|
163
|
+
/** how many {@link DataflowGraph#withoutSharedTargetWalks} are running */
|
|
164
|
+
private walkLoners;
|
|
165
|
+
/**
|
|
166
|
+
* The walks for call targets ({@link Dataflow.callTargetsOf}) done so far, which every later one builds on until the graph
|
|
167
|
+
* changes (see {@link DataflowGraph#dropQualifications}): resolving the calls one by one would walk the same reads again for each.
|
|
168
|
+
*/
|
|
165
169
|
private targetWalks?;
|
|
166
|
-
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Runs `fn` with each walk for call targets on its own: code that changes the graph after nearly every call it asks about
|
|
172
|
+
* (as linking calls does) would only start the shared walks anew each time, which costs more than walking alone.
|
|
173
|
+
*/
|
|
174
|
+
withoutSharedTargetWalks<T>(fn: () => T): T;
|
|
175
|
+
/** The walks shared until the graph changes, made by `create` on demand, `undefined` within {@link DataflowGraph#withoutSharedTargetWalks}. */
|
|
170
176
|
sharedTargetWalks(create: (graph: this) => LinkedFunctionResolver): LinkedFunctionResolver | undefined;
|
|
171
177
|
/** Drops the cached qualifications, as the graph may no longer imply them. Every mutator runs through here, so the guard covers them all. */
|
|
172
178
|
private dropQualifications;
|
package/dataflow/graph/graph.js
CHANGED
|
@@ -234,13 +234,11 @@ class DataflowGraph {
|
|
|
234
234
|
if (cache.complete) {
|
|
235
235
|
return wanted;
|
|
236
236
|
}
|
|
237
|
-
this.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
this.resolveInto(cache, id, this.vertexInformation.get(id), resolve);
|
|
241
|
-
}
|
|
237
|
+
for (const id of this.types.get(vertex_1.VertexType.FunctionCall) ?? []) {
|
|
238
|
+
if (!wanted.has(id)) {
|
|
239
|
+
this.resolveInto(cache, id, this.vertexInformation.get(id), resolve);
|
|
242
240
|
}
|
|
243
|
-
}
|
|
241
|
+
}
|
|
244
242
|
cache.complete = true;
|
|
245
243
|
return wanted;
|
|
246
244
|
}
|
|
@@ -255,34 +253,29 @@ class DataflowGraph {
|
|
|
255
253
|
}
|
|
256
254
|
/** set by a `consume` merge, see {@link DataflowGraph#mergeWith|mergeWith()}; the graph must not change after that */
|
|
257
255
|
consumed = false;
|
|
258
|
-
/** how many {@link DataflowGraph#
|
|
259
|
-
|
|
256
|
+
/** how many {@link DataflowGraph#withoutSharedTargetWalks} are running */
|
|
257
|
+
walkLoners = 0;
|
|
258
|
+
/**
|
|
259
|
+
* The walks for call targets ({@link Dataflow.callTargetsOf}) done so far, which every later one builds on until the graph
|
|
260
|
+
* changes (see {@link DataflowGraph#dropQualifications}): resolving the calls one by one would walk the same reads again for each.
|
|
261
|
+
*/
|
|
260
262
|
targetWalks;
|
|
261
|
-
/**
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
/**
|
|
264
|
+
* Runs `fn` with each walk for call targets on its own: code that changes the graph after nearly every call it asks about
|
|
265
|
+
* (as linking calls does) would only start the shared walks anew each time, which costs more than walking alone.
|
|
266
|
+
*/
|
|
267
|
+
withoutSharedTargetWalks(fn) {
|
|
268
|
+
this.walkLoners++;
|
|
265
269
|
try {
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
catch (e) {
|
|
269
|
-
this.stopSharingTargetWalks();
|
|
270
|
-
throw e;
|
|
270
|
+
return fn();
|
|
271
271
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
this.stopSharingTargetWalks();
|
|
276
|
-
return result;
|
|
277
|
-
}
|
|
278
|
-
stopSharingTargetWalks() {
|
|
279
|
-
if (--this.walkSharers === 0) {
|
|
280
|
-
this.targetWalks = undefined;
|
|
272
|
+
finally {
|
|
273
|
+
this.walkLoners--;
|
|
281
274
|
}
|
|
282
275
|
}
|
|
283
|
-
/** The walks shared
|
|
276
|
+
/** The walks shared until the graph changes, made by `create` on demand, `undefined` within {@link DataflowGraph#withoutSharedTargetWalks}. */
|
|
284
277
|
sharedTargetWalks(create) {
|
|
285
|
-
return this.
|
|
278
|
+
return this.walkLoners > 0 ? undefined : this.targetWalks ??= create(this);
|
|
286
279
|
}
|
|
287
280
|
/** Drops the cached qualifications, as the graph may no longer imply them. Every mutator runs through here, so the guard covers them all. */
|
|
288
281
|
dropQualifications() {
|
package/dataflow/info.d.ts
CHANGED
|
@@ -119,7 +119,8 @@ export type KillReference =
|
|
|
119
119
|
| {
|
|
120
120
|
readonly kind: 'all';
|
|
121
121
|
readonly cds?: readonly ControlDependency[];
|
|
122
|
-
readonly except?: ReadonlySet<BrandedIdentifier>;
|
|
122
|
+
readonly except?: ReadonlySet<BrandedIdentifier>; /** the call performing the removal */
|
|
123
|
+
readonly killedBy?: NodeId;
|
|
123
124
|
}
|
|
124
125
|
/** a not statically resolvable set of names, e.g., `rm(list = someVector)` */
|
|
125
126
|
| {
|
package/dataflow/info.js
CHANGED
|
@@ -95,9 +95,11 @@ function leaveThrough(exit, rootId) {
|
|
|
95
95
|
* Adds all non-default exit points to the existing list and updates the `invertExitCds` accordingly.
|
|
96
96
|
*/
|
|
97
97
|
function addNonDefaultExitPoints(existing, invertExitCds, activeCds, add) {
|
|
98
|
+
/* an exit that follows a conditional one (`if(c) return(1); stop()`) only happens if the earlier one did not */
|
|
99
|
+
const notEarlier = invertExitCds.slice();
|
|
98
100
|
for (const ep of add) {
|
|
99
101
|
if (ep.type !== 0 /* ExitPointType.Default */) {
|
|
100
|
-
existing.push(ep);
|
|
102
|
+
existing.push(notEarlier.length > 0 ? { ...ep, cds: withCds(ep.cds ?? activeCds, notEarlier) } : ep);
|
|
101
103
|
const ownCds = exports.ControlDependency.minus(ep.cds ?? [], activeCds ?? []);
|
|
102
104
|
appendCds(invertExitCds, ownCds.map(negateControlDependency));
|
|
103
105
|
}
|
|
@@ -7,7 +7,7 @@ import { RNode } from '../../r-bridge/lang-4.x/ast/model/model';
|
|
|
7
7
|
import type { FlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
8
8
|
import { type ClassFlowInfo } from '../fn/dispatch';
|
|
9
9
|
import type { REnvironmentInformation } from '../environments/environment';
|
|
10
|
-
import { type BrandedIdentifier, type IdentifierDefinition } from '../environments/identifier';
|
|
10
|
+
import { type BrandedIdentifier, type IdentifierDefinition, type ClassName } from '../environments/identifier';
|
|
11
11
|
/** The methods each method hands on to with `NextMethod()`, in the order they run. */
|
|
12
12
|
export type NextMethods = ReadonlyMap<NodeId, readonly NodeId[]>;
|
|
13
13
|
/** What the dispatch of one call rules out, and what the next-method calls of the methods it runs may run. */
|
|
@@ -61,6 +61,8 @@ export declare class DispatchNarrower {
|
|
|
61
61
|
export declare function callsNextMethod(fn: NodeId, graph: DataflowGraph): boolean;
|
|
62
62
|
/** Whether every run of `call` comes after the top-level `statement`, which runs once: `call` runs once after it, or it is in a function that only calls by name run, each of which only after the statement. */
|
|
63
63
|
export declare function runsOnlyAfter(call: NodeId, statement: RNode<ParentInformation>, graph: DataflowGraph, depth?: number): boolean;
|
|
64
|
+
/** The class the function `fn` is the S3 method of, for one of the generics `prefixes`, `undefined` unless every name it is bound to says the same. */
|
|
65
|
+
export declare function s3ClassOfMethod(fn: NodeId, prefixes: readonly BrandedIdentifier[], graph: DataflowGraph): ClassName | undefined;
|
|
64
66
|
/** The function definitions the definitions or reads `ids` lead to. */
|
|
65
67
|
export declare function linkedFunctionIds(ids: ReadonlySet<NodeId>, graph: DataflowGraph): NodeId[];
|
|
66
68
|
/** The methods `environment` binds for the generics a built-in dispatches to on its own (see `dispatches` of a built-in): every `<generic>.<class>` and every function `setMethod` registers for one, whatever the class, as it may be that of a part. */
|
|
@@ -4,6 +4,7 @@ exports.DispatchNarrower = exports.MaxContextDepth = void 0;
|
|
|
4
4
|
exports.ruledOutPerCall = ruledOutPerCall;
|
|
5
5
|
exports.callsNextMethod = callsNextMethod;
|
|
6
6
|
exports.runsOnlyAfter = runsOnlyAfter;
|
|
7
|
+
exports.s3ClassOfMethod = s3ClassOfMethod;
|
|
7
8
|
exports.linkedFunctionIds = linkedFunctionIds;
|
|
8
9
|
exports.internalGenericMethods = internalGenericMethods;
|
|
9
10
|
exports.methodOnlyEdges = methodOnlyEdges;
|
|
@@ -20,6 +20,8 @@ export declare function linkInstanceReads(graph: DataflowGraph, info: DataflowGr
|
|
|
20
20
|
export declare function readsOfUncalledClosures(fn: NodeId, subflow: DataflowFunctionFlowInformation, graph: DataflowGraph, idMap: AstIdMap): (read: NodeId) => boolean;
|
|
21
21
|
/** Links a function call with a single target function definition. */
|
|
22
22
|
export declare function linkFunctionCallWithSingleTarget(graph: DataflowGraph, { subflow: fnSubflow, exitPoints, id: fnId, params, envOps }: DataflowGraphVertexFunctionDefinition, info: DataflowGraphVertexFunctionCall, idMap: AstIdMap): ExitPoint[];
|
|
23
|
+
/** Whether an error raised by the call `from` still leaves the expression it is written in (the whole program for `undefined`): redoes what a `stop` written at that spot would have done, since we only learn a callee always throws after linking it here. */
|
|
24
|
+
export declare function errorEscapes(from: NodeId, expression: NodeId | undefined, idMap: AstIdMap, graph: DataflowGraph): boolean;
|
|
23
25
|
/** What {@link linkFunctionCalls} reports for a call it linked. */
|
|
24
26
|
export type CalledFunctions = {
|
|
25
27
|
functionCall: NodeId;
|