@eagleoutice/flowr 2.17.5 → 2.17.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -51
- package/abstract-interpretation/absint-inference.d.ts +13 -29
- package/abstract-interpretation/absint-inference.js +18 -32
- 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 +56 -0
- package/abstract-interpretation/branch-paths.d.ts +59 -0
- package/abstract-interpretation/branch-paths.js +120 -0
- package/abstract-interpretation/data-frame/arguments.d.ts +3 -14
- package/abstract-interpretation/data-frame/arguments.js +2 -10
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +4 -12
- package/abstract-interpretation/data-frame/dataframe-domain.js +6 -20
- package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +8 -7
- package/abstract-interpretation/data-frame/dataframe-semantics.js +218 -325
- package/abstract-interpretation/data-frame/resolve-args.d.ts +2 -6
- package/abstract-interpretation/data-frame/semantics.d.ts +3 -0
- package/abstract-interpretation/data-frame/semantics.js +24 -52
- package/abstract-interpretation/data-frame/shape-inference.d.ts +5 -15
- package/abstract-interpretation/domains/abstract-domain.d.ts +7 -21
- package/abstract-interpretation/domains/abstract-domain.js +6 -18
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +2 -6
- package/abstract-interpretation/domains/interval-domain.js +3 -10
- package/abstract-interpretation/domains/lattice.d.ts +14 -42
- package/abstract-interpretation/domains/set-range-domain.d.ts +6 -18
- package/abstract-interpretation/domains/set-range-domain.js +4 -12
- package/abstract-interpretation/domains/state-domain.d.ts +9 -27
- package/abstract-interpretation/domains/value-abstract-domain.d.ts +22 -66
- package/abstract-interpretation/domains/value-abstract-domain.js +3 -9
- package/abstract-interpretation/unsupported-functions.d.ts +2 -6
- package/abstract-interpretation/unsupported-functions.js +3 -9
- package/abstract-interpretation/value-semantics.d.ts +1 -2
- package/benchmark/slicer.d.ts +4 -11
- package/benchmark/slicer.js +8 -24
- package/benchmark/stats/count-comments.d.ts +1 -3
- package/benchmark/stats/count-comments.js +1 -3
- package/benchmark/stats/print.d.ts +3 -10
- package/benchmark/stats/print.js +39 -110
- package/benchmark/stats/sigdb-counts.js +1 -5
- package/benchmark/stats/size-of.js +3 -13
- package/benchmark/stats/stats.d.ts +1 -3
- package/benchmark/stopwatch.d.ts +1 -3
- package/benchmark/stopwatch.js +1 -3
- package/benchmark/summarizer/first-phase/input.d.ts +2 -6
- package/benchmark/summarizer/first-phase/input.js +2 -6
- package/benchmark/summarizer/first-phase/process.d.ts +4 -12
- package/benchmark/summarizer/first-phase/process.js +22 -39
- package/benchmark/summarizer/second-phase/graph.d.ts +0 -1
- package/benchmark/summarizer/second-phase/graph.js +9 -33
- package/benchmark/summarizer/second-phase/process.d.ts +4 -12
- package/benchmark/summarizer/second-phase/process.js +78 -221
- package/benchmark/summarizer/summarizer.d.ts +4 -12
- package/cli/benchmark-app.js +1 -5
- package/cli/benchmark-helper-app.js +2 -10
- package/cli/common/options.d.ts +1 -3
- package/cli/common/options.js +1 -3
- package/cli/common/script.d.ts +1 -3
- package/cli/common/script.js +3 -11
- package/cli/common/scripts-info.d.ts +2 -7
- package/cli/common/scripts-info.js +2 -6
- package/cli/flowr-main-options.d.ts +1 -3
- package/cli/flowr-main-options.js +6 -31
- package/cli/flowr.js +5 -8
- package/cli/repl/commands/repl-commands.d.ts +5 -15
- package/cli/repl/commands/repl-commands.js +7 -17
- package/cli/repl/commands/repl-dataflow.js +4 -4
- package/cli/repl/commands/repl-execute.d.ts +1 -4
- package/cli/repl/commands/repl-execute.js +1 -4
- package/cli/repl/commands/repl-main.d.ts +4 -14
- package/cli/repl/commands/repl-main.js +1 -5
- package/cli/repl/commands/repl-query.js +2 -10
- package/cli/repl/commands/repl-signature.js +2 -3
- package/cli/repl/completion.d.ts +11 -3
- package/cli/repl/completion.js +32 -0
- package/cli/repl/core.d.ts +5 -16
- package/cli/repl/core.js +58 -19
- package/cli/repl/execute.js +3 -11
- package/cli/repl/ghost-hint.js +6 -6
- package/cli/repl/parser/slice-query-parser.d.ts +3 -9
- package/cli/repl/parser/slice-query-parser.js +6 -10
- package/cli/repl/print-version.d.ts +2 -6
- package/cli/repl/print-version.js +4 -8
- package/cli/repl/prompt.d.ts +1 -0
- package/cli/repl/prompt.js +1 -0
- package/cli/repl/server/connection.d.ts +2 -6
- package/cli/repl/server/connection.js +8 -35
- package/cli/repl/server/messages/all-messages.d.ts +3 -9
- package/cli/repl/server/messages/all-messages.js +1 -4
- package/cli/repl/server/messages/message-analysis.d.ts +6 -18
- package/cli/repl/server/messages/message-error.d.ts +1 -3
- package/cli/repl/server/messages/message-hello.d.ts +2 -7
- package/cli/repl/server/messages/message-repl.d.ts +1 -1
- package/cli/repl/server/messages/message-slice.d.ts +2 -7
- package/cli/repl/server/net.d.ts +3 -11
- package/cli/repl/server/net.js +1 -3
- package/cli/repl/server/send.d.ts +2 -6
- package/cli/repl/server/send.js +2 -6
- package/cli/repl/server/server.js +1 -6
- package/cli/repl/server/validate.d.ts +3 -9
- package/cli/repl/server/validate.js +3 -9
- package/cli/script-core/summarizer-core.d.ts +1 -3
- package/cli/script-core/summarizer-core.js +1 -3
- package/cli/summarizer-app.js +1 -4
- package/cli/wiki.d.ts +1 -3
- package/cli/wiki.js +3 -15
- package/clones/algorithms/baxter-ast.js +2 -2
- package/clones/clone-ast.js +2 -2
- package/clones/clone-detector.js +2 -2
- package/config.d.ts +5 -15
- package/config.js +17 -59
- package/control-flow/basic-cfg-guided-visitor.d.ts +2 -6
- package/control-flow/basic-cfg-guided-visitor.js +2 -6
- package/control-flow/cfg-dead-code.d.ts +1 -1
- package/control-flow/cfg-dead-code.js +27 -47
- package/control-flow/cfg-properties.d.ts +1 -3
- package/control-flow/cfg-properties.js +1 -3
- package/control-flow/cfg-simplification.d.ts +2 -6
- package/control-flow/cfg-simplification.js +2 -6
- package/control-flow/cfg-to-basic-blocks.d.ts +1 -3
- package/control-flow/cfg-to-basic-blocks.js +2 -9
- package/control-flow/control-flow-graph.d.ts +16 -49
- package/control-flow/control-flow-graph.js +60 -194
- package/control-flow/dfg-cfg-guided-visitor.d.ts +2 -6
- package/control-flow/dfg-cfg-guided-visitor.js +2 -6
- package/control-flow/happens-before.d.ts +1 -3
- package/control-flow/happens-before.js +1 -3
- package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -7
- package/control-flow/semantic-cfg-guided-visitor.js +12 -45
- package/control-flow/simple-visitor.d.ts +1 -5
- package/control-flow/simple-visitor.js +1 -5
- package/control-flow/syntax-cfg-guided-visitor.d.ts +23 -67
- package/control-flow/syntax-cfg-guided-visitor.js +22 -66
- package/control-flow/useless-loop.d.ts +0 -5
- package/control-flow/useless-loop.js +0 -5
- package/core/pipeline-executor.d.ts +1 -4
- package/core/pipeline-executor.js +2 -8
- package/core/print/print.d.ts +4 -14
- package/core/print/slice-diff-ansi.d.ts +1 -3
- package/core/print/slice-diff-ansi.js +2 -7
- package/core/steps/all/core/01-parse-tree-sitter.js +1 -4
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +1 -1
- package/core/steps/all/static-slicing/00-slice.d.ts +1 -1
- package/core/steps/all/static-slicing/00-slice.js +1 -3
- package/core/steps/all/static-slicing/10-reconstruct.js +1 -3
- package/core/steps/pipeline/create-pipeline.d.ts +1 -3
- package/core/steps/pipeline/create-pipeline.js +2 -8
- package/core/steps/pipeline/default-pipelines.d.ts +48 -323
- package/core/steps/pipeline/default-pipelines.js +9 -47
- package/core/steps/pipeline/invalid-pipeline-error.d.ts +1 -3
- package/core/steps/pipeline/invalid-pipeline-error.js +1 -3
- package/core/steps/pipeline/pipeline.d.ts +1 -6
- package/core/steps/pipeline-step.d.ts +2 -6
- 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/cluster.d.ts +1 -3
- package/dataflow/cluster.js +1 -3
- package/dataflow/environments/ambient-contract.d.ts +102 -0
- package/dataflow/environments/ambient-contract.js +134 -0
- package/dataflow/environments/ambient-effect.d.ts +1064 -0
- package/dataflow/environments/ambient-effect.js +276 -0
- package/dataflow/environments/ambient-state-name.d.ts +50 -3
- package/dataflow/environments/ambient-state-name.js +68 -7
- package/dataflow/environments/append.d.ts +1 -3
- package/dataflow/environments/append.js +2 -7
- package/dataflow/environments/apply-kill.d.ts +2 -3
- package/dataflow/environments/apply-kill.js +34 -52
- package/dataflow/environments/built-in-config.d.ts +1 -2
- package/dataflow/environments/built-in-kinds.d.ts +4 -46
- package/dataflow/environments/built-in-kinds.js +6 -2
- package/dataflow/environments/built-in-proc-name.d.ts +2 -6
- package/dataflow/environments/built-in-proc-name.js +2 -6
- package/dataflow/environments/built-in-props.d.ts +16 -4
- package/dataflow/environments/built-in-props.js +12 -7
- package/dataflow/environments/built-in.d.ts +8 -4
- package/dataflow/environments/built-in.js +16 -42
- package/dataflow/environments/clone.js +1 -4
- package/dataflow/environments/default-builtin-config/base-functions.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/base-functions.js +114 -56
- 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/define-helpers.d.ts +4 -0
- package/dataflow/environments/default-builtin-config/define-helpers.js +4 -0
- package/dataflow/environments/default-builtin-config/dev-tooling.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/dev-tooling.js +11 -8
- 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 +25 -15
- package/dataflow/environments/default-builtin-config/guard-builders.d.ts +23 -0
- package/dataflow/environments/default-builtin-config/guard-builders.js +36 -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 +206 -0
- package/dataflow/environments/default-builtin-config/index.d.ts +4 -4
- 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-data-table.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/package-data-table.js +2 -3
- 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 +23 -6
- 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 +209 -77
- package/dataflow/environments/default-builtin-config/shared-configs.js +70 -91
- package/dataflow/environments/default-builtin-config/statistics.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/statistics.js +4 -1
- package/dataflow/environments/define.js +1 -4
- package/dataflow/environments/diff.d.ts +4 -10
- package/dataflow/environments/diff.js +8 -11
- package/dataflow/environments/environment.d.ts +22 -4
- package/dataflow/environments/environment.js +48 -22
- package/dataflow/environments/frame-memory.d.ts +0 -1
- package/dataflow/environments/frame-memory.js +0 -1
- 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/overwrite.js +1 -4
- package/dataflow/environments/pkg-name.d.ts +1 -0
- package/dataflow/environments/query-fn-props.d.ts +11 -7
- package/dataflow/environments/query-fn-props.js +78 -81
- package/dataflow/environments/reference-to-maybe.d.ts +3 -6
- package/dataflow/environments/reference-to-maybe.js +1 -3
- package/dataflow/environments/removal-marker.d.ts +2 -0
- package/dataflow/environments/removal-marker.js +5 -0
- package/dataflow/environments/resolve-helper.d.ts +3 -2
- package/dataflow/environments/resolve-helper.js +2 -0
- package/dataflow/environments/scoping.js +2 -8
- package/dataflow/eval/resolve/alias-tracking.d.ts +2 -0
- package/dataflow/eval/resolve/alias-tracking.js +52 -80
- package/dataflow/eval/resolve/resolve-argument.d.ts +3 -3
- package/dataflow/eval/resolve/resolve-argument.js +8 -13
- package/dataflow/eval/resolve/resolve-get.js +1 -4
- package/dataflow/eval/resolve/resolve-strings.d.ts +2 -5
- package/dataflow/eval/resolve/resolve-strings.js +5 -5
- package/dataflow/eval/resolve/resolve-working-directory.js +1 -3
- package/dataflow/eval/resolve/resolve.d.ts +1 -1
- package/dataflow/eval/resolve/resolve.js +15 -16
- package/dataflow/eval/values/general.js +10 -11
- package/dataflow/eval/values/intervals/interval-constants.d.ts +0 -2
- package/dataflow/eval/values/intervals/interval-constants.js +1 -9
- package/dataflow/eval/values/logical/logical-constants.js +1 -4
- package/dataflow/eval/values/scalar/scalar-constants.d.ts +2 -6
- package/dataflow/eval/values/scalar/scalar-constants.js +4 -18
- package/dataflow/eval/values/sets/set-constants.js +1 -4
- package/dataflow/eval/values/vectors/vector-constants.js +1 -5
- package/dataflow/extractor.js +124 -28
- package/dataflow/fn/argument-roles.d.ts +2 -2
- package/dataflow/fn/argument-roles.js +9 -5
- package/dataflow/fn/call-sites.d.ts +57 -0
- package/dataflow/fn/call-sites.js +167 -0
- package/dataflow/fn/class-declaration.js +2 -2
- package/dataflow/fn/condition-handlers.d.ts +2 -0
- package/dataflow/fn/condition-handlers.js +3 -1
- package/dataflow/fn/dispatch.js +6 -5
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/frame-reflection.d.ts +6 -4
- package/dataflow/fn/frame-reflection.js +16 -0
- package/dataflow/fn/function-props.d.ts +1 -1
- package/dataflow/fn/function-props.js +15 -25
- package/dataflow/fn/function-semantics.d.ts +45 -2
- package/dataflow/fn/function-semantics.js +18 -0
- package/dataflow/fn/guards/built-in-guards.d.ts +112 -0
- package/dataflow/fn/guards/built-in-guards.js +193 -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 +1551 -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 +679 -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/guards/stored-location.d.ts +21 -0
- package/dataflow/fn/guards/stored-location.js +21 -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 +5 -1
- package/dataflow/fn/strict-function.js +73 -26
- package/dataflow/graph/ambient-access.d.ts +4 -1
- package/dataflow/graph/ambient-access.js +8 -2
- package/dataflow/graph/call-graph.d.ts +1 -1
- package/dataflow/graph/call-graph.js +1 -5
- package/dataflow/graph/closure-frames.js +1 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +4 -3
- package/dataflow/graph/dataflowgraph-builder.js +24 -31
- package/dataflow/graph/df-helper.d.ts +6 -0
- package/dataflow/graph/df-helper.js +33 -31
- package/dataflow/graph/edge.d.ts +3 -9
- package/dataflow/graph/edge.js +2 -6
- package/dataflow/graph/graph-helper.d.ts +2 -3
- package/dataflow/graph/graph.d.ts +13 -8
- package/dataflow/graph/graph.js +29 -41
- package/dataflow/graph/match-args.d.ts +1 -1
- package/dataflow/graph/match-args.js +13 -31
- package/dataflow/graph/quads.js +2 -7
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/graph/vertex.js +1 -5
- package/dataflow/hooks.d.ts +1 -1
- package/dataflow/info.d.ts +10 -26
- package/dataflow/info.js +12 -33
- package/dataflow/internal/control-flow.d.ts +1 -2
- package/dataflow/internal/dispatch-linking.d.ts +3 -1
- package/dataflow/internal/dispatch-linking.js +1 -0
- package/dataflow/internal/linker.d.ts +4 -3
- package/dataflow/internal/linker.js +151 -43
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +3 -8
- package/dataflow/internal/process/functions/call/argument/make-argument.js +3 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +14 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +33 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +34 -57
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +506 -339
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +14 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +14 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +115 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +26 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -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 +37 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +5 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +6 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +37 -44
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +20 -20
- 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 +352 -55
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +119 -30
- 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 +6 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +9 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +38 -34
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +45 -134
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +39 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +2 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +7 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.d.ts +1 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +6 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +4 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +0 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +0 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +22 -12
- 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 +57 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +2 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -9
- 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.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +9 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +65 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +5 -23
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +168 -28
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +8 -2
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +155 -28
- package/dataflow/internal/process/functions/call/common.d.ts +2 -2
- package/dataflow/internal/process/functions/call/common.js +4 -5
- package/dataflow/internal/process/functions/call/deferred.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +2 -2
- package/dataflow/internal/process/functions/call/nse-kind.d.ts +1 -4
- package/dataflow/internal/process/functions/call/nse-kind.js +1 -4
- package/dataflow/internal/process/functions/call/nse.js +1 -6
- package/dataflow/internal/process/functions/call/quoted.d.ts +4 -2
- package/dataflow/internal/process/functions/call/quoted.js +24 -5
- package/dataflow/internal/process/functions/process-argument.d.ts +2 -6
- package/dataflow/internal/process/functions/process-argument.js +3 -11
- package/dataflow/internal/process/functions/process-parameter.d.ts +0 -1
- package/dataflow/internal/process/functions/process-parameter.js +0 -1
- package/dataflow/internal/process/process-named-call.d.ts +1 -3
- package/dataflow/internal/process/process-named-call.js +1 -3
- package/dataflow/internal/process/process-value.d.ts +1 -4
- package/dataflow/internal/process/process-value.js +2 -9
- package/dataflow/origin/dfg-get-origin.d.ts +1 -3
- package/dataflow/origin/dfg-get-origin.js +10 -30
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +0 -1
- package/dataflow/origin/dfg-get-symbol-refs.js +0 -1
- package/dataflow/processor.d.ts +10 -24
- package/dataflow/processor.js +1 -0
- package/documentation/data/dfg/doc-ambient.d.ts +4 -0
- package/documentation/data/dfg/doc-ambient.js +83 -0
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +2 -6
- package/documentation/data/dfg/doc-data-dfg-util.js +2 -6
- package/documentation/data/faq/faqs.js +1 -3
- package/documentation/data/faq/recommended-configs.js +2 -15
- package/documentation/data/faq/wiki-faq-store.d.ts +1 -3
- package/documentation/data/faq/wiki-faq-store.js +4 -13
- package/documentation/data/interface/doc-writing-code.d.ts +1 -3
- package/documentation/data/interface/doc-writing-code.js +4 -12
- package/documentation/data/server/doc-data-server-messages.js +28 -120
- package/documentation/doc-capabilities.js +2 -2
- package/documentation/doc-readme.d.ts +2 -5
- package/documentation/doc-readme.js +4 -18
- package/documentation/doc-util/doc-benchmarks.d.ts +2 -6
- package/documentation/doc-util/doc-benchmarks.js +2 -6
- package/documentation/doc-util/doc-cfg.d.ts +4 -10
- package/documentation/doc-util/doc-cfg.js +7 -21
- package/documentation/doc-util/doc-cli-option.d.ts +4 -10
- package/documentation/doc-util/doc-cli-option.js +3 -9
- package/documentation/doc-util/doc-dfg.d.ts +10 -9
- package/documentation/doc-util/doc-dfg.js +9 -24
- package/documentation/doc-util/doc-escape.js +1 -7
- package/documentation/doc-util/doc-files.d.ts +2 -6
- package/documentation/doc-util/doc-files.js +2 -6
- package/documentation/doc-util/doc-general.d.ts +0 -10
- package/documentation/doc-util/doc-general.js +0 -18
- package/documentation/doc-util/doc-normalized-ast.js +4 -7
- package/documentation/doc-util/doc-playground.d.ts +1 -1
- package/documentation/doc-util/doc-query.d.ts +6 -8
- package/documentation/doc-util/doc-query.js +9 -12
- package/documentation/doc-util/doc-repl.d.ts +1 -3
- package/documentation/doc-util/doc-repl.js +1 -3
- package/documentation/doc-util/doc-search.d.ts +1 -3
- package/documentation/doc-util/doc-search.js +2 -7
- package/documentation/doc-util/doc-server-message.d.ts +4 -12
- package/documentation/doc-util/doc-server-message.js +4 -12
- package/documentation/doc-util/doc-structure.d.ts +5 -7
- package/documentation/doc-util/doc-structure.js +9 -9
- package/documentation/doc-util/doc-types.d.ts +4 -12
- package/documentation/doc-util/doc-types.js +29 -127
- package/documentation/issue-linting-rule.d.ts +2 -5
- package/documentation/issue-linting-rule.js +1 -3
- package/documentation/wiki-absint.js +3 -6
- package/documentation/wiki-analyzer.d.ts +2 -5
- package/documentation/wiki-analyzer.js +22 -61
- package/documentation/wiki-cfg.d.ts +1 -2
- package/documentation/wiki-cfg.js +23 -56
- package/documentation/wiki-core.d.ts +3 -8
- package/documentation/wiki-core.js +32 -59
- package/documentation/wiki-create-linting-rules.d.ts +1 -2
- package/documentation/wiki-create-linting-rules.js +1 -4
- package/documentation/wiki-dataflow-graph.d.ts +2 -5
- package/documentation/wiki-dataflow-graph.js +83 -133
- package/documentation/wiki-engine.d.ts +2 -5
- package/documentation/wiki-engine.js +3 -11
- package/documentation/wiki-faq.d.ts +2 -5
- package/documentation/wiki-faq.js +1 -3
- package/documentation/wiki-helper-objects.d.ts +2 -5
- package/documentation/wiki-helper-objects.js +3 -5
- package/documentation/wiki-interface.d.ts +2 -5
- package/documentation/wiki-interface.js +14 -54
- package/documentation/wiki-linter.d.ts +2 -8
- package/documentation/wiki-linter.js +33 -92
- package/documentation/wiki-linting-and-testing.d.ts +2 -5
- package/documentation/wiki-linting-and-testing.js +4 -9
- package/documentation/wiki-mk/doc-context.d.ts +6 -14
- package/documentation/wiki-mk/doc-context.js +8 -28
- package/documentation/wiki-mk/doc-maker.d.ts +9 -27
- package/documentation/wiki-mk/doc-maker.js +6 -18
- package/documentation/wiki-normalized-ast.d.ts +2 -5
- package/documentation/wiki-normalized-ast.js +2 -7
- package/documentation/wiki-onboarding.d.ts +2 -5
- package/documentation/wiki-onboarding.js +1 -3
- package/documentation/wiki-overview.d.ts +2 -5
- package/documentation/wiki-overview.js +1 -3
- package/documentation/wiki-query.d.ts +2 -5
- package/documentation/wiki-query.js +262 -329
- package/documentation/wiki-search.d.ts +2 -5
- package/documentation/wiki-search.js +1 -3
- package/documentation/wiki-setup.d.ts +2 -5
- package/documentation/wiki-setup.js +1 -3
- package/documentation/wiki-signature-database.d.ts +2 -5
- package/documentation/wiki-signature-database.js +3 -5
- package/engines.d.ts +1 -4
- package/engines.js +1 -4
- package/linter/linter-executor.d.ts +1 -3
- package/linter/linter-executor.js +3 -11
- package/linter/linter-fix.d.ts +5 -0
- package/linter/linter-fix.js +7 -22
- package/linter/linter-format.d.ts +23 -55
- package/linter/linter-format.js +13 -26
- package/linter/linter-rules.d.ts +126 -73
- package/linter/linter-rules.js +25 -9
- package/linter/linter-tags.d.ts +9 -29
- package/linter/linter-tags.js +9 -29
- package/linter/rules/{absolute-path.d.ts → absolute-file-paths.d.ts} +10 -10
- package/linter/rules/{absolute-path.js → absolute-file-paths.js} +16 -20
- 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 +7 -17
- package/linter/rules/cmd-check/class-string-comparison.js +1 -4
- package/linter/rules/cmd-check/cmd-check-util.d.ts +3 -6
- package/linter/rules/cmd-check/cmd-check-util.js +17 -35
- package/linter/rules/cmd-check/compiled-code.js +6 -6
- package/linter/rules/cmd-check/dependency-declaration.js +4 -10
- package/linter/rules/cmd-check/description-metadata.js +5 -9
- package/linter/rules/cmd-check/documentation-mismatch.d.ts +9 -2
- package/linter/rules/cmd-check/documentation-mismatch.js +11 -69
- package/linter/rules/cmd-check/file-checks.d.ts +5 -0
- package/linter/rules/cmd-check/file-checks.js +5 -3
- package/linter/rules/cmd-check/foreign-function-calls.js +5 -7
- package/linter/rules/cmd-check/global-environment-modification.js +6 -9
- package/linter/rules/cmd-check/namespace-tampering.js +14 -24
- package/linter/rules/cmd-check/non-ascii-code.js +1 -4
- package/linter/rules/cmd-check/package-data.js +4 -4
- package/linter/rules/cmd-check/package-files.d.ts +1 -3
- package/linter/rules/cmd-check/package-files.js +2 -2
- package/linter/rules/cmd-check/package-hooks.js +3 -5
- package/linter/rules/cmd-check/package-metafiles.d.ts +2 -2
- package/linter/rules/cmd-check/package-metafiles.js +5 -23
- package/linter/rules/cmd-check/package-runtime.js +6 -19
- package/linter/rules/cmd-check/package-structure.js +7 -8
- package/linter/rules/cmd-check/rd-files.d.ts +2 -2
- package/linter/rules/cmd-check/rd-files.js +31 -37
- package/linter/rules/cmd-check/s-three-method-consistency.js +9 -14
- package/linter/rules/cmd-check/true-false-abbreviation.js +1 -3
- package/linter/rules/dataframe-access-validation.d.ts +9 -9
- package/linter/rules/dataframe-access-validation.js +2 -2
- package/linter/rules/dead-code.js +2 -15
- package/linter/rules/deprecated-functions.d.ts +2 -4
- package/linter/rules/deprecated-functions.js +45 -141
- package/linter/rules/file-path-validity.d.ts +1 -3
- package/linter/rules/file-path-validity.js +20 -61
- package/linter/rules/function-finder-util.d.ts +4 -9
- package/linter/rules/function-finder-util.js +5 -16
- package/linter/rules/interactive-functions.d.ts +30 -0
- package/linter/rules/interactive-functions.js +85 -0
- package/linter/rules/naming-convention.d.ts +5 -15
- package/linter/rules/naming-convention.js +14 -54
- package/linter/rules/network-functions.d.ts +3 -7
- package/linter/rules/network-functions.js +1 -3
- package/linter/rules/overwritten-file.js +4 -4
- package/linter/rules/problematic-inputs.d.ts +1 -2
- package/linter/rules/problematic-inputs.js +1 -4
- package/linter/rules/process-state-in-session.d.ts +0 -1
- package/linter/rules/process-state-in-session.js +7 -7
- package/linter/rules/roxygen-arguments.d.ts +6 -6
- package/linter/rules/roxygen-arguments.js +2 -2
- package/linter/rules/seeded-randomness.d.ts +2 -4
- package/linter/rules/seeded-randomness.js +9 -9
- package/linter/rules/software-has-license.js +1 -3
- package/linter/rules/software-has-tests.js +2 -10
- package/linter/rules/{stop-with-call-arg.d.ts → stop-call.d.ts} +6 -6
- package/linter/rules/{stop-with-call-arg.js → stop-call.js} +4 -6
- package/linter/rules/syntactically-valid.js +17 -44
- package/linter/rules/unclosed-connection.d.ts +1 -2
- package/linter/rules/unclosed-connection.js +1 -4
- 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 +39 -64
- package/linter/rules/unescaped-arguments.d.ts +10 -30
- package/linter/rules/unescaped-arguments.js +20 -53
- package/linter/rules/{unused-definition.d.ts → unused-definitions.d.ts} +12 -14
- package/linter/rules/{unused-definition.js → unused-definitions.js} +41 -84
- package/linter/rules/unused-import.d.ts +1 -1
- package/linter/rules/unused-import.js +4 -13
- package/linter/rules/useless-loop.d.ts +1 -1
- package/linter/rules/useless-loop.js +3 -13
- package/package.json +1 -1
- package/project/cache/flowr-analyzer-cache.d.ts +2 -7
- package/project/cache/flowr-analyzer-cache.js +5 -14
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +2 -3
- package/project/cache/flowr-analyzer-controlflow-cache.js +0 -1
- package/project/cache/flowr-cache.d.ts +2 -7
- package/project/cache/flowr-cache.js +2 -7
- package/project/context/abstract-flowr-analyzer-context.d.ts +7 -22
- package/project/context/abstract-flowr-analyzer-context.js +5 -16
- package/project/context/flowr-analyzer-context.d.ts +7 -12
- package/project/context/flowr-analyzer-context.js +8 -22
- package/project/context/flowr-analyzer-dependencies-context.d.ts +7 -19
- package/project/context/flowr-analyzer-dependencies-context.js +8 -22
- package/project/context/flowr-analyzer-environment-context.d.ts +12 -30
- package/project/context/flowr-analyzer-environment-context.js +4 -15
- package/project/context/flowr-analyzer-files-context.d.ts +14 -37
- package/project/context/flowr-analyzer-files-context.js +27 -87
- package/project/context/flowr-analyzer-gas-context.d.ts +1 -0
- package/project/context/flowr-analyzer-gas-context.js +9 -31
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -10
- package/project/context/flowr-analyzer-incremental-analysis-context.js +2 -6
- package/project/context/flowr-analyzer-loading-order-context.d.ts +5 -15
- package/project/context/flowr-analyzer-meta-context.d.ts +8 -33
- package/project/context/flowr-analyzer-meta-context.js +0 -1
- package/project/context/flowr-file.d.ts +6 -14
- package/project/context/flowr-file.js +1 -3
- package/project/dependency-version-space.d.ts +1 -3
- package/project/dependency-version-space.js +41 -135
- package/project/flowr-analyzer-builder.d.ts +7 -5
- package/project/flowr-analyzer-builder.js +10 -12
- package/project/flowr-analyzer.d.ts +13 -34
- package/project/flowr-analyzer.js +10 -19
- package/project/incremental/incremental-parse/edit-computation.js +1 -8
- package/project/incremental/incremental-parse/incremental-parse.js +3 -12
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +13 -35
- package/project/plugins/file-plugins/files/flowr-description-file.js +12 -38
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +1 -2
- package/project/plugins/file-plugins/files/flowr-manifest-files.js +1 -4
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -2
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +8 -42
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -7
- package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +1 -2
- package/project/plugins/file-plugins/files/flowr-rd-file.js +17 -32
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +15 -40
- package/project/plugins/file-plugins/files/flowr-rda-file.js +343 -819
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +6 -18
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +10 -34
- package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +1 -2
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +4 -13
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +4 -18
- package/project/plugins/file-plugins/files/flowr-sysdata-file.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +2 -6
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +2 -6
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +1 -4
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +1 -4
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.js +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.js +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +1 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.js +1 -3
- package/project/plugins/flowr-analyzer-plugin.d.ts +2 -6
- package/project/plugins/flowr-analyzer-plugin.js +2 -6
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +1 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.js +1 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -4
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-on-demand-plugin.d.ts +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-on-demand-plugin.js +13 -9
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +0 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +7 -35
- package/project/plugins/package-version-plugins/package.d.ts +1 -1
- package/project/plugins/plugin-registry.d.ts +3 -10
- package/project/plugins/plugin-registry.js +3 -10
- package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +1 -1
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -8
- package/project/sigdb/build.d.ts +2 -0
- package/project/sigdb/build.js +130 -186
- package/project/sigdb/decode.d.ts +4 -1
- package/project/sigdb/decode.js +13 -5
- package/project/sigdb/guarded-source.d.ts +6 -0
- package/project/sigdb/guarded-source.js +29 -0
- package/project/sigdb/manifest.js +10 -10
- package/project/sigdb/memory-source.d.ts +1 -1
- package/project/sigdb/memory-source.js +1 -1
- package/project/sigdb/on-demand/package-sources.js +2 -2
- package/project/sigdb/on-demand/recoverer.d.ts +1 -1
- package/project/sigdb/on-demand/remote-sources.js +2 -2
- package/project/sigdb/reader.d.ts +41 -25
- package/project/sigdb/reader.js +90 -82
- package/project/sigdb/schema.d.ts +24 -2
- package/project/sigdb/sigdb-download.js +2 -12
- package/project/sigdb/signature-db.d.ts +1 -1
- package/project/sigdb/signature-db.js +6 -6
- package/project/sigdb/spec-query.js +4 -4
- package/queries/base-query-format.js +2 -8
- package/queries/catalog/absint-query/absint-query-format.d.ts +4 -3
- package/queries/catalog/absint-query/absint-query-format.js +50 -10
- package/queries/catalog/ambient-access-query/ambient-access-query-format.d.ts +5 -3
- package/queries/catalog/ambient-access-query/ambient-access-query-format.js +46 -3
- package/queries/catalog/call-context-query/call-context-query-executor.js +7 -45
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +6 -21
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +5 -11
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +4 -10
- package/queries/catalog/call-context-query/identify-link-to-relation.d.ts +1 -4
- package/queries/catalog/call-context-query/identify-link-to-relation.js +1 -4
- package/queries/catalog/call-graph-query/call-graph-query-executor.d.ts +1 -3
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +2 -7
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -3
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +5 -6
- package/queries/catalog/cluster-query/cluster-query-format.js +12 -3
- package/queries/catalog/code-clones-query/code-clones-query-format.d.ts +4 -3
- package/queries/catalog/code-clones-query/code-clones-query-format.js +25 -6
- package/queries/catalog/config-query/config-query-format.d.ts +3 -2
- package/queries/catalog/config-query/config-query-format.js +39 -2
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +5 -9
- package/queries/catalog/control-flow-query/control-flow-query-format.js +13 -4
- package/queries/catalog/data-columns-query/data-columns-query-format.d.ts +70 -0
- package/queries/catalog/data-columns-query/data-columns-query-format.js +210 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +4 -5
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +30 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +4 -5
- package/queries/catalog/dataflow-query/dataflow-query-format.js +10 -2
- package/queries/catalog/dependencies-query/data-flow.js +5 -4
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -3
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +13 -15
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -4
- package/queries/catalog/dependencies-query/dependencies-query-format.js +13 -32
- package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +0 -1
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +6 -5
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +24 -17
- package/queries/catalog/dependencies-query/function-info/tagged-functions.d.ts +11 -0
- package/queries/catalog/dependencies-query/function-info/tagged-functions.js +15 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +2 -8
- package/queries/catalog/dependencies-query/function-info/transform-functions.js +1 -4
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +1 -3
- package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -3
- package/queries/catalog/dependencies-query/plot-description.js +2 -2
- package/queries/catalog/dice-query/dice-query-format.d.ts +7 -2
- package/queries/catalog/dice-query/dice-query-format.js +32 -6
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +5 -4
- package/queries/catalog/does-call-query/does-call-query-format.js +115 -30
- package/queries/catalog/files-query/files-query-format.d.ts +5 -6
- package/queries/catalog/files-query/files-query-format.js +36 -31
- package/queries/catalog/function-info-query/function-info-query-executor.js +1 -7
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +4 -3
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +301 -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 +34 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +3 -2
- package/queries/catalog/id-map-query/id-map-query-format.js +10 -2
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +1 -1
- package/queries/catalog/input-sources-query/input-sources-query-executor.d.ts +1 -3
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +2 -7
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +1 -4
- package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -2
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +5 -11
- package/queries/catalog/input-sources-query/simple-input-classifier.js +2 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +4 -6
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +33 -9
- 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 +123 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +5 -4
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +58 -9
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +5 -6
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +21 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +5 -6
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +13 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +10 -6
- package/queries/catalog/linter-query/linter-query-format.js +68 -25
- 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 +62 -10
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +4 -5
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +10 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +4 -3
- package/queries/catalog/origin-query/origin-query-format.js +25 -9
- package/queries/catalog/project-query/project-query-format.d.ts +6 -5
- package/queries/catalog/project-query/project-query-format.js +93 -2
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +7 -10
- package/queries/catalog/provenance-query/provenance-query-format.js +26 -5
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +6 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +30 -11
- package/queries/catalog/search-query/search-query-format.d.ts +3 -2
- package/queries/catalog/search-query/search-query-format.js +15 -2
- package/queries/catalog/signature-query/signature-query-executor.d.ts +1 -1
- package/queries/catalog/signature-query/signature-query-executor.js +18 -41
- package/queries/catalog/signature-query/signature-query-format.d.ts +3 -0
- package/queries/catalog/signature-query/signature-query-render.d.ts +1 -1
- package/queries/catalog/signature-query/signature-query-render.js +29 -4
- package/queries/catalog/slice-query-options.d.ts +1 -1
- 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 +52 -2
- package/queries/catalog/taint-query/taint-query-format.d.ts +5 -4
- package/queries/catalog/taint-query/taint-query-format.js +18 -33
- package/queries/query-function-filter.js +7 -33
- package/queries/query-function-property.d.ts +1 -1
- package/queries/query-function-property.js +4 -7
- package/queries/query-meta.d.ts +2 -0
- package/queries/query-meta.js +8 -0
- package/queries/query-print.d.ts +6 -10
- package/queries/query-print.js +20 -75
- package/queries/query.d.ts +67 -58
- package/queries/query.js +51 -73
- package/queries/virtual-query/compound-query.d.ts +2 -7
- package/queries/virtual-query/compound-query.js +2 -8
- package/queries/virtual-query/virtual-queries.js +1 -3
- package/r-bridge/data/get.d.ts +1 -3
- package/r-bridge/data/get.js +1 -3
- package/r-bridge/lang-4.x/ast/model/model.d.ts +19 -59
- package/r-bridge/lang-4.x/ast/model/model.js +9 -27
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +5 -14
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +2 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +9 -25
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +6 -18
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +4 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -11
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +2 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +4 -11
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +2 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -7
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +5 -15
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +3 -10
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +3 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +2 -7
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +2 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +4 -14
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +42 -126
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +4 -6
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +5 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +18 -0
- package/r-bridge/lang-4.x/ast/model/processing/role.js +25 -0
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -3
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +1 -3
- package/r-bridge/lang-4.x/ast/model/syntax-version.js +2 -2
- package/r-bridge/lang-4.x/ast/model/type.d.ts +1 -5
- package/r-bridge/lang-4.x/ast/model/type.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +5 -17
- package/r-bridge/lang-4.x/ast/parser/json/format.js +4 -20
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +1 -3
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.d.ts +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.js +2 -7
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.d.ts +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +2 -12
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-break.js +1 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +2 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -6
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -7
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.d.ts +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +3 -23
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +1 -9
- package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-comment.js +1 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-line-directive.js +7 -30
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-delimiter.d.ts +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-delimiter.js +2 -9
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +3 -9
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +6 -21
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.js +0 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +4 -20
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +7 -19
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +8 -26
- package/r-bridge/lang-4.x/ast/parser/main/normalizer-data.d.ts +4 -12
- package/r-bridge/lang-4.x/ast/parser/main/normalizer-data.js +1 -3
- package/r-bridge/lang-4.x/convert-values.d.ts +6 -20
- package/r-bridge/lang-4.x/convert-values.js +10 -41
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -5
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +0 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +39 -208
- package/r-bridge/parser.d.ts +1 -3
- package/r-bridge/parser.js +1 -4
- package/r-bridge/retriever.d.ts +5 -16
- package/r-bridge/retriever.js +5 -17
- package/r-bridge/roxygen2/documentation-provider.d.ts +1 -1
- package/r-bridge/roxygen2/roxygen-ast.d.ts +5 -15
- package/r-bridge/roxygen2/roxygen-ast.js +2 -6
- package/r-bridge/roxygen2/roxygen-parse.d.ts +2 -1
- package/r-bridge/roxygen2/roxygen-parse.js +4 -13
- package/r-bridge/shell-executor.d.ts +3 -9
- package/r-bridge/shell-executor.js +4 -13
- package/r-bridge/shell.d.ts +7 -24
- package/r-bridge/shell.js +15 -31
- package/reconstruct/auto-select/auto-select-defaults.d.ts +1 -3
- package/reconstruct/auto-select/auto-select-defaults.js +1 -3
- package/reconstruct/reconstruct.js +23 -18
- package/search/flowr-search-builder.d.ts +16 -48
- package/search/flowr-search-builder.js +15 -46
- package/search/flowr-search-executor.d.ts +1 -3
- package/search/flowr-search-executor.js +1 -3
- package/search/flowr-search-filters.d.ts +5 -9
- package/search/flowr-search-filters.js +4 -13
- package/search/flowr-search-printer.d.ts +3 -9
- package/search/flowr-search-printer.js +3 -9
- package/search/flowr-search-traverse.d.ts +1 -3
- package/search/flowr-search-traverse.js +1 -3
- package/search/flowr-search.d.ts +6 -19
- package/search/search-executor/search-enrichers.d.ts +5 -15
- package/search/search-executor/search-enrichers.js +6 -25
- package/search/search-executor/search-generators.d.ts +3 -9
- package/search/search-executor/search-generators.js +4 -10
- package/search/search-executor/search-mappers.d.ts +1 -3
- package/search/search-executor/search-mappers.js +1 -3
- package/search/search-executor/search-transformer.d.ts +3 -9
- package/search/search-executor/search-transformer.js +2 -6
- package/search/search-optimizer/search-optimizer.d.ts +1 -4
- package/search/search-optimizer/search-optimizer.js +4 -26
- package/slicing/criterion/collect-all.d.ts +1 -3
- package/slicing/criterion/filters/all-variables.js +2 -9
- package/slicing/criterion/parse.d.ts +2 -6
- package/slicing/criterion/parse.js +3 -9
- package/slicing/static/fingerprint.d.ts +1 -1
- package/slicing/static/removal-slice.js +6 -5
- package/slicing/static/slice-call.d.ts +13 -4
- package/slicing/static/slice-call.js +45 -6
- package/slicing/static/slicer-types.d.ts +3 -9
- package/slicing/static/static-slicer.d.ts +3 -4
- package/slicing/static/static-slicer.js +144 -32
- package/slicing/static/visiting-queue.d.ts +2 -1
- package/slicing/static/visiting-queue.js +4 -1
- package/taint-analysis/builder/domain.d.ts +1 -2
- package/taint-analysis/builder/domain.js +1 -6
- package/taint-analysis/builder/report-template.d.ts +4 -11
- package/taint-analysis/builder/report-template.js +2 -7
- package/taint-analysis/builder/taint-analysis-definition.d.ts +2 -3
- package/taint-analysis/builder/taint-analysis-definition.js +1 -5
- package/taint-analysis/builder/taint-analysis.d.ts +9 -25
- package/taint-analysis/builder/taint-analysis.js +1 -3
- package/taint-analysis/builtin-index-bridge.js +1 -7
- package/taint-analysis/function-categories.d.ts +4 -7
- package/taint-analysis/function-categories.js +4 -15
- package/taint-analysis/predefined/normalization.js +5 -10
- package/taint-analysis/predefined/predefined.d.ts +0 -1
- package/taint-analysis/predefined/predefined.js +1 -2
- package/taint-analysis/predefined/randomness-analysis.js +4 -16
- package/taint-analysis/predefined/secret-analysis.js +2 -8
- package/taint-analysis/predefined/security-analysis.js +9 -43
- package/taint-analysis/taint-mapping.d.ts +4 -13
- package/taint-analysis/taint-mapping.js +3 -9
- package/taint-analysis/taint-resolve.d.ts +2 -3
- package/taint-analysis/taint-visitor.d.ts +1 -3
- package/taint-analysis/taint-visitor.js +2 -2
- package/util/arg-matching.js +4 -4
- package/util/assert.d.ts +1 -3
- package/util/assert.js +2 -5
- package/util/collections/arrays.d.ts +9 -30
- package/util/collections/arrays.js +5 -18
- package/util/collections/defaultmap.d.ts +2 -7
- package/util/collections/defaultmap.js +2 -7
- package/util/collections/objectmap.d.ts +2 -6
- package/util/collections/objectmap.js +2 -6
- package/util/collections/set.d.ts +2 -6
- package/util/collections/set.js +2 -6
- package/util/diff-graph.d.ts +1 -3
- package/util/diff-graph.js +2 -8
- package/util/diff.d.ts +2 -6
- package/util/diff.js +1 -3
- package/util/files.d.ts +3 -9
- package/util/files.js +3 -9
- package/util/flowr-version.d.ts +2 -4
- package/util/flowr-version.js +3 -5
- package/util/html-hover-over.d.ts +1 -5
- package/util/html-hover-over.js +1 -5
- package/util/json.d.ts +1 -3
- package/util/json.js +1 -3
- package/util/log.d.ts +2 -1
- package/util/log.js +7 -14
- package/util/mermaid/ast.d.ts +3 -7
- package/util/mermaid/ast.js +2 -6
- package/util/mermaid/cfg.d.ts +2 -4
- package/util/mermaid/cfg.js +4 -8
- package/util/mermaid/dfg.d.ts +5 -15
- package/util/mermaid/dfg.js +20 -16
- package/util/mermaid/mermaid.d.ts +4 -13
- package/util/mermaid/mermaid.js +5 -19
- package/util/numbers.d.ts +1 -3
- package/util/numbers.js +1 -3
- package/util/objects.d.ts +6 -10
- package/util/objects.js +12 -6
- package/util/os.d.ts +1 -3
- package/util/os.js +1 -3
- package/util/parallel.d.ts +1 -4
- package/util/parallel.js +1 -4
- package/util/proc.js +2 -2
- package/util/quads.d.ts +6 -19
- package/util/quads.js +2 -7
- package/util/r-author.d.ts +1 -3
- package/util/r-author.js +2 -10
- package/util/r-datasets.d.ts +27 -0
- package/util/r-datasets.js +45 -0
- package/util/r-license.d.ts +2 -6
- package/util/r-license.js +10 -43
- package/util/r-regex.d.ts +1 -3
- package/util/r-regex.js +1 -3
- package/util/r-value.d.ts +3 -9
- package/util/r-value.js +7 -21
- package/util/random.d.ts +1 -3
- package/util/random.js +1 -3
- package/util/range.d.ts +22 -66
- package/util/range.js +22 -66
- package/util/schema.d.ts +4 -13
- package/util/schema.js +4 -13
- package/util/simple-df/dfg-ascii.d.ts +1 -3
- package/util/simple-df/dfg-ascii.js +5 -27
- package/util/simple-df/dfg-view.d.ts +1 -3
- package/util/simple-df/dfg-view.js +1 -3
- package/util/slice-direction.d.ts +1 -3
- package/util/slice-direction.js +1 -3
- package/util/summarizer.d.ts +3 -8
- package/util/summarizer.js +1 -3
- package/util/text/ansi.d.ts +5 -15
- package/util/text/ansi.js +5 -15
- package/util/text/args.d.ts +8 -2
- package/util/text/args.js +41 -9
- package/util/text/playground-link.d.ts +11 -0
- package/util/text/playground-link.js +17 -11
- package/util/text/r-highlight.js +6 -6
- package/util/text/strings.d.ts +6 -19
- package/util/text/strings.js +7 -24
- package/util/text/time.d.ts +1 -3
- package/util/text/time.js +1 -3
- package/util/version.d.ts +3 -9
- package/util/version.js +4 -8
- 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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PrintingOptions = void 0;
|
|
3
|
+
exports.PrintWrites = exports.PrintingOptions = void 0;
|
|
4
4
|
exports.hidesBody = hidesBody;
|
|
5
5
|
exports.reachesBuiltInLate = reachesBuiltInLate;
|
|
6
6
|
exports.readsAllAmbientState = readsAllAmbientState;
|
|
@@ -9,10 +9,15 @@ exports.ambientWritesOfRelease = ambientWritesOfRelease;
|
|
|
9
9
|
exports.makeAmbientWritesMaybe = makeAmbientWritesMaybe;
|
|
10
10
|
exports.ambientWritesBetween = ambientWritesBetween;
|
|
11
11
|
exports.markForcing = markForcing;
|
|
12
|
+
exports.markLocking = markLocking;
|
|
13
|
+
exports.mayLock = mayLock;
|
|
12
14
|
exports.mayForce = mayForce;
|
|
13
15
|
exports.ambientAccessOfSymbol = ambientAccessOfSymbol;
|
|
16
|
+
exports.holds = holds;
|
|
17
|
+
exports.decide = decide;
|
|
18
|
+
exports.applies = applies;
|
|
14
19
|
exports.drawingWritesDevice = drawingWritesDevice;
|
|
15
|
-
exports.
|
|
20
|
+
exports.applyAmbientEffects = applyAmbientEffects;
|
|
16
21
|
exports.applyAmbientStateOfCallee = applyAmbientStateOfCallee;
|
|
17
22
|
exports.hiddenSideEffects = hiddenSideEffects;
|
|
18
23
|
exports.writesOfHiddenBuiltIn = writesOfHiddenBuiltIn;
|
|
@@ -23,11 +28,13 @@ exports.processAmbientScope = processAmbientScope;
|
|
|
23
28
|
exports.evaluatesCapturedCode = evaluatesCapturedCode;
|
|
24
29
|
exports.autoPrintReads = autoPrintReads;
|
|
25
30
|
exports.readsOfAutoPrint = readsOfAutoPrint;
|
|
31
|
+
exports.autoPrintsStatementsOf = autoPrintsStatementsOf;
|
|
26
32
|
exports.autoPrints = autoPrints;
|
|
27
33
|
exports.applyAmbientStateOfCalledBuiltIns = applyAmbientStateOfCalledBuiltIns;
|
|
28
34
|
exports.errorsOfWarnings = errorsOfWarnings;
|
|
29
35
|
exports.signalSites = signalSites;
|
|
30
36
|
exports.maySignal = maySignal;
|
|
37
|
+
exports.testsValue = testsValue;
|
|
31
38
|
const info_1 = require("../../../../../info");
|
|
32
39
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
33
40
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
@@ -36,6 +43,8 @@ const built_in_props_1 = require("../../../../../environments/built-in-props");
|
|
|
36
43
|
const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
37
44
|
const r_expression_list_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
|
|
38
45
|
const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
46
|
+
const r_logical_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-logical");
|
|
47
|
+
const query_fn_props_1 = require("../../../../../environments/query-fn-props");
|
|
39
48
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
40
49
|
const environment_1 = require("../../../../../environments/environment");
|
|
41
50
|
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
@@ -46,6 +55,7 @@ const r_function_definition_1 = require("../../../../../../r-bridge/lang-4.x/ast
|
|
|
46
55
|
const r_value_1 = require("../../../../../eval/values/r-value");
|
|
47
56
|
const match_args_1 = require("../../../../../graph/match-args");
|
|
48
57
|
const known_call_handling_1 = require("../known-call-handling");
|
|
58
|
+
const built_in_expression_list_1 = require("./built-in-expression-list");
|
|
49
59
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
50
60
|
const node_value_1 = require("../../../../../eval/resolve/node-value");
|
|
51
61
|
const applied_arguments_1 = require("../../../../../graph/applied-arguments");
|
|
@@ -62,16 +72,22 @@ const arrays_1 = require("../../../../../../util/collections/arrays");
|
|
|
62
72
|
const ambient_access_1 = require("../../../../../graph/ambient-access");
|
|
63
73
|
const ambient_state_name_1 = require("../../../../../environments/ambient-state-name");
|
|
64
74
|
const built_in_ambient_keys_1 = require("./built-in-ambient-keys");
|
|
75
|
+
const logic_1 = require("../../../../../../util/logic");
|
|
65
76
|
const base_operators_1 = require("../../../../../environments/default-builtin-config/base-operators");
|
|
66
77
|
const r_while_loop_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-while-loop");
|
|
67
78
|
const r_for_loop_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-for-loop");
|
|
68
79
|
const built_in_kinds_1 = require("../../../../../environments/built-in-kinds");
|
|
80
|
+
const ambient_effect_1 = require("../../../../../environments/ambient-effect");
|
|
69
81
|
var built_in_kinds_2 = require("../../../../../environments/built-in-kinds");
|
|
70
82
|
Object.defineProperty(exports, "PrintingOptions", { enumerable: true, get: function () { return built_in_kinds_2.PrintingOptions; } });
|
|
71
83
|
const ListConstructors = new Set(['list', 'c']);
|
|
72
|
-
|
|
84
|
+
/** the states of the active instance of a family */
|
|
85
|
+
function activeStates(family) {
|
|
86
|
+
return family.states.map(([active]) => active);
|
|
87
|
+
}
|
|
88
|
+
const DeviceStates = ambient_state_name_1.GraphicsDevices.states.flat();
|
|
73
89
|
const Accumulating = new Set([
|
|
74
|
-
...DeviceStates, ambient_state_name_1.AmbientStateName.canvas, ambient_state_name_1.AmbientStateName.palette, ambient_state_name_1.AmbientStateName.allOptions, ambient_state_name_1.AmbientStateName.unknownOption,
|
|
90
|
+
...DeviceStates, ...ambient_state_name_1.OutputSinks.states.flat(), ...ambient_state_name_1.MessageSinks.states.flat(), ambient_state_name_1.AmbientStateName.canvas, ambient_state_name_1.AmbientStateName.palette, ambient_state_name_1.AmbientStateName.allOptions, ambient_state_name_1.AmbientStateName.unknownOption,
|
|
75
91
|
ambient_state_name_1.AmbientStateName.warnsAsErrors, ambient_state_name_1.AmbientStateName.files, ambient_state_name_1.AmbientStateName.rngKind, ambient_state_name_1.AmbientStateName.finalizers, ...ambient_state_name_1.KeyedAccumulators
|
|
76
92
|
]);
|
|
77
93
|
/** What a call does to the graphics devices. */
|
|
@@ -80,7 +96,9 @@ var DeviceAccess;
|
|
|
80
96
|
DeviceAccess["Open"] = "open";
|
|
81
97
|
DeviceAccess["Close"] = "close";
|
|
82
98
|
DeviceAccess["CloseAll"] = "close-all";
|
|
83
|
-
/** closes one that is not known to be the active one,
|
|
99
|
+
/** closes one that is not known to be the active one, which writes what any of them holds */
|
|
100
|
+
DeviceAccess["CloseSome"] = "close-some";
|
|
101
|
+
/** makes another one active */
|
|
84
102
|
DeviceAccess["Switch"] = "switch";
|
|
85
103
|
})(DeviceAccess || (DeviceAccess = {}));
|
|
86
104
|
/** How a write differs from the default, see {@link AmbientWrite}. */
|
|
@@ -101,21 +119,33 @@ function maybe(name) {
|
|
|
101
119
|
function optionReads(keys) {
|
|
102
120
|
return keys === undefined ? [ambient_state_name_1.AmbientStateName.allOptions] : [...keys.map(ambient_state_name_1.AmbientStateName.option), ambient_state_name_1.AmbientStateName.unknownOption];
|
|
103
121
|
}
|
|
104
|
-
/**
|
|
105
|
-
|
|
106
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Links a call handing back the entry `key` of a keyed state (`getOption("digits")`, `Sys.getenv("A")`, `par("mfrow")`) to the values the calls that may have set it last gave it,
|
|
124
|
+
* so value resolution sees them like the result of a call. It links only if these calls cover every path and named the entry, as anything else (`options(op)`, `layout(m)`, a new device) may set it to a value we do not know.
|
|
125
|
+
*/
|
|
126
|
+
function linkEntryValue(res, rootId, state, keys, data) {
|
|
127
|
+
const [key] = keys;
|
|
128
|
+
if (keys.length !== 1 || key === ambient_state_name_1.UnknownKey || resolve_helper_1.Resolve.byName(ambient_state_name_1.AmbientStateName.keyed(state, ambient_state_name_1.UnknownKey), data.environment)?.some(d => !node_id_1.NodeId.isBuiltIn(d.nodeId))) {
|
|
107
129
|
return;
|
|
108
130
|
}
|
|
109
|
-
const defs = resolve_helper_1.Resolve.byName(ambient_state_name_1.AmbientStateName.
|
|
110
|
-
|
|
131
|
+
const defs = resolve_helper_1.Resolve.byName(ambient_state_name_1.AmbientStateName.keyed(state, key), data.environment) ?? [];
|
|
132
|
+
const whole = new Set((resolve_helper_1.Resolve.byName(ambient_state_name_1.AmbientStateName.allOf(state), data.environment) ?? []).map(d => d.nodeId));
|
|
133
|
+
const own = new Set(defs.map(d => d.nodeId));
|
|
134
|
+
/* a write of the whole state that names no entry, like `layout(m)`, may change this one as well */
|
|
135
|
+
const namesEntries = (id) => {
|
|
136
|
+
const setter = data.completeAst.idMap.get(id);
|
|
137
|
+
return node_id_1.NodeId.isBuiltIn(id) || (r_function_call_1.RFunctionCall.is(setter) && setter.arguments.every(a => a === r_function_call_1.EmptyArgument || a.name !== undefined));
|
|
138
|
+
};
|
|
139
|
+
if (defs.length === 0 || [...whole].some(id => !own.has(id) && !namesEntries(id)) || !(defs.some(d => (0, info_1.happensInEveryBranch)(d.cds)) || (0, info_1.happensInEveryBranch)(defs.flatMap(d => d.cds ?? [])))) {
|
|
111
140
|
return;
|
|
112
141
|
}
|
|
113
142
|
const values = [];
|
|
114
143
|
for (const { nodeId } of defs) {
|
|
115
144
|
const setter = data.completeAst.idMap.get(nodeId);
|
|
116
|
-
const named = r_function_call_1.RFunctionCall.is(setter) ? setter.arguments.filter(a => a !== r_function_call_1.EmptyArgument && a.name !== undefined && identifier_1.Identifier.getName(a.name.content) ===
|
|
145
|
+
const named = r_function_call_1.RFunctionCall.is(setter) && whole.has(nodeId) ? setter.arguments.filter(a => a !== r_function_call_1.EmptyArgument && a.name !== undefined && identifier_1.Identifier.getName(a.name.content) === key) : [];
|
|
117
146
|
const value = named.length === 1 ? r_argument_1.RArgument.valueOf(named[0]) : undefined;
|
|
118
|
-
|
|
147
|
+
/* setting an option to NULL removes it, so reading it hands back the default instead */
|
|
148
|
+
if (value === undefined || (r_symbol_1.RSymbol.is(value) && identifier_1.Identifier.getName(value.content) === 'NULL')) {
|
|
119
149
|
return;
|
|
120
150
|
}
|
|
121
151
|
values.push(value.info.id);
|
|
@@ -135,22 +165,19 @@ function reachesBuiltInLate(call) {
|
|
|
135
165
|
}
|
|
136
166
|
/** A call into code flowR cannot see may read any option, draw random numbers (with `draws` advancing the generator), and with `graphics` draw on the device. */
|
|
137
167
|
function readsAllAmbientState(res, rootId, data, graphics, draws = true) {
|
|
138
|
-
const reads = [ambient_state_name_1.AmbientStateName.allOptions, ambient_state_name_1.AmbientStateName.rng, ambient_state_name_1.AmbientStateName.allOf(ambient_state_name_1.KeyedState.Env)];
|
|
139
|
-
if (graphics) {
|
|
140
|
-
reads.push(ambient_state_name_1.AmbientStateName.graphics, ambient_state_name_1.AmbientStateName.palette);
|
|
141
|
-
}
|
|
168
|
+
const reads = [ambient_state_name_1.AmbientStateName.allOptions, ambient_state_name_1.AmbientStateName.rng, ambient_state_name_1.AmbientStateName.allOf(ambient_state_name_1.KeyedState.Env), ...graphics ? [ambient_state_name_1.AmbientStateName.graphics, ambient_state_name_1.AmbientStateName.palette] : []];
|
|
142
169
|
return withAccess(res, rootId, data, reads, draws ? [{ ...maybe(ambient_state_name_1.AmbientStateName.rng), assumed: true }] : []);
|
|
143
170
|
}
|
|
144
171
|
/** Adds the reads and writes of the ambient state to what a call does, see {@link AmbientStateName}. */
|
|
145
|
-
function withAccess(res, rootId, data, reads, writes = []) {
|
|
146
|
-
if (reads.length === 0 && writes.length === 0) {
|
|
172
|
+
function withAccess(res, rootId, data, reads, writes = [], kills = []) {
|
|
173
|
+
if (reads.length === 0 && writes.length === 0 && kills.length === 0) {
|
|
147
174
|
return res;
|
|
148
175
|
}
|
|
149
176
|
const cds = data.cds ? [...data.cds] : undefined;
|
|
150
177
|
const maybeWritten = writes.flatMap(w => typeof w === 'object' && w.mode === AmbientWriteMode.Maybe ? [w.name] : []);
|
|
151
178
|
const read = (0, arrays_1.uniqueArrayMerge)(reads, maybeWritten);
|
|
152
179
|
const readRefs = read.map(name => ({ nodeId: rootId, name, type: identifier_1.ReferenceType.Variable, cds }));
|
|
153
|
-
recordAmbient(res.graph, rootId, res.environment, read, writes);
|
|
180
|
+
recordAmbient(res.graph, rootId, res.environment, read, writes, kills);
|
|
154
181
|
/* the writes stay out of `out`: an assignment reads whatever else its source writes (`x <- y <- 3`) */
|
|
155
182
|
return {
|
|
156
183
|
...res,
|
|
@@ -162,9 +189,9 @@ function withAccess(res, rootId, data, reads, writes = []) {
|
|
|
162
189
|
function writesLocally(environment, name, mode) {
|
|
163
190
|
return mode === AmbientWriteMode.Local || (environment.level > 0 && environment.current.memory.has(name));
|
|
164
191
|
}
|
|
165
|
-
/** Notes in `graph` what the call `rootId` reads and
|
|
166
|
-
function recordAmbient(graph, rootId, environment, reads, writes) {
|
|
167
|
-
if (reads.length === 0 && writes.length === 0) {
|
|
192
|
+
/** Notes in `graph` what the call `rootId` reads, writes, and ends (`kills`), see {@link DataflowGraph#recordAmbientAccess}; `environment` is the one the writes apply to. */
|
|
193
|
+
function recordAmbient(graph, rootId, environment, reads, writes, kills = []) {
|
|
194
|
+
if (reads.length === 0 && writes.length === 0 && kills.length === 0) {
|
|
168
195
|
return;
|
|
169
196
|
}
|
|
170
197
|
const global = [];
|
|
@@ -174,7 +201,7 @@ function recordAmbient(graph, rootId, environment, reads, writes) {
|
|
|
174
201
|
const { name, mode, assumed: isAssumed } = typeof write === 'string' ? { name: write, mode: undefined, assumed: undefined } : write;
|
|
175
202
|
(writesLocally(environment, name, mode) ? local : isAssumed ? assumed : global).push(name);
|
|
176
203
|
}
|
|
177
|
-
graph.recordAmbientAccess(rootId, { reads, writes: global, assumed, local });
|
|
204
|
+
graph.recordAmbientAccess(rootId, { reads, writes: global, assumed, local, kills });
|
|
178
205
|
}
|
|
179
206
|
/** Whether the code itself binds a variable of the same name, by quoting it in backticks, which a write of the state must not replace, as they only share the name. */
|
|
180
207
|
function boundByCode(environment, name) {
|
|
@@ -246,16 +273,20 @@ function makeAmbientWritesMaybe(after, before, target, cds) {
|
|
|
246
273
|
}
|
|
247
274
|
/** The states written in `after` that `before` does not hold, as by a promise (`delayedAssign`) whose writes only happen once a read forces it. */
|
|
248
275
|
function ambientWritesBetween(after, before) {
|
|
249
|
-
|
|
250
|
-
for (const [name] of ambientDefinitionsBetween(after, before, false)) {
|
|
251
|
-
names.add(name);
|
|
252
|
-
}
|
|
253
|
-
return [...names];
|
|
276
|
+
return (0, arrays_1.uniqueArray)(ambientDefinitionsBetween(after, before, false).map(([name]) => name));
|
|
254
277
|
}
|
|
255
278
|
/** Notes that a definition binds a promise or a text connection, which reads have to look for from now on. */
|
|
256
279
|
function markForcing(environment) {
|
|
257
280
|
environment_1.REnvironment.findBuiltIn(environment.current).forcing = true;
|
|
258
281
|
}
|
|
282
|
+
/** Notes that a call may lock a binding or an environment (`lockBinding`), after which binding a name may fail. */
|
|
283
|
+
function markLocking(environment) {
|
|
284
|
+
environment_1.REnvironment.findBuiltIn(environment.current).locking = true;
|
|
285
|
+
}
|
|
286
|
+
/** Whether a call seen so far may lock a binding, see {@link markLocking}. */
|
|
287
|
+
function mayLock(environment) {
|
|
288
|
+
return environment_1.REnvironment.findBuiltIn(environment.current).locking === true;
|
|
289
|
+
}
|
|
259
290
|
/** Whether a definition seen so far binds a promise or a text connection, see {@link markForcing}. */
|
|
260
291
|
function mayForce(environment) {
|
|
261
292
|
return environment_1.REnvironment.findBuiltIn(environment.current).forcing === true;
|
|
@@ -264,8 +295,17 @@ function mayForce(environment) {
|
|
|
264
295
|
function ambientAccessOfSymbol(res, symbol, data) {
|
|
265
296
|
const forcing = mayForce(data.environment);
|
|
266
297
|
const definitions = forcing ? resolve_helper_1.Resolve.byName(symbol.content, data.environment) ?? [] : [];
|
|
267
|
-
const
|
|
268
|
-
|
|
298
|
+
const promises = definitions.filter(identifier_1.isInGraphDefinition);
|
|
299
|
+
const reads = (0, arrays_1.uniqueArrayMerge)(ambientReadsOfSymbol(symbol, data, forcing), promises.flatMap(d => d.forcedReads ?? []));
|
|
300
|
+
const accessed = withAccess(res, symbol.info.id, data, reads, promises.flatMap(d => d.forces ?? []).map(maybe));
|
|
301
|
+
/* a read may be the one forcing the promise, so what its code binds may be bound from here on (the first read forces it, so only maybe) */
|
|
302
|
+
let environment = accessed.environment;
|
|
303
|
+
for (const write of promises.flatMap(d => d.forcedWrites ?? [])) {
|
|
304
|
+
environment = environment_1.REnvironment.define(write, false, environment, true);
|
|
305
|
+
}
|
|
306
|
+
/* a read reached either forces the promise or comes after a forcing that left already, so it leaves as the promise does */
|
|
307
|
+
const exits = promises.flatMap(d => d.forcedExits ?? []).map(e => ({ ...e, nodeId: symbol.info.id, cds: e.cds ?? data.cds }));
|
|
308
|
+
return environment === accessed.environment && exits.length === 0 ? accessed : { ...accessed, environment, exitPoints: [...accessed.exitPoints, ...exits] };
|
|
269
309
|
}
|
|
270
310
|
/** Binds `name` (globally) to the given definitions, in addition to what it holds with `keep`, so `#graphics` can become what another state holds. */
|
|
271
311
|
function setAmbient(environment, name, definitions, keep = false) {
|
|
@@ -287,10 +327,7 @@ function ambientReadsOfSymbol(symbol, data, forcing) {
|
|
|
287
327
|
else if (name === ambient_state_name_1.AmbientStateName.rngVariable) {
|
|
288
328
|
return [ambient_state_name_1.AmbientStateName.rng, ambient_state_name_1.AmbientStateName.rngKind];
|
|
289
329
|
}
|
|
290
|
-
|
|
291
|
-
return [];
|
|
292
|
-
}
|
|
293
|
-
return optionsVariableReads(symbol, data);
|
|
330
|
+
return name === '.Options' ? optionsVariableReads(symbol, data) : [];
|
|
294
331
|
}
|
|
295
332
|
/** `.Options$digits` (or `.Options[["digits"]]`) reads that option, anything else done with `.Options` reads all of them. */
|
|
296
333
|
function optionsVariableReads(symbol, data) {
|
|
@@ -299,13 +336,7 @@ function optionsVariableReads(symbol, data) {
|
|
|
299
336
|
return optionReads(undefined);
|
|
300
337
|
}
|
|
301
338
|
const value = r_argument_1.RArgument.valueOf(parent.access[0]);
|
|
302
|
-
|
|
303
|
-
return optionReads([value.content.str]);
|
|
304
|
-
}
|
|
305
|
-
else if (parent.operator === '$' && r_symbol_1.RSymbol.is(value)) {
|
|
306
|
-
return optionReads([identifier_1.Identifier.getName(value.content)]);
|
|
307
|
-
}
|
|
308
|
-
return optionReads(undefined);
|
|
339
|
+
return optionReads(r_string_1.RString.is(value) ? [value.content.str] : parent.operator === '$' && r_symbol_1.RSymbol.is(value) ? [identifier_1.Identifier.getName(value.content)] : undefined);
|
|
309
340
|
}
|
|
310
341
|
/** Options affecting calls we cannot name (`scipen` changes every number-to-string conversion), so setting one stays an unknown side effect. */
|
|
311
342
|
const GlobalEffectOptions = new Set([
|
|
@@ -320,147 +351,289 @@ const GlobalEffectEnv = /^(TZ|LANG|LANGUAGE|LC_\w+|R_\w+|TMPDIR|TEMP|TMP|HOME|PA
|
|
|
320
351
|
function keyedReads(state, keys) {
|
|
321
352
|
return keys.length === 0 || keys.includes(ambient_state_name_1.UnknownKey) ? [ambient_state_name_1.AmbientStateName.allOf(state)] : [...keys.map(k => ambient_state_name_1.AmbientStateName.keyed(state, k)), ambient_state_name_1.AmbientStateName.keyed(state, ambient_state_name_1.UnknownKey)];
|
|
322
353
|
}
|
|
354
|
+
const Families = {
|
|
355
|
+
[ambient_effect_1.AmbientPart.Device]: { state: ambient_state_name_1.AmbientStateName.device, instances: ambient_state_name_1.GraphicsDevices },
|
|
356
|
+
[ambient_effect_1.AmbientPart.Sink]: { state: ambient_state_name_1.AmbientStateName.sink, instances: ambient_state_name_1.OutputSinks },
|
|
357
|
+
[ambient_effect_1.AmbientPart.MessageSink]: { state: ambient_state_name_1.MessageSinks.switched, instances: ambient_state_name_1.MessageSinks },
|
|
358
|
+
[ambient_effect_1.AmbientPart.Plot]: { state: ambient_state_name_1.AmbientStateName.plot, of: ambient_state_name_1.GraphicsDevices },
|
|
359
|
+
[ambient_state_name_1.KeyedState.Par]: { state: ambient_state_name_1.AmbientStateName.graphics, keyed: ambient_state_name_1.KeyedState.Par, of: ambient_state_name_1.GraphicsDevices },
|
|
360
|
+
[ambient_effect_1.AmbientPart.Palette]: { state: ambient_state_name_1.AmbientStateName.palette },
|
|
361
|
+
[ambient_effect_1.AmbientPart.LastPlot]: { state: ambient_state_name_1.AmbientStateName.lastPlot },
|
|
362
|
+
[ambient_state_name_1.KeyedState.Option]: { state: ambient_state_name_1.AmbientStateName.allOptions, keyed: ambient_state_name_1.KeyedState.Option },
|
|
363
|
+
[ambient_state_name_1.KeyedState.Env]: { state: ambient_state_name_1.AmbientStateName.allOf(ambient_state_name_1.KeyedState.Env), keyed: ambient_state_name_1.KeyedState.Env },
|
|
364
|
+
[ambient_state_name_1.KeyedState.Locale]: { state: ambient_state_name_1.AmbientStateName.allOf(ambient_state_name_1.KeyedState.Locale), keyed: ambient_state_name_1.KeyedState.Locale },
|
|
365
|
+
[ambient_state_name_1.KeyedState.SearchPath]: { state: ambient_state_name_1.AmbientStateName.allOf(ambient_state_name_1.KeyedState.SearchPath), keyed: ambient_state_name_1.KeyedState.SearchPath },
|
|
366
|
+
[ambient_state_name_1.KeyedState.InstalledPackages]: { state: ambient_state_name_1.AmbientStateName.allOf(ambient_state_name_1.KeyedState.InstalledPackages), keyed: ambient_state_name_1.KeyedState.InstalledPackages },
|
|
367
|
+
[ambient_effect_1.AmbientPart.Rng]: { state: ambient_state_name_1.AmbientStateName.rng },
|
|
368
|
+
[ambient_effect_1.AmbientPart.RngKind]: { state: ambient_state_name_1.AmbientStateName.rngKind },
|
|
369
|
+
[ambient_effect_1.AmbientPart.WorkingDirectory]: { state: ambient_state_name_1.AmbientStateName.workingDirectory },
|
|
370
|
+
[ambient_effect_1.AmbientPart.Directories]: { state: ambient_state_name_1.AmbientStateName.directories },
|
|
371
|
+
[ambient_effect_1.AmbientPart.Files]: { state: ambient_state_name_1.AmbientStateName.files },
|
|
372
|
+
[ambient_effect_1.AmbientPart.ProjectRoot]: { state: ambient_state_name_1.AmbientStateName.projectRoot },
|
|
373
|
+
[ambient_effect_1.AmbientPart.LibPaths]: { state: ambient_state_name_1.AmbientStateName.libPaths },
|
|
374
|
+
[ambient_effect_1.AmbientPart.Umask]: { state: ambient_state_name_1.AmbientStateName.umask },
|
|
375
|
+
[ambient_effect_1.AmbientPart.Finalizers]: { state: ambient_state_name_1.AmbientStateName.finalizers },
|
|
376
|
+
[ambient_effect_1.AmbientPart.TextConnection]: { state: ambient_state_name_1.AmbientStateName.anyFile },
|
|
377
|
+
[ambient_effect_1.AmbientPart.ErrorMessage]: { state: ambient_state_name_1.AmbientStateName.errorMessage }
|
|
378
|
+
};
|
|
379
|
+
/** Whether an effect changes the state, so a call whose only changes are off only queries it. */
|
|
380
|
+
function changes(effect) {
|
|
381
|
+
return effect.access !== ambient_effect_1.AmbientVerb.Reads && effect.access !== ambient_effect_1.AmbientVerb.Builds;
|
|
382
|
+
}
|
|
383
|
+
function isProcessorInfo(data) {
|
|
384
|
+
return data !== undefined && 'completeAst' in data;
|
|
385
|
+
}
|
|
386
|
+
/** Whether the `condition` holds for the arguments `args`, what values are known decided with `data`, see {@link decide}. */
|
|
387
|
+
function holds(condition, args, data) {
|
|
388
|
+
return decide(condition, args, data).holds;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Whether the `condition` holds for the arguments `args`, what values are known decided with `data`, and the argument nodes that decided it.
|
|
392
|
+
* A forwarded `...` may hold any argument, so what it could give leaves a condition open.
|
|
393
|
+
*/
|
|
394
|
+
function decide(condition, args, data) {
|
|
395
|
+
const dots = args.some(built_in_ambient_keys_1.forwardsDots);
|
|
396
|
+
const given = args.filter((a) => a !== r_function_call_1.EmptyArgument && !(0, built_in_ambient_keys_1.forwardsDots)(a));
|
|
397
|
+
const all = { decidedBy: args.flatMap(a => a === r_function_call_1.EmptyArgument ? [] : [a.info.id]) };
|
|
398
|
+
const open = (known, never = logic_1.Ternary.Never) => dots && known === never ? logic_1.Ternary.Maybe : known;
|
|
399
|
+
if (condition === 'no-arguments') {
|
|
400
|
+
return { holds: given.length > 0 ? logic_1.Ternary.Never : dots ? logic_1.Ternary.Maybe : logic_1.Ternary.Always, ...all };
|
|
401
|
+
}
|
|
402
|
+
else if (condition === 'query') {
|
|
403
|
+
return { holds: open(isQuery(given) ? logic_1.Ternary.Always : logic_1.Ternary.Never, logic_1.Ternary.Always), ...all };
|
|
404
|
+
}
|
|
405
|
+
else if ('flag' in condition) {
|
|
406
|
+
const flag = given.find(a => a.name !== undefined && identifier_1.Identifier.getName(a.name.content) === condition.flag);
|
|
407
|
+
if (flag === undefined) {
|
|
408
|
+
return { holds: open(logic_1.Ternary.Never), decidedBy: [] };
|
|
409
|
+
}
|
|
410
|
+
return { holds: r_logical_1.RLogical.is(flag.value) ? flag.value.content ? logic_1.Ternary.Always : logic_1.Ternary.Never : data === undefined ? logic_1.Ternary.Maybe : (0, built_in_ambient_keys_1.flagValue)(flag.value, data), decidedBy: [flag.info.id] };
|
|
411
|
+
}
|
|
412
|
+
else if ('arg' in condition) {
|
|
413
|
+
const arg = match_args_1.MatchArgs.toNames(args, condition.formals).get(condition.arg);
|
|
414
|
+
if (arg !== undefined && (0, built_in_ambient_keys_1.forwardsDots)(arg)) {
|
|
415
|
+
return { holds: logic_1.Ternary.Maybe, decidedBy: [arg.info.id] };
|
|
416
|
+
}
|
|
417
|
+
const known = 'calls' in condition ? argumentCalls(arg, condition.calls, data) : argumentIs(arg, condition.is, data);
|
|
418
|
+
return { holds: arg === undefined && dots ? logic_1.Ternary.Maybe : known, decidedBy: arg === undefined ? [] : [arg.info.id] };
|
|
419
|
+
}
|
|
420
|
+
const besides = given.some(a => {
|
|
421
|
+
const at = args.indexOf(a);
|
|
422
|
+
return a.name === undefined ? at >= condition.besides.length : !condition.besides.includes(identifier_1.Identifier.getName(a.name.content));
|
|
423
|
+
});
|
|
424
|
+
return { holds: besides ? logic_1.Ternary.Always : open(logic_1.Ternary.Never), ...all };
|
|
425
|
+
}
|
|
426
|
+
/** Whether the argument is one of the strings `is`, `null` standing for a missing or `NULL` argument. */
|
|
427
|
+
function argumentIs(arg, is, data) {
|
|
428
|
+
const value = r_argument_1.RArgument.valueOf(arg);
|
|
429
|
+
if (value === undefined || (r_symbol_1.RSymbol.is(value) && value.content === convert_values_1.RNull)) {
|
|
430
|
+
return is.includes(null) ? logic_1.Ternary.Always : logic_1.Ternary.Never;
|
|
431
|
+
}
|
|
432
|
+
/* an argument given is taken for a value, `NULL` only if written so */
|
|
433
|
+
const strings = r_string_1.RString.is(value) ? [value.content.str] : data === undefined ? undefined : (0, built_in_ambient_keys_1.stringValuesOf)(value, data);
|
|
434
|
+
if (!is.some(v => v !== null)) {
|
|
435
|
+
return logic_1.Ternary.Never;
|
|
436
|
+
}
|
|
437
|
+
else if (strings === undefined) {
|
|
438
|
+
return logic_1.Ternary.Maybe;
|
|
439
|
+
}
|
|
440
|
+
const known = strings.map(v => is.includes(v));
|
|
441
|
+
return known.every(Boolean) ? logic_1.Ternary.Always : known.some(Boolean) ? logic_1.Ternary.Maybe : logic_1.Ternary.Never;
|
|
442
|
+
}
|
|
443
|
+
/** Whether the argument is a call of one of the functions `calls`, or a variable bound to one (which only a processor tracks, after it a variable is left open). */
|
|
444
|
+
function argumentCalls(arg, calls, data) {
|
|
445
|
+
if (arg === undefined) {
|
|
446
|
+
return logic_1.Ternary.Never;
|
|
447
|
+
}
|
|
448
|
+
const direct = r_argument_1.RArgument.valueOf(arg);
|
|
449
|
+
const values = isProcessorInfo(data) ? boundValues(arg.info.id, data) : r_symbol_1.RSymbol.is(direct) ? [] : [direct].filter(assert_1.isNotUndefined);
|
|
450
|
+
const known = values.map(v => r_function_call_1.RFunctionCall.isNamed(v, new Set(calls)));
|
|
451
|
+
return known.length === 0 ? logic_1.Ternary.Maybe : known.every(Boolean) ? logic_1.Ternary.Always : known.some(Boolean) ? logic_1.Ternary.Maybe : logic_1.Ternary.Never;
|
|
452
|
+
}
|
|
453
|
+
/** Whether the effect happens for the arguments `args`, see {@link AmbientEffect#when}. */
|
|
454
|
+
function applies(effect, args, data) {
|
|
455
|
+
return logic_1.TernaryLogic.and(effect.when === undefined ? logic_1.Ternary.Always : holds(effect.when, args, data), effect.unless === undefined ? logic_1.Ternary.Always : logic_1.TernaryLogic.negate(holds(effect.unless, args, data)));
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* What the effect on a part without instances does to its state, for the entries `keys` (all of them if `undefined`).
|
|
459
|
+
* A part of the active instance of a family opens one on the fly, a drawing on the plot writes the canvas with `drawing`.
|
|
460
|
+
* With `maybe` the arguments are unknown, so a reset only adds and an entry is not known to be removed.
|
|
461
|
+
*/
|
|
462
|
+
function stateAccess(effect, keys, maybe, drawing) {
|
|
463
|
+
const { state, keyed, of } = Families[effect.family];
|
|
464
|
+
const { access } = effect;
|
|
465
|
+
if (access === ambient_effect_1.AmbientVerb.Builds) {
|
|
466
|
+
return { reads: [], writes: [], kills: [] };
|
|
467
|
+
}
|
|
468
|
+
const read = keyed === undefined ? [state] : keyedReads(keyed, keys ?? []);
|
|
469
|
+
const written = keyed === undefined ? [state] : keys === undefined ? [ambient_state_name_1.AmbientStateName.allOf(keyed)] : (0, built_in_ambient_keys_1.keyedWrites)(keyed, keys);
|
|
470
|
+
const writes = [
|
|
471
|
+
...of === undefined ? [] : [of.used],
|
|
472
|
+
...drawing && effect.family === ambient_effect_1.AmbientPart.Plot && (access === ambient_effect_1.AmbientVerb.Adds || access === ambient_effect_1.AmbientVerb.Resets) ? [ambient_state_name_1.AmbientStateName.canvas] : [],
|
|
473
|
+
...access === ambient_effect_1.AmbientVerb.Reads ? [] : access === ambient_effect_1.AmbientVerb.Resets && !maybe ? written.map(name => ({ name, mode: AmbientWriteMode.Reset })) : written
|
|
474
|
+
];
|
|
475
|
+
return {
|
|
476
|
+
/* with unknown arguments, a reset may add to what is there (`plot(f, add = TRUE)`) */
|
|
477
|
+
reads: access === ambient_effect_1.AmbientVerb.Reads || access === ambient_effect_1.AmbientVerb.Adds || (maybe && access === ambient_effect_1.AmbientVerb.Resets) ? read : [],
|
|
478
|
+
writes,
|
|
479
|
+
kills: access === ambient_effect_1.AmbientVerb.Kills && !maybe ? written.filter(n => keyed === undefined || n !== ambient_state_name_1.AmbientStateName.allOf(keyed)) : []
|
|
480
|
+
};
|
|
481
|
+
}
|
|
323
482
|
/** Whether a call drawing on a device writes its canvas, see `semantics.ambient.drawingWritesDevice`. */
|
|
324
483
|
function drawingWritesDevice(config) {
|
|
325
484
|
return config.semantics.ambient?.drawingWritesDevice === true;
|
|
326
485
|
}
|
|
327
|
-
/** Wires the {@link
|
|
328
|
-
function
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
else if (args === UnknownArguments) {
|
|
333
|
-
return applyWithUnknownArguments(res, rootId, data, access);
|
|
334
|
-
}
|
|
335
|
-
const reads = [];
|
|
336
|
-
const writes = [];
|
|
337
|
-
switch (access.type) {
|
|
338
|
-
case "read-graphics" /* AmbientStateAccessType.ReadGraphics */:
|
|
339
|
-
reads.push(ambient_state_name_1.AmbientStateName.graphics, ambient_state_name_1.AmbientStateName.palette);
|
|
340
|
-
if (drawingWritesDevice(data.ctx.config)) {
|
|
341
|
-
writes.push(ambient_state_name_1.AmbientStateName.canvas);
|
|
342
|
-
}
|
|
343
|
-
break;
|
|
344
|
-
case "set-graphics" /* AmbientStateAccessType.SetGraphics */:
|
|
345
|
-
/* the call returns the previous state */
|
|
346
|
-
reads.push(ambient_state_name_1.AmbientStateName.graphics);
|
|
347
|
-
if (onlyQueries(access, args)) {
|
|
348
|
-
if (access.queryLinksTo) {
|
|
349
|
-
(0, unknown_side_effect_1.handleUnknownSideEffect)(res.graph, res.environment, rootId, access.queryLinksTo);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
writes.push(ambient_state_name_1.AmbientStateName.graphics, ...access.keys === undefined ? [] : (0, built_in_ambient_keys_1.keyedWrites)(ambient_state_name_1.KeyedState.Par, (0, built_in_ambient_keys_1.keysOf)(access.keys, args, data)));
|
|
354
|
-
}
|
|
355
|
-
break;
|
|
356
|
-
case "set-palette" /* AmbientStateAccessType.SetPalette */:
|
|
357
|
-
reads.push(ambient_state_name_1.AmbientStateName.palette);
|
|
358
|
-
if (!onlyQueries(access, args)) {
|
|
359
|
-
writes.push(ambient_state_name_1.AmbientStateName.palette);
|
|
360
|
-
}
|
|
361
|
-
break;
|
|
362
|
-
case "read-options" /* AmbientStateAccessType.ReadOptions */: {
|
|
363
|
-
const dispatched = access.dispatchOn === undefined ? undefined : r_argument_1.RArgument.valueOf(args[access.dispatchOn]);
|
|
364
|
-
reads.push(...printingReads(dispatched, access.dispatchOn !== undefined, access.keys, data));
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
case "get-option" /* AmbientStateAccessType.GetOption */: {
|
|
368
|
-
const first = args.find(a => a !== r_function_call_1.EmptyArgument && (a.name === undefined || identifier_1.Identifier.getName(a.name.content) === 'x'));
|
|
369
|
-
const keys = (0, built_in_ambient_keys_1.stringValuesOf)(r_argument_1.RArgument.valueOf(first), data);
|
|
370
|
-
reads.push(...optionReads(keys));
|
|
371
|
-
if (args.length === 1) {
|
|
372
|
-
linkOptionValue(res, rootId, keys, data);
|
|
373
|
-
}
|
|
374
|
-
break;
|
|
486
|
+
/** Wires the {@link AmbientEffect}s of a call into its dataflow information: reads become unknown references, writes define the pseudo variable globally. */
|
|
487
|
+
function applyAmbientEffects(res, args, rootId, data, effects) {
|
|
488
|
+
for (const effect of ambient_effect_1.Ambient.list(effects)) {
|
|
489
|
+
if (args === UnknownArguments) {
|
|
490
|
+
res = applyWithUnknownArguments(res, rootId, data, effect);
|
|
375
491
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
/* a variable R or a child process reads by itself is read by calls we cannot name */
|
|
381
|
-
if (access.state === ambient_state_name_1.KeyedState.Env && keys.some(k => k === ambient_state_name_1.UnknownKey || GlobalEffectEnv.test(k))) {
|
|
382
|
-
res.graph.markIdForUnknownSideEffects(rootId);
|
|
492
|
+
else {
|
|
493
|
+
const happens = applies(effect, args, data);
|
|
494
|
+
if (happens !== logic_1.Ternary.Never) {
|
|
495
|
+
res = applyEffect(res, args, rootId, data, effect, happens === logic_1.Ternary.Maybe);
|
|
383
496
|
}
|
|
384
|
-
writes.push(...(0, built_in_ambient_keys_1.keyedWrites)(access.state, keys));
|
|
385
|
-
break;
|
|
386
497
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
case
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
reads.push(ambient_state_name_1.AmbientStateName.rng);
|
|
414
|
-
writes.push(ambient_state_name_1.AmbientStateName.rngKind, ambient_state_name_1.AmbientStateName.rng);
|
|
498
|
+
}
|
|
499
|
+
return res;
|
|
500
|
+
}
|
|
501
|
+
/** Applies the effect, which only `maybe` happens. */
|
|
502
|
+
function applyEffect(res, args, rootId, data, effect, maybe = false) {
|
|
503
|
+
const { instances, keyed } = Families[effect.family];
|
|
504
|
+
if (instances !== undefined) {
|
|
505
|
+
return instanceAccess(res, rootId, data, effect, instances, args.length > 0);
|
|
506
|
+
}
|
|
507
|
+
const named = effect.member === undefined || effect.member === 'every' ? undefined : (0, built_in_ambient_keys_1.keysOf)(effect.member, args, data);
|
|
508
|
+
/* a path, url, or remote (`user/repo`) does not tell which package it installs */
|
|
509
|
+
const keys = effect.family === ambient_state_name_1.KeyedState.InstalledPackages ? named?.map(k => ambient_state_name_1.PlainPackageName.test(k) ? k : ambient_state_name_1.UnknownKey) : named;
|
|
510
|
+
switch (effect.family) {
|
|
511
|
+
case ambient_state_name_1.KeyedState.Option:
|
|
512
|
+
return effect.access === ambient_effect_1.AmbientVerb.Reads ? readOptions(res, args, rootId, data, effect, keys) : setOptions(res, args, rootId, data);
|
|
513
|
+
case ambient_effect_1.AmbientPart.Files:
|
|
514
|
+
return fileAccess(res, rootId, data, effect);
|
|
515
|
+
case ambient_effect_1.AmbientPart.TextConnection:
|
|
516
|
+
return openTextConnection(res, args, rootId, data);
|
|
517
|
+
case ambient_effect_1.AmbientPart.Finalizers:
|
|
518
|
+
return effect.access === ambient_effect_1.AmbientVerb.Reads ? runFinalizers(res, rootId, data) : registerFinalizer(res, args, rootId, data);
|
|
519
|
+
case ambient_effect_1.AmbientPart.LastPlot:
|
|
520
|
+
if (changes(effect)) {
|
|
521
|
+
/* the plot object is what the outermost `+` the call is part of builds */
|
|
522
|
+
recordAmbient(res.graph, rootId, res.environment, [], [ambient_state_name_1.AmbientStateName.lastPlot]);
|
|
523
|
+
return { ...res, environment: defineAmbient(res.environment, outermostPlus(rootId, data.completeAst.idMap), data.cds ? [...data.cds] : undefined, [ambient_state_name_1.AmbientStateName.lastPlot]) };
|
|
415
524
|
}
|
|
416
525
|
break;
|
|
417
|
-
|
|
418
|
-
case
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
break;
|
|
422
|
-
case "read-files" /* AmbientStateAccessType.ReadFiles */: {
|
|
423
|
-
const stems = fileStems(res, rootId, data, access);
|
|
424
|
-
if (stems?.length === 0) {
|
|
425
|
-
break;
|
|
526
|
+
case ambient_state_name_1.KeyedState.Env:
|
|
527
|
+
case ambient_state_name_1.KeyedState.Par:
|
|
528
|
+
if (effect.handsBack && keys !== undefined && keyed !== undefined) {
|
|
529
|
+
linkEntryValue(res, rootId, keyed, keys, data);
|
|
426
530
|
}
|
|
427
|
-
reads
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
writes.push(...stems === undefined ? [ambient_state_name_1.AmbientStateName.anyFile, ambient_state_name_1.AmbientStateName.files] : stems.map(ambient_state_name_1.AmbientStateName.file));
|
|
431
|
-
}
|
|
432
|
-
break;
|
|
433
|
-
}
|
|
434
|
-
case "write-files" /* AmbientStateAccessType.WriteFiles */: {
|
|
435
|
-
const stems = fileStems(res, rootId, data, access);
|
|
436
|
-
if (stems?.length === 0) {
|
|
437
|
-
break;
|
|
531
|
+
/* a variable R or a child process reads by itself is read by calls we cannot name */
|
|
532
|
+
if (effect.family === ambient_state_name_1.KeyedState.Env && changes(effect) && keys?.some(k => k === ambient_state_name_1.UnknownKey || GlobalEffectEnv.test(k))) {
|
|
533
|
+
res.graph.markIdForUnknownSideEffects(rootId);
|
|
438
534
|
}
|
|
439
|
-
reads.push(ambient_state_name_1.AmbientStateName.workingDirectory);
|
|
440
|
-
writes.push(...stems === undefined ? [ambient_state_name_1.AmbientStateName.anyFile] : stems.map(ambient_state_name_1.AmbientStateName.file), ambient_state_name_1.AmbientStateName.files);
|
|
441
535
|
break;
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
return withAccess(res, rootId, data, [ambient_state_name_1.AmbientStateName.finalizers], registered.flatMap(d => d.writes ?? []).map(maybe));
|
|
536
|
+
}
|
|
537
|
+
const { reads, writes, kills } = stateAccess(effect, keyed === undefined ? undefined : keys, maybe, drawingWritesDevice(data.ctx.config));
|
|
538
|
+
return withAccess(res, rootId, data, reads, (0, arrays_1.uniqueArray)(writes), kills);
|
|
539
|
+
}
|
|
540
|
+
/** What the effect on an instance family does: opening, closing, and switching move the states of the instances, see {@link deviceAccess}. */
|
|
541
|
+
function instanceAccess(res, rootId, data, effect, family, named) {
|
|
542
|
+
const { state } = Families[effect.family];
|
|
543
|
+
switch (effect.access) {
|
|
544
|
+
case ambient_effect_1.AmbientVerb.Opens:
|
|
545
|
+
return deviceAccess(res, rootId, data, DeviceAccess.Open, family);
|
|
546
|
+
case ambient_effect_1.AmbientVerb.Switches:
|
|
547
|
+
return deviceAccess(res, rootId, data, DeviceAccess.Switch, family);
|
|
548
|
+
case ambient_effect_1.AmbientVerb.Closes:
|
|
549
|
+
/* `dev.off(which)` may close an instance other than the active one, which keeps its state then */
|
|
550
|
+
return deviceAccess(res, rootId, data, effect.member === 'every' ? DeviceAccess.CloseAll : named ? DeviceAccess.CloseSome : DeviceAccess.Close, family);
|
|
551
|
+
default: {
|
|
552
|
+
const { reads, writes } = instanceStateAccess(effect, state, family);
|
|
553
|
+
return withAccess(res, rootId, data, reads, writes);
|
|
461
554
|
}
|
|
462
555
|
}
|
|
463
|
-
|
|
556
|
+
}
|
|
557
|
+
/** What reading or using an instance does, `every` one with {@link AmbientEffect#member}: using it adds to what its closing links to. */
|
|
558
|
+
function instanceStateAccess(effect, state, family) {
|
|
559
|
+
const others = family.states.find(([active]) => active === state)?.[1];
|
|
560
|
+
return {
|
|
561
|
+
reads: effect.access === ambient_effect_1.AmbientVerb.Builds ? [] : [state, ...effect.member === 'every' && others !== undefined ? [others] : []],
|
|
562
|
+
writes: changes(effect) ? [family.used] : []
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
/** What reading options does: the entries `keys` names, all options if a method may print the value `print(x)` dispatches on, which draws a plot object. */
|
|
566
|
+
function readOptions(res, args, rootId, data, effect, keys) {
|
|
567
|
+
if (effect.dispatchOn !== undefined) {
|
|
568
|
+
const dispatched = r_argument_1.RArgument.valueOf(args[effect.dispatchOn]);
|
|
569
|
+
return withAccess(res, rootId, data, printingReads(dispatched, true, keys ?? [], data), mayHoldPlot(dispatched, data) ? DrawsNewPlot : []);
|
|
570
|
+
}
|
|
571
|
+
if (effect.handsBack) {
|
|
572
|
+
linkEntryValue(res, rootId, ambient_state_name_1.KeyedState.Option, keys ?? [], data);
|
|
573
|
+
}
|
|
574
|
+
return withAccess(res, rootId, data, keyedReads(ambient_state_name_1.KeyedState.Option, keys ?? []));
|
|
575
|
+
}
|
|
576
|
+
/** what every access of a file reads to find it: the working directory a relative path starts from and the directories the path leads through */
|
|
577
|
+
const FileSystemReads = [ambient_state_name_1.AmbientStateName.workingDirectory, ambient_state_name_1.AmbientStateName.directories];
|
|
578
|
+
/** What reading or writing the files the call names does, see {@link fileStems}. */
|
|
579
|
+
function fileAccess(res, rootId, data, effect) {
|
|
580
|
+
const stems = fileStems(res, rootId, data, effect);
|
|
581
|
+
if (stems?.length === 0) {
|
|
582
|
+
return res;
|
|
583
|
+
}
|
|
584
|
+
if (effect.access === ambient_effect_1.AmbientVerb.Reads) {
|
|
585
|
+
/* a read through a connection the program holds moves its position, so the next read depends on this one */
|
|
586
|
+
const moves = readsThroughHandle(res, rootId, data, effect.sig) ? stems === undefined ? [ambient_state_name_1.AmbientStateName.anyFile, ambient_state_name_1.AmbientStateName.files] : stems.map(ambient_state_name_1.AmbientStateName.file) : [];
|
|
587
|
+
return withAccess(res, rootId, data, [...FileSystemReads, ...stems === undefined ? [ambient_state_name_1.AmbientStateName.files] : [...stems.map(ambient_state_name_1.AmbientStateName.file), ambient_state_name_1.AmbientStateName.anyFile]], moves);
|
|
588
|
+
}
|
|
589
|
+
return withAccess(res, rootId, data, FileSystemReads, [...stems === undefined ? [ambient_state_name_1.AmbientStateName.anyFile] : stems.map(ambient_state_name_1.AmbientStateName.file), ambient_state_name_1.AmbientStateName.files]);
|
|
590
|
+
}
|
|
591
|
+
/** `gc()` may run every registered finalizer whose object is released. */
|
|
592
|
+
function runFinalizers(res, rootId, data) {
|
|
593
|
+
const registered = (resolve_helper_1.Resolve.byName(ambient_state_name_1.AmbientStateName.finalizers, data.environment) ?? []).filter(identifier_1.isInGraphDefinition);
|
|
594
|
+
for (const fn of registered.flatMap(d => d.value ?? [])) {
|
|
595
|
+
res.graph.addEdge(rootId, fn, edge_1.EdgeType.Calls);
|
|
596
|
+
}
|
|
597
|
+
return withAccess(res, rootId, data, [ambient_state_name_1.AmbientStateName.finalizers], registered.flatMap(d => d.writes ?? []).map(maybe));
|
|
598
|
+
}
|
|
599
|
+
/** drawing a new plot adds to the device, which opens one if none is open, and replaces its plot */
|
|
600
|
+
const DrawsNewPlot = [ambient_state_name_1.AmbientStateName.device, { name: ambient_state_name_1.AmbientStateName.plot, mode: AmbientWriteMode.Reset }];
|
|
601
|
+
/**
|
|
602
|
+
* Whether the value of `node` may be a plot object, which printing draws: a call building one ({@link AmbientVerb.Builds}, as `ggplot` does),
|
|
603
|
+
* a `+` adding to one, or a variable bound to either.
|
|
604
|
+
*/
|
|
605
|
+
function mayHoldPlot(node, data, seen = new Set()) {
|
|
606
|
+
if (node === undefined || seen.has(node.info.id)) {
|
|
607
|
+
return false;
|
|
608
|
+
}
|
|
609
|
+
seen.add(node.info.id);
|
|
610
|
+
if (r_function_call_1.RFunctionCall.isNamed(node)) {
|
|
611
|
+
return ((0, query_fn_props_1.statedFunctions)(node.functionName.content, data.environment) ?? []).some(t => hiddenAccess(t).some(a => a.family === ambient_effect_1.AmbientPart.Plot && a.access === ambient_effect_1.AmbientVerb.Builds));
|
|
612
|
+
}
|
|
613
|
+
else if (r_binary_op_1.RBinaryOp.is(node)) {
|
|
614
|
+
return node.operator === '+' && (mayHoldPlot(node.lhs, data, seen) || mayHoldPlot(node.rhs, data, seen));
|
|
615
|
+
}
|
|
616
|
+
else if (r_if_then_else_1.RIfThenElse.is(node)) {
|
|
617
|
+
return mayHoldPlot(node.then, data, seen) || mayHoldPlot(node.otherwise, data, seen);
|
|
618
|
+
}
|
|
619
|
+
else if (r_expression_list_1.RExpressionList.is(node)) {
|
|
620
|
+
return mayHoldPlot(node.children.at(-1), data, seen);
|
|
621
|
+
}
|
|
622
|
+
else if (!r_symbol_1.RSymbol.is(node)) {
|
|
623
|
+
return false;
|
|
624
|
+
}
|
|
625
|
+
return (resolve_helper_1.Resolve.byName(node.content, data.environment) ?? []).filter(identifier_1.isInGraphDefinition).some(d => {
|
|
626
|
+
const source = data.completeAst.idMap.get(d.definedAt);
|
|
627
|
+
return r_binary_op_1.RBinaryOp.is(source) && mayHoldPlot(source.lhs.info.id === d.nodeId ? source.rhs : source.lhs, data, seen);
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
/** the outermost `+` chain holding `id`, `id` itself if it is part of none */
|
|
631
|
+
function outermostPlus(id, idMap) {
|
|
632
|
+
let at = idMap.get(id);
|
|
633
|
+
for (let parent = at === undefined ? undefined : model_1.RNode.directParent(at, idMap); r_binary_op_1.RBinaryOp.is(parent) && parent.operator === '+'; parent = model_1.RNode.directParent(parent, idMap)) {
|
|
634
|
+
at = parent;
|
|
635
|
+
}
|
|
636
|
+
return at?.info.id ?? id;
|
|
464
637
|
}
|
|
465
638
|
/** `reg.finalizer(e, f)` keeps the functions `f` may be, and the name holding `e`, whose release lets `gc()` run them. */
|
|
466
639
|
function registerFinalizer(res, args, rootId, data) {
|
|
@@ -528,8 +701,7 @@ function callsTagged(node, data, tag) {
|
|
|
528
701
|
/** Whether the resource argument `id` names no file: `""` (the console for `cat`), `NULL`, or a console connection like `stdout()`. */
|
|
529
702
|
function namesNoFile(id, data) {
|
|
530
703
|
const values = boundValues(id, data);
|
|
531
|
-
return values.length > 0 && values.every(v => (r_string_1.RString.is(v) && v.content.str === '') || (r_symbol_1.RSymbol.is(v) && v.content === convert_values_1.RNull)
|
|
532
|
-
|| callsTagged(v, data, built_in_props_1.SemanticCallTag.Console));
|
|
704
|
+
return values.length > 0 && values.every(v => (r_string_1.RString.is(v) && v.content.str === '') || (r_symbol_1.RSymbol.is(v) && v.content === convert_values_1.RNull) || callsTagged(v, data, built_in_props_1.SemanticCallTag.Console));
|
|
533
705
|
}
|
|
534
706
|
/** The stems of the files the call names, `undefined` unless every file argument is a known path to a file with an extension (a device's `plot%03d.png` or a directory may stand for others). */
|
|
535
707
|
function fileStems(res, rootId, data, { sig, numbered }) {
|
|
@@ -581,133 +753,120 @@ function isPlainValue(node, data) {
|
|
|
581
753
|
}
|
|
582
754
|
/** The arguments of a call made on our behalf, like `do.call(par, args)`, which we cannot see. */
|
|
583
755
|
const UnknownArguments = Symbol('unknown-arguments');
|
|
584
|
-
function applyWithUnknownArguments(res, rootId, data,
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
756
|
+
function applyWithUnknownArguments(res, rootId, data, effect) {
|
|
757
|
+
const { instances } = Families[effect.family];
|
|
758
|
+
if (instances !== undefined && effect.access !== ambient_effect_1.AmbientVerb.Reads && effect.access !== ambient_effect_1.AmbientVerb.Adds) {
|
|
759
|
+
/* we cannot tell which instance a close closes */
|
|
760
|
+
return instanceAccess(res, rootId, data, effect, instances, true);
|
|
761
|
+
}
|
|
762
|
+
else if (effect.family === ambient_effect_1.AmbientPart.Files) {
|
|
588
763
|
/* the arguments handed on (`do.call(readLines, list("a.txt"))`, `lapply(files, readLines)`) may still name the files */
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
res.graph.markIdForUnknownSideEffects(rootId);
|
|
597
|
-
}
|
|
598
|
-
const { reads, writes } = unknownArgumentAccess(access, drawingWritesDevice(data.ctx.config));
|
|
764
|
+
return applyEffect(res, [], rootId, data, effect);
|
|
765
|
+
}
|
|
766
|
+
else if (effect.family === ambient_state_name_1.KeyedState.Option && changes(effect)) {
|
|
767
|
+
/* like `options(op)`: it may set anything */
|
|
768
|
+
res.graph.markIdForUnknownSideEffects(rootId);
|
|
769
|
+
}
|
|
770
|
+
const { reads, writes } = unknownArgumentAccess(effect, drawingWritesDevice(data.ctx.config));
|
|
599
771
|
return withAccess(res, rootId, data, reads, writes);
|
|
600
772
|
}
|
|
601
|
-
const Devices = { reads: [], writes: [ambient_state_name_1.AmbientStateName.graphics, ambient_state_name_1.AmbientStateName.device] };
|
|
602
773
|
/* evaluated code may attach a package as well, which every call nothing else resolves reads */
|
|
603
774
|
const Quoted = { reads: [ambient_state_name_1.AmbientStateName.allOptions, ambient_state_name_1.AmbientStateName.graphics, ambient_state_name_1.AmbientStateName.palette], writes: [ambient_state_name_1.AmbientStateName.unknownOption, ambient_state_name_1.AmbientStateName.allOptions, ambient_state_name_1.AmbientStateName.graphics, ambient_state_name_1.AmbientStateName.palette, ambient_state_name_1.AmbientStateName.allOf(ambient_state_name_1.KeyedState.SearchPath)] };
|
|
604
|
-
/** What
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
642
|
-
/** Graphics parameters are per device; within a function the open devices are unknown, so a device call only adds. */
|
|
643
|
-
function deviceAccess(res, rootId, data, kind) {
|
|
644
|
-
/* only a switch reads the state; what a closed device holds reaches its file through the plots on it (see LinkToLastPlot) */
|
|
645
|
-
const reads = kind === DeviceAccess.Switch ? [ambient_state_name_1.AmbientStateName.graphics] : [];
|
|
775
|
+
/** What the effect may read and write when the arguments of the call are unknown, as when only linking reveals it: any condition may hold, and any entry be named but stated ones. */
|
|
776
|
+
function unknownArgumentAccess(effect, drawing) {
|
|
777
|
+
const { state, instances } = Families[effect.family];
|
|
778
|
+
if (instances !== undefined) {
|
|
779
|
+
return effect.access === ambient_effect_1.AmbientVerb.Reads || effect.access === ambient_effect_1.AmbientVerb.Adds ? instanceStateAccess(effect, state, instances) : { reads: [], writes: activeStates(instances) };
|
|
780
|
+
}
|
|
781
|
+
switch (effect.family) {
|
|
782
|
+
case ambient_state_name_1.KeyedState.Option:
|
|
783
|
+
if (changes(effect)) {
|
|
784
|
+
return { reads: [ambient_state_name_1.AmbientStateName.allOptions], writes: [ambient_state_name_1.AmbientStateName.unknownOption, ambient_state_name_1.AmbientStateName.allOptions, ambient_state_name_1.AmbientStateName.warnsAsErrors] };
|
|
785
|
+
}
|
|
786
|
+
break;
|
|
787
|
+
case ambient_effect_1.AmbientPart.Files:
|
|
788
|
+
return effect.access === ambient_effect_1.AmbientVerb.Reads ? { reads: [...FileSystemReads, ambient_state_name_1.AmbientStateName.files], writes: [] }
|
|
789
|
+
: { reads: FileSystemReads, writes: [ambient_state_name_1.AmbientStateName.anyFile, ambient_state_name_1.AmbientStateName.files] };
|
|
790
|
+
case ambient_effect_1.AmbientPart.TextConnection:
|
|
791
|
+
return { reads: [], writes: [] };
|
|
792
|
+
case ambient_effect_1.AmbientPart.Finalizers:
|
|
793
|
+
return effect.access === ambient_effect_1.AmbientVerb.Reads ? { reads: [state], writes: [] } : { reads: [], writes: [state] };
|
|
794
|
+
}
|
|
795
|
+
const member = effect.member;
|
|
796
|
+
const keys = typeof member === 'object' && member.from === 'constant' && effect.dispatchOn === undefined ? member.keys : [ambient_state_name_1.UnknownKey];
|
|
797
|
+
const { reads, writes } = stateAccess(effect, Families[effect.family].keyed === undefined ? undefined : keys, true, drawing);
|
|
798
|
+
return { reads, writes: writes.map(w => typeof w === 'string' ? w : w.name) };
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Opens, closes, or switches an instance of the `family` (a graphics device), each of whose states is per instance.
|
|
802
|
+
* A close reads the calls that opened and used the closed instance, the explicit opening reads the close in turn, so keeping it keeps the close.
|
|
803
|
+
* Within a function the open instances are unknown, so a call only adds.
|
|
804
|
+
*/
|
|
805
|
+
function deviceAccess(res, rootId, data, kind, family = ambient_state_name_1.GraphicsDevices) {
|
|
806
|
+
const otherOf = (state) => family.states.find(([active]) => active === state)?.[1] ?? state;
|
|
807
|
+
const actives = activeStates(family);
|
|
808
|
+
/* `x <- dev.off()` is the device that is active afterward, one of the others */
|
|
809
|
+
const closing = kind === DeviceAccess.Close ? [family.used, ...resultIsUsed(rootId, data) ? [otherOf(family.used)] : []] : [];
|
|
810
|
+
const all = [family.used, otherOf(family.used)];
|
|
811
|
+
const reads = kind === DeviceAccess.Switch ? [family.switched] : kind === DeviceAccess.CloseSome ? [family.switched, ...all] : kind === DeviceAccess.CloseAll ? all : closing;
|
|
646
812
|
/* closing writes the file of the device, which its opening names unless we do not know the device closed */
|
|
647
813
|
const unnamedFile = kind === DeviceAccess.Open ? [] : [ambient_state_name_1.AmbientStateName.anyFile, ambient_state_name_1.AmbientStateName.files];
|
|
648
814
|
const cds = data.cds ? [...data.cds] : undefined;
|
|
649
815
|
if (data.environment.level > 0) {
|
|
650
816
|
/* a device the body opened itself is the one a later close in the same body closes: `f <- function() { pdf("a.pdf"); plot(1); dev.off() }` writes `a.pdf` and no other file */
|
|
651
|
-
const here = kind === DeviceAccess.Close ? res.environment.current.memory.get(
|
|
817
|
+
const here = kind === DeviceAccess.Close ? res.environment.current.memory.get(family.openedHere) ?? [] : [];
|
|
652
818
|
for (const open of here) {
|
|
653
819
|
res.graph.addEdge(open.nodeId, rootId, edge_1.EdgeType.Reads);
|
|
654
820
|
}
|
|
655
|
-
let environment = { ...res.environment, current: res.environment.current.removeAll([{ name:
|
|
821
|
+
let environment = { ...res.environment, current: res.environment.current.removeAll([{ name: family.openedHere }]) };
|
|
656
822
|
if (kind === DeviceAccess.Open) {
|
|
657
|
-
environment = defineAmbient(environment, rootId, cds, [{ name:
|
|
823
|
+
environment = defineAmbient(environment, rootId, cds, [{ name: family.openedHere, mode: AmbientWriteMode.Local }]);
|
|
658
824
|
}
|
|
659
|
-
|
|
825
|
+
recordAmbient(res.graph, rootId, environment, [], [], kind === DeviceAccess.Close || kind === DeviceAccess.CloseAll ? actives : []);
|
|
826
|
+
return withAccess({ ...res, environment }, rootId, data, reads, [...actives, ...here.length > 0 ? [] : unnamedFile]);
|
|
660
827
|
}
|
|
661
828
|
const lookup = (name) => resolve_helper_1.Resolve.byName(name, res.environment) ?? [];
|
|
662
|
-
|
|
663
|
-
const
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
const reset = (name) => defineAmbient(environment, rootId, cds, [{ name, mode: AmbientWriteMode.Reset }]);
|
|
668
|
-
/* a later plot depends on neither the close nor the closed device's state; a device only depends on its close so it does not catch later plots */
|
|
669
|
-
const closes = (openers) => {
|
|
670
|
-
for (const open of openers) {
|
|
671
|
-
res.graph.addEdge(open.nodeId, rootId, edge_1.EdgeType.Reads);
|
|
672
|
-
}
|
|
673
|
-
};
|
|
829
|
+
/* a use opening the device on the fly (`plot` without one) names no file and needs no close */
|
|
830
|
+
const closed = kind === DeviceAccess.Close ? lookup(family.opened) : kind === DeviceAccess.CloseAll ? [...lookup(family.opened), ...lookup(otherOf(family.opened))] : [];
|
|
831
|
+
for (const open of closed) {
|
|
832
|
+
res.graph.addEdge(open.nodeId, rootId, edge_1.EdgeType.Reads);
|
|
833
|
+
}
|
|
674
834
|
/* in a loop, an earlier round may have opened a device this one leaves behind, or a close may leave one open */
|
|
675
835
|
const repeats = model_1.RLoopConstructs.encloses(rootId, data.completeAst.idMap);
|
|
676
|
-
const earlierRound = repeats ? [{ nodeId: rootId, name:
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
environment = setAmbient(environment, ambient_state_name_1.AmbientStateName.otherDevicesOpenedBy, opener, true);
|
|
701
|
-
break;
|
|
836
|
+
const earlierRound = repeats ? [{ nodeId: rootId, name: family.used, type: identifier_1.ReferenceType.Variable, definedAt: rootId, cds: cds ?? [] }] : [];
|
|
837
|
+
let environment = res.environment;
|
|
838
|
+
if (kind === DeviceAccess.Switch || kind === DeviceAccess.CloseSome) {
|
|
839
|
+
environment = defineAmbient(environment, rootId, cds, actives);
|
|
840
|
+
}
|
|
841
|
+
for (const [active, others] of family.states) {
|
|
842
|
+
const current = lookup(active);
|
|
843
|
+
const other = lookup(others);
|
|
844
|
+
switch (kind) {
|
|
845
|
+
case DeviceAccess.Open:
|
|
846
|
+
environment = setAmbient(environment, others, [...other, ...current, ...earlierRound]);
|
|
847
|
+
environment = defineAmbient(environment, rootId, cds, [{ name: active, mode: AmbientWriteMode.Reset }]);
|
|
848
|
+
break;
|
|
849
|
+
case DeviceAccess.Close:
|
|
850
|
+
environment = setAmbient(environment, active, repeats ? [...other, ...current] : other);
|
|
851
|
+
break;
|
|
852
|
+
case DeviceAccess.CloseAll:
|
|
853
|
+
environment = setAmbient(setAmbient(environment, active, []), others, []);
|
|
854
|
+
break;
|
|
855
|
+
case DeviceAccess.Switch:
|
|
856
|
+
case DeviceAccess.CloseSome:
|
|
857
|
+
environment = setAmbient(setAmbient(environment, active, other, true), others, current, true);
|
|
858
|
+
break;
|
|
859
|
+
}
|
|
702
860
|
}
|
|
703
|
-
|
|
704
|
-
const
|
|
705
|
-
|
|
861
|
+
/* a close ends the state of the device it closes, all of them for every device */
|
|
862
|
+
const kills = kind === DeviceAccess.Close ? actives : kind === DeviceAccess.CloseAll ? family.states.flat() : [];
|
|
863
|
+
recordAmbient(res.graph, rootId, res.environment, [], kind === DeviceAccess.CloseAll ? family.states.flat() : actives, kills);
|
|
864
|
+
return withAccess({ ...res, environment }, rootId, data, reads, kind === DeviceAccess.Open || closed.length > 0 ? [] : unnamedFile);
|
|
706
865
|
}
|
|
707
866
|
/** A call to `fn` made on our behalf (`do.call(fn, args)`, `sapply(x, fn)`): it accesses the state as `fn` does, or reads all of it if `fn` is opaque. */
|
|
708
867
|
function applyAmbientStateOfCallee(res, callId, fn, data) {
|
|
709
868
|
const targets = resolve_helper_1.Resolve.byNameAndType(fn, data.environment, identifier_1.ReferenceType.Function) ?? [];
|
|
710
|
-
res =
|
|
869
|
+
res = applyAmbientEffects(res, UnknownArguments, callId, data, targets.flatMap(hiddenAccess));
|
|
711
870
|
hiddenSideEffects(res.graph, res.environment, callId, targets);
|
|
712
871
|
const unknown = (targets.length === 0 && data.environment.level === 0) || targets.some(t => t.type !== identifier_1.ReferenceType.BuiltInFunction && hidesBody(t));
|
|
713
872
|
return unknown ? readsAllAmbientState(res, callId, data, true) : res;
|
|
@@ -724,8 +883,7 @@ function hiddenSideEffects(graph, environment, callId, targets) {
|
|
|
724
883
|
for (const target of targets) {
|
|
725
884
|
const builtIn = target.type === identifier_1.ReferenceType.BuiltInFunction ? target : undefined;
|
|
726
885
|
const processor = builtIn?.processorName;
|
|
727
|
-
const effect = builtIn?.config?.hasUnknownSideEffects
|
|
728
|
-
?? (processor !== undefined && WritesEnvironment.has(processor));
|
|
886
|
+
const effect = builtIn?.config?.hasUnknownSideEffects ?? (processor !== undefined && WritesEnvironment.has(processor));
|
|
729
887
|
if (effect) {
|
|
730
888
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(graph, environment, callId, effect === true ? undefined : effect);
|
|
731
889
|
}
|
|
@@ -735,8 +893,7 @@ function hiddenSideEffects(graph, environment, callId, targets) {
|
|
|
735
893
|
}
|
|
736
894
|
}
|
|
737
895
|
function hiddenAccess(target) {
|
|
738
|
-
|
|
739
|
-
return [access ?? []].flat();
|
|
896
|
+
return ambient_effect_1.Ambient.list(target.type === identifier_1.ReferenceType.BuiltInFunction ? target.config?.ambient : undefined);
|
|
740
897
|
}
|
|
741
898
|
/** The (maybe) writes of the call `callId` to the built-in `target` through a parameter, like `g <- function(f, ...) f(...); g(options, digits = 3)`. */
|
|
742
899
|
function writesOfHiddenBuiltIn(target, callId, drawing = false) {
|
|
@@ -776,62 +933,40 @@ function setOptions(res, args, rootId, data) {
|
|
|
776
933
|
}
|
|
777
934
|
/* the call returns the previous values of what it sets, which only matters if that value is used */
|
|
778
935
|
const previous = resultIsUsed(rootId, data) ? written : [];
|
|
779
|
-
const reads = [...queried.map(ambient_state_name_1.AmbientStateName.option), ...previous];
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}
|
|
783
|
-
if (reads.length > 0) {
|
|
784
|
-
reads.push(ambient_state_name_1.AmbientStateName.unknownOption);
|
|
785
|
-
}
|
|
786
|
-
const writes = [...written];
|
|
787
|
-
if (unknownKeys) {
|
|
788
|
-
writes.push(ambient_state_name_1.AmbientStateName.unknownOption);
|
|
789
|
-
}
|
|
790
|
-
if (warnsAsErrors) {
|
|
791
|
-
writes.push(ambient_state_name_1.AmbientStateName.warnsAsErrors);
|
|
792
|
-
}
|
|
793
|
-
if (writes.length > 0) {
|
|
794
|
-
writes.push(ambient_state_name_1.AmbientStateName.allOptions);
|
|
795
|
-
}
|
|
796
|
-
return withAccess(res, rootId, data, reads, writes);
|
|
936
|
+
const reads = [...queried.map(ambient_state_name_1.AmbientStateName.option), ...previous, ...args.length === 0 || unknownKeys ? [ambient_state_name_1.AmbientStateName.allOptions] : []];
|
|
937
|
+
const writes = [...written, ...unknownKeys ? [ambient_state_name_1.AmbientStateName.unknownOption] : [], ...warnsAsErrors ? [ambient_state_name_1.AmbientStateName.warnsAsErrors] : []];
|
|
938
|
+
return withAccess(res, rootId, data, reads.length > 0 ? [...reads, ambient_state_name_1.AmbientStateName.unknownOption] : [], writes.length > 0 ? [...writes, ambient_state_name_1.AmbientStateName.allOptions] : []);
|
|
797
939
|
}
|
|
798
940
|
/** Whether the call to `fn` only queries the state it may set, as `par("mar")`, `options("digits")` and `palette()` do, which hand that state back visibly where setting it returns the previous one invisibly. */
|
|
799
941
|
function callOnlyQueries(fn, args, environment) {
|
|
800
942
|
const targets = resolve_helper_1.Resolve.byNameAndType(fn, environment, identifier_1.ReferenceType.Function) ?? [];
|
|
801
|
-
return targets.length > 0 && targets.every(t => hiddenAccess(t)
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
case "set-options" /* AmbientStateAccessType.SetOptions */:
|
|
808
|
-
return isQuery(args);
|
|
809
|
-
case "set-palette" /* AmbientStateAccessType.SetPalette */:
|
|
810
|
-
return args.length === 0;
|
|
811
|
-
case "set-state" /* AmbientStateAccessType.SetState */:
|
|
812
|
-
return access.queryWithoutArguments === true && args.length === 0;
|
|
813
|
-
default:
|
|
814
|
-
return false;
|
|
815
|
-
}
|
|
943
|
+
return targets.length > 0 && targets.every(t => onlyQueries(hiddenAccess(t), args));
|
|
944
|
+
}
|
|
945
|
+
/** Whether a call with the `effects` only queries: a change is off for the arguments `args`, and no other one happens. */
|
|
946
|
+
function onlyQueries(effects, args) {
|
|
947
|
+
const changing = effects.filter(changes);
|
|
948
|
+
return changing.some(e => e.unless !== undefined && holds(e.unless, args) === logic_1.Ternary.Always) && changing.every(e => applies(e, args) === logic_1.Ternary.Never);
|
|
816
949
|
}
|
|
817
950
|
/** `par()`, `par("mar", "usr")`, and `par(no.readonly = TRUE)` only query the graphics state */
|
|
818
951
|
function isQuery(args) {
|
|
819
|
-
return args.every(a => a === r_function_call_1.EmptyArgument
|
|
820
|
-
|| (a.name === undefined ? r_string_1.RString.is(a.value) : identifier_1.Identifier.getName(a.name.content) === 'no.readonly'));
|
|
952
|
+
return args.every(a => a === r_function_call_1.EmptyArgument || (a.name === undefined ? r_string_1.RString.is(a.value) : identifier_1.Identifier.getName(a.name.content) === 'no.readonly'));
|
|
821
953
|
}
|
|
822
|
-
/** Whether the call's value may be used: anything but a non-final statement or
|
|
823
|
-
function resultIsUsed(rootId, data) {
|
|
954
|
+
/** Whether the call's value may be used: anything but a non-final statement or, unless it is `printed` there, a top-level statement of the script (the last of a block is its value). */
|
|
955
|
+
function resultIsUsed(rootId, data, printed) {
|
|
824
956
|
const node = data.completeAst.idMap.get(rootId);
|
|
825
957
|
const parent = node === undefined ? undefined : model_1.RNode.directParent(node, data.completeAst.idMap);
|
|
958
|
+
/* R prints the value a top-level statement leaves visible */
|
|
959
|
+
printed ??= !(r_function_call_1.RFunctionCall.isNamed(node) && returnsInvisibly(node.functionName.content, data.environment));
|
|
826
960
|
if (parent === undefined) {
|
|
827
961
|
return false;
|
|
828
962
|
}
|
|
829
963
|
else if (r_expression_list_1.RExpressionList.is(parent)) {
|
|
830
964
|
/* a block yields its last value, which is used where the block's is */
|
|
831
|
-
return
|
|
965
|
+
return data.completeAst.ast.files.some(f => f.root.info.id === parent.info.id) ? printed && autoPrintsStatementsOf(parent.info.id, data)
|
|
966
|
+
: parent.children.at(-1)?.info.id === rootId && resultIsUsed(parent.info.id, data, printed);
|
|
832
967
|
}
|
|
833
968
|
else if (r_if_then_else_1.RIfThenElse.is(parent)) {
|
|
834
|
-
return parent.condition.info.id === rootId || resultIsUsed(parent.info.id, data);
|
|
969
|
+
return parent.condition.info.id === rootId || resultIsUsed(parent.info.id, data, printed);
|
|
835
970
|
}
|
|
836
971
|
/* a loop discards what its body yields */
|
|
837
972
|
return !(model_1.RLoopConstructs.is(parent) && parent.body.info.id === rootId);
|
|
@@ -852,22 +987,34 @@ function linkAmbientStateWithinLoop(graph, reads, body) {
|
|
|
852
987
|
function processAmbientScope(name, args, rootId, data, scope) {
|
|
853
988
|
const bound = match_args_1.MatchArgs.toNames(args, scope.params);
|
|
854
989
|
const code = scope.code === undefined ? undefined : bound.get(scope.code);
|
|
855
|
-
|
|
990
|
+
/* the code may be several arguments, all that fall to `...` (`capture.output(print(1), print(2))`) */
|
|
991
|
+
const formals = new Set([...bound.entries()].filter(([param]) => param !== '...').map(([, arg]) => arg.info.id));
|
|
992
|
+
const isCode = (arg) => arg !== undefined && arg !== r_function_call_1.EmptyArgument
|
|
993
|
+
&& (scope.code === '...' ? !formals.has(arg.info.id) : arg.info.id === code?.info.id);
|
|
994
|
+
const family = scopedFamily(scope.state);
|
|
856
995
|
const local = code === undefined && data.environment.level > 0;
|
|
857
996
|
const { writes, unknown } = scope.preserve ? { writes: local ? [{ name: singleStateOf(built_in_kinds_1.AmbientSingleState.Rng), mode: AmbientWriteMode.Local }] : [], unknown: false } : scopedWrites(scope, args, bound, local);
|
|
858
997
|
const cds = data.cds ? [...data.cds] : undefined;
|
|
859
|
-
const apply = (environment) =>
|
|
998
|
+
const apply = (environment) => family !== undefined ? deviceAccess({ ...info_1.DataflowInformation.initialize(rootId, data), environment }, rootId, data, local ? DeviceAccess.Switch : DeviceAccess.Open, family).environment
|
|
860
999
|
: defineAmbient(environment, rootId, cds, writes);
|
|
861
|
-
|
|
1000
|
+
let { information } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
862
1001
|
name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Default,
|
|
863
|
-
patchData: (d, i) => i
|
|
1002
|
+
patchData: (d, i) => isCode(args[i]) ? { ...d, environment: apply(d.environment) } : d
|
|
864
1003
|
});
|
|
1004
|
+
/* `capture.output` prints every visible value of its code into the diversion, as the top level does */
|
|
1005
|
+
for (const value of family === ambient_state_name_1.OutputSinks ? args.filter(isCode).map(r_argument_1.RArgument.valueOf) : []) {
|
|
1006
|
+
if (value !== undefined && autoPrints(value, information, data)) {
|
|
1007
|
+
const environment = information.environment;
|
|
1008
|
+
information = readsOfAutoPrint(information, value, { ...data, environment });
|
|
1009
|
+
(0, built_in_expression_list_1.printMethodsOf)(value.info.id, environment, information.graph, { graph: information.graph, idMap: data.completeAst.idMap, ctx: data.ctx, environment });
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
865
1012
|
if (unknown) {
|
|
866
1013
|
information.graph.markIdForUnknownSideEffects(rootId);
|
|
867
1014
|
}
|
|
868
1015
|
/* the state a scope changes around its code is back afterward */
|
|
869
|
-
const changed =
|
|
870
|
-
recordAmbient(information.graph, rootId, information.environment, [], code === undefined && !(
|
|
1016
|
+
const changed = family !== undefined ? activeStates(family) : writes;
|
|
1017
|
+
recordAmbient(information.graph, rootId, information.environment, [], code === undefined && !(family !== undefined && local) ? changed : changed.map(w => ({ name: typeof w === 'string' ? w : w.name, mode: AmbientWriteMode.Local })));
|
|
871
1018
|
if (code === undefined) {
|
|
872
1019
|
const applied = { ...information, environment: apply(information.environment) };
|
|
873
1020
|
/* the frame starts out with the state as it was */
|
|
@@ -876,13 +1023,13 @@ function processAmbientScope(name, args, rootId, data, scope) {
|
|
|
876
1023
|
/* afterward, what the scope changed is back to what it was before */
|
|
877
1024
|
let environment = information.environment;
|
|
878
1025
|
const keyed = keyedStateOf(scope);
|
|
879
|
-
const restored =
|
|
1026
|
+
const restored = family !== undefined ? family.states.flat()
|
|
880
1027
|
: scope.state === built_in_kinds_1.AmbientSingleState.Rng || scope.state === built_in_kinds_1.AmbientSingleState.WorkingDirectory ? [singleStateOf(scope.state)]
|
|
881
1028
|
: writes.map(w => typeof w === 'string' ? w : w.name).filter(n => keyed !== undefined && n.startsWith(ambient_state_name_1.AmbientStateName.keyed(keyed, '')) && n !== ambient_state_name_1.AmbientStateName.keyed(keyed, ambient_state_name_1.UnknownKey));
|
|
882
1029
|
for (const state of restored) {
|
|
883
1030
|
const before = resolve_helper_1.Resolve.byName(state, data.environment);
|
|
884
1031
|
/* an entry nothing set before keeps the scope's definition, we cannot tell R's default apart */
|
|
885
|
-
if ((before !== undefined && before.length > 0) || ((
|
|
1032
|
+
if ((before !== undefined && before.length > 0) || ((family !== undefined || scope.state === built_in_kinds_1.AmbientSingleState.Rng || scope.state === built_in_kinds_1.AmbientSingleState.WorkingDirectory) && data.environment.level === 0)) {
|
|
886
1033
|
environment = setAmbient(environment, state, before ?? []);
|
|
887
1034
|
}
|
|
888
1035
|
}
|
|
@@ -893,6 +1040,10 @@ function processAmbientScope(name, args, rootId, data, scope) {
|
|
|
893
1040
|
}
|
|
894
1041
|
return { ...information, environment };
|
|
895
1042
|
}
|
|
1043
|
+
/** The family of instances a scope opens one of for its code, `with_png` a device and `capture.output` a diversion of the output. */
|
|
1044
|
+
function scopedFamily(state) {
|
|
1045
|
+
return state === built_in_kinds_1.AmbientSingleState.Device ? ambient_state_name_1.GraphicsDevices : state === built_in_kinds_1.AmbientSingleState.Sink ? ambient_state_name_1.OutputSinks : undefined;
|
|
1046
|
+
}
|
|
896
1047
|
/** The keyed state an {@link AmbientScope} changes the entries of, `undefined` for a state without entries. */
|
|
897
1048
|
function keyedStateOf(scope) {
|
|
898
1049
|
return scope.state === ambient_state_name_1.KeyedState.Option || scope.state === ambient_state_name_1.KeyedState.Env || scope.state === ambient_state_name_1.KeyedState.Locale ? scope.state : undefined;
|
|
@@ -961,22 +1112,28 @@ function evaluatesCapturedCode(res, rootId, data) {
|
|
|
961
1112
|
}
|
|
962
1113
|
/** What the implicit `print` of a top-level value reads (see {@link readsOfAutoPrint}): every option if a method may print it (`dispatched`). */
|
|
963
1114
|
function autoPrintReads(dispatched) {
|
|
964
|
-
return optionReads(dispatched ? undefined : built_in_kinds_1.PrintingOptions);
|
|
1115
|
+
return [...optionReads(dispatched ? undefined : built_in_kinds_1.PrintingOptions), ambient_state_name_1.AmbientStateName.sink];
|
|
965
1116
|
}
|
|
966
|
-
/**
|
|
1117
|
+
/** what printing writes: it is part of the diversion of the output, see {@link OutputSinks} */
|
|
1118
|
+
exports.PrintWrites = [ambient_state_name_1.AmbientStateName.sinkOutput];
|
|
1119
|
+
/** R prints every visible top-level value (see {@link autoPrints}) by an implicit `print`, which reads the options the configured `print` reads for that value, and draws a plot object. */
|
|
967
1120
|
function readsOfAutoPrint(processed, expression, data) {
|
|
968
1121
|
const print = resolve_helper_1.Resolve.byNameAndType('print', { current: environment_1.REnvironment.findBuiltIn(data.environment.current), level: 0 }, identifier_1.ReferenceType.Function)?.slice(0, 1) ?? [];
|
|
969
|
-
const reads = print.flatMap(hiddenAccess).flatMap(
|
|
970
|
-
? printingReads(expression,
|
|
971
|
-
return withAccess(processed, expression.info.id, data, reads, []);
|
|
1122
|
+
const reads = print.flatMap(hiddenAccess).flatMap(effect => effect.family === ambient_state_name_1.KeyedState.Option && effect.access === ambient_effect_1.AmbientVerb.Reads
|
|
1123
|
+
? printingReads(expression, effect.dispatchOn !== undefined, typeof effect.member === 'object' && effect.member.from === 'constant' ? effect.member.keys : [], data) : []);
|
|
1124
|
+
return withAccess(processed, expression.info.id, data, [...reads, ambient_state_name_1.AmbientStateName.sink], [...exports.PrintWrites, ...mayHoldPlot(expression, data) ? DrawsNewPlot : []]);
|
|
972
1125
|
}
|
|
973
1126
|
/** the processors whose calls return invisibly, although their configuration states no {@link CallProp.Invisible} */
|
|
974
1127
|
const InvisibleProcessors = new Set([built_in_proc_name_1.BuiltInProcName.ForLoop, built_in_proc_name_1.BuiltInProcName.WhileLoop, built_in_proc_name_1.BuiltInProcName.RepeatLoop,
|
|
975
1128
|
built_in_proc_name_1.BuiltInProcName.Assignment, built_in_proc_name_1.BuiltInProcName.SuperAssignment, built_in_proc_name_1.BuiltInProcName.FunctionDefinition]);
|
|
1129
|
+
/** Whether R prints the visible values of the statements of the expression list `list`: those of the top level of the analyzed script, not of a sourced file. */
|
|
1130
|
+
function autoPrintsStatementsOf(list, data) {
|
|
1131
|
+
return data.referenceChain.length <= 1 && data.environment.level === 0 && data.completeAst.ast.files.some(f => f.root.info.id === list);
|
|
1132
|
+
}
|
|
976
1133
|
/** whether the value of the top-level `expression` is visible, so that R prints it, decided on its vertex */
|
|
977
1134
|
function autoPrints(expression, processed, data) {
|
|
978
1135
|
const vertex = processed.graph.getVertex(expression.info.id);
|
|
979
|
-
if (vertex === undefined
|
|
1136
|
+
if (vertex === undefined) {
|
|
980
1137
|
return false;
|
|
981
1138
|
}
|
|
982
1139
|
else if (!vertex_1.DfgVertex.isFunctionCall(vertex)) {
|
|
@@ -985,9 +1142,16 @@ function autoPrints(expression, processed, data) {
|
|
|
985
1142
|
else if (Array.isArray(vertex.origin) && vertex.origin.some(o => InvisibleProcessors.has(o))) {
|
|
986
1143
|
return false;
|
|
987
1144
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1145
|
+
else if (r_expression_list_1.RExpressionList.is(expression) && expression.grouping?.[0].lexeme === '{' && vertex.onlyBuiltin && expression.children.length > 0) {
|
|
1146
|
+
/* a block hands on its last value, visible or not */
|
|
1147
|
+
return autoPrints(expression.children[expression.children.length - 1], processed, data);
|
|
1148
|
+
}
|
|
1149
|
+
return !returnsInvisibly(vertex.name, data.environment);
|
|
1150
|
+
}
|
|
1151
|
+
/** `invisible`, `library`, ...: whether everything `name` resolves to returns invisibly */
|
|
1152
|
+
function returnsInvisibly(name, environment) {
|
|
1153
|
+
const targets = resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.Function);
|
|
1154
|
+
return targets !== undefined && targets.length > 0 && targets.every(t => t.type === identifier_1.ReferenceType.BuiltInFunction && built_in_props_1.CallProps.hasAny(t.config, built_in_props_1.CallProp.Invisible));
|
|
991
1155
|
}
|
|
992
1156
|
/** A call through a variable bound to a built-in (`p <- par; p(...)`), only revealed when linking the statement's calls. */
|
|
993
1157
|
function applyAmbientStateOfCalledBuiltIns(res, callId, builtIns, before, graph, data) {
|
|
@@ -998,7 +1162,7 @@ function applyAmbientStateOfCalledBuiltIns(res, callId, builtIns, before, graph,
|
|
|
998
1162
|
const known = res.unknownReferences.length;
|
|
999
1163
|
for (const builtIn of builtIns) {
|
|
1000
1164
|
const targets = node_id_1.NodeId.isBuiltIn(builtIn) ? resolve_helper_1.Resolve.byNameAndType(node_id_1.NodeId.fromBuiltIn(builtIn), before, identifier_1.ReferenceType.Function) ?? [] : [];
|
|
1001
|
-
res =
|
|
1165
|
+
res = applyAmbientEffects(res, call.arguments, callId, data, targets.flatMap(hiddenAccess));
|
|
1002
1166
|
hiddenSideEffects(graph, before, callId, targets);
|
|
1003
1167
|
}
|
|
1004
1168
|
const access = res.graph.ambientAccessOf(callId);
|
|
@@ -1088,12 +1252,16 @@ function rejectsArguments(definition, call) {
|
|
|
1088
1252
|
const given = call.arguments.filter(a => a !== r_function_call_1.EmptyArgument);
|
|
1089
1253
|
return given.length > names.length || given.some(a => a.name !== undefined && !names.some(n => n.startsWith(identifier_1.Identifier.getName(a.name?.content ?? ''))));
|
|
1090
1254
|
}
|
|
1255
|
+
/** Whether `id` follows a statement that always exits, so it never runs and has no vertex. */
|
|
1256
|
+
function unanalyzed(id, graph, data) {
|
|
1257
|
+
return data.unreachable?.has(id) === true && !graph.hasVertex(id);
|
|
1258
|
+
}
|
|
1091
1259
|
/** what may warn when `root` runs, see {@link WarningSiteMode}, `bodies` holds what may in the bodies of the closures seen so far */
|
|
1092
1260
|
function warningSites(root, graph, data, bodies, mode) {
|
|
1093
1261
|
const sites = [];
|
|
1094
1262
|
const { signal } = mode;
|
|
1095
1263
|
model_1.RNode.visitAst(root, node => {
|
|
1096
|
-
if (r_function_definition_1.RFunctionDefinition.is(node)) {
|
|
1264
|
+
if (r_function_definition_1.RFunctionDefinition.is(node) || unanalyzed(node.info.id, graph, data)) {
|
|
1097
1265
|
return true;
|
|
1098
1266
|
}
|
|
1099
1267
|
else if (r_binary_op_1.RBinaryOp.is(node) ? r_binary_op_1.RBinaryOp.getOperatorInfo(node)?.usedAs !== base_operators_1.OperatorUsedAs.Assignment : r_unary_op_1.RUnaryOp.is(node) || r_access_1.RAccess.is(node)) {
|
|
@@ -1111,7 +1279,7 @@ function warningSites(root, graph, data, bodies, mode) {
|
|
|
1111
1279
|
}
|
|
1112
1280
|
return false;
|
|
1113
1281
|
}
|
|
1114
|
-
if (mode.muffled &&
|
|
1282
|
+
if (mode.muffled && targets.length > 0 && targets.every(t => t.type === identifier_1.ReferenceType.BuiltInFunction && t.config?.muffles?.includes('warning') === true)) {
|
|
1115
1283
|
return true;
|
|
1116
1284
|
}
|
|
1117
1285
|
const handlers = mode.muffled ? muffledHandlers(node, graph, data) : undefined;
|
|
@@ -1146,10 +1314,9 @@ function warningSites(root, graph, data, bodies, mode) {
|
|
|
1146
1314
|
});
|
|
1147
1315
|
return sites;
|
|
1148
1316
|
}
|
|
1149
|
-
/** Whether `node` branches or loops on a value
|
|
1317
|
+
/** Whether `node` branches or loops on a value R may reject: a condition that is not `TRUE` or `FALSE` (`if(NA)`, `if(logical(0))`) or a vector that is not a constant. */
|
|
1150
1318
|
function testsValue(node) {
|
|
1151
|
-
|
|
1152
|
-
return tested !== undefined && !model_1.RConstant.is(tested);
|
|
1319
|
+
return r_if_then_else_1.RIfThenElse.is(node) || r_while_loop_1.RWhileLoop.is(node) ? !r_logical_1.RLogical.is(node.condition) : r_for_loop_1.RForLoop.is(node) && !model_1.RConstant.is(node.vector);
|
|
1153
1320
|
}
|
|
1154
1321
|
/** The handlers of a `withCallingHandlers` whose first handler muffles every `warning` of its `expr`, `undefined` otherwise. */
|
|
1155
1322
|
function muffledHandlers(call, graph, data) {
|