@eagleoutice/flowr 2.16.2 → 2.16.4
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 +15 -15
- package/abstract-interpretation/data-frame/arguments.js +4 -3
- package/abstract-interpretation/data-frame/dataframe-semantics.js +1 -2
- package/abstract-interpretation/data-frame/semantics.d.ts +2 -2
- package/abstract-interpretation/data-frame/semantics.js +2 -6
- package/benchmark/slicer.js +1 -3
- package/benchmark/summarizer/first-phase/input.js +1 -12
- package/benchmark/summarizer/second-phase/process.d.ts +7 -0
- package/benchmark/summarizer/second-phase/process.js +15 -12
- package/cli/repl/commands/repl-cfg.js +18 -49
- package/cli/repl/commands/repl-clipboard.d.ts +2 -0
- package/cli/repl/commands/repl-clipboard.js +5 -0
- package/cli/repl/commands/repl-commands.js +2 -2
- package/cli/repl/commands/repl-dataflow.js +21 -55
- package/cli/repl/commands/repl-normalize.js +15 -28
- package/cli/repl/commands/repl-parse.js +2 -2
- package/cli/repl/commands/repl-query.js +10 -10
- package/cli/repl/commands/repl-signature.js +4 -4
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +8 -30
- package/cli/repl/server/messages/message-analysis.js +1 -1
- package/config.d.ts +6 -0
- package/config.js +7 -4
- package/control-flow/cfg-dead-code.js +5 -14
- package/control-flow/cfg-to-basic-blocks.js +1 -6
- package/control-flow/control-flow-graph.d.ts +2 -16
- package/control-flow/control-flow-graph.js +8 -66
- package/control-flow/diff-cfg.js +10 -23
- package/control-flow/semantic-cfg-guided-visitor.js +5 -11
- package/control-flow/simple-visitor.js +2 -2
- package/core/steps/pipeline/default-pipelines.d.ts +138 -138
- package/data/r-base-packages.generated.js +0 -1
- package/data/r-base-primitives.generated.js +0 -1
- package/data/r-s3-generics.generated.d.ts +5 -0
- package/data/r-s3-generics.generated.js +103 -0
- package/dataflow/cluster.js +2 -1
- package/dataflow/environments/append.d.ts +1 -0
- package/dataflow/environments/built-in-props.d.ts +10 -0
- package/dataflow/environments/built-in-props.js +25 -1
- package/dataflow/environments/built-in.js +15 -9
- package/dataflow/environments/clone.d.ts +1 -0
- package/dataflow/environments/clone.js +1 -0
- package/dataflow/environments/default-builtin-config.d.ts +188 -14
- package/dataflow/environments/default-builtin-config.js +125 -65
- package/dataflow/environments/define.d.ts +1 -0
- package/dataflow/environments/define.js +1 -0
- package/dataflow/environments/environment.d.ts +27 -0
- package/dataflow/environments/environment.js +37 -16
- package/dataflow/environments/frame-memory.d.ts +9 -1
- package/dataflow/environments/frame-memory.js +12 -1
- package/dataflow/environments/identifier.d.ts +0 -2
- package/dataflow/environments/identifier.js +5 -7
- package/dataflow/environments/overwrite.js +1 -0
- package/dataflow/environments/query-fn-props.js +4 -4
- package/dataflow/environments/scoping.d.ts +3 -0
- package/dataflow/environments/scoping.js +3 -0
- package/dataflow/eval/resolve/alias-tracking.js +3 -3
- package/dataflow/eval/resolve/resolve-argument.d.ts +7 -3
- package/dataflow/eval/resolve/resolve-argument.js +16 -11
- package/dataflow/eval/resolve/resolve-numbers.js +5 -2
- package/dataflow/eval/resolve/resolve-strings.d.ts +1 -1
- package/dataflow/eval/resolve/resolve-working-directory.js +2 -2
- package/dataflow/eval/resolve/resolve.js +3 -8
- package/dataflow/eval/values/intervals/interval-constants.js +1 -6
- package/dataflow/eval/values/r-value.js +1 -6
- package/dataflow/extractor.js +17 -17
- package/dataflow/fn/argument-roles.js +15 -15
- package/dataflow/fn/class-declaration.js +7 -7
- package/dataflow/fn/frame-reflection.d.ts +1 -23
- package/dataflow/fn/frame-reflection.js +8 -95
- package/dataflow/fn/function-props.d.ts +0 -3
- package/dataflow/fn/function-props.js +9 -11
- package/dataflow/fn/function-semantics.d.ts +1 -0
- package/dataflow/fn/strict-function.js +15 -14
- package/dataflow/graph/call-graph.d.ts +8 -0
- package/dataflow/graph/call-graph.js +40 -25
- package/dataflow/graph/dataflowgraph-builder.d.ts +0 -60
- package/dataflow/graph/dataflowgraph-builder.js +15 -135
- package/dataflow/graph/df-helper.d.ts +56 -4
- package/dataflow/graph/df-helper.js +116 -1
- package/dataflow/graph/diff-dataflow-graph.js +13 -15
- package/dataflow/graph/graph-helper.d.ts +20 -0
- package/dataflow/graph/graph-helper.js +18 -0
- package/dataflow/graph/graph.js +3 -8
- package/dataflow/graph/match-args.d.ts +1 -1
- package/dataflow/graph/match-args.js +3 -3
- package/dataflow/internal/linker.d.ts +4 -10
- package/dataflow/internal/linker.js +21 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +39 -22
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +6 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +27 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +33 -35
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +6 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +12 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +7 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +5 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +8 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +36 -38
- package/dataflow/internal/process/functions/call/common.d.ts +3 -1
- package/dataflow/internal/process/functions/call/common.js +6 -7
- package/dataflow/internal/process/functions/call/deferred.js +8 -8
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +11 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +11 -7
- package/dataflow/internal/process/functions/call/named-call-handling.js +4 -3
- package/dataflow/internal/process/functions/call/nse.js +4 -4
- package/dataflow/internal/process/functions/call/quoted.js +16 -14
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
- package/dataflow/internal/process/functions/process-parameter.js +2 -2
- package/dataflow/internal/process/process-named-call.js +1 -1
- package/dataflow/origin/dfg-get-origin.js +2 -2
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -0
- package/dataflow/origin/dfg-get-symbol-refs.js +3 -8
- package/documentation/data/faq/wiki-faq-store.js +2 -2
- package/documentation/doc-capabilities.js +2 -1
- package/documentation/doc-util/doc-functions.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +1 -1
- package/documentation/doc-util/doc-query.js +3 -1
- package/documentation/doc-util/doc-repl.js +4 -4
- package/documentation/doc-util/doc-timings.js +3 -2
- package/documentation/doc-util/doc-types.js +2 -2
- package/documentation/wiki-absint.js +2 -1
- package/documentation/wiki-cfg.js +2 -1
- package/documentation/wiki-create-linting-rules.js +2 -2
- package/documentation/wiki-dataflow-graph.js +6 -6
- package/documentation/wiki-interface.js +3 -2
- package/documentation/wiki-linter.d.ts +14 -0
- package/documentation/wiki-linter.js +353 -88
- package/documentation/wiki-mk/doc-maker.js +1 -2
- package/documentation/wiki-query.js +25 -0
- package/documentation/wiki-search.js +2 -1
- package/documentation/wiki-signature-database.js +0 -2
- package/linter/linter-executor.js +4 -0
- package/linter/linter-rules.d.ts +552 -35
- package/linter/linter-rules.js +39 -1
- package/linter/linter-tags.d.ts +6 -0
- package/linter/linter-tags.js +6 -0
- package/linter/rules/absolute-path.d.ts +1 -1
- package/linter/rules/absolute-path.js +9 -6
- package/linter/rules/cmd-check/bogus-return.d.ts +29 -0
- package/linter/rules/cmd-check/bogus-return.js +63 -0
- package/linter/rules/cmd-check/call-arguments.d.ts +63 -0
- package/linter/rules/cmd-check/call-arguments.js +216 -0
- package/linter/rules/cmd-check/class-string-comparison.d.ts +48 -0
- package/linter/rules/cmd-check/class-string-comparison.js +135 -0
- package/linter/rules/cmd-check/cmd-check-util.d.ts +67 -0
- package/linter/rules/cmd-check/cmd-check-util.js +169 -0
- package/linter/rules/cmd-check/compiled-code.d.ts +86 -0
- package/linter/rules/cmd-check/compiled-code.js +350 -0
- package/linter/rules/cmd-check/conformance.d.ts +51 -0
- package/linter/rules/cmd-check/conformance.js +166 -0
- package/linter/rules/cmd-check/dependency-declaration.d.ts +95 -0
- package/linter/rules/cmd-check/dependency-declaration.js +299 -0
- package/linter/rules/cmd-check/description-metadata.d.ts +63 -0
- package/linter/rules/cmd-check/description-metadata.js +393 -0
- package/linter/rules/cmd-check/documentation-mismatch.d.ts +60 -0
- package/linter/rules/cmd-check/documentation-mismatch.js +407 -0
- package/linter/rules/cmd-check/file-checks.d.ts +29 -0
- package/linter/rules/cmd-check/file-checks.js +34 -0
- package/linter/rules/cmd-check/foreign-function-calls.d.ts +54 -0
- package/linter/rules/cmd-check/foreign-function-calls.js +115 -0
- package/linter/rules/cmd-check/global-environment-modification.d.ts +61 -0
- package/linter/rules/cmd-check/global-environment-modification.js +237 -0
- package/linter/rules/cmd-check/namespace-tampering.d.ts +52 -0
- package/linter/rules/cmd-check/namespace-tampering.js +162 -0
- package/linter/rules/cmd-check/non-ascii-code.d.ts +51 -0
- package/linter/rules/cmd-check/non-ascii-code.js +112 -0
- package/linter/rules/cmd-check/package-code.d.ts +30 -0
- package/linter/rules/cmd-check/package-code.js +141 -0
- package/linter/rules/cmd-check/package-data.d.ts +51 -0
- package/linter/rules/cmd-check/package-data.js +181 -0
- package/linter/rules/cmd-check/package-files.d.ts +41 -0
- package/linter/rules/cmd-check/package-files.js +157 -0
- package/linter/rules/cmd-check/package-hooks.d.ts +57 -0
- package/linter/rules/cmd-check/package-hooks.js +173 -0
- package/linter/rules/cmd-check/package-metafiles.d.ts +49 -0
- package/linter/rules/cmd-check/package-metafiles.js +292 -0
- package/linter/rules/cmd-check/package-runtime.d.ts +67 -0
- package/linter/rules/cmd-check/package-runtime.js +284 -0
- package/linter/rules/cmd-check/package-structure.d.ts +85 -0
- package/linter/rules/cmd-check/package-structure.js +320 -0
- package/linter/rules/cmd-check/rd-files.d.ts +83 -0
- package/linter/rules/cmd-check/rd-files.js +621 -0
- package/linter/rules/cmd-check/s-three-method-consistency.d.ts +72 -0
- package/linter/rules/cmd-check/s-three-method-consistency.js +206 -0
- package/linter/rules/cmd-check/true-false-abbreviation.d.ts +45 -0
- package/linter/rules/cmd-check/true-false-abbreviation.js +121 -0
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +1 -1
- package/linter/rules/dead-code.d.ts +4 -4
- package/linter/rules/dead-code.js +19 -4
- package/linter/rules/deprecated-functions.d.ts +1 -1
- package/linter/rules/deprecated-functions.js +5 -5
- package/linter/rules/file-path-validity.d.ts +6 -2
- package/linter/rules/file-path-validity.js +7 -3
- package/linter/rules/namespace-access.d.ts +3 -3
- package/linter/rules/namespace-access.js +12 -3
- package/linter/rules/naming-convention.d.ts +2 -2
- package/linter/rules/naming-convention.js +14 -15
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/network-functions.js +1 -1
- package/linter/rules/no-leaked-credentials.d.ts +1 -1
- package/linter/rules/no-leaked-credentials.js +5 -5
- package/linter/rules/problematic-inputs.d.ts +2 -2
- package/linter/rules/problematic-inputs.js +4 -3
- package/linter/rules/roxygen-arguments.d.ts +2 -2
- package/linter/rules/roxygen-arguments.js +2 -2
- package/linter/rules/seeded-randomness.d.ts +2 -2
- package/linter/rules/seeded-randomness.js +7 -7
- package/linter/rules/software-has-license.d.ts +3 -3
- package/linter/rules/software-has-license.js +3 -3
- package/linter/rules/software-has-tests.d.ts +2 -2
- package/linter/rules/software-has-tests.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +3 -3
- package/linter/rules/stop-with-call-arg.js +21 -4
- package/linter/rules/syntactically-valid.d.ts +1 -1
- package/linter/rules/syntactically-valid.js +1 -1
- package/linter/rules/unclosed-connection.d.ts +2 -2
- package/linter/rules/unclosed-connection.js +5 -5
- package/linter/rules/undefined-symbol-util.js +16 -32
- package/linter/rules/undefined-symbol.d.ts +3 -1
- package/linter/rules/undefined-symbol.js +34 -4
- package/linter/rules/unescaped-arguments.d.ts +1 -1
- package/linter/rules/unescaped-arguments.js +11 -10
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/unused-definition.js +14 -20
- package/linter/rules/unused-import.d.ts +1 -1
- package/linter/rules/unused-import.js +1 -1
- package/linter/rules/useless-loop.d.ts +1 -1
- package/linter/rules/useless-loop.js +1 -1
- package/package.json +1 -1
- package/project/cache/flowr-analyzer-cache.js +1 -1
- package/project/context/flowr-analyzer-context.js +1 -1
- package/project/context/flowr-analyzer-environment-context.d.ts +2 -2
- package/project/context/flowr-analyzer-environment-context.js +2 -1
- package/project/context/flowr-analyzer-files-context.d.ts +6 -0
- package/project/context/flowr-analyzer-files-context.js +15 -11
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +0 -2
- package/project/context/flowr-analyzer-incremental-analysis-context.js +0 -4
- package/project/context/flowr-file.d.ts +4 -0
- package/project/context/flowr-file.js +4 -0
- package/project/flowr-analyzer-builder.js +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +2 -2
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +4 -0
- package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-manifest-files.js +11 -14
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +3 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +25 -15
- package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +44 -0
- package/project/plugins/file-plugins/files/flowr-rd-file.js +130 -61
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -16
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +4 -0
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +4 -0
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +0 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +2 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +3 -7
- package/project/sigdb/build.js +16 -30
- package/project/sigdb/dict.d.ts +4 -6
- package/project/sigdb/dict.js +125 -31
- package/project/sigdb/reader.js +2 -18
- package/project/sigdb/sigdb-download.js +14 -23
- package/queries/base-query-format.d.ts +2 -0
- package/queries/base-query-format.js +10 -2
- package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
- package/queries/catalog/absint-query/absint-query-format.js +5 -7
- package/queries/catalog/call-context-query/call-context-query-executor.js +24 -32
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -3
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -4
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -4
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -3
- package/queries/catalog/config-query/config-query-format.js +3 -3
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -3
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -3
- package/queries/catalog/dependencies-query/data-flow.d.ts +45 -0
- package/queries/catalog/dependencies-query/data-flow.js +179 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +18 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +108 -12
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +17 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +14 -11
- package/queries/catalog/dependencies-query/function-info/derived-functions.js +2 -1
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.js +13 -13
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +3 -3
- package/queries/catalog/dependencies-query/function-info/source-functions.js +2 -2
- package/queries/catalog/dependencies-query/function-info/test-functions.js +8 -8
- package/queries/catalog/dependencies-query/function-info/transform-functions.d.ts +8 -0
- package/queries/catalog/dependencies-query/function-info/transform-functions.js +17 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +4 -0
- package/queries/catalog/dependencies-query/implicit-echo.d.ts +5 -3
- package/queries/catalog/dependencies-query/implicit-echo.js +36 -35
- package/queries/catalog/dependencies-query/link-devices.d.ts +3 -2
- package/queries/catalog/dependencies-query/link-devices.js +9 -6
- package/queries/catalog/dependencies-query/plot-description.d.ts +10 -0
- package/queries/catalog/dependencies-query/plot-description.js +119 -0
- package/queries/catalog/dependencies-query/plot-objects.d.ts +13 -0
- package/queries/catalog/dependencies-query/plot-objects.js +61 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +2 -2
- package/queries/catalog/dice-query/dice-query-format.js +3 -40
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
- package/queries/catalog/does-call-query/does-call-query-format.js +2 -2
- package/queries/catalog/function-info-query/function-info-query-format.js +2 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +2 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -3
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -3
- package/queries/catalog/input-sources-query/simple-input-classifier.js +28 -29
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +4 -7
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +1 -1
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +3 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
- package/queries/catalog/linter-query/linter-query-executor.js +10 -3
- package/queries/catalog/linter-query/linter-query-format.d.ts +4 -1
- package/queries/catalog/linter-query/linter-query-format.js +32 -21
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -3
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -3
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.js +4 -5
- package/queries/catalog/project-query/project-query-format.js +2 -2
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -4
- package/queries/catalog/search-query/search-query-format.js +1 -3
- package/queries/catalog/signature-query/signature-query-executor.js +3 -3
- package/queries/catalog/signature-query/signature-query-format.js +2 -2
- package/queries/catalog/slice-query-options.d.ts +16 -0
- package/queries/catalog/slice-query-options.js +28 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -42
- package/queries/query-print.d.ts +4 -0
- package/queries/query-print.js +17 -1
- package/queries/query.d.ts +3 -3
- package/queries/query.js +3 -4
- package/r-bridge/lang-4.x/ast/model/model.d.ts +27 -3
- package/r-bridge/lang-4.x/ast/model/model.js +28 -1
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +20 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +25 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +18 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +15 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +17 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +20 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/operators.js +0 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -6
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -6
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -3
- package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -20
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -9
- 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 +2 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -11
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -11
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +6 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +7 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +0 -10
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +30 -82
- package/r-bridge/retriever.d.ts +0 -4
- package/r-bridge/retriever.js +0 -13
- package/r-bridge/roxygen2/documentation-provider.js +3 -7
- package/r-bridge/shell.js +3 -8
- package/reconstruct/auto-select/magic-comments.js +8 -7
- package/reconstruct/inline/source-inline-map.d.ts +3 -0
- package/reconstruct/inline/source-inline-map.js +8 -7
- package/reconstruct/reconstruct.d.ts +1 -1
- package/reconstruct/reconstruct.js +33 -109
- package/search/flowr-search-printer.js +4 -15
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/filters/all-variables.js +1 -2
- package/slicing/static/fingerprint.js +11 -2
- package/slicing/static/slice-call.d.ts +2 -8
- package/slicing/static/slice-call.js +8 -18
- package/slicing/static/static-slicer.js +81 -6
- package/util/collections/arrays.js +1 -1
- package/util/collections/set.js +1 -1
- package/util/diff-graph.d.ts +4 -0
- package/util/diff-graph.js +12 -0
- package/util/files.js +2 -6
- package/util/json.js +1 -15
- package/util/mermaid/cfg.js +10 -17
- package/util/mermaid/dfg.js +6 -8
- package/util/objects.d.ts +1 -1
- package/util/quads.js +4 -13
- package/util/r-author.js +5 -5
- package/util/range.d.ts +9 -0
- package/util/range.js +11 -0
- package/util/schema.js +3 -3
- package/util/simple-df/dfg-view.js +2 -1
- package/util/text/ansi.js +1 -2
- package/util/text/playground-link.js +2 -1
- package/util/text/r-highlight.js +2 -1
- package/util/text/strings.d.ts +2 -0
- package/util/text/strings.js +5 -0
- package/util/text/time.js +1 -2
- package/util/version.js +4 -3
- package/dataflow/fn/recursive-function.d.ts +0 -6
- package/dataflow/fn/recursive-function.js +0 -32
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +0 -16
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +0 -27
|
@@ -4,6 +4,7 @@ import { Identifier, type IdentifierDefinition } from './identifier';
|
|
|
4
4
|
* Define an identifier in the environment, possibly as a super assignment.
|
|
5
5
|
* This recalculates the level.
|
|
6
6
|
* With `append`, a super assignment keeps the definitions the name already has instead of replacing them.
|
|
7
|
+
* @useInstead {@link REnvironment.define}
|
|
7
8
|
*/
|
|
8
9
|
export declare function define(definition: IdentifierDefinition & {
|
|
9
10
|
name: Identifier;
|
|
@@ -6,6 +6,7 @@ const identifier_1 = require("./identifier");
|
|
|
6
6
|
* Define an identifier in the environment, possibly as a super assignment.
|
|
7
7
|
* This recalculates the level.
|
|
8
8
|
* With `append`, a super assignment keeps the definitions the name already has instead of replacing them.
|
|
9
|
+
* @useInstead {@link REnvironment.define}
|
|
9
10
|
*/
|
|
10
11
|
function define(definition, superAssign, { level, current }, append = false) {
|
|
11
12
|
const newEnv = superAssign ? current.defineSuper(definition, append) : current.define(definition);
|
|
@@ -2,6 +2,11 @@ import type { BuiltInMemory } from './built-in';
|
|
|
2
2
|
import type { BrandedIdentifier, IdentifierDefinition, ReferenceType } from './identifier';
|
|
3
3
|
import { Identifier } from './identifier';
|
|
4
4
|
import type { ControlDependency } from '../info';
|
|
5
|
+
import { appendEnvironment } from './append';
|
|
6
|
+
import { define as defineInEnvironment } from './define';
|
|
7
|
+
import { overwriteEnvironment } from './overwrite';
|
|
8
|
+
import { cloneEnvironmentInformation } from './clone';
|
|
9
|
+
import { cleanEnvOf, popLocalEnvironment, pushLocalEnvironment } from './scoping';
|
|
5
10
|
import { Frame } from './frame-memory';
|
|
6
11
|
import type { MemoryView } from './frame-memory';
|
|
7
12
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
@@ -128,6 +133,10 @@ export declare class Environment implements IEnvironment {
|
|
|
128
133
|
}
|
|
129
134
|
/** Walks up to the global environment (see {@link Environment#globalEnv}), falling back to the last non-builtin env. */
|
|
130
135
|
declare function findGlobalEnvironment(this: void, env: Environment): Environment;
|
|
136
|
+
/** The frames from `env` outwards, excluding the built-in environment. */
|
|
137
|
+
declare function framesOf(this: void, env: Environment): Generator<Environment, void, undefined>;
|
|
138
|
+
/** The frames below the global environment of `env`, i.e. the layers of the `search()` path, innermost first. */
|
|
139
|
+
declare function searchPathOf(this: void, env: Environment): Generator<Environment, void, undefined>;
|
|
131
140
|
/** Walks up to the built-in environment. */
|
|
132
141
|
declare function findBuiltInEnvironment(this: void, env: Environment): Environment;
|
|
133
142
|
/** The `search()` position directly below the global environment; where R attaches by default. */
|
|
@@ -161,12 +170,30 @@ export declare const REnvironment: {
|
|
|
161
170
|
readonly findGlobal: typeof findGlobalEnvironment;
|
|
162
171
|
/** Walks up to the built-in environment; see {@link findBuiltInEnvironment}. */
|
|
163
172
|
readonly findBuiltIn: typeof findBuiltInEnvironment;
|
|
173
|
+
/** The frames from an environment outwards, without the built-in one; see {@link framesOf}. */
|
|
174
|
+
readonly frames: typeof framesOf;
|
|
175
|
+
/** The layers below the global environment, innermost first; see {@link searchPathOf}. */
|
|
176
|
+
readonly searchPath: typeof searchPathOf;
|
|
164
177
|
/** Attaches a package block at a `search()` position, below the global by default; see {@link attachPackageAt}. */
|
|
165
178
|
readonly attachAt: typeof attachPackageAt;
|
|
166
179
|
/** The `search()` position of a named entry; see {@link searchPositionOf}. */
|
|
167
180
|
readonly searchPosition: typeof searchPositionOf;
|
|
168
181
|
/** The packages on the search path; see {@link attachedPackagesOf}. */
|
|
169
182
|
readonly attachedPackages: typeof attachedPackagesOf;
|
|
183
|
+
/** Defines an identifier in the environment, as a super assignment if asked; returns the new environment information. */
|
|
184
|
+
readonly define: typeof defineInEnvironment;
|
|
185
|
+
/** Adds all writes of `next` to `base` as things that might happen; see {@link appendEnvironment}. */
|
|
186
|
+
readonly append: typeof appendEnvironment;
|
|
187
|
+
/** Lets the definitions of `next` replace those of `base` by name; see {@link overwriteEnvironment}. */
|
|
188
|
+
readonly overwrite: typeof overwriteEnvironment;
|
|
189
|
+
/** Clones the environment information, with or without its parents; see {@link cloneEnvironmentInformation}. */
|
|
190
|
+
readonly clone: typeof cloneEnvironmentInformation;
|
|
191
|
+
/** Adds a local scope on top, see {@link REnvironment.popLocal} for the counterpart; see {@link pushLocalEnvironment}. */
|
|
192
|
+
readonly pushLocal: typeof pushLocalEnvironment;
|
|
193
|
+
/** Removes the top local scope, see {@link REnvironment.pushLocal} for the counterpart; see {@link popLocalEnvironment}. */
|
|
194
|
+
readonly popLocal: typeof popLocalEnvironment;
|
|
195
|
+
/** The search path of the environment with an empty global frame: attached packages stay visible, global binds do not; see {@link cleanEnvOf}. */
|
|
196
|
+
readonly cleanOf: typeof cleanEnvOf;
|
|
170
197
|
};
|
|
171
198
|
/**
|
|
172
199
|
* A ({@link IEnvironment#parent|scoped}) mapping of names to their definitions ({@link BuiltIns}).
|
|
@@ -12,6 +12,10 @@ const removal_marker_1 = require("./removal-marker");
|
|
|
12
12
|
const identifier_1 = require("./identifier");
|
|
13
13
|
const info_1 = require("../info");
|
|
14
14
|
const append_1 = require("./append");
|
|
15
|
+
const define_1 = require("./define");
|
|
16
|
+
const overwrite_1 = require("./overwrite");
|
|
17
|
+
const clone_1 = require("./clone");
|
|
18
|
+
const scoping_1 = require("./scoping");
|
|
15
19
|
const frame_memory_1 = require("./frame-memory");
|
|
16
20
|
const log_1 = require("../../util/log");
|
|
17
21
|
const defaultmap_1 = require("../../util/collections/defaultmap");
|
|
@@ -283,20 +287,14 @@ class Environment {
|
|
|
283
287
|
if (old === undefined && applyCds === undefined) {
|
|
284
288
|
frame.set(key, values);
|
|
285
289
|
}
|
|
286
|
-
else if (append) {
|
|
290
|
+
else if (append || applyCds === undefined) {
|
|
287
291
|
frame.set(key, (0, append_1.uniqueMergeValuesInDefinitions)(old ?? [], values));
|
|
288
292
|
}
|
|
289
293
|
else {
|
|
290
294
|
// we need to make a copy to avoid side effects for old reference in other environments
|
|
291
295
|
const updated = old?.slice() ?? [];
|
|
292
296
|
for (const v of values) {
|
|
293
|
-
if (updated.some(o => o.nodeId === v.nodeId && o.definedAt === v.definedAt)) {
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
296
|
-
if (applyCds === undefined) {
|
|
297
|
-
updated.push(v);
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
297
|
+
if (!updated.some(o => o.nodeId === v.nodeId && o.definedAt === v.definedAt)) {
|
|
300
298
|
updated.push({ ...v, cds: v.cds ? applyCds.concat(v.cds) : applyCds.slice() });
|
|
301
299
|
}
|
|
302
300
|
}
|
|
@@ -424,6 +422,16 @@ function findGlobalEnvironment(env) {
|
|
|
424
422
|
}
|
|
425
423
|
return current;
|
|
426
424
|
}
|
|
425
|
+
/** The frames from `env` outwards, excluding the built-in environment. */
|
|
426
|
+
function* framesOf(env) {
|
|
427
|
+
for (let e = env; !e.builtInEnv; e = e.parent) {
|
|
428
|
+
yield e;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/** The frames below the global environment of `env`, i.e. the layers of the `search()` path, innermost first. */
|
|
432
|
+
function searchPathOf(env) {
|
|
433
|
+
return framesOf(findGlobalEnvironment(env).parent);
|
|
434
|
+
}
|
|
427
435
|
/** Walks up to the built-in environment. */
|
|
428
436
|
function findBuiltInEnvironment(env) {
|
|
429
437
|
let current = env;
|
|
@@ -470,7 +478,7 @@ function searchPositionOf(env, name) {
|
|
|
470
478
|
return 1;
|
|
471
479
|
}
|
|
472
480
|
let pos = 1;
|
|
473
|
-
for (
|
|
481
|
+
for (const e of searchPathOf(env)) {
|
|
474
482
|
if (e.t === EnvType.Imports) {
|
|
475
483
|
continue; // internal layer, not a search-path entry
|
|
476
484
|
}
|
|
@@ -487,7 +495,7 @@ function searchPositionOf(env, name) {
|
|
|
487
495
|
*/
|
|
488
496
|
function attachedPackagesOf(env) {
|
|
489
497
|
const attached = new Set(["base" /* PkgName.Base */]);
|
|
490
|
-
for (
|
|
498
|
+
for (const e of searchPathOf(env)) {
|
|
491
499
|
if (e.t !== EnvType.Imports && e.n !== undefined) {
|
|
492
500
|
attached.add(e.n);
|
|
493
501
|
}
|
|
@@ -504,12 +512,30 @@ exports.REnvironment = {
|
|
|
504
512
|
findGlobal: findGlobalEnvironment,
|
|
505
513
|
/** Walks up to the built-in environment; see {@link findBuiltInEnvironment}. */
|
|
506
514
|
findBuiltIn: findBuiltInEnvironment,
|
|
515
|
+
/** The frames from an environment outwards, without the built-in one; see {@link framesOf}. */
|
|
516
|
+
frames: framesOf,
|
|
517
|
+
/** The layers below the global environment, innermost first; see {@link searchPathOf}. */
|
|
518
|
+
searchPath: searchPathOf,
|
|
507
519
|
/** Attaches a package block at a `search()` position, below the global by default; see {@link attachPackageAt}. */
|
|
508
520
|
attachAt: attachPackageAt,
|
|
509
521
|
/** The `search()` position of a named entry; see {@link searchPositionOf}. */
|
|
510
522
|
searchPosition: searchPositionOf,
|
|
511
523
|
/** The packages on the search path; see {@link attachedPackagesOf}. */
|
|
512
524
|
attachedPackages: attachedPackagesOf,
|
|
525
|
+
/** Defines an identifier in the environment, as a super assignment if asked; returns the new environment information. */
|
|
526
|
+
define: define_1.define,
|
|
527
|
+
/** Adds all writes of `next` to `base` as things that might happen; see {@link appendEnvironment}. */
|
|
528
|
+
append: append_1.appendEnvironment,
|
|
529
|
+
/** Lets the definitions of `next` replace those of `base` by name; see {@link overwriteEnvironment}. */
|
|
530
|
+
overwrite: overwrite_1.overwriteEnvironment,
|
|
531
|
+
/** Clones the environment information, with or without its parents; see {@link cloneEnvironmentInformation}. */
|
|
532
|
+
clone: clone_1.cloneEnvironmentInformation,
|
|
533
|
+
/** Adds a local scope on top, see {@link REnvironment.popLocal} for the counterpart; see {@link pushLocalEnvironment}. */
|
|
534
|
+
pushLocal: scoping_1.pushLocalEnvironment,
|
|
535
|
+
/** Removes the top local scope, see {@link REnvironment.pushLocal} for the counterpart; see {@link popLocalEnvironment}. */
|
|
536
|
+
popLocal: scoping_1.popLocalEnvironment,
|
|
537
|
+
/** The search path of the environment with an empty global frame: attached packages stay visible, global binds do not; see {@link cleanEnvOf}. */
|
|
538
|
+
cleanOf: scoping_1.cleanEnvOf,
|
|
513
539
|
};
|
|
514
540
|
/**
|
|
515
541
|
* Whether the package block `layers` ends with `tail` (a block grows at the front, so this is the shape two branches take
|
|
@@ -549,11 +575,6 @@ function splitLibraryLayers(env) {
|
|
|
549
575
|
}
|
|
550
576
|
/** Serializes an environment, replacing the built-in environment with a placeholder. */
|
|
551
577
|
function builtInEnvJsonReplacer(k, v) {
|
|
552
|
-
|
|
553
|
-
return '<BuiltInEnvironment>';
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
return (0, json_1.jsonReplacer)(k, v);
|
|
557
|
-
}
|
|
578
|
+
return isDefaultBuiltInEnvironment(v) ? '<BuiltInEnvironment>' : (0, json_1.jsonReplacer)(k, v);
|
|
558
579
|
}
|
|
559
580
|
//# sourceMappingURL=environment.js.map
|
|
@@ -43,6 +43,8 @@ export declare class Frame implements MemoryView {
|
|
|
43
43
|
* overlays again until the stack reaches {@link DefaultMaxOverlayDepth}, where a copy flattens it.
|
|
44
44
|
*/
|
|
45
45
|
forWrite(): Frame;
|
|
46
|
+
/** The attached package this frame binds, as long as nothing was written to it, see {@link LazyBindings}. */
|
|
47
|
+
lazy(): LazyBindings | undefined;
|
|
46
48
|
/** How many overlays are stacked below this one, which bounds what a lookup miss walks. */
|
|
47
49
|
private stacked;
|
|
48
50
|
set(name: BrandedIdentifier, defs: IdentifierDefinition[]): void;
|
|
@@ -75,8 +77,14 @@ export declare class Frame implements MemoryView {
|
|
|
75
77
|
export declare class LazyBindings implements MemoryView {
|
|
76
78
|
private readonly names;
|
|
77
79
|
private readonly bind;
|
|
80
|
+
readonly origin: string;
|
|
78
81
|
private readonly built;
|
|
79
|
-
|
|
82
|
+
/**
|
|
83
|
+
* @param names - the names this binds
|
|
84
|
+
* @param bind - builds the definitions of one name
|
|
85
|
+
* @param origin - what, besides the names, decides what `bind` returns, so the bindings can be told apart without building them
|
|
86
|
+
*/
|
|
87
|
+
constructor(names: ReadonlySet<BrandedIdentifier>, bind: (name: BrandedIdentifier) => IdentifierDefinition[], origin: string);
|
|
80
88
|
get(name: BrandedIdentifier): IdentifierDefinition[] | undefined;
|
|
81
89
|
has(name: BrandedIdentifier): boolean;
|
|
82
90
|
get size(): number;
|
|
@@ -74,6 +74,10 @@ class Frame {
|
|
|
74
74
|
}
|
|
75
75
|
return new Frame(new Map(this.bindings), false);
|
|
76
76
|
}
|
|
77
|
+
/** The attached package this frame binds, as long as nothing was written to it, see {@link LazyBindings}. */
|
|
78
|
+
lazy() {
|
|
79
|
+
return this.base === undefined && this.bindings instanceof LazyBindings ? this.bindings : undefined;
|
|
80
|
+
}
|
|
77
81
|
/** How many overlays are stacked below this one, which bounds what a lookup miss walks. */
|
|
78
82
|
stacked() {
|
|
79
83
|
let n = 0;
|
|
@@ -202,10 +206,17 @@ const EmptyFrame = Frame.of(new Map());
|
|
|
202
206
|
class LazyBindings {
|
|
203
207
|
names;
|
|
204
208
|
bind;
|
|
209
|
+
origin;
|
|
205
210
|
built = new Map();
|
|
206
|
-
|
|
211
|
+
/**
|
|
212
|
+
* @param names - the names this binds
|
|
213
|
+
* @param bind - builds the definitions of one name
|
|
214
|
+
* @param origin - what, besides the names, decides what `bind` returns, so the bindings can be told apart without building them
|
|
215
|
+
*/
|
|
216
|
+
constructor(names, bind, origin) {
|
|
207
217
|
this.names = names;
|
|
208
218
|
this.bind = bind;
|
|
219
|
+
this.origin = origin;
|
|
209
220
|
}
|
|
210
221
|
get(name) {
|
|
211
222
|
if (!this.names.has(name)) {
|
|
@@ -116,8 +116,6 @@ export declare const Identifier: {
|
|
|
116
116
|
* If the first identifier is internal, it will match any target (internal or not).
|
|
117
117
|
*/
|
|
118
118
|
readonly matches: (this: void, id: Identifier, target: Identifier, s3?: boolean) => boolean;
|
|
119
|
-
/** The text as a regex matches it literally: `[`, `$` and `.` name functions in R, they are not pattern syntax. */
|
|
120
|
-
readonly quote: (this: void, text: string) => string;
|
|
121
119
|
/**
|
|
122
120
|
* Helper to create a regular expression that matches against an array of {@link Identifier} values. If both the passed identifier and the matched identifier are namespaced, their namespaces are expected to match. If either is not namespaced, the namespace is ignored on both.
|
|
123
121
|
*/
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ReferenceTypeReverseMapping = exports.ReferenceType = exports.IdentifierView = exports.Identifier = void 0;
|
|
4
4
|
exports.isReferenceType = isReferenceType;
|
|
5
5
|
exports.hasEnvState = hasEnvState;
|
|
6
|
+
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
6
7
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
7
8
|
const strings_1 = require("../../util/text/strings");
|
|
8
9
|
const r_base_packages_1 = require("../../util/r-base-packages");
|
|
@@ -28,8 +29,9 @@ exports.Identifier = {
|
|
|
28
29
|
* Prefer {@link Identifier.from} for static config entries where namespace is always present and name has no backticks.
|
|
29
30
|
*/
|
|
30
31
|
make(name, namespace, internal = false) {
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const split = r_string_1.RString.splitQuotes(name);
|
|
33
|
+
if (split.quote === '`') {
|
|
34
|
+
name = split.content;
|
|
33
35
|
}
|
|
34
36
|
return namespace ? [name, namespace, internal] : name;
|
|
35
37
|
},
|
|
@@ -157,10 +159,6 @@ exports.Identifier = {
|
|
|
157
159
|
/* an omitted flag is the same as an explicit `false`, `pkg::fn` written either way is one identifier */
|
|
158
160
|
return exports.Identifier.accessesInternal(target) !== true;
|
|
159
161
|
},
|
|
160
|
-
/** The text as a regex matches it literally: `[`, `$` and `.` name functions in R, they are not pattern syntax. */
|
|
161
|
-
quote(text) {
|
|
162
|
-
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
163
|
-
},
|
|
164
162
|
/**
|
|
165
163
|
* Helper to create a regular expression that matches against an array of {@link Identifier} values. If both the passed identifier and the matched identifier are namespaced, their namespaces are expected to match. If either is not namespaced, the namespace is ignored on both.
|
|
166
164
|
*/
|
|
@@ -168,7 +166,7 @@ exports.Identifier = {
|
|
|
168
166
|
// if the passed identifier is not namespaced, we match against *any* namespace. if it is namespaced, we match against the correct namespace or no namespace
|
|
169
167
|
return new RegExp(`^(${identifiers.map(i => {
|
|
170
168
|
const namespace = exports.Identifier.getNamespace(i);
|
|
171
|
-
return `(${namespace === undefined ? '.+' :
|
|
169
|
+
return `(${namespace === undefined ? '.+' : (0, strings_1.escapeRegex)(namespace)}:::?)?${(0, strings_1.escapeRegex)(exports.Identifier.getName(i))}`;
|
|
172
170
|
}).join('|')})$`);
|
|
173
171
|
},
|
|
174
172
|
/** Special identifier for the `...` argument */
|
|
@@ -4,6 +4,7 @@ exports.overwriteEnvironment = overwriteEnvironment;
|
|
|
4
4
|
const scoping_1 = require("./scoping");
|
|
5
5
|
/**
|
|
6
6
|
* Definitions within `next` replace those in `base` by name; if all of `next`'s are maybe, they are appended instead (turning existing ones maybe too), like {@link appendEnvironment}.
|
|
7
|
+
* @useInstead {@link REnvironment.overwrite}
|
|
7
8
|
* @see {@link Environment.overwrite} - for details on how definitions are handled.
|
|
8
9
|
*/
|
|
9
10
|
function overwriteEnvironment(base, next, applyCds) {
|
|
@@ -35,7 +35,8 @@ function statedBuiltIn(definition, environment) {
|
|
|
35
35
|
return undefined;
|
|
36
36
|
}
|
|
37
37
|
const [pkg, fn] = pkgFn;
|
|
38
|
-
const
|
|
38
|
+
const builtIn = environment_1.REnvironment.findBuiltIn(environment.current);
|
|
39
|
+
const known = (builtIn.namespaces?.get(pkg)?.get(fn) ?? builtIn.memory.get(fn))
|
|
39
40
|
?.filter(d => d.type === identifier_1.ReferenceType.BuiltInFunction && identifier_1.Identifier.getNamespace(d.name ?? '') === pkg);
|
|
40
41
|
return known?.length ? known : undefined;
|
|
41
42
|
}
|
|
@@ -139,9 +140,8 @@ function callFnProps(id, { graph, environment }) {
|
|
|
139
140
|
}
|
|
140
141
|
/** Whether `id` is quoted only by calls shipping it to a worker (`future(expr)`, `%dopar%`), which still runs it. */
|
|
141
142
|
function quotedForWorker(id, graph, index) {
|
|
142
|
-
const quoting =
|
|
143
|
-
return quoting.length > 0 && quoting.every(s =>
|
|
144
|
-
&& node_id_1.NodeId.isBuiltIn(t) && ((index.propsOf(node_id_1.NodeId.fromBuiltIn(t)) ?? 0) & built_in_props_1.CallProp.Concurrent) !== 0));
|
|
143
|
+
const quoting = df_helper_1.Dataflow.sourcesOf(graph, id, edge_1.EdgeType.NonStandardEvaluation);
|
|
144
|
+
return quoting.length > 0 && quoting.every(s => df_helper_1.Dataflow.targetsOf(graph, s, edge_1.EdgeType.Calls).some(t => node_id_1.NodeId.isBuiltIn(t) && ((index.propsOf(node_id_1.NodeId.fromBuiltIn(t)) ?? 0) & built_in_props_1.CallProp.Concurrent) !== 0));
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* What the signature database implies for a package function: what its own entry states
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type REnvironmentInformation } from './environment';
|
|
2
2
|
/**
|
|
3
3
|
* Add a new local environment scope to the stack, returns the modified variant (shares the original stack, no deep-clone).
|
|
4
|
+
* @useInstead {@link REnvironment.pushLocal}
|
|
4
5
|
* @see {@link popLocalEnvironment} - to remove the local scope again
|
|
5
6
|
*/
|
|
6
7
|
export declare function pushLocalEnvironment({ level, current }: REnvironmentInformation): REnvironmentInformation;
|
|
7
8
|
/**
|
|
8
9
|
* Remove the top local environment scope from the stack, returns the modified variant (shares the original stack, no deep-clone).
|
|
10
|
+
* @useInstead {@link REnvironment.popLocal}
|
|
9
11
|
* @see {@link pushLocalEnvironment} - to add a local scope
|
|
10
12
|
*/
|
|
11
13
|
export declare function popLocalEnvironment({ current, level }: REnvironmentInformation): REnvironmentInformation;
|
|
@@ -19,5 +21,6 @@ export declare function padToCommonScope(base: REnvironmentInformation, next: RE
|
|
|
19
21
|
/**
|
|
20
22
|
* The environment's search path with an empty global frame: attached packages stay visible, the global frame's
|
|
21
23
|
* binds do not. Prefer this over `makeCleanEnv` wherever an environment is at hand; the chain below is shared.
|
|
24
|
+
* @useInstead {@link REnvironment.cleanOf}
|
|
22
25
|
*/
|
|
23
26
|
export declare function cleanEnvOf({ current }: REnvironmentInformation): REnvironmentInformation;
|
|
@@ -8,6 +8,7 @@ const environment_1 = require("./environment");
|
|
|
8
8
|
const assert_1 = require("../../util/assert");
|
|
9
9
|
/**
|
|
10
10
|
* Add a new local environment scope to the stack, returns the modified variant (shares the original stack, no deep-clone).
|
|
11
|
+
* @useInstead {@link REnvironment.pushLocal}
|
|
11
12
|
* @see {@link popLocalEnvironment} - to remove the local scope again
|
|
12
13
|
*/
|
|
13
14
|
function pushLocalEnvironment({ level, current }) {
|
|
@@ -18,6 +19,7 @@ function pushLocalEnvironment({ level, current }) {
|
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Remove the top local environment scope from the stack, returns the modified variant (shares the original stack, no deep-clone).
|
|
22
|
+
* @useInstead {@link REnvironment.popLocal}
|
|
21
23
|
* @see {@link pushLocalEnvironment} - to add a local scope
|
|
22
24
|
*/
|
|
23
25
|
function popLocalEnvironment({ current, level }) {
|
|
@@ -42,6 +44,7 @@ function padToCommonScope(base, next) {
|
|
|
42
44
|
/**
|
|
43
45
|
* The environment's search path with an empty global frame: attached packages stay visible, the global frame's
|
|
44
46
|
* binds do not. Prefer this over `makeCleanEnv` wherever an environment is at hand; the chain below is shared.
|
|
47
|
+
* @useInstead {@link REnvironment.cleanOf}
|
|
45
48
|
*/
|
|
46
49
|
function cleanEnvOf({ current }) {
|
|
47
50
|
const inner = environment_1.REnvironment.findGlobal(current);
|
|
@@ -26,6 +26,7 @@ const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol"
|
|
|
26
26
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
27
27
|
const resolve_helper_1 = require("../../environments/resolve-helper");
|
|
28
28
|
const node_value_1 = require("./node-value");
|
|
29
|
+
const df_helper_1 = require("../../graph/df-helper");
|
|
29
30
|
const AliasHandler = {
|
|
30
31
|
[vertex_1.VertexType.Value]: (sourceId) => [sourceId],
|
|
31
32
|
[vertex_1.VertexType.Use]: getUseAlias,
|
|
@@ -305,9 +306,8 @@ function parameterDefaultState(node, idMap, graph) {
|
|
|
305
306
|
if (!r_parameter_1.RParameter.is(bound) || bound.info.parent === undefined) {
|
|
306
307
|
return 'applies';
|
|
307
308
|
}
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
return calls === 0 ? 'unknown' : count(graph.edgesFrom(bound.name.info.id), edge_1.EdgeType.DefinedByOnCall) >= calls ? 'overridden' : 'applies';
|
|
309
|
+
const calls = df_helper_1.Dataflow.sourcesOf(graph, bound.info.parent, edge_1.EdgeType.Calls).length;
|
|
310
|
+
return calls === 0 ? 'unknown' : df_helper_1.Dataflow.targetsOf(graph, bound.name.info.id, edge_1.EdgeType.DefinedByOnCall).length >= calls ? 'overridden' : 'applies';
|
|
311
311
|
}
|
|
312
312
|
/**
|
|
313
313
|
* The sequence a use of a `for` loop's variable runs over, `undefined` when `id` is no such use. Every
|
|
@@ -3,9 +3,13 @@ import type { DataflowGraphVertexFunctionCall } from '../../graph/vertex';
|
|
|
3
3
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import type { VariableResolve } from '../../../config';
|
|
5
5
|
import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The index of the argument of `vertex` that binds the formal `argumentName`, R's matching when the formals are known and the `argumentIndex`-th unnamed argument otherwise.
|
|
8
|
+
* Pass the `formals` of the call when they are known already, which saves looking them up again.
|
|
9
|
+
*/
|
|
10
|
+
export declare function boundArgumentIndex<Idx extends number | 'unnamed' | undefined>(graph: DataflowGraph, vertex: DataflowGraphVertexFunctionCall, argumentIndex: Idx, argumentName: string, ctx: ReadOnlyFlowrAnalyzerContext, formals?: readonly string[]): Idx | number;
|
|
8
11
|
/**
|
|
9
12
|
* Get the values of all arguments matching the criteria, keyed by the id of the argument.
|
|
13
|
+
* Pass the `formals` of the call when they are known already, see {@link boundArgumentIndex}.
|
|
10
14
|
*/
|
|
11
|
-
export declare function getArgumentStringValue(variableResolve: VariableResolve, graph: DataflowGraph, vertex: DataflowGraphVertexFunctionCall, argumentIndex: number | 'unnamed' | undefined, argumentName: string | undefined, resolveValue: boolean | 'library' | undefined, ctx: ReadOnlyFlowrAnalyzerContext): Map<NodeId, Set<string | undefined>> | undefined;
|
|
15
|
+
export declare function getArgumentStringValue(variableResolve: VariableResolve, graph: DataflowGraph, vertex: DataflowGraphVertexFunctionCall, argumentIndex: number | 'unnamed' | undefined, argumentName: string | undefined, resolveValue: boolean | 'library' | undefined, ctx: ReadOnlyFlowrAnalyzerContext, formals?: readonly string[]): Map<NodeId, Set<string | undefined>> | undefined;
|
|
@@ -21,19 +21,23 @@ const string_constants_1 = require("../values/string/string-constants");
|
|
|
21
21
|
const resolve_helper_1 = require("../../environments/resolve-helper");
|
|
22
22
|
const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
23
23
|
const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The index of the argument of `vertex` that binds the formal `argumentName`, R's matching when the formals are known and the `argumentIndex`-th unnamed argument otherwise.
|
|
26
|
+
* Pass the `formals` of the call when they are known already, which saves looking them up again.
|
|
27
|
+
*/
|
|
28
|
+
function boundArgumentIndex(graph, vertex, argumentIndex, argumentName, ctx, formals) {
|
|
29
|
+
/* an exact name binds its formal whatever else the call does, so this needs no formals */
|
|
30
|
+
const exact = vertex.args.findIndex(arg => arg !== r_function_call_1.EmptyArgument && arg.name === argumentName);
|
|
31
|
+
if (exact >= 0) {
|
|
32
|
+
return exact;
|
|
33
|
+
}
|
|
34
|
+
const call = formals === undefined ? graph.idMap?.get(vertex.id) : undefined;
|
|
35
|
+
formals ??= r_function_call_1.RFunctionCall.is(call) ? match_args_1.MatchArgs.formalsOf(call, graph, ctx) : undefined;
|
|
28
36
|
if (formals?.includes(argumentName)) {
|
|
29
37
|
const bound = match_args_1.MatchArgs.toSpec(vertex.args, Object.fromEntries(formals.map(f => [f, f]))).get(argumentName)?.[0];
|
|
30
38
|
return bound === undefined ? vertex.args.length : vertex.args.findIndex(a => a !== r_function_call_1.EmptyArgument && a.nodeId === bound);
|
|
31
39
|
}
|
|
32
|
-
|
|
33
|
-
if (arg >= 0) {
|
|
34
|
-
return arg;
|
|
35
|
-
}
|
|
36
|
-
else if (typeof argumentIndex === 'number') {
|
|
40
|
+
if (typeof argumentIndex === 'number') {
|
|
37
41
|
/* a named argument takes no position, so the parameter binds the matching unnamed one */
|
|
38
42
|
const unnamed = vertex.args.flatMap((a, i) => a === r_function_call_1.EmptyArgument || !a.name ? [i] : []);
|
|
39
43
|
return unnamed[argumentIndex] ?? vertex.args.length;
|
|
@@ -42,10 +46,11 @@ function boundArgumentIndex(graph, vertex, argumentIndex, argumentName, ctx) {
|
|
|
42
46
|
}
|
|
43
47
|
/**
|
|
44
48
|
* Get the values of all arguments matching the criteria, keyed by the id of the argument.
|
|
49
|
+
* Pass the `formals` of the call when they are known already, see {@link boundArgumentIndex}.
|
|
45
50
|
*/
|
|
46
|
-
function getArgumentStringValue(variableResolve, graph, vertex, argumentIndex, argumentName, resolveValue, ctx) {
|
|
51
|
+
function getArgumentStringValue(variableResolve, graph, vertex, argumentIndex, argumentName, resolveValue, ctx, formals) {
|
|
47
52
|
if (argumentName && argumentIndex !== 'unnamed') {
|
|
48
|
-
argumentIndex = boundArgumentIndex(graph, vertex, argumentIndex, argumentName, ctx);
|
|
53
|
+
argumentIndex = boundArgumentIndex(graph, vertex, argumentIndex, argumentName, ctx, formals);
|
|
49
54
|
}
|
|
50
55
|
if (argumentIndex === undefined) {
|
|
51
56
|
return undefined;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NumericFold = exports.NumericFns = void 0;
|
|
4
4
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
5
5
|
const identifier_1 = require("../../environments/identifier");
|
|
6
|
+
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
6
7
|
const r_value_1 = require("../../../util/r-value");
|
|
7
8
|
const r_value_2 = require("../values/r-value");
|
|
8
9
|
const interval_constants_1 = require("../values/intervals/interval-constants");
|
|
@@ -126,8 +127,10 @@ function calledName(node) {
|
|
|
126
127
|
case type_1.RType.UnaryOp:
|
|
127
128
|
case type_1.RType.BinaryOp:
|
|
128
129
|
return node.operator;
|
|
129
|
-
case type_1.RType.FunctionCall:
|
|
130
|
-
|
|
130
|
+
case type_1.RType.FunctionCall: {
|
|
131
|
+
const name = r_function_call_1.RFunctionCall.calledName(node);
|
|
132
|
+
return name === undefined ? undefined : identifier_1.Identifier.getName(name);
|
|
133
|
+
}
|
|
131
134
|
default:
|
|
132
135
|
return undefined;
|
|
133
136
|
}
|
|
@@ -24,7 +24,7 @@ export interface StringFn {
|
|
|
24
24
|
/** parameters a call may supply that change nothing for the single strings we fold, like `paste`'s `collapse` */
|
|
25
25
|
readonly ignored?: readonly string[];
|
|
26
26
|
/** the fold over the supplied arguments, in declaration order */
|
|
27
|
-
|
|
27
|
+
fold(...args: unknown[]): string | number | undefined;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Every string built-in the value solver folds, the joining ones included: `paste` is an entry like `toupper`
|
|
@@ -10,12 +10,12 @@ const dependencies_query_format_1 = require("../../../queries/catalog/dependenci
|
|
|
10
10
|
const strings_1 = require("../../../util/text/strings");
|
|
11
11
|
const info_1 = require("../../info");
|
|
12
12
|
const edge_1 = require("../../graph/edge");
|
|
13
|
-
const frame_reflection_1 = require("../../fn/frame-reflection");
|
|
14
13
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
15
14
|
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
16
15
|
const files_1 = require("../../../util/files");
|
|
17
16
|
const built_in_source_1 = require("../../internal/process/functions/call/built-in/built-in-source");
|
|
18
17
|
const arrays_1 = require("../../../util/collections/arrays");
|
|
18
|
+
const df_helper_1 = require("../../graph/df-helper");
|
|
19
19
|
/** functions recognized as changing the working directory; a registry so more (e.g. `withr::with_dir`) can be added */
|
|
20
20
|
const ChangeFunctions = [
|
|
21
21
|
{ name: 'setwd', namespace: 'base', argIdx: 0, argName: 'dir' }
|
|
@@ -130,7 +130,7 @@ function collect(graph, ctx) {
|
|
|
130
130
|
// a function's setwd is propagated to its call sites; only a lone unconditional setwd has a site-independent effect
|
|
131
131
|
for (const [fn, setwds] of byFn.entries()) {
|
|
132
132
|
const net = setwds.length === 1 && setwds[0].cds.length === 0 && !setwds[0].iterated ? setwds[0].dir : undefined;
|
|
133
|
-
for (const site of
|
|
133
|
+
for (const site of df_helper_1.Dataflow.sourcesOf(graph, fn, edge_1.EdgeType.Calls)) {
|
|
134
134
|
const cds = graph.getVertex(site)?.cds ?? [];
|
|
135
135
|
out.push({ id: site, dir: net, cds, iterated: isIterated(cds, graph.idMap), enclosedInFunction: enclosingFunction(graph.idMap, site) !== undefined });
|
|
136
136
|
}
|
|
@@ -30,16 +30,12 @@ const r_expression_list_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/
|
|
|
30
30
|
*/
|
|
31
31
|
function evalHandlerOf(name, environment, ctx) {
|
|
32
32
|
/* without an environment the search path is unknown, so what a package states about the name has its say */
|
|
33
|
-
const defs = environment ? resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.BuiltInFunction) : builtInDefinitionsOf(name
|
|
33
|
+
const defs = environment ? resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.BuiltInFunction) : ctx.env.builtInDefinitionsOf(name);
|
|
34
34
|
const def = defs?.length === 1 ? defs[0] : undefined;
|
|
35
35
|
return def?.type === identifier_1.ReferenceType.BuiltInFunction ? def.evalHandler : undefined;
|
|
36
36
|
}
|
|
37
|
-
function builtInDefinitionsOf(name, ctx) {
|
|
38
|
-
return ctx.env.builtInEnvironment.memory.get(identifier_1.Identifier.getName(name))
|
|
39
|
-
?? ctx.env.statedDefinitionsOf(name);
|
|
40
|
-
}
|
|
41
37
|
function foldsThroughBuiltIn(name, ctx) {
|
|
42
|
-
return builtInDefinitionsOf(name
|
|
38
|
+
return ctx.env.builtInDefinitionsOf(name).some(d => d.type === identifier_1.ReferenceType.BuiltInFunction && d.evalHandler !== undefined);
|
|
43
39
|
}
|
|
44
40
|
/** the node types that may fold through a built-in: calls, operators, and the `(`/`{` groupings */
|
|
45
41
|
const EvalNodeTypes = [type_1.RType.FunctionCall, type_1.RType.BinaryOp, type_1.RType.UnaryOp, type_1.RType.ExpressionList];
|
|
@@ -60,8 +56,7 @@ function evalNameOf({ node, graph, environment, ctx }) {
|
|
|
60
56
|
}
|
|
61
57
|
else if (graph === undefined) {
|
|
62
58
|
const named = r_expression_list_1.RExpressionList.is(node) ? r_expression_list_1.RExpressionList.groupStart(node)?.content
|
|
63
|
-
: r_function_call_1.RFunctionCall.
|
|
64
|
-
: (r_binary_op_1.RBinaryOp.is(node) || r_unary_op_1.RUnaryOp.is(node)) && onlyLiterals(node) ? identifier_1.Identifier.make(node.operator) : undefined;
|
|
59
|
+
: r_function_call_1.RFunctionCall.calledName(node) ?? ((r_binary_op_1.RBinaryOp.is(node) || r_unary_op_1.RUnaryOp.is(node)) && onlyLiterals(node) ? identifier_1.Identifier.make(node.operator) : undefined);
|
|
65
60
|
return named !== undefined && environment !== undefined && foldsThroughBuiltIn(named, ctx)
|
|
66
61
|
&& resolve_helper_1.Resolve.isBuiltIn(named, environment, identifier_1.ReferenceType.Function) ? named : undefined;
|
|
67
62
|
}
|
|
@@ -15,12 +15,7 @@ function intervalFrom(start, end = start, startInclusive = true, endInclusive =
|
|
|
15
15
|
return intervalFromValues(typeof start === 'number' ? (0, scalar_constants_1.getScalarFromInteger)(start) : (0, scalar_constants_1.liftScalar)(start), typeof end === 'number' ? (0, scalar_constants_1.getScalarFromInteger)(end) : (0, scalar_constants_1.liftScalar)(end), startInclusive, endInclusive);
|
|
16
16
|
}
|
|
17
17
|
function shiftNum(v) {
|
|
18
|
-
|
|
19
|
-
return (0, scalar_constants_1.liftScalar)(v);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return v;
|
|
23
|
-
}
|
|
18
|
+
return (0, r_value_1.isBottom)(v) || (0, r_value_1.isTop)(v) ? (0, scalar_constants_1.liftScalar)(v) : v;
|
|
24
19
|
}
|
|
25
20
|
/**
|
|
26
21
|
* The same as {@link intervalFrom}, but from bounds that are already lifted values.
|
|
@@ -56,12 +56,7 @@ function stringifyRNumberSuffix(value) {
|
|
|
56
56
|
function renderString(value) {
|
|
57
57
|
const quote = value.quotes;
|
|
58
58
|
const raw = value.flag === 'raw';
|
|
59
|
-
|
|
60
|
-
return `r${quote}(${value.str})${quote}`;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return `${quote}${JSON.stringify(value.str).slice(1, -1)}${quote}`;
|
|
64
|
-
}
|
|
59
|
+
return raw ? `r${quote}(${value.str})${quote}` : `${quote}${JSON.stringify(value.str).slice(1, -1)}${quote}`;
|
|
65
60
|
}
|
|
66
61
|
/**
|
|
67
62
|
* A value as a human-readable string, dispatching on its type and answering for `Top` and `Bottom` as well.
|