@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
|
@@ -9,7 +9,6 @@ const control_flow_1 = require("../../../../control-flow");
|
|
|
9
9
|
const info_1 = require("../../../../../info");
|
|
10
10
|
const linker_1 = require("../../../../linker");
|
|
11
11
|
const known_call_handling_1 = require("../known-call-handling");
|
|
12
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
13
12
|
const assert_1 = require("../../../../../../util/assert");
|
|
14
13
|
const logger_1 = require("../../../../../logger");
|
|
15
14
|
const built_in_list_1 = require("./built-in-list");
|
|
@@ -21,11 +20,10 @@ const model_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/model");
|
|
|
21
20
|
const program_order_1 = require("../../../../program-order");
|
|
22
21
|
const graph_1 = require("../../../../../graph/graph");
|
|
23
22
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
24
|
-
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
25
23
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
26
24
|
const class_declaration_1 = require("../../../../../fn/class-declaration");
|
|
27
25
|
const built_in_new_env_1 = require("./built-in-new-env");
|
|
28
|
-
const
|
|
26
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
29
27
|
const edge_1 = require("../../../../../graph/edge");
|
|
30
28
|
const built_in_library_1 = require("./built-in-library");
|
|
31
29
|
const r_number_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-number");
|
|
@@ -43,7 +41,7 @@ const arrays_1 = require("../../../../../../util/collections/arrays");
|
|
|
43
41
|
const group_generics_1 = require("../../../../../environments/group-generics");
|
|
44
42
|
const arg_matching_1 = require("../../../../../../util/arg-matching");
|
|
45
43
|
const defaultmap_1 = require("../../../../../../util/collections/defaultmap");
|
|
46
|
-
const
|
|
44
|
+
const df_helper_1 = require("../../../../../graph/df-helper");
|
|
47
45
|
/**
|
|
48
46
|
* Process a function definition, i.e., `function(a, b) { ... }`
|
|
49
47
|
*/
|
|
@@ -54,7 +52,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
54
52
|
}
|
|
55
53
|
/* we remove the last argument, as it is the body */
|
|
56
54
|
const parameters = args.slice(0, -1);
|
|
57
|
-
const bodyArg =
|
|
55
|
+
const bodyArg = r_argument_1.RArgument.unnamedValueOf(args.at(-1));
|
|
58
56
|
(0, assert_1.guard)(bodyArg !== undefined, () => `Function Definition ${JSON.stringify(args)} has no body! This is bad!`);
|
|
59
57
|
const originalEnvironment = data.environment;
|
|
60
58
|
const idMap = data.completeAst.idMap;
|
|
@@ -76,12 +74,12 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
76
74
|
const read = processed.in.concat(processed.unknownReferences);
|
|
77
75
|
allParameterReads.push(...read);
|
|
78
76
|
(0, linker_1.linkInputs)(read, data.environment, readInParameters, subgraph, false);
|
|
79
|
-
data.environment =
|
|
77
|
+
data.environment = environment_1.REnvironment.overwrite(data.environment, processed.environment);
|
|
80
78
|
}
|
|
81
79
|
const paramsEnvironments = data.environment;
|
|
82
80
|
const body = (0, processor_1.processDataflowFor)(bodyArg, data);
|
|
83
81
|
for (const [, v] of body.graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
84
|
-
const envir =
|
|
82
|
+
const envir = vertex_1.DfgVertex.hasOrigin(v, built_in_proc_name_1.BuiltInProcName.Rm) ? v.args.find(a => graph_1.FunctionArgument.hasName(a, 'envir')) : undefined;
|
|
85
83
|
const offset = envir && parseSysFrameOffset(idMap.get(envir.valueId ?? envir.nodeId));
|
|
86
84
|
if (offset === undefined || offset > 0) {
|
|
87
85
|
continue;
|
|
@@ -89,7 +87,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
89
87
|
const targetLevel = offset === 0 ? 0 : originalEnvironment.level + 1 + offset;
|
|
90
88
|
let targetEnv = originalEnvironment;
|
|
91
89
|
while (targetEnv.level > targetLevel && targetEnv.level > 0) {
|
|
92
|
-
targetEnv =
|
|
90
|
+
targetEnv = environment_1.REnvironment.popLocal(targetEnv);
|
|
93
91
|
}
|
|
94
92
|
if (targetEnv.level !== targetLevel) {
|
|
95
93
|
continue;
|
|
@@ -124,7 +122,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
124
122
|
if (parameter?.defaultValue === undefined) {
|
|
125
123
|
continue;
|
|
126
124
|
}
|
|
127
|
-
const forcedAt =
|
|
125
|
+
const forcedAt = df_helper_1.Dataflow.sourcesOf(subgraph, parameter.name.info.id, edge_1.EdgeType.Reads);
|
|
128
126
|
model_1.RNode.visitAst(parameter.defaultValue, inner => {
|
|
129
127
|
if (r_symbol_1.RSymbol.is(inner) && vertex_1.DfgVertex.isUse(subgraph.getVertex(inner.info.id))
|
|
130
128
|
&& linkParameterReadToBodyWrites(subgraph, { nodeId: inner.info.id, name: inner.content, cds: undefined, type: identifier_1.ReferenceType.Variable }, writesByName)) {
|
|
@@ -136,7 +134,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
136
134
|
});
|
|
137
135
|
}
|
|
138
136
|
// parameter names are unique, so overwriting their environments here is correct even with non-`=` arguments
|
|
139
|
-
let outEnvironment =
|
|
137
|
+
let outEnvironment = environment_1.REnvironment.overwrite(paramsEnvironments, body.environment);
|
|
140
138
|
for (const read of remainingRead) {
|
|
141
139
|
if (read.name) {
|
|
142
140
|
subgraph.addVertex({
|
|
@@ -169,9 +167,9 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
169
167
|
}
|
|
170
168
|
let hookEnvironment = vert.subflow.environment;
|
|
171
169
|
while (hookEnvironment.level > outEnvironment.level) {
|
|
172
|
-
hookEnvironment =
|
|
170
|
+
hookEnvironment = environment_1.REnvironment.popLocal(hookEnvironment);
|
|
173
171
|
}
|
|
174
|
-
outEnvironment =
|
|
172
|
+
outEnvironment = environment_1.REnvironment.overwrite(outEnvironment, hookEnvironment);
|
|
175
173
|
/* the jumps and errors of an exit hook overrule the exit points of the body */
|
|
176
174
|
subgraph.addEdge(rootId, hook.id, edge_1.EdgeType.Calls);
|
|
177
175
|
const hookExitPoints = vert.exitPoints.filter(e => e.type === 1 /* ExitPointType.Return */ || e.type === 4 /* ExitPointType.Error */);
|
|
@@ -207,7 +205,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
207
205
|
updateNestedFunctionClosures(subgraph, outEnvironment, remainingRead);
|
|
208
206
|
const readParams = {};
|
|
209
207
|
for (const paramId of paramIds) {
|
|
210
|
-
readParams[paramId] =
|
|
208
|
+
readParams[paramId] = df_helper_1.Dataflow.sourcesOf(subgraph, paramId, edge_1.EdgeType.Reads).length > 0;
|
|
211
209
|
}
|
|
212
210
|
const returnEnvState = data.ctx.config.solver.trackEnvironments
|
|
213
211
|
? afterHookExitPoints.values().map(({ nodeId }) => envStateReturnedAt(nodeId, subgraph, outEnvironment, data)).find(assert_1.isNotUndefined)
|
|
@@ -216,7 +214,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
216
214
|
graph.addVertex({
|
|
217
215
|
tag: vertex_1.VertexType.FunctionDefinition,
|
|
218
216
|
id: name.info.id,
|
|
219
|
-
environment:
|
|
217
|
+
environment: environment_1.REnvironment.popLocal(outEnvironment),
|
|
220
218
|
cds: data.cds,
|
|
221
219
|
params: readParams,
|
|
222
220
|
subflow: flow,
|
|
@@ -261,12 +259,12 @@ function envStateReturnedAt(nodeId, graph, outEnvironment, data) {
|
|
|
261
259
|
function retrieveActiveEnvironment(callerEnvironment, baseEnvironment, ctx) {
|
|
262
260
|
callerEnvironment ??= ctx.env.makeCleanEnv();
|
|
263
261
|
while (baseEnvironment.level < callerEnvironment.level) {
|
|
264
|
-
baseEnvironment =
|
|
262
|
+
baseEnvironment = environment_1.REnvironment.pushLocal(baseEnvironment);
|
|
265
263
|
}
|
|
266
264
|
while (baseEnvironment.level > callerEnvironment.level) {
|
|
267
|
-
callerEnvironment =
|
|
265
|
+
callerEnvironment = environment_1.REnvironment.pushLocal(callerEnvironment);
|
|
268
266
|
}
|
|
269
|
-
return
|
|
267
|
+
return environment_1.REnvironment.overwrite(baseEnvironment, callerEnvironment);
|
|
270
268
|
}
|
|
271
269
|
/**
|
|
272
270
|
* Whether the dispatch takes its object from the first formal, which is what R does unless the call names
|
|
@@ -280,7 +278,7 @@ function dispatchesOnFirstParameter(id, idMap) {
|
|
|
280
278
|
function updateDispatches(graph, myArgs, idMap) {
|
|
281
279
|
for (const [, info] of graph.vertices(false)) {
|
|
282
280
|
const isDispatch = vertex_1.DfgVertex.isFunctionCall(info)
|
|
283
|
-
&& (
|
|
281
|
+
&& (vertex_1.DfgVertex.hasOrigin(info, built_in_proc_name_1.BuiltInProcName.S3Dispatch) || vertex_1.DfgVertex.hasOrigin(info, built_in_proc_name_1.BuiltInProcName.S7Dispatch));
|
|
284
282
|
if (!isDispatch || info.args.length > 0) {
|
|
285
283
|
continue;
|
|
286
284
|
}
|
|
@@ -353,7 +351,7 @@ function* superAssignedTargets(graph, nodes) {
|
|
|
353
351
|
if (!vertex_1.DfgVertex.hasOrigin(graph.getVertex(nodeId), built_in_proc_name_1.BuiltInProcName.SuperAssignment)) {
|
|
354
352
|
continue;
|
|
355
353
|
}
|
|
356
|
-
for (const target of
|
|
354
|
+
for (const target of df_helper_1.Dataflow.targetsOf(graph, nodeId, edge_1.EdgeType.Returns)) {
|
|
357
355
|
const node = graph.idMap?.get(target);
|
|
358
356
|
if (vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)) && r_symbol_1.RSymbol.is(node)) {
|
|
359
357
|
yield [target, node.content];
|
|
@@ -368,7 +366,7 @@ function* superAssignedTargets(graph, nodes) {
|
|
|
368
366
|
function namesShadowingBuiltIns(environment) {
|
|
369
367
|
const shadowing = new Set();
|
|
370
368
|
const generics = new Set();
|
|
371
|
-
for (
|
|
369
|
+
for (const env of environment_1.REnvironment.frames(environment.current)) {
|
|
372
370
|
for (const [identifier, definitions] of env.memory) {
|
|
373
371
|
if (definitions.every(d => node_id_1.NodeId.isBuiltIn(d.nodeId))) {
|
|
374
372
|
continue;
|
|
@@ -407,9 +405,9 @@ function linkOwnS3Methods(call, name, graph, environment, statement, ctx) {
|
|
|
407
405
|
/* the dispatch looks the method up by name, just like a call written out would */
|
|
408
406
|
graph.addEdge(call.id, def.nodeId, edge_1.EdgeType.Reads);
|
|
409
407
|
}
|
|
410
|
-
return
|
|
408
|
+
return linkedFunctionIds(dispatched, graph);
|
|
411
409
|
}
|
|
412
|
-
function
|
|
410
|
+
function linkedFunctionIds(defs, graph) {
|
|
413
411
|
return (0, linker_1.getAllLinkedFunctionDefinitions)(new Set(defs.map(d => d.nodeId)), graph)[0].values().map(d => d.id).toArray();
|
|
414
412
|
}
|
|
415
413
|
/**
|
|
@@ -445,9 +443,9 @@ function dispatchedS3Methods(call, name, methods, graph, environment, statement,
|
|
|
445
443
|
}
|
|
446
444
|
}
|
|
447
445
|
}
|
|
448
|
-
const callsNext =
|
|
446
|
+
const callsNext = linkedFunctionIds([...picked], graph).some(d => {
|
|
449
447
|
const v = graph.getVertex(d);
|
|
450
|
-
return vertex_1.DfgVertex.isFunctionDefinition(v) &&
|
|
448
|
+
return vertex_1.DfgVertex.isFunctionDefinition(v) && df_helper_1.Dataflow.callsIn(v, graph).some(([, c]) => vertex_1.DfgVertex.hasOrigin(c, built_in_proc_name_1.BuiltInProcName.S3DispatchNext));
|
|
451
449
|
});
|
|
452
450
|
return callsNext ? undefined : [...picked];
|
|
453
451
|
}
|
|
@@ -465,7 +463,7 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
|
|
|
465
463
|
const runsOnceAt = (0, defaultmap_1.memoize)((id) => program_order_1.ProgramOrder.runsOnceAt(id, graph));
|
|
466
464
|
const environmentAt = (0, defaultmap_1.memoize)((id) => {
|
|
467
465
|
const environment = graph.getVertex(id).environment;
|
|
468
|
-
return environment ?
|
|
466
|
+
return environment ? environment_1.REnvironment.overwrite(outEnvironment, environment) : outEnvironment;
|
|
469
467
|
});
|
|
470
468
|
for (let i = 0; i < calls.length; i++) {
|
|
471
469
|
const [id, vertex] = calls[i];
|
|
@@ -481,7 +479,7 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
|
|
|
481
479
|
const effectiveEnvironment = environmentAt(id);
|
|
482
480
|
/* a call the program runs once, at the top and outside any loop, cannot see what is defined after it */
|
|
483
481
|
const definedLater = (definition) => program_order_1.ProgramOrder.definedLater(definition, runsOnceAt(id), graph);
|
|
484
|
-
const targets = new Set(
|
|
482
|
+
const targets = new Set(df_helper_1.Dataflow.callTargetsOf(id, graph, effectiveEnvironment));
|
|
485
483
|
/* a call of a parameter sees what it is bound to only once the calls handing it down are linked */
|
|
486
484
|
if (!deferred.has(id) && targets.size > 0 && targets.values().every(t => !node_id_1.NodeId.isBuiltIn(t) && vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(t)))) {
|
|
487
485
|
deferred.add(id);
|
|
@@ -492,7 +490,7 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
|
|
|
492
490
|
let treatAsS3 = origin.includes(built_in_proc_name_1.BuiltInProcName.S3Dispatch);
|
|
493
491
|
if (treatAsS3 && !graph.isRoot(id)) {
|
|
494
492
|
/* a body dispatches where it is called, which may see a method the end of the script has replaced */
|
|
495
|
-
rootDefinitions ??=
|
|
493
|
+
rootDefinitions ??= df_helper_1.Dataflow.definitionsByName(graph);
|
|
496
494
|
const prefix = identifier_1.Identifier.getName(name) + '.';
|
|
497
495
|
for (const [defined, ids] of rootDefinitions.entries()) {
|
|
498
496
|
if (defined.startsWith(prefix)) {
|
|
@@ -537,8 +535,8 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
|
|
|
537
535
|
targetVertex.mode.push('s3');
|
|
538
536
|
}
|
|
539
537
|
// collect all next method calls to link them to the same targets!
|
|
540
|
-
for (const [next, v] of
|
|
541
|
-
if (
|
|
538
|
+
for (const [next, v] of df_helper_1.Dataflow.callsIn(targetVertex, graph)) {
|
|
539
|
+
if (vertex_1.DfgVertex.hasOrigin(v, built_in_proc_name_1.BuiltInProcName.S3DispatchNext)) {
|
|
542
540
|
collectedNextMethods.add(next);
|
|
543
541
|
}
|
|
544
542
|
}
|
|
@@ -551,7 +549,7 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
|
|
|
551
549
|
}
|
|
552
550
|
/* only writes from within functions (`<<-`) are left, and the call may run before them, seeing what they replace */
|
|
553
551
|
if (resolved.every(d => !graph.isRoot(d.nodeId)) && ingoing.name !== undefined) {
|
|
554
|
-
rootDefinitions ??=
|
|
552
|
+
rootDefinitions ??= df_helper_1.Dataflow.definitionsByName(graph);
|
|
555
553
|
for (const def of rootDefinitions.get(identifier_1.Identifier.getName(ingoing.name)).filter(d => graph.isRoot(d))) {
|
|
556
554
|
graph.addEdge(ingoing.nodeId, def, edge_1.EdgeType.Reads);
|
|
557
555
|
}
|
|
@@ -585,7 +583,7 @@ function updateNestedFunctionCalls(graph, outEnvironment, ctx) {
|
|
|
585
583
|
}
|
|
586
584
|
}
|
|
587
585
|
linkLiftedReads(graph, lifted, enclosingOf, environmentAt, runsOnceAt);
|
|
588
|
-
const called = new Set(graph.verticesOfType(vertex_1.VertexType.FunctionCall).flatMap(([id]) =>
|
|
586
|
+
const called = new Set(graph.verticesOfType(vertex_1.VertexType.FunctionCall).flatMap(([id]) => df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Calls)));
|
|
589
587
|
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)) {
|
|
590
588
|
if (called.has(id)) {
|
|
591
589
|
continue;
|
|
@@ -610,7 +608,7 @@ function linkLiftedReads(graph, lifted, enclosingOf, environmentAt, runsOnceAt)
|
|
|
610
608
|
continue;
|
|
611
609
|
}
|
|
612
610
|
known.add(read.nodeId);
|
|
613
|
-
for (const call of
|
|
611
|
+
for (const call of df_helper_1.Dataflow.sourcesOf(graph, definition, edge_1.EdgeType.Calls)) {
|
|
614
612
|
if (!vertex_1.DfgVertex.isFunctionCall(graph.getVertex(call))) {
|
|
615
613
|
continue;
|
|
616
614
|
}
|
|
@@ -634,7 +632,7 @@ function linkLiftedReads(graph, lifted, enclosingOf, environmentAt, runsOnceAt)
|
|
|
634
632
|
}
|
|
635
633
|
}
|
|
636
634
|
function parseSysFrameOffset(node) {
|
|
637
|
-
if (!r_function_call_1.RFunctionCall.isNamed(node
|
|
635
|
+
if (!r_function_call_1.RFunctionCall.isNamed(node, 'sys.frame') || node.arguments.length !== 1) {
|
|
638
636
|
return undefined;
|
|
639
637
|
}
|
|
640
638
|
return r_number_1.RNumber.literalValueOf(r_argument_1.RArgument.valueOf(node.arguments[0]));
|
|
@@ -662,9 +660,9 @@ function prepareFunctionEnvironment(data, rootId) {
|
|
|
662
660
|
for (let frame = data.environment.current; enclosing.length < level; frame = frame.parent) {
|
|
663
661
|
enclosing.push(frame);
|
|
664
662
|
}
|
|
665
|
-
let env =
|
|
663
|
+
let env = environment_1.REnvironment.cleanOf(data.environment);
|
|
666
664
|
for (let i = 0; i < level + 1; i++) {
|
|
667
|
-
env =
|
|
665
|
+
env = environment_1.REnvironment.pushLocal(env);
|
|
668
666
|
if (i === level) {
|
|
669
667
|
env.current.setClosureNodeId(rootId);
|
|
670
668
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processGet = processGet;
|
|
4
4
|
const known_call_handling_1 = require("../known-call-handling");
|
|
5
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
6
5
|
const make_argument_1 = require("../argument/make-argument");
|
|
7
6
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
8
7
|
const logger_1 = require("../../../../../logger");
|
|
9
|
-
const retriever_1 = require("../../../../../../r-bridge/retriever");
|
|
10
8
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
11
9
|
const edge_1 = require("../../../../../graph/edge");
|
|
12
10
|
const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
|
|
@@ -24,7 +22,7 @@ function namesDenotedBy(node, data) {
|
|
|
24
22
|
if (folded !== undefined) {
|
|
25
23
|
return [folded];
|
|
26
24
|
}
|
|
27
|
-
if (r_function_call_1.RFunctionCall.isNamed(node
|
|
25
|
+
if (r_function_call_1.RFunctionCall.isNamed(node, 'c')
|
|
28
26
|
&& resolve_helper_1.Resolve.isBuiltIn(node.functionName.content, data.environment, identifier_1.ReferenceType.Function)) {
|
|
29
27
|
const parts = node.arguments.map(arg => {
|
|
30
28
|
const value = r_argument_1.RArgument.valueOf(arg);
|
|
@@ -37,7 +35,7 @@ function namesDenotedBy(node, data) {
|
|
|
37
35
|
/** One symbol per constant name the first argument of `get` denotes, so the lookup is processed like a plain read of them. */
|
|
38
36
|
function synthesizeTargets(retrieve, name, rootId, data) {
|
|
39
37
|
const literal = r_string_1.RString.is(retrieve);
|
|
40
|
-
const names = literal ? [
|
|
38
|
+
const names = literal ? [r_string_1.RString.unquote(retrieve.lexeme)] : namesDenotedBy(retrieve, data);
|
|
41
39
|
const location = literal ? retrieve.location : retrieve.location ?? name.location ?? range_1.SourceRange.invalid();
|
|
42
40
|
const literalLexeme = literal ? retrieve.lexeme : undefined;
|
|
43
41
|
return names.map((resolvedName, i) => {
|
|
@@ -63,7 +61,7 @@ function synthesizeTargets(retrieve, name, rootId, data) {
|
|
|
63
61
|
*/
|
|
64
62
|
function processGet(name, args, rootId, data, config = {}) {
|
|
65
63
|
const resolution = (0, built_in_envir_utils_1.resolveFirstEnvirArg)(args, data, config.sig, ['envir', ...built_in_envir_utils_1.EnvirPositionFormals]);
|
|
66
|
-
const retrieve =
|
|
64
|
+
const retrieve = r_argument_1.RArgument.unnamedValueOf(args[0]);
|
|
67
65
|
const targets = retrieve === undefined ? [] : synthesizeTargets(retrieve, name, rootId, data);
|
|
68
66
|
if (targets.length === 0) {
|
|
69
67
|
logger_1.dataflowLogger.warn(`symbol access with ${identifier_1.Identifier.toString(name.content)} has no resolvable name argument, skipping`);
|
|
@@ -6,12 +6,10 @@ const function_semantics_1 = require("../../../../../fn/function-semantics");
|
|
|
6
6
|
const resolve_1 = require("../../../../../eval/resolve/resolve");
|
|
7
7
|
const known_call_handling_1 = require("../known-call-handling");
|
|
8
8
|
const common_1 = require("../common");
|
|
9
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
10
9
|
const logger_1 = require("../../../../../logger");
|
|
11
10
|
const edge_1 = require("../../../../../graph/edge");
|
|
12
11
|
const control_flow_1 = require("../../../../control-flow");
|
|
13
12
|
const built_in_ambient_state_1 = require("./built-in-ambient-state");
|
|
14
|
-
const append_1 = require("../../../../../environments/append");
|
|
15
13
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
16
14
|
const node_value_1 = require("../../../../../eval/resolve/node-value");
|
|
17
15
|
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
@@ -20,9 +18,10 @@ const model_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/model");
|
|
|
20
18
|
const r_function_definition_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
21
19
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
22
20
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
23
|
-
|
|
21
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
22
|
+
function conditionalArgsOf(config, args) {
|
|
24
23
|
if (!config?.args) {
|
|
25
|
-
return args.map(e =>
|
|
24
|
+
return args.map(e => r_argument_1.RArgument.valueOf(e));
|
|
26
25
|
}
|
|
27
26
|
const params = {
|
|
28
27
|
[config.args.cond]: 'cond',
|
|
@@ -31,7 +30,7 @@ function getArguments(config, args) {
|
|
|
31
30
|
'...': '...'
|
|
32
31
|
};
|
|
33
32
|
const argMaps = function_semantics_1.FunctionSemantics.call.match.toSpec((0, common_1.convertFnArguments)(args), params);
|
|
34
|
-
return ['cond', 'yes', 'no'].map(k =>
|
|
33
|
+
return ['cond', 'yes', 'no'].map(k => r_argument_1.RArgument.valueOf(r_argument_1.RArgument.getWithId(args, argMaps.get(k)?.[0])));
|
|
35
34
|
}
|
|
36
35
|
/** Whether `id` may run again in the same frame, as part of a loop not left through a function definition. */
|
|
37
36
|
function withinLoop(id, idMap) {
|
|
@@ -48,7 +47,7 @@ function processIfThenElse(name, args, rootId, data, config) {
|
|
|
48
47
|
logger_1.dataflowLogger.warn(`If-then-else ${identifier_1.Identifier.toString(name.content)} has something different from 2 or 3 arguments, skipping`);
|
|
49
48
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
50
49
|
}
|
|
51
|
-
const [condArg, thenArg, otherwiseArg] =
|
|
50
|
+
const [condArg, thenArg, otherwiseArg] = conditionalArgsOf(config, args);
|
|
52
51
|
if (condArg === undefined || thenArg === undefined) {
|
|
53
52
|
logger_1.dataflowLogger.warn(`If-then-else ${identifier_1.Identifier.toString(name.content)} has empty condition or then case in ${JSON.stringify(args)}, skipping`);
|
|
54
53
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
@@ -96,7 +95,7 @@ function processIfThenElse(name, args, rootId, data, config) {
|
|
|
96
95
|
finalEnvironment = thenEnvironment;
|
|
97
96
|
}
|
|
98
97
|
else {
|
|
99
|
-
finalEnvironment =
|
|
98
|
+
finalEnvironment = environment_1.REnvironment.append(thenEnvironment, otherwiseEnvironment);
|
|
100
99
|
}
|
|
101
100
|
const whenTrue = { id: rootId, when: true };
|
|
102
101
|
const whenFalse = { id: rootId, when: false };
|
|
@@ -164,7 +164,7 @@ function stringLiterals(node) {
|
|
|
164
164
|
if (r_string_1.RString.is(node)) {
|
|
165
165
|
return [node.content.str];
|
|
166
166
|
}
|
|
167
|
-
return r_function_call_1.RFunctionCall.isNamed(node
|
|
167
|
+
return r_function_call_1.RFunctionCall.isNamed(node, 'c')
|
|
168
168
|
? node.arguments.flatMap(a => a !== r_function_call_1.EmptyArgument && r_string_1.RString.is(a.value) ? [a.value.content.str] : [])
|
|
169
169
|
: [];
|
|
170
170
|
}
|
|
@@ -294,7 +294,10 @@ function loadNodesForNamespace(env, pack) {
|
|
|
294
294
|
if (env.current.builtInEnv) {
|
|
295
295
|
return nodes; // resolving straight in the built-in environment (`get(x, envir = baseenv())`): no search path above it
|
|
296
296
|
}
|
|
297
|
-
for (
|
|
297
|
+
for (const e of environment_1.REnvironment.searchPath(env.current)) {
|
|
298
|
+
if (e.t === undefined) {
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
298
301
|
if (e.n !== pack) {
|
|
299
302
|
continue;
|
|
300
303
|
}
|
|
@@ -340,7 +343,8 @@ function selectExports(callables, spec) {
|
|
|
340
343
|
*/
|
|
341
344
|
function lazyExports(pack, exports, ctx, definedAt) {
|
|
342
345
|
const byName = new Map(exports.map(exp => [identifier_1.Identifier.getName(identifier_1.Identifier.make(exp.as, pack)), exp]));
|
|
343
|
-
|
|
346
|
+
const aliases = exports.filter(exp => exp.as !== exp.exported).map(exp => `${exp.as}=${exp.exported}`);
|
|
347
|
+
return new frame_memory_1.LazyBindings(new Set(byName.keys()), name => [exportDefinition(pack, byName.get(name), ctx, definedAt)], `${pack}|${String(definedAt)}|${aliases.join(',')}`);
|
|
344
348
|
}
|
|
345
349
|
/**
|
|
346
350
|
* The identifier definition binding a package export (or its alias) to its built-in function-definition.
|
|
@@ -430,7 +434,7 @@ function startupAttachPosition(pack, env) {
|
|
|
430
434
|
return undefined;
|
|
431
435
|
}
|
|
432
436
|
let pos = environment_1.DefaultAttachPosition;
|
|
433
|
-
for (
|
|
437
|
+
for (const e of environment_1.REnvironment.searchPath(env)) {
|
|
434
438
|
if (e.t === environment_1.EnvType.Imports) {
|
|
435
439
|
continue; // internal layer, not a search-path entry
|
|
436
440
|
}
|
|
@@ -444,7 +448,10 @@ function startupAttachPosition(pack, env) {
|
|
|
444
448
|
}
|
|
445
449
|
/** Whether package `pack` is already attached below the global env in a way that makes this (re-)attach a no-op. */
|
|
446
450
|
function isAttached(env, pack, namespaceOnly) {
|
|
447
|
-
for (
|
|
451
|
+
for (const e of environment_1.REnvironment.searchPath(env)) {
|
|
452
|
+
if (e.t === undefined) {
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
448
455
|
if (e.n === pack && blocksAttach(e, namespaceOnly)) {
|
|
449
456
|
return true;
|
|
450
457
|
}
|
|
@@ -8,11 +8,10 @@ const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/
|
|
|
8
8
|
const known_call_handling_1 = require("../known-call-handling");
|
|
9
9
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
10
10
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
11
|
-
const define_1 = require("../../../../../environments/define");
|
|
12
|
-
const scoping_1 = require("../../../../../environments/scoping");
|
|
13
11
|
const resolve_helper_1 = require("../../../../../environments/resolve-helper");
|
|
14
12
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
15
13
|
const r_function_definition_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
14
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
16
15
|
/**
|
|
17
16
|
* Process a list call.
|
|
18
17
|
*
|
|
@@ -39,7 +38,7 @@ function resolveListToEnvState(source, data, values = false) {
|
|
|
39
38
|
if (!r_function_call_1.RFunctionCall.isNamed(source)) {
|
|
40
39
|
return undefined;
|
|
41
40
|
}
|
|
42
|
-
let envState =
|
|
41
|
+
let envState = environment_1.REnvironment.pushLocal(data.environment);
|
|
43
42
|
let found = false;
|
|
44
43
|
let position = 0;
|
|
45
44
|
for (const arg of source.arguments) {
|
|
@@ -60,7 +59,7 @@ function resolveListToEnvState(source, data, values = false) {
|
|
|
60
59
|
};
|
|
61
60
|
for (const name of [arg.name?.content, identifier_1.Identifier.make(String(position))]) {
|
|
62
61
|
if (name !== undefined) {
|
|
63
|
-
envState =
|
|
62
|
+
envState = environment_1.REnvironment.define({ ...definition, name }, false, envState);
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
found = true;
|
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processLoadCall = processLoadCall;
|
|
4
4
|
exports.sexpTypeToReferenceType = sexpTypeToReferenceType;
|
|
5
|
+
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
5
6
|
const function_semantics_1 = require("../../../../../fn/function-semantics");
|
|
6
7
|
const known_call_handling_1 = require("../known-call-handling");
|
|
7
8
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
8
9
|
const flowr_rda_file_1 = require("../../../../../../project/plugins/file-plugins/files/flowr-rda-file");
|
|
9
10
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
10
|
-
const retriever_1 = require("../../../../../../r-bridge/retriever");
|
|
11
11
|
const built_in_source_1 = require("./built-in-source");
|
|
12
12
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
13
13
|
const logger_1 = require("../../../../../logger");
|
|
14
14
|
const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
|
|
15
15
|
const edge_1 = require("../../../../../graph/edge");
|
|
16
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
17
16
|
const node_value_1 = require("../../../../../eval/resolve/node-value");
|
|
18
17
|
const r_value_1 = require("../../../../../eval/values/r-value");
|
|
19
18
|
const assert_1 = require("../../../../../../util/assert");
|
|
@@ -27,7 +26,7 @@ const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/
|
|
|
27
26
|
* adds control dependencies between the variables and the loaded file.
|
|
28
27
|
*/
|
|
29
28
|
function processLoadCall(name, args, rootId, data) {
|
|
30
|
-
const { fileArg, envirArg } =
|
|
29
|
+
const { fileArg, envirArg } = loadArgsOf(args, data);
|
|
31
30
|
if (!fileArg) {
|
|
32
31
|
const fn = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' });
|
|
33
32
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(fn.information.graph, fn.information.environment, rootId);
|
|
@@ -45,7 +44,7 @@ function processLoadCall(name, args, rootId, data) {
|
|
|
45
44
|
}
|
|
46
45
|
let sourceFile;
|
|
47
46
|
if (r_string_1.RString.is(fileArg)) {
|
|
48
|
-
sourceFile = [
|
|
47
|
+
sourceFile = [r_string_1.RString.unquote(fileArg.lexeme)];
|
|
49
48
|
}
|
|
50
49
|
else {
|
|
51
50
|
const resolved = node_value_1.NodeValue.setOf(fileArg.info.id, data, { environment: envirResolution?.envirData.environment ?? data.environment });
|
|
@@ -53,7 +52,7 @@ function processLoadCall(name, args, rootId, data) {
|
|
|
53
52
|
}
|
|
54
53
|
if (sourceFile) {
|
|
55
54
|
for (const candidate of sourceFile) {
|
|
56
|
-
const path =
|
|
55
|
+
const path = r_string_1.RString.unquote(candidate);
|
|
57
56
|
let filepath = path ? (0, built_in_source_1.findSource)(data.ctx.config.solver.resolveSource, path, data) : path;
|
|
58
57
|
if (Array.isArray(filepath)) {
|
|
59
58
|
if (filepath.length > 1) {
|
|
@@ -221,15 +220,15 @@ function sexpTypeToReferenceType(type) {
|
|
|
221
220
|
return identifier_1.ReferenceType.Unknown;
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
|
-
function
|
|
223
|
+
function loadArgsOf(args, data) {
|
|
225
224
|
// prefer R's real `base::load` signature from the database, falling back to the known formals when it is absent
|
|
226
225
|
const loadParams = (0, built_in_envir_utils_1.signatureParamNames)(data, identifier_1.Identifier.make('load', "base" /* PkgName.Base */), ['file', 'envir', 'verbose']);
|
|
227
226
|
const bound = function_semantics_1.FunctionSemantics.call.match.toNames(args, loadParams);
|
|
228
227
|
const fileArgBound = bound.get('file');
|
|
229
228
|
const envirArg = bound.get('envir');
|
|
230
229
|
const verboseArgBound = bound.get('verbose');
|
|
231
|
-
const fileArg = fileArgBound ?
|
|
232
|
-
const verboseArg = verboseArgBound ?
|
|
230
|
+
const fileArg = fileArgBound ? r_argument_1.RArgument.valueOf(fileArgBound) : undefined;
|
|
231
|
+
const verboseArg = verboseArgBound ? r_argument_1.RArgument.valueOf(verboseArgBound) : undefined;
|
|
233
232
|
return { fileArg, envirArg, verboseArg };
|
|
234
233
|
}
|
|
235
234
|
//# sourceMappingURL=built-in-load.js.map
|
|
@@ -9,13 +9,12 @@ const edge_1 = require("../../../../../graph/edge");
|
|
|
9
9
|
const known_call_handling_1 = require("../known-call-handling");
|
|
10
10
|
const control_flow_1 = require("../../../../control-flow");
|
|
11
11
|
const common_1 = require("../common");
|
|
12
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
13
|
-
const scoping_1 = require("../../../../../environments/scoping");
|
|
14
12
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
15
13
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
16
14
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
17
15
|
const built_in_envir_utils_1 = require("./built-in-envir-utils");
|
|
18
16
|
const resolve_helper_1 = require("../../../../../environments/resolve-helper");
|
|
17
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
19
18
|
/** Processes a built-in 'local' function call. */
|
|
20
19
|
function processLocal(name, args, rootId, data, config) {
|
|
21
20
|
if (args.length === 0) {
|
|
@@ -27,8 +26,8 @@ function processLocal(name, args, rootId, data, config) {
|
|
|
27
26
|
'...': '...'
|
|
28
27
|
});
|
|
29
28
|
const envArg = r_argument_1.RArgument.getWithId(args, argMaps.get('env')?.[0]);
|
|
30
|
-
const env =
|
|
31
|
-
const expr =
|
|
29
|
+
const env = r_argument_1.RArgument.valueOf(envArg);
|
|
30
|
+
const expr = r_argument_1.RArgument.valueOf(r_argument_1.RArgument.getWithId(args, argMaps.get('expr')?.[0]));
|
|
32
31
|
if (!expr) {
|
|
33
32
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
34
33
|
}
|
|
@@ -49,7 +48,7 @@ function processLocal(name, args, rootId, data, config) {
|
|
|
49
48
|
}
|
|
50
49
|
const baseEnvironment = envirResolution
|
|
51
50
|
? envirResolution.envirData.environment // evaluate in the tracked custom env
|
|
52
|
-
:
|
|
51
|
+
: environment_1.REnvironment.pushLocal(data.environment); // normal new local scope
|
|
53
52
|
const dfExpr = (0, processor_1.processDataflowFor)(expr, { ...data, environment: baseEnvironment });
|
|
54
53
|
(0, common_1.patchFunctionCall)({
|
|
55
54
|
nextGraph: dfEnv.graph,
|
|
@@ -59,7 +58,7 @@ function processLocal(name, args, rootId, data, config) {
|
|
|
59
58
|
argumentProcessResult: env ? [dfExpr, dfEnv] : [dfExpr],
|
|
60
59
|
origin: built_in_proc_name_1.BuiltInProcName.Local
|
|
61
60
|
});
|
|
62
|
-
const resultEnvironment = envirResolution ? data.environment :
|
|
61
|
+
const resultEnvironment = envirResolution ? data.environment : environment_1.REnvironment.popLocal(dfExpr.environment);
|
|
63
62
|
/* definitions of the local scope vanish with it, only what escaped it (e.g. via `<<-`) may bubble up */
|
|
64
63
|
const escaping = envirResolution ? dfExpr.out : dfExpr.out.filter(o => o.name !== undefined && resolve_helper_1.Resolve.byNameAndType(o.name, resultEnvironment, o.type)?.some(d => d.nodeId === o.nodeId));
|
|
65
64
|
const graph = dfEnv.graph.mergeWith(dfExpr.graph);
|
|
@@ -6,13 +6,12 @@ const known_call_handling_1 = require("../known-call-handling");
|
|
|
6
6
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
7
7
|
const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
8
8
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
9
|
-
const scoping_1 = require("../../../../../environments/scoping");
|
|
10
9
|
const environment_1 = require("../../../../../environments/environment");
|
|
11
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
12
10
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
13
11
|
const convert_values_1 = require("../../../../../../r-bridge/lang-4.x/convert-values");
|
|
14
12
|
const built_in_envir_utils_1 = require("./built-in-envir-utils");
|
|
15
13
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
14
|
+
const environment_2 = require("../../../../../environments/environment");
|
|
16
15
|
const EmptyParentEnvFunctions = new Set(['emptyenv', 'baseenv']);
|
|
17
16
|
/**
|
|
18
17
|
* Processes `new.env()` and `rlang::new_environment()`.
|
|
@@ -50,7 +49,7 @@ function resolveNewEnvParentArg(args, data) {
|
|
|
50
49
|
if (r_argument_1.RArgument.isEmpty(arg) || arg.name?.content !== 'parent') {
|
|
51
50
|
continue;
|
|
52
51
|
}
|
|
53
|
-
const node =
|
|
52
|
+
const node = r_argument_1.RArgument.valueOf(arg);
|
|
54
53
|
if (!node) {
|
|
55
54
|
return undefined;
|
|
56
55
|
}
|
|
@@ -93,6 +92,6 @@ function createFreshEnvState(data, sourceInfo) {
|
|
|
93
92
|
};
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
|
-
return
|
|
95
|
+
return environment_2.REnvironment.pushLocal(data.environment);
|
|
97
96
|
}
|
|
98
97
|
//# sourceMappingURL=built-in-new-env.js.map
|
|
@@ -5,7 +5,6 @@ const function_semantics_1 = require("../../../../../fn/function-semantics");
|
|
|
5
5
|
const known_call_handling_1 = require("../known-call-handling");
|
|
6
6
|
const nse_1 = require("../nse");
|
|
7
7
|
const assert_1 = require("../../../../../../util/assert");
|
|
8
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
9
8
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
10
9
|
const data_masking_functions_1 = require("../../../../../environments/data-masking-functions");
|
|
11
10
|
const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
@@ -46,7 +45,7 @@ function processPipe(name, args, rootId, data, { pipePlaceholderName, assignLhs,
|
|
|
46
45
|
logger_1.dataflowLogger.warn(`Pipe ${identifier_1.Identifier.toString(name.content)} has something else than 2 arguments, skipping`);
|
|
47
46
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Pipe }).information;
|
|
48
47
|
}
|
|
49
|
-
const [lhs, rhs] = args.map(e =>
|
|
48
|
+
const [lhs, rhs] = args.map(e => r_argument_1.RArgument.unnamedValueOf(e));
|
|
50
49
|
(0, assert_1.guard)(lhs !== undefined && rhs !== undefined, () => `lhs and rhs must be present, but ${JSON.stringify(lhs)} and ${JSON.stringify(rhs)} were found instead.`);
|
|
51
50
|
const occurrenceIds = [];
|
|
52
51
|
model_1.RNode.visitAst(rhs, (node) => {
|
|
@@ -126,7 +125,7 @@ function processPipe(name, args, rootId, data, { pipePlaceholderName, assignLhs,
|
|
|
126
125
|
});
|
|
127
126
|
information.graph.addEdge(functionCallNode.id, argId, edge_1.EdgeType.Argument | edge_1.EdgeType.Reads);
|
|
128
127
|
}
|
|
129
|
-
if (r_function_call_1.RFunctionCall.isNamed(rhs
|
|
128
|
+
if (r_function_call_1.RFunctionCall.isNamed(rhs, data_masking_functions_1.DataMaskingFunctionNames)) {
|
|
130
129
|
markPipedDataMask(rhs, information.graph);
|
|
131
130
|
}
|
|
132
131
|
}
|