@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,169 @@
|
|
|
1
|
+
import type { BrandedIdentifier, BrandedNamespace } from './identifier';
|
|
2
|
+
/** The type of a value as R's `typeof` tells it, as a bitfield, with the three kinds of functions as one and the rest of what R has as {@link RValueType.Other}. */
|
|
3
|
+
export declare enum RValueType {
|
|
4
|
+
Null = 1,
|
|
5
|
+
Logical = 2,
|
|
6
|
+
Integer = 4,
|
|
7
|
+
Double = 8,
|
|
8
|
+
Complex = 16,
|
|
9
|
+
Character = 32,
|
|
10
|
+
Raw = 64,
|
|
11
|
+
List = 128,
|
|
12
|
+
Pairlist = 256,
|
|
13
|
+
Function = 512,
|
|
14
|
+
Environment = 1024,
|
|
15
|
+
Symbol = 2048,
|
|
16
|
+
Language = 4096,
|
|
17
|
+
Expression = 8192,
|
|
18
|
+
/** `S4`, `externalptr`, and the like */
|
|
19
|
+
Other = 16384
|
|
20
|
+
}
|
|
21
|
+
/** a bitfield of {@link RValueType} */
|
|
22
|
+
export type RValueTypes = number;
|
|
23
|
+
/** What R has as a value at all. */
|
|
24
|
+
export declare const AnyType: RValueTypes;
|
|
25
|
+
/** What a predicate over one value says about the type of the value. */
|
|
26
|
+
export interface TypePredicate {
|
|
27
|
+
/** the types it can be true for */
|
|
28
|
+
readonly yes: RValueTypes;
|
|
29
|
+
/** it tells these types and no other, so finding it false rules them out as well, or does so only for a value without a class attribute, as `is.integer` is false for a factor */
|
|
30
|
+
readonly exact?: boolean | 'unclassed';
|
|
31
|
+
/** a value with a class attribute of these types passes as well, like an S4 object holding an environment does for `is.environment` */
|
|
32
|
+
readonly classedToo?: RValueTypes;
|
|
33
|
+
/** true for every value of these types without attributes, other than `NULL` */
|
|
34
|
+
readonly plain?: boolean;
|
|
35
|
+
/** only true for a value with a class attribute, like `is.data.frame` */
|
|
36
|
+
readonly classed?: boolean;
|
|
37
|
+
/** only true for something of length one */
|
|
38
|
+
readonly scalar?: boolean;
|
|
39
|
+
/** being true makes the value usable as a function */
|
|
40
|
+
readonly callable?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** What not failing says about the argument a checking call was handed. */
|
|
43
|
+
export interface CheckingCall {
|
|
44
|
+
readonly types?: RValueTypes;
|
|
45
|
+
readonly classed?: boolean;
|
|
46
|
+
/** the argument naming the only values allowed */
|
|
47
|
+
readonly choices?: BrandedIdentifier;
|
|
48
|
+
/** without that argument, the default of the formal it was handed states the choices */
|
|
49
|
+
readonly choicesFromDefault?: boolean;
|
|
50
|
+
/** partial matches of the choices also pass */
|
|
51
|
+
readonly partial?: boolean;
|
|
52
|
+
/** a length-one value is all that passes */
|
|
53
|
+
readonly scalar?: boolean;
|
|
54
|
+
/** the arguments that let more through, each with the types it may add; anything else they take (`len`, `lower`) only narrows */
|
|
55
|
+
readonly loosens?: Readonly<Record<BrandedIdentifier, RValueTypes>>;
|
|
56
|
+
/** the arguments that keep it from failing at once, so not even the check itself is a guard, like `add` */
|
|
57
|
+
readonly defers?: readonly BrandedIdentifier[];
|
|
58
|
+
/** failing is all it does when the argument was not given */
|
|
59
|
+
readonly present?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** A condition R checks of the value bound to a formal, stated as data so that a configuration can change it. */
|
|
62
|
+
export type RCondition =
|
|
63
|
+
/** the predicate holds of the value, or of what `of` reads off it, like `is.null(dim(x))` */
|
|
64
|
+
{
|
|
65
|
+
readonly is: BrandedIdentifier;
|
|
66
|
+
readonly of?: BrandedIdentifier;
|
|
67
|
+
} | {
|
|
68
|
+
readonly not: RCondition;
|
|
69
|
+
} | {
|
|
70
|
+
readonly any: readonly RCondition[];
|
|
71
|
+
} | {
|
|
72
|
+
readonly all: readonly RCondition[];
|
|
73
|
+
}
|
|
74
|
+
/** the length of the value compares to the given one */
|
|
75
|
+
| {
|
|
76
|
+
readonly length: '==' | '<=' | '>=';
|
|
77
|
+
readonly to: number;
|
|
78
|
+
}
|
|
79
|
+
/** the value can be applied as a function, which depends on the functions around */
|
|
80
|
+
| {
|
|
81
|
+
readonly callable: true;
|
|
82
|
+
}
|
|
83
|
+
/** the condition holds of the value bound to another formal of the same call, like `is.null(value)` letting any `x` of `attr<-` through */
|
|
84
|
+
| {
|
|
85
|
+
readonly on: BrandedIdentifier;
|
|
86
|
+
readonly holds: RCondition;
|
|
87
|
+
}
|
|
88
|
+
/** what `of` reads off the value, the outermost reader first, compares to a number, to what is read off another formal, or to what a call without arguments returns */
|
|
89
|
+
| {
|
|
90
|
+
readonly compare: '==' | '<=' | '>=' | '<' | '>';
|
|
91
|
+
readonly of?: readonly BrandedIdentifier[];
|
|
92
|
+
readonly to: number | ROperand;
|
|
93
|
+
};
|
|
94
|
+
/** What a comparison of an {@link RCondition} compares to: what `of` reads off the value of formal `on`, or what calling `call` without arguments returns, like `...length()`. */
|
|
95
|
+
export type ROperand = {
|
|
96
|
+
readonly on: BrandedIdentifier;
|
|
97
|
+
readonly of?: readonly BrandedIdentifier[];
|
|
98
|
+
} | {
|
|
99
|
+
readonly call: BrandedIdentifier;
|
|
100
|
+
};
|
|
101
|
+
/** The R versions something holds for, from `since` on and before `until`, either end open if left out. */
|
|
102
|
+
export interface RVersions {
|
|
103
|
+
readonly since?: string;
|
|
104
|
+
readonly until?: string;
|
|
105
|
+
}
|
|
106
|
+
/** A failure R raises by itself if the value bound to a formal does not pass a condition. */
|
|
107
|
+
export interface RFailure extends RVersions {
|
|
108
|
+
readonly requires: RCondition;
|
|
109
|
+
/** what R says, with `%s` for the value */
|
|
110
|
+
readonly message: string;
|
|
111
|
+
/** a value with a class attribute, or a classed other operand, may bring a method of its own, which lets anything through */
|
|
112
|
+
readonly dispatches?: boolean;
|
|
113
|
+
/** R only looks at the value if another formal passes this, as `TRUE && y` evaluates `y` while `FALSE && y` does not */
|
|
114
|
+
readonly when?: {
|
|
115
|
+
readonly of: BrandedIdentifier;
|
|
116
|
+
readonly holds: RCondition;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/** What the value a function returns is like, whatever it was handed. */
|
|
120
|
+
export interface ReturnedValue {
|
|
121
|
+
readonly types: RValueTypes;
|
|
122
|
+
/** it is a single value */
|
|
123
|
+
readonly scalar?: boolean;
|
|
124
|
+
/** no element of it is `NA` */
|
|
125
|
+
readonly notNA?: boolean;
|
|
126
|
+
/** it counts something, so it holds whole numbers none of which is negative */
|
|
127
|
+
readonly count?: boolean;
|
|
128
|
+
/** it holds at least one element */
|
|
129
|
+
readonly nonEmpty?: boolean;
|
|
130
|
+
/** for a list, the types each of its elements has, as the columns of a data frame read from a file */
|
|
131
|
+
readonly elements?: RValueTypes;
|
|
132
|
+
/** all of this holds only if the value of this formal has no class attribute, as a method for a classed one may return anything */
|
|
133
|
+
readonly dispatchesOn?: BrandedIdentifier;
|
|
134
|
+
}
|
|
135
|
+
/** What a function has to do with the guards of what calls it, all read off the built-in definitions rather than its name. */
|
|
136
|
+
export interface GuardFacts {
|
|
137
|
+
/** the package providing it, none for what R ships with */
|
|
138
|
+
readonly pkg?: BrandedNamespace;
|
|
139
|
+
/** it tells something about the type of its argument */
|
|
140
|
+
readonly predicate?: TypePredicate;
|
|
141
|
+
/** what it returns, with the types it returns that for, as `typeof` does */
|
|
142
|
+
readonly reads?: Readonly<Record<string, RValueTypes>>;
|
|
143
|
+
/** it reads whole numbers off its argument, which a comparison can bound: always one if `single`, one per element if `elementwise`, and one or none at all (`NULL`) if `nullable`, so `stopifnot` lets the latter pass without bounding anything */
|
|
144
|
+
readonly measures?: 'single' | 'elementwise' | 'nullable';
|
|
145
|
+
/** its not failing says something about its first argument */
|
|
146
|
+
readonly check?: CheckingCall;
|
|
147
|
+
/** it fails unless each of its arguments is a single `TRUE`, as `stopifnot` does elsewhere, with the arguments that are no conditions */
|
|
148
|
+
readonly asserts?: readonly BrandedIdentifier[];
|
|
149
|
+
/** what R fails on for the value of each formal on top of evaluating it, a `callable` condition marking the formal holding what it applies at once */
|
|
150
|
+
readonly asks?: Readonly<Record<BrandedIdentifier, readonly RFailure[]>>;
|
|
151
|
+
/** the formals a call has to hand a value, as R fails on a call without one even though nothing evaluates it */
|
|
152
|
+
readonly required?: readonly BrandedIdentifier[];
|
|
153
|
+
/** it yields one logical, no matter how long its arguments are */
|
|
154
|
+
readonly singleResult?: boolean;
|
|
155
|
+
/** what it returns, or `argument` for the one argument it was handed, as `invisible` returns it; a predicate, a measure, and what {@link GuardFacts.reads} need not state it */
|
|
156
|
+
readonly returns?: ReturnedValue | 'argument';
|
|
157
|
+
/** it does not do anything but compute, whatever else is stated of it */
|
|
158
|
+
readonly computes?: boolean;
|
|
159
|
+
/** the formals a missing formal can be handed to without an error, as the special primitives matching their arguments themselves take it as not given */
|
|
160
|
+
readonly missingOk?: readonly BrandedIdentifier[];
|
|
161
|
+
/** it hands out a frame or writes to one in a way the dataflow does not see */
|
|
162
|
+
readonly opensFrame?: boolean;
|
|
163
|
+
/** what holds instead for some R versions, in place of what is stated above */
|
|
164
|
+
readonly changed?: readonly (RVersions & {
|
|
165
|
+
readonly facts: Omit<GuardFacts, 'changed'>;
|
|
166
|
+
})[];
|
|
167
|
+
}
|
|
168
|
+
/** What is stated about a function by its name alone, see {@link GuardFacts}. */
|
|
169
|
+
export type GuardFactsLookup = (name: BrandedIdentifier) => GuardFacts | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnyType = exports.RValueType = void 0;
|
|
4
|
+
/** The type of a value as R's `typeof` tells it, as a bitfield, with the three kinds of functions as one and the rest of what R has as {@link RValueType.Other}. */
|
|
5
|
+
var RValueType;
|
|
6
|
+
(function (RValueType) {
|
|
7
|
+
RValueType[RValueType["Null"] = 1] = "Null";
|
|
8
|
+
RValueType[RValueType["Logical"] = 2] = "Logical";
|
|
9
|
+
RValueType[RValueType["Integer"] = 4] = "Integer";
|
|
10
|
+
RValueType[RValueType["Double"] = 8] = "Double";
|
|
11
|
+
RValueType[RValueType["Complex"] = 16] = "Complex";
|
|
12
|
+
RValueType[RValueType["Character"] = 32] = "Character";
|
|
13
|
+
RValueType[RValueType["Raw"] = 64] = "Raw";
|
|
14
|
+
RValueType[RValueType["List"] = 128] = "List";
|
|
15
|
+
RValueType[RValueType["Pairlist"] = 256] = "Pairlist";
|
|
16
|
+
RValueType[RValueType["Function"] = 512] = "Function";
|
|
17
|
+
RValueType[RValueType["Environment"] = 1024] = "Environment";
|
|
18
|
+
RValueType[RValueType["Symbol"] = 2048] = "Symbol";
|
|
19
|
+
RValueType[RValueType["Language"] = 4096] = "Language";
|
|
20
|
+
RValueType[RValueType["Expression"] = 8192] = "Expression";
|
|
21
|
+
/** `S4`, `externalptr`, and the like */
|
|
22
|
+
RValueType[RValueType["Other"] = 16384] = "Other";
|
|
23
|
+
})(RValueType || (exports.RValueType = RValueType = {}));
|
|
24
|
+
/** What R has as a value at all. */
|
|
25
|
+
exports.AnyType = (1 << 15) - 1;
|
|
26
|
+
//# sourceMappingURL=guard-facts.js.map
|
|
@@ -2,7 +2,7 @@ import type { AmbientStateName } from './ambient-state-name';
|
|
|
2
2
|
import type { AttachedBuiltIn, BuiltInIdentifierConstant, BuiltInIdentifierDefinition } from './built-in';
|
|
3
3
|
import type { Accessor } from '../../util/accessor';
|
|
4
4
|
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
|
-
import type { ControlDependency } from '../info';
|
|
5
|
+
import type { ControlDependency, ExitPoint } from '../info';
|
|
6
6
|
import type { REnvironmentInformation } from './environment';
|
|
7
7
|
import type { Origin } from '../origin/dfg-get-origin';
|
|
8
8
|
export { PkgName } from './pkg-name';
|
|
@@ -44,6 +44,8 @@ export declare const Identifier: {
|
|
|
44
44
|
readonly accessesInternal: (this: void, id: Identifier | undefined) => boolean | undefined;
|
|
45
45
|
/** Convert the identifier to a **valid R** string representation, this will properly quote namespaces that contain `::` to avoid confusion. */
|
|
46
46
|
readonly toString: Accessor<Identifier, string>;
|
|
47
|
+
/** {@link Identifier.toString} as R reads it where the base packages R attaches on startup are on the search path: a name of theirs alone, any other qualified. */
|
|
48
|
+
readonly toPreludeString: (this: void, id: Identifier) => string;
|
|
47
49
|
/** Check if two identifiers match. */
|
|
48
50
|
readonly matches: (this: void, id: Identifier, target: Identifier, s3?: boolean) => boolean;
|
|
49
51
|
/** Helper to create a regular expression that matches against an array of {@link Identifier} values. */
|
|
@@ -164,6 +166,12 @@ export interface InGraphIdentifierDefinition extends IdentifierReference {
|
|
|
164
166
|
readonly iterated?: boolean;
|
|
165
167
|
/** The ambient state reading this identifier may change, as forcing a promise (`delayedAssign`) whose code writes it does. */
|
|
166
168
|
readonly forces?: readonly AmbientStateName[];
|
|
169
|
+
/** The variables forcing the promise this identifier binds (`delayedAssign("y", x <- TRUE)`) may write, which a read of it may define. */
|
|
170
|
+
readonly forcedWrites?: readonly NamedInGraphIdentifierDefinition[];
|
|
171
|
+
/** How forcing the promise this identifier binds may leave the function, `delayedAssign("p", return(1))` returning from it, which a read of it may do. */
|
|
172
|
+
readonly forcedExits?: readonly ExitPoint[];
|
|
173
|
+
/** The ambient state forcing the promise this identifier binds reads, which it reads where it is forced. */
|
|
174
|
+
readonly forcedReads?: readonly AmbientStateName[];
|
|
167
175
|
/** Whether the ambient state is only assumed written, by a body flowR cannot see. */
|
|
168
176
|
readonly assumed?: true;
|
|
169
177
|
/** For a registered finalizer, the variable holding the object it is registered for. */
|
|
@@ -77,6 +77,11 @@ exports.Identifier = {
|
|
|
77
77
|
}
|
|
78
78
|
return id.includes('::') ? JSON.stringify(id) : id;
|
|
79
79
|
}),
|
|
80
|
+
/** {@link Identifier.toString} as R reads it where the base packages R attaches on startup are on the search path: a name of theirs alone, any other qualified. */
|
|
81
|
+
toPreludeString(id) {
|
|
82
|
+
const namespace = exports.Identifier.getNamespace(id);
|
|
83
|
+
return namespace === undefined || r_base_packages_1.AttachedBasePackageSet.has(namespace) ? exports.Identifier.getName(id) : exports.Identifier.toString(id);
|
|
84
|
+
},
|
|
80
85
|
/** Check if two identifiers match. */
|
|
81
86
|
matches(id, target, s3 = false) {
|
|
82
87
|
const idName = exports.Identifier.getName(id);
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `FunctionSemantics` wires the call helpers together and this file sits below it, so `CallProps` is used directly here; reaching for `FunctionSemantics.call.props` would make `src/dataflow/fn/function-semantics.ts` import its own importers.
|
|
3
|
-
* @lintIgnore use-instead
|
|
4
|
-
*/
|
|
5
1
|
import { type ArgProps, type BuiltInFnInfo, type FnSig, type PropSelector, type SemanticCallTags, type StatedProps, CallProps } from './built-in-props';
|
|
6
2
|
import type { BuiltIns } from './built-in';
|
|
7
3
|
import type { BuiltInDefinition, BuiltInDefinitions } from './built-in-config';
|
|
8
4
|
import type { REnvironmentInformation } from './environment';
|
|
9
|
-
import type { BrandedIdentifier, BrandedNamespace } from './identifier';
|
|
5
|
+
import type { BrandedIdentifier, IdentifierDefinition, BrandedNamespace } from './identifier';
|
|
10
6
|
import { Identifier } from './identifier';
|
|
11
7
|
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
12
8
|
import type { PackageSignatureSource } from '../../project/sigdb/reader';
|
|
@@ -25,6 +21,8 @@ export interface FnPropsSource {
|
|
|
25
21
|
/** the package version to ask the signature database for (its latest by default) */
|
|
26
22
|
readonly version?: string;
|
|
27
23
|
}
|
|
24
|
+
/** The definitions `name` resolves to as a function in `environment`, each package export replaced by what flowR states about it. */
|
|
25
|
+
export declare function statedFunctions(name: Identifier, environment: REnvironmentInformation): readonly IdentifierDefinition[] | undefined;
|
|
28
26
|
/** What flowR knows about the function `name`: what the built-in definitions state, filled up with what the signature database knows (see {@link fnInfoFromSignature}). */
|
|
29
27
|
export declare function queryFnProps(name: Identifier, { environment, builtIns, signatures, version }: FnPropsSource): BuiltInFnInfo | undefined;
|
|
30
28
|
/** How to ask what flowR states about a built-in, answering every name once. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuiltInIndex = void 0;
|
|
4
|
+
exports.statedFunctions = statedFunctions;
|
|
4
5
|
exports.queryFnProps = queryFnProps;
|
|
5
6
|
exports.builtInLookup = builtInLookup;
|
|
6
7
|
exports.callFnProps = callFnProps;
|
|
@@ -13,6 +14,7 @@ exports.builtInNames = builtInNames;
|
|
|
13
14
|
* `FunctionSemantics` wires the call helpers together and this file sits below it, so `CallProps` is used directly here; reaching for `FunctionSemantics.call.props` would make `src/dataflow/fn/function-semantics.ts` import its own importers.
|
|
14
15
|
* @lintIgnore use-instead
|
|
15
16
|
*/
|
|
17
|
+
const strings_1 = require("../../util/text/strings");
|
|
16
18
|
const built_in_props_1 = require("./built-in-props");
|
|
17
19
|
const function_semantics_1 = require("../fn/function-semantics");
|
|
18
20
|
const default_builtin_config_1 = require("./default-builtin-config");
|
|
@@ -52,27 +54,33 @@ function withStatedBuiltIns(definitions, environment) {
|
|
|
52
54
|
}
|
|
53
55
|
return replaced ?? definitions;
|
|
54
56
|
}
|
|
57
|
+
/** The definitions `name` resolves to as a function in `environment`, each package export replaced by what flowR states about it. */
|
|
58
|
+
function statedFunctions(name, environment) {
|
|
59
|
+
const resolved = resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.Function);
|
|
60
|
+
return resolved === undefined ? undefined : withStatedBuiltIns(resolved, environment);
|
|
61
|
+
}
|
|
55
62
|
function ofDefinitions(definitions) {
|
|
56
63
|
let sig;
|
|
57
64
|
let stated = {};
|
|
58
65
|
let frame;
|
|
66
|
+
let muffles;
|
|
59
67
|
for (const d of definitions ?? []) {
|
|
60
68
|
if (d.type !== identifier_1.ReferenceType.BuiltInFunction) {
|
|
61
69
|
continue;
|
|
62
70
|
}
|
|
63
71
|
const info = d.config;
|
|
64
72
|
sig ??= info?.sig;
|
|
73
|
+
muffles ??= info?.muffles;
|
|
65
74
|
stated = function_semantics_1.FunctionSemantics.call.props.join(stated, info);
|
|
66
75
|
frame = info?.frame === undefined ? frame : (frame ?? 0) | info.frame;
|
|
67
76
|
}
|
|
68
|
-
return sig === undefined && frame === undefined && !function_semantics_1.FunctionSemantics.call.props.hasAny(stated) ? undefined : { sig, ...stated, frame };
|
|
77
|
+
return sig === undefined && frame === undefined && !function_semantics_1.FunctionSemantics.call.props.hasAny(stated) ? undefined : { sig, ...stated, frame, ...muffles === undefined ? {} : { muffles } };
|
|
69
78
|
}
|
|
70
79
|
/** What flowR knows about the function `name`: what the built-in definitions state, filled up with what the signature database knows (see {@link fnInfoFromSignature}). */
|
|
71
80
|
function queryFnProps(name, { environment, builtIns, signatures, version }) {
|
|
72
81
|
let info;
|
|
73
82
|
if (environment !== undefined) {
|
|
74
|
-
const
|
|
75
|
-
const stated = resolved === undefined ? undefined : withStatedBuiltIns(resolved, environment);
|
|
83
|
+
const stated = statedFunctions(name, environment);
|
|
76
84
|
if (stated?.some(d => d.type !== identifier_1.ReferenceType.BuiltInFunction)) {
|
|
77
85
|
return undefined;
|
|
78
86
|
}
|
|
@@ -194,27 +202,42 @@ function fnEntry(name, ctx, version) {
|
|
|
194
202
|
function nonEmpty(of) {
|
|
195
203
|
return of !== undefined && of.length > 0 ? of : undefined;
|
|
196
204
|
}
|
|
197
|
-
/** The package an unqualified `name` is answered for. */
|
|
205
|
+
/** The package an unqualified `name` is answered for: a dependency exporting it, else an attached base package, asking only those rather than every package of the database. */
|
|
198
206
|
function packageExporting(name, ctx) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
if (!ctx.deps.hasSignatureDatabase()) {
|
|
208
|
+
return (0, r_base_packages_1.baseRExportOwner)(name);
|
|
209
|
+
}
|
|
210
|
+
/* a `library()` the analysis meets adds a dependency, which may answer a name anew */
|
|
211
|
+
const dependencies = ctx.deps.getDependencies().length;
|
|
212
|
+
let known = ExportingPerContext.get(ctx.deps);
|
|
213
|
+
if (known?.dependencies !== dependencies) {
|
|
214
|
+
known = { dependencies, owners: new Map() };
|
|
215
|
+
ExportingPerContext.set(ctx.deps, known);
|
|
216
|
+
}
|
|
217
|
+
if (!known.owners.has(name)) {
|
|
218
|
+
known.owners.set(name, exportingPackage(name, ctx));
|
|
219
|
+
}
|
|
220
|
+
return known.owners.get(name);
|
|
221
|
+
}
|
|
222
|
+
/** what {@link packageExporting} answered per dependencies context, as long as it has the same number of dependencies */
|
|
223
|
+
const ExportingPerContext = new WeakMap();
|
|
224
|
+
function exportingPackage(name, ctx) {
|
|
225
|
+
const db = (0, signature_db_1.signatureDbOf)(ctx.deps);
|
|
226
|
+
const src = db.sources();
|
|
227
|
+
const mostUsed = (pkgs) => {
|
|
228
|
+
let best;
|
|
229
|
+
for (const pkg of pkgs) {
|
|
230
|
+
if (db.rawFunctionOf(identifier_1.Identifier.make(name, pkg))?.exported === true && (best === undefined || src.downloads(pkg) > src.downloads(best) || (src.downloads(pkg) === src.downloads(best) && (0, strings_1.compareByCodeUnit)(pkg, best) < 0))) {
|
|
231
|
+
best = pkg;
|
|
208
232
|
}
|
|
209
|
-
return pkg; // and nothing outranks a package the code attaches itself
|
|
210
|
-
}
|
|
211
|
-
const rank = pkg === "base" /* PkgName.Base */ ? 2 : 1;
|
|
212
|
-
if (rank < bestRank) {
|
|
213
|
-
bestRank = rank;
|
|
214
|
-
best = pkg;
|
|
215
233
|
}
|
|
216
|
-
|
|
217
|
-
|
|
234
|
+
return best;
|
|
235
|
+
};
|
|
236
|
+
const attached = (pkg) => pkg === "base" /* PkgName.Base */ || r_base_packages_1.AttachedBasePackageSet.has(pkg);
|
|
237
|
+
return mostUsed(new Set(ctx.deps.getDependencies().map(d => d.name).filter(p => !attached(p))))
|
|
238
|
+
?? mostUsed([...r_base_packages_1.AttachedBasePackageSet].filter(p => p !== "base" /* PkgName.Base */))
|
|
239
|
+
?? mostUsed(["base" /* PkgName.Base */])
|
|
240
|
+
?? (0, r_base_packages_1.baseRExportOwner)(name);
|
|
218
241
|
}
|
|
219
242
|
/** The identifiers a definition registers, with the suffixes of a replacement spelled out. */
|
|
220
243
|
function builtInNames(definition) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { BrandedIdentifier } from './identifier';
|
|
2
2
|
/** The reserved name recording that `name` was removed. */
|
|
3
3
|
export declare function removalMarkerOf(name: BrandedIdentifier): BrandedIdentifier;
|
|
4
|
+
/** The name a {@link removalMarkerOf|marker} records the removal of, or the name itself if it is no marker. */
|
|
5
|
+
export declare function removedNameOf(name: BrandedIdentifier): BrandedIdentifier;
|
|
4
6
|
/** Records that a {@link removalMarkerOf|marker} was written for `name`; see {@link anyRemovalMarker}. */
|
|
5
7
|
export declare function noteRemovalMarker(name: BrandedIdentifier): void;
|
|
6
8
|
/** Whether a removal marker was ever written for `name`, so nothing else pays for looking one up. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removalMarkerOf = removalMarkerOf;
|
|
4
|
+
exports.removedNameOf = removedNameOf;
|
|
4
5
|
exports.noteRemovalMarker = noteRemovalMarker;
|
|
5
6
|
exports.anyRemovalMarker = anyRemovalMarker;
|
|
6
7
|
const removalMarkerPrefix = ' rm-removal:';
|
|
@@ -8,6 +9,10 @@ const removalMarkerPrefix = ' rm-removal:';
|
|
|
8
9
|
function removalMarkerOf(name) {
|
|
9
10
|
return (removalMarkerPrefix + name);
|
|
10
11
|
}
|
|
12
|
+
/** The name a {@link removalMarkerOf|marker} records the removal of, or the name itself if it is no marker. */
|
|
13
|
+
function removedNameOf(name) {
|
|
14
|
+
return name.startsWith(removalMarkerPrefix) ? name.slice(removalMarkerPrefix.length) : name;
|
|
15
|
+
}
|
|
11
16
|
const removedNames = new Set();
|
|
12
17
|
/** Records that a {@link removalMarkerOf|marker} was written for `name`; see {@link anyRemovalMarker}. */
|
|
13
18
|
function noteRemovalMarker(name) {
|
|
@@ -44,12 +44,9 @@ export declare const StringFns: {
|
|
|
44
44
|
};
|
|
45
45
|
readonly paste0: {
|
|
46
46
|
readonly pkg: PkgName.Base;
|
|
47
|
-
readonly params: readonly ["..."
|
|
48
|
-
readonly defaults: {
|
|
49
|
-
readonly sep: "";
|
|
50
|
-
};
|
|
47
|
+
readonly params: readonly ["..."];
|
|
51
48
|
readonly ignored: readonly ["collapse"];
|
|
52
|
-
readonly fold: (parts: string[]
|
|
49
|
+
readonly fold: (parts: string[]) => string;
|
|
53
50
|
};
|
|
54
51
|
readonly 'file.path': {
|
|
55
52
|
readonly pkg: PkgName.Base;
|
|
@@ -51,9 +51,9 @@ function format(fmt, parts) {
|
|
|
51
51
|
* parameter with a default. The rest take a fixed number of arguments under the names R documents.
|
|
52
52
|
*/
|
|
53
53
|
exports.StringFns = {
|
|
54
|
-
/* the joining calls,
|
|
54
|
+
/* the joining calls, `paste0` has no separator, so a `sep` is one more part */
|
|
55
55
|
paste: { pkg: "base" /* PkgName.Base */, params: ['...', 'sep'], defaults: { sep: ' ' }, ignored: ['collapse'], fold: (parts, sep) => parts.join(sep) },
|
|
56
|
-
paste0: { pkg: "base" /* PkgName.Base */, params: ['...'
|
|
56
|
+
paste0: { pkg: "base" /* PkgName.Base */, params: ['...'], ignored: ['collapse'], fold: (parts) => parts.join('') },
|
|
57
57
|
'file.path': { pkg: "base" /* PkgName.Base */, params: ['...', 'fsep'], defaults: { fsep: '/' }, fold: (parts, fsep) => parts.join(fsep) },
|
|
58
58
|
sprintf: { pkg: "base" /* PkgName.Base */, params: ['fmt', '...'], fold: (fmt, parts = []) => format(fmt, parts) },
|
|
59
59
|
/* the project root stays implicit, so the fold yields the path below it */
|
package/dataflow/extractor.js
CHANGED
|
@@ -48,6 +48,7 @@ const config_1 = require("../config");
|
|
|
48
48
|
const df_helper_1 = require("./graph/df-helper");
|
|
49
49
|
const built_in_ambient_state_1 = require("./internal/process/functions/call/built-in/built-in-ambient-state");
|
|
50
50
|
const ambient_state_name_1 = require("./environments/ambient-state-name");
|
|
51
|
+
const ambient_access_1 = require("./graph/ambient-access");
|
|
51
52
|
const unnamed_call_handling_1 = require("./internal/process/functions/call/unnamed-call-handling");
|
|
52
53
|
const built_in_proc_name_1 = require("./environments/built-in-proc-name");
|
|
53
54
|
const built_in_envir_utils_1 = require("./internal/process/functions/call/built-in/built-in-envir-utils");
|
|
@@ -453,6 +454,10 @@ function linkResourceReadersToWriters(graph, environment, ctx) {
|
|
|
453
454
|
};
|
|
454
455
|
/* each added edge clears the graph's cached call names, but none of these edges changes what a call targets */
|
|
455
456
|
const prints = (0, defaultmap_1.memoize)((id) => function_semantics_1.FunctionSemantics.call.props.hasAll((0, query_fn_props_1.callFnProps)(id, { graph, environment }), [built_in_props_1.SemanticCallTag.Prints]));
|
|
457
|
+
const diverts = (id) => {
|
|
458
|
+
const access = graph.ambientAccessOf(id);
|
|
459
|
+
return access !== undefined && ambient_access_1.AmbientAccess.names(access)[ambient_access_1.AmbientAccessKind.Write].some(state => state === ambient_state_name_1.OutputSinks.switched || state === ambient_state_name_1.MessageSinks.switched);
|
|
460
|
+
};
|
|
456
461
|
let cfg;
|
|
457
462
|
for (const reader of readers) {
|
|
458
463
|
let before;
|
|
@@ -463,8 +468,8 @@ function linkResourceReadersToWriters(graph, environment, ctx) {
|
|
|
463
468
|
before ??= (0, happens_before_1.reachableTo)(cfg ??= new control_flow_graph_1.ControlFlowGraph(graph), [reader.id]);
|
|
464
469
|
if (before.has(writer.id)) {
|
|
465
470
|
graph.addEdge(reader.id, writer.id, edge_1.EdgeType.Reads);
|
|
466
|
-
/* whatever prints into a diverting writer (`print` after `sink(file)`) writes to the resource as well */
|
|
467
|
-
for (const id of df_helper_1.Dataflow.sourcesOf(graph, writer.id, edge_1.EdgeType.Reads).filter(prints)) {
|
|
471
|
+
/* whatever prints into a diverting writer (`print` after `sink(file)`) writes to the resource as well, a writer that diverts nothing (`dir.create`) takes none of it */
|
|
472
|
+
for (const id of diverts(writer.id) ? df_helper_1.Dataflow.sourcesOf(graph, writer.id, edge_1.EdgeType.Reads).filter(prints) : []) {
|
|
468
473
|
graph.addEdge(reader.id, id, edge_1.EdgeType.Reads);
|
|
469
474
|
}
|
|
470
475
|
}
|
|
@@ -529,13 +534,14 @@ function separateFileWritesPerCall(graph, environment, ctx) {
|
|
|
529
534
|
return { reads, writes };
|
|
530
535
|
});
|
|
531
536
|
const readPaths = (0, defaultmap_1.memoize)((id) => fileAccess(id).reads ? pathsOf(id, false, graph, environment, ctx) : undefined);
|
|
532
|
-
/* writing to the console (`cat(x)`) names no file,
|
|
533
|
-
const
|
|
537
|
+
/* writing to the console (`cat(x)`) names no file, but writes into the diversion of the output, whose end reads every call printing */
|
|
538
|
+
const writesFile = (id) => {
|
|
534
539
|
const vertex = graph.getVertex(id);
|
|
535
|
-
return resourceArgs((0, applied_arguments_1.appliedArguments)(graph, vertex), (0, query_fn_props_1.callFnProps)(id, { graph, environment }), true).length > 0
|
|
540
|
+
return (fileAccess(id).writes && resourceArgs((0, applied_arguments_1.appliedArguments)(graph, vertex), (0, query_fn_props_1.callFnProps)(id, { graph, environment }), true).length > 0)
|
|
541
|
+
|| graph.ambientAccessOf(id)?.writes.has(ambient_state_name_1.AmbientStateName.sinkOutput) === true;
|
|
536
542
|
};
|
|
537
543
|
const writers = [...graph.verticesOfType(vertex_1.VertexType.FunctionCall)].map(([id]) => id)
|
|
538
|
-
.filter(id => graph.edgesFrom(id).values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.SideEffectOnCall)) && !graph.unknownSideEffects.has(id) &&
|
|
544
|
+
.filter(id => graph.edgesFrom(id).values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.SideEffectOnCall)) && !graph.unknownSideEffects.has(id) && writesFile(id));
|
|
539
545
|
const separated = new Set();
|
|
540
546
|
for (const writer of writers) {
|
|
541
547
|
const levels = fileWriteLevels(writer, graph, idMap, callContext => pathsOf(writer, true, graph, environment, ctx, callContext));
|
|
@@ -649,6 +655,8 @@ function extractDataFlowGraph(parser, completeAst, ctx) {
|
|
|
649
655
|
const files = completeAst.ast.files.slice();
|
|
650
656
|
ctx.files.addConsideredFile(files[0].filePath ? files[0].filePath : flowr_file_1.FlowrFile.INLINE_PATH);
|
|
651
657
|
const env = ctx.env.makeCleanEnv();
|
|
658
|
+
/* what an earlier program noted on the built-in environment all programs share does not hold for this one */
|
|
659
|
+
environment_1.REnvironment.findBuiltIn(env.current).forgetProgramMarks();
|
|
652
660
|
env.current.n = ctx.meta.getNamespace();
|
|
653
661
|
const environment = (0, built_in_library_1.attachProject)(env, ctx);
|
|
654
662
|
const dfData = {
|
|
@@ -659,6 +667,7 @@ function extractDataFlowGraph(parser, completeAst, ctx) {
|
|
|
659
667
|
cds: undefined,
|
|
660
668
|
referenceChain: [files[0].filePath],
|
|
661
669
|
statementOrder: new Map(),
|
|
670
|
+
unreachable: new Set(),
|
|
662
671
|
ctx
|
|
663
672
|
};
|
|
664
673
|
let df = (0, assert_1.guardNesting)('Dataflow analysis', files[0].filePath, () => (0, processor_1.processDataflowFor)(files[0].root, dfData));
|
|
@@ -701,21 +710,21 @@ function extractDataFlowGraph(parser, completeAst, ctx) {
|
|
|
701
710
|
const cleanEnvironment = ctx.env.makeCleanEnv();
|
|
702
711
|
(0, linker_1.separateClosureInstances)(df.graph, name => (0, query_fn_props_1.queryFnProps)(name, { environment: cleanEnvironment }));
|
|
703
712
|
(0, transitive_side_effects_1.linkPromisesToWritesOfCall)(df.graph, ctx);
|
|
713
|
+
(0, transitive_side_effects_1.linkStatementsAfterCallsOfClosures)(df.graph);
|
|
714
|
+
(0, transitive_side_effects_1.linkStateWritesOfForcedPromises)(df.graph);
|
|
715
|
+
(0, transitive_side_effects_1.linkUsesOfScopedInstances)(df.graph);
|
|
704
716
|
(0, transitive_side_effects_1.settleConditionalWritesOfCalls)(df.graph, ctx);
|
|
705
717
|
function_semantics_1.FunctionSemantics.call.quoted.finalize(df.graph, df.environment, completeAst.idMap, () => new control_flow_graph_1.ControlFlowGraph(df.graph));
|
|
706
718
|
(0, built_in_try_catch_1.linkLateWarningsAsErrors)(df.graph, df.environment, completeAst.idMap);
|
|
707
719
|
(0, built_in_try_catch_1.linkHandlersToSignalSites)(df.graph, df.environment, dfData);
|
|
708
|
-
(0, built_in_try_catch_1.orderRaisingBodies)(df.graph, completeAst.idMap, ctx);
|
|
720
|
+
(0, built_in_try_catch_1.orderRaisingBodies)(df.graph, completeAst.idMap, ctx, df.environment);
|
|
709
721
|
function_semantics_1.FunctionSemantics.settleJumpsInPromises(df.graph, df.exitPoints, { ctx });
|
|
710
722
|
function_semantics_1.FunctionSemantics.settleDefinitionsInPromises(df.graph, { ctx });
|
|
711
|
-
|
|
712
|
-
df.graph
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
linkReadsOfDivertedOutput(df.graph, df.environment);
|
|
717
|
-
separateFileWritesPerCall(df.graph, df.environment, ctx);
|
|
718
|
-
});
|
|
723
|
+
linkEnvironmentArgumentsWrittenByCallee(df.graph, df.environment);
|
|
724
|
+
resolveLinkToSideEffects(df.graph, ctx);
|
|
725
|
+
linkResourceReadersToWriters(df.graph, df.environment, ctx);
|
|
726
|
+
linkReadsOfDivertedOutput(df.graph, df.environment);
|
|
727
|
+
separateFileWritesPerCall(df.graph, df.environment, ctx);
|
|
719
728
|
return df;
|
|
720
729
|
}
|
|
721
730
|
//# sourceMappingURL=extractor.js.map
|
|
@@ -4,3 +4,5 @@ import { type BrandedIdentifier } from '../environments/identifier';
|
|
|
4
4
|
export declare const ErrorConditionClasses: ReadonlySet<BrandedIdentifier>;
|
|
5
5
|
/** Whether the arguments written for a condition-handling call name a handler catching an error (matched by name). */
|
|
6
6
|
export declare function namesAnErrorHandler<Info>(args: readonly PotentiallyEmptyRArgument<Info>[]): boolean;
|
|
7
|
+
/** Classes the session signals on its own (a user interrupt) rather than the code, so a handler of them catches no error the code raises. */
|
|
8
|
+
export declare const SessionConditionClasses: ReadonlySet<BrandedIdentifier>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ErrorConditionClasses = void 0;
|
|
3
|
+
exports.SessionConditionClasses = exports.ErrorConditionClasses = void 0;
|
|
4
4
|
exports.namesAnErrorHandler = namesAnErrorHandler;
|
|
5
5
|
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
6
6
|
const identifier_1 = require("../environments/identifier");
|
|
@@ -10,4 +10,6 @@ exports.ErrorConditionClasses = new Set(['error', 'simpleError', 'condition']);
|
|
|
10
10
|
function namesAnErrorHandler(args) {
|
|
11
11
|
return args.some(a => r_argument_1.RArgument.isNamed(a) && exports.ErrorConditionClasses.has(identifier_1.Identifier.getName(a.name.content)));
|
|
12
12
|
}
|
|
13
|
+
/** Classes the session signals on its own (a user interrupt) rather than the code, so a handler of them catches no error the code raises. */
|
|
14
|
+
exports.SessionConditionClasses = new Set(['interrupt']);
|
|
13
15
|
//# sourceMappingURL=condition-handlers.js.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { DataflowGraph } from '../graph/graph';
|
|
2
|
-
import type { DataflowGraphVertexFunctionDefinition } from '../graph/vertex';
|
|
2
|
+
import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexFunctionDefinition } from '../graph/vertex';
|
|
3
3
|
import type { ArgProps, BuiltInFnInfo } from '../environments/built-in-props';
|
|
4
|
-
import
|
|
4
|
+
import { Identifier } from '../environments/identifier';
|
|
5
5
|
/** What flowR states about the built-in a call names, see {@link BuiltInFnInfo}. */
|
|
6
6
|
export type BuiltInLookup = (name: Identifier) => BuiltInFnInfo | undefined;
|
|
7
|
+
/** Whether the call binds a name beyond its own frame ({@link CallProp.Scope}): `y <<- 1`, `library(x)`, `assign` to an env do; `y <- 1` does not. */
|
|
8
|
+
export declare function bindsOutside(vertex: DataflowGraphVertexFunctionCall, info: BuiltInFnInfo | undefined): boolean;
|
|
7
9
|
/** What to ask for beyond the definition itself, see {@link reflectiveRolesOf}. */
|
|
8
10
|
export interface FrameReflectionOptions {
|
|
9
11
|
/** what flowR states about a built-in, answered once per name */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bindsOutside = bindsOutside;
|
|
3
4
|
exports.reflectiveRolesOf = reflectiveRolesOf;
|
|
4
5
|
const graph_1 = require("../graph/graph");
|
|
5
6
|
const built_in_proc_name_1 = require("../environments/built-in-proc-name");
|
|
@@ -7,8 +8,23 @@ const edge_1 = require("../graph/edge");
|
|
|
7
8
|
const df_helper_1 = require("../graph/df-helper");
|
|
8
9
|
const vertex_1 = require("../graph/vertex");
|
|
9
10
|
const built_in_props_1 = require("../environments/built-in-props");
|
|
11
|
+
const identifier_1 = require("../environments/identifier");
|
|
10
12
|
const fixpoint_1 = require("../../util/fixpoint");
|
|
11
13
|
const monoid_1 = require("../../util/monoid");
|
|
14
|
+
/** the assignments binding in the frame they run in, which is a scope of the function's own */
|
|
15
|
+
const FrameLocalBinders = new Set(['<-', '=', '->', ':=', 'assign']);
|
|
16
|
+
/** Whether the name is a replacement function binding in its own frame (`names(x) <- v`); the `<<-` twin does not. */
|
|
17
|
+
function isFrameLocalReplacement(name) {
|
|
18
|
+
return name.endsWith('<-') && !name.endsWith('<<-');
|
|
19
|
+
}
|
|
20
|
+
/** Whether the call binds a name beyond its own frame ({@link CallProp.Scope}): `y <<- 1`, `library(x)`, `assign` to an env do; `y <- 1` does not. */
|
|
21
|
+
function bindsOutside(vertex, info) {
|
|
22
|
+
const name = identifier_1.Identifier.getName(vertex.name);
|
|
23
|
+
if (!FrameLocalBinders.has(name) && !isFrameLocalReplacement(name)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return info?.sig !== undefined && built_in_props_1.FnSig.posWith(built_in_props_1.FnSig.layout(info.sig), vertex.args.length, built_in_props_1.ArgProp.Written).length > 0;
|
|
27
|
+
}
|
|
12
28
|
/**
|
|
13
29
|
* What `definition`'s body reaches about its own formals through the frame or call it sits in, as the {@link BuiltInFnInfo#frame} bits of the reflective calls it makes (`0` for none).
|
|
14
30
|
* @useInstead {@link FunctionSemantics.frameReflection}
|