@eagleoutice/flowr 2.16.2 → 2.16.3
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 +10 -10
- 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 +2 -3
- 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 +1 -2
- 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-repl.js +4 -4
- 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 +1 -1
- package/documentation/wiki-dataflow-graph.js +6 -6
- package/documentation/wiki-interface.js +3 -2
- package/documentation/wiki-linter.js +54 -4
- 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 +518 -1
- 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.js +4 -3
- 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 +211 -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 +47 -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 +54 -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 +49 -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 +165 -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 +67 -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/deprecated-functions.js +4 -4
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +13 -14
- package/linter/rules/no-leaked-credentials.js +4 -4
- package/linter/rules/problematic-inputs.js +2 -1
- package/linter/rules/seeded-randomness.js +5 -5
- package/linter/rules/software-has-license.d.ts +1 -1
- package/linter/rules/software-has-license.js +1 -1
- package/linter/rules/unclosed-connection.js +3 -3
- package/linter/rules/undefined-symbol-util.js +16 -32
- package/linter/rules/undefined-symbol.d.ts +2 -0
- package/linter/rules/undefined-symbol.js +33 -3
- package/linter/rules/unescaped-arguments.js +10 -9
- package/linter/rules/unused-definition.js +13 -19
- 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 +1 -1
- package/project/context/flowr-analyzer-files-context.d.ts +6 -0
- package/project/context/flowr-analyzer-files-context.js +3 -0
- 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/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 +43 -0
- package/queries/catalog/dependencies-query/data-flow.js +173 -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 +33 -34
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processAttach = processAttach;
|
|
4
|
+
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
4
5
|
const known_call_handling_1 = require("../known-call-handling");
|
|
5
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
6
6
|
const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
7
7
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
8
8
|
const environment_1 = require("../../../../../environments/environment");
|
|
@@ -15,12 +15,8 @@ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model
|
|
|
15
15
|
function processAttach(name, args, rootId, data) {
|
|
16
16
|
const result = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Attach }).information;
|
|
17
17
|
const whatArg = args.length >= 1 ? args[0] : undefined;
|
|
18
|
-
const whatNode = whatArg && whatArg !== r_function_call_1.EmptyArgument ?
|
|
19
|
-
|
|
20
|
-
(0, unknown_side_effect_1.handleUnknownSideEffect)(result.graph, result.environment, rootId);
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
const envirResolution = (0, built_in_envir_utils_1.resolveSymbolToEnvir)(whatNode.content, whatNode.info.id, data);
|
|
18
|
+
const whatNode = whatArg && whatArg !== r_function_call_1.EmptyArgument ? r_argument_1.RArgument.valueOf(whatArg) : undefined;
|
|
19
|
+
const envirResolution = r_symbol_1.RSymbol.is(whatNode) ? (0, built_in_envir_utils_1.resolveSymbolToEnvir)(whatNode.content, whatNode.info.id, data) : undefined;
|
|
24
20
|
if (!envirResolution) {
|
|
25
21
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(result.graph, result.environment, rootId);
|
|
26
22
|
return result;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.processEnvContents = processEnvContents;
|
|
4
4
|
exports.processListToEnv = processListToEnv;
|
|
5
5
|
const known_call_handling_1 = require("../known-call-handling");
|
|
6
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
7
6
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
8
7
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
9
8
|
const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
@@ -12,8 +11,9 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
|
|
|
12
11
|
const edge_1 = require("../../../../../graph/edge");
|
|
13
12
|
const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
|
|
14
13
|
const built_in_envir_utils_1 = require("./built-in-envir-utils");
|
|
14
|
+
const linker_1 = require("../../../../linker");
|
|
15
15
|
const resolve_helper_1 = require("../../../../../environments/resolve-helper");
|
|
16
|
-
const
|
|
16
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
17
17
|
/**
|
|
18
18
|
* Processes a call listing what an environment holds (`ls`, `objects`), which reads every binding in it: the
|
|
19
19
|
* answer changes with each one, so each has to stay.
|
|
@@ -25,17 +25,12 @@ function processEnvContents(name, args, rootId, data, config = {}) {
|
|
|
25
25
|
return result;
|
|
26
26
|
}
|
|
27
27
|
for (const defs of resolution.envDef.envState.current.memory.values()) {
|
|
28
|
-
|
|
29
|
-
result.graph.addEdge(rootId, def.nodeId, edge_1.EdgeType.Reads);
|
|
30
|
-
if (def.definedAt !== undefined && def.definedAt !== def.nodeId) {
|
|
31
|
-
result.graph.addEdge(rootId, def.definedAt, edge_1.EdgeType.Reads);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
28
|
+
(0, linker_1.linkFieldReads)(result.graph, rootId, defs, false);
|
|
34
29
|
}
|
|
35
30
|
return result;
|
|
36
31
|
}
|
|
37
32
|
function listLiteralOf(node, data) {
|
|
38
|
-
if (r_function_call_1.RFunctionCall.isNamed(node
|
|
33
|
+
if (r_function_call_1.RFunctionCall.isNamed(node, 'list')
|
|
39
34
|
&& resolve_helper_1.Resolve.isBuiltIn(node.functionName.content, data.environment, identifier_1.ReferenceType.Function)) {
|
|
40
35
|
return node;
|
|
41
36
|
}
|
|
@@ -62,7 +57,7 @@ function processListToEnv(name, args, rootId, data, config = {}) {
|
|
|
62
57
|
if ((0, built_in_envir_utils_1.unknownIfAmbiguous)(envirRouting, result, rootId)) {
|
|
63
58
|
return result;
|
|
64
59
|
}
|
|
65
|
-
const first = args.length >= 1 && args[0] !== r_function_call_1.EmptyArgument ?
|
|
60
|
+
const first = args.length >= 1 && args[0] !== r_function_call_1.EmptyArgument ? r_argument_1.RArgument.valueOf(args[0]) : undefined;
|
|
66
61
|
const literal = listLiteralOf(first, data);
|
|
67
62
|
if (literal === undefined) {
|
|
68
63
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(result.graph, result.environment, rootId);
|
|
@@ -90,7 +85,7 @@ function processListToEnv(name, args, rootId, data, config = {}) {
|
|
|
90
85
|
}
|
|
91
86
|
let environment = result.environment;
|
|
92
87
|
for (const definition of written) {
|
|
93
|
-
environment =
|
|
88
|
+
environment = environment_1.REnvironment.define(definition, false, environment);
|
|
94
89
|
}
|
|
95
90
|
const defined = { ...result, environment, out: [...result.out, ...written] };
|
|
96
91
|
const envirResolution = (0, built_in_envir_utils_1.envirOf)(envirRouting);
|
|
@@ -18,10 +18,8 @@ exports.routeWrittenToEnvir = routeWrittenToEnvir;
|
|
|
18
18
|
exports.resolveAttachPosition = resolveAttachPosition;
|
|
19
19
|
const r_value_1 = require("../../../../../eval/values/r-value");
|
|
20
20
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
21
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
22
21
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
23
22
|
const identifier_2 = require("../../../../../environments/identifier");
|
|
24
|
-
const define_1 = require("../../../../../environments/define");
|
|
25
23
|
const environment_1 = require("../../../../../environments/environment");
|
|
26
24
|
const prefix_1 = require("../../../../../../util/prefix");
|
|
27
25
|
const built_in_stack_env_1 = require("./built-in-stack-env");
|
|
@@ -65,7 +63,7 @@ function resolveDefsToEnvirResolution(defs, nodeId, data) {
|
|
|
65
63
|
for (const varDef of varDefs) {
|
|
66
64
|
const named = varDef;
|
|
67
65
|
if (named.name !== undefined) {
|
|
68
|
-
mergedEnvState =
|
|
66
|
+
mergedEnvState = environment_1.REnvironment.define(named, false, mergedEnvState);
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
69
|
}
|
|
@@ -122,7 +120,7 @@ function resolveArgToEnvirOrAmbiguous(arg, data) {
|
|
|
122
120
|
if (r_argument_1.RArgument.isEmpty(arg)) {
|
|
123
121
|
return undefined;
|
|
124
122
|
}
|
|
125
|
-
const node =
|
|
123
|
+
const node = r_argument_1.RArgument.valueOf(arg);
|
|
126
124
|
// `.GlobalEnv`/`.BaseEnv` or a `globalenv()`/`baseenv()`/`emptyenv()` call resolves to the corresponding stack env
|
|
127
125
|
const stackEnv = (0, built_in_stack_env_1.resolveNodeToStackEnv)(node, data);
|
|
128
126
|
if (stackEnv !== undefined && node !== undefined) {
|
|
@@ -182,7 +180,7 @@ function suppliesArg(args, sig, formals) {
|
|
|
182
180
|
return formals.some(formal => envirArgOf(args, bound, formal) !== undefined);
|
|
183
181
|
}
|
|
184
182
|
function globalPositionOf(arg, data) {
|
|
185
|
-
const node = r_argument_1.RArgument.
|
|
183
|
+
const node = r_argument_1.RArgument.valueOf(arg);
|
|
186
184
|
const value = node === undefined ? undefined : node_value_1.NodeValue.soleOf(node.info.id, data);
|
|
187
185
|
if (node === undefined || value === undefined || r_value_1.RValue.numberOf(value) !== 1) {
|
|
188
186
|
return undefined;
|
|
@@ -249,7 +247,7 @@ function routeWrittenToCustomEnv(result, envDef, newDefAt, definedAt) {
|
|
|
249
247
|
/* only a binding the write made here moves into the environment, `local(y <- 2, envir = e)` leaves the caller's `y` alone */
|
|
250
248
|
const namesToRemove = written.filter(w => result.environment.current.lookup(identifier_1.Identifier.getName(w.name))?.some(d => d.nodeId === w.nodeId)).map(w => ({ name: w.name }));
|
|
251
249
|
for (const w of written) {
|
|
252
|
-
newEnvState =
|
|
250
|
+
newEnvState = environment_1.REnvironment.define(w, false, newEnvState);
|
|
253
251
|
}
|
|
254
252
|
const stripped = { current: result.environment.current.removeAll(namesToRemove), level: result.environment.level };
|
|
255
253
|
return { ...result, environment: rebindHolders(stripped, envDef, newEnvState, newDefAt) };
|
|
@@ -258,7 +256,7 @@ function routeWrittenToCustomEnv(result, envDef, newDefAt, definedAt) {
|
|
|
258
256
|
function rebindHolders(environment, envDef, envState, definedAt) {
|
|
259
257
|
for (const holder of holdersOf(environment, envDef)) {
|
|
260
258
|
/* a holder bound in an enclosing frame is updated there, so the write escapes the function like a `<<-` */
|
|
261
|
-
environment =
|
|
259
|
+
environment = environment_1.REnvironment.define({ ...holder, definedAt: definedAt ?? holder.definedAt, envState }, environment.current.lookup(identifier_1.Identifier.getName(holder.name)) === undefined, environment);
|
|
262
260
|
}
|
|
263
261
|
return environment;
|
|
264
262
|
}
|
|
@@ -270,7 +268,7 @@ function routeWrittenToStackEnv(result, into, rootId, definedAt) {
|
|
|
270
268
|
const written = writtenDefinitionsOf(result, definedAt);
|
|
271
269
|
let environment = into;
|
|
272
270
|
for (const w of written) {
|
|
273
|
-
environment =
|
|
271
|
+
environment = environment_1.REnvironment.define(w, true, environment);
|
|
274
272
|
result.graph.addEdge(w.nodeId, rootId, edge_1.EdgeType.Reads);
|
|
275
273
|
}
|
|
276
274
|
return { ...result, environment };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processEvalCall = processEvalCall;
|
|
4
|
+
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
4
5
|
const r_binary_op_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
|
|
5
6
|
const function_semantics_1 = require("../../../../../fn/function-semantics");
|
|
6
7
|
const info_1 = require("../../../../../info");
|
|
@@ -13,7 +14,6 @@ const logger_1 = require("../../../../../logger");
|
|
|
13
14
|
const log_1 = require("../../../../../../util/log");
|
|
14
15
|
const built_in_source_1 = require("./built-in-source");
|
|
15
16
|
const edge_1 = require("../../../../../graph/edge");
|
|
16
|
-
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
17
17
|
const assert_1 = require("../../../../../../util/assert");
|
|
18
18
|
const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
|
|
19
19
|
const node_value_1 = require("../../../../../eval/resolve/node-value");
|
|
@@ -28,6 +28,8 @@ const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/
|
|
|
28
28
|
const r_function_call_2 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
29
29
|
const built_in_ambient_state_1 = require("./built-in-ambient-state");
|
|
30
30
|
const SymbolConstructors = new Set(['as.name', 'as.symbol']);
|
|
31
|
+
const PasteFunctions = new Set(['paste', 'paste0']);
|
|
32
|
+
const StringParsers = new Set(['str2lang', 'str2expression']);
|
|
31
33
|
const SyntacticName = /^[.a-zA-Z][.a-zA-Z0-9_]*$/;
|
|
32
34
|
/** the formals of `eval(expr, envir, enclos)` */
|
|
33
35
|
const EvalParameterNames = ['expr', 'envir', 'enclos'];
|
|
@@ -90,8 +92,7 @@ function processEvalCall(name, args, rootId, data, config) {
|
|
|
90
92
|
return (0, built_in_ambient_state_1.evaluatesCapturedCode)(information, rootId, data);
|
|
91
93
|
}
|
|
92
94
|
function namesParentFrame(envir, data) {
|
|
93
|
-
return r_function_call_1.RFunctionCall.isNamed(envir)
|
|
94
|
-
&& identifier_1.Identifier.getName(envir.functionName.content) === 'parent.frame'
|
|
95
|
+
return r_function_call_1.RFunctionCall.isNamed(envir, 'parent.frame')
|
|
95
96
|
&& resolve_helper_1.Resolve.isBuiltIn(envir.functionName.content, data.environment, identifier_1.ReferenceType.Function);
|
|
96
97
|
}
|
|
97
98
|
function escapeWritesToParentFrame(expr, rootId, data, information) {
|
|
@@ -122,22 +123,22 @@ function resolveEvalToCode(evalArgument, config, data) {
|
|
|
122
123
|
return getAsString(val, data);
|
|
123
124
|
}
|
|
124
125
|
else {
|
|
125
|
-
if (r_function_call_1.RFunctionCall.isNamed(val
|
|
126
|
-
const arg =
|
|
127
|
-
const nArg =
|
|
128
|
-
if (nArg !== undefined || arg === undefined
|
|
126
|
+
if (r_function_call_1.RFunctionCall.isNamed(val, 'parse')) {
|
|
127
|
+
const arg = r_argument_1.RArgument.findNamed(val.arguments, 'text');
|
|
128
|
+
const nArg = r_argument_1.RArgument.findNamed(val.arguments, 'n');
|
|
129
|
+
if (nArg !== undefined || arg === undefined) {
|
|
129
130
|
return undefined;
|
|
130
131
|
}
|
|
131
|
-
if (r_function_call_1.RFunctionCall.isNamed(arg.value
|
|
132
|
-
return handlePaste(arg.value.arguments, data,
|
|
132
|
+
if (r_function_call_1.RFunctionCall.isNamed(arg.value, PasteFunctions)) {
|
|
133
|
+
return handlePaste(arg.value.arguments, data, r_function_call_1.RFunctionCall.isNamed(arg.value, 'paste') ? [' '] : ['']);
|
|
133
134
|
}
|
|
134
135
|
return getAsString(arg.value, data);
|
|
135
136
|
}
|
|
136
|
-
else if (r_function_call_1.RFunctionCall.isNamed(val
|
|
137
|
+
else if (r_function_call_1.RFunctionCall.isNamed(val, StringParsers)) {
|
|
137
138
|
/* both parse their string, like `parse(text = s)` */
|
|
138
139
|
return getAsString(r_function_call_1.RFunctionCall.soleArgument(val.arguments)?.value, data);
|
|
139
140
|
}
|
|
140
|
-
else if (r_function_call_1.RFunctionCall.isNamed(val
|
|
141
|
+
else if (r_function_call_1.RFunctionCall.isNamed(val, SymbolConstructors)
|
|
141
142
|
&& resolve_helper_1.Resolve.isBuiltIn(val.functionName.content, data.environment, identifier_1.ReferenceType.Function)) {
|
|
142
143
|
const arg = r_function_call_1.RFunctionCall.soleArgument(val.arguments);
|
|
143
144
|
const named = arg?.value ? (0, built_in_envir_utils_1.resolveConstantString)(arg.value, data) : undefined;
|
|
@@ -169,9 +170,9 @@ function getAsString(val, data) {
|
|
|
169
170
|
return undefined;
|
|
170
171
|
}
|
|
171
172
|
function handlePaste(args, data, sepDefault) {
|
|
172
|
-
const sepArg =
|
|
173
|
+
const sepArg = r_argument_1.RArgument.findNamed(args, 'sep');
|
|
173
174
|
if (sepArg) {
|
|
174
|
-
const res = sepArg
|
|
175
|
+
const res = sepArg.value ? getAsString(sepArg.value, data) : undefined;
|
|
175
176
|
if (!res) {
|
|
176
177
|
// sep not resolvable clearly / unknown
|
|
177
178
|
return undefined;
|
|
@@ -5,7 +5,6 @@ const info_1 = require("../../../../../info");
|
|
|
5
5
|
const processor_1 = require("../../../../../processor");
|
|
6
6
|
const linker_1 = require("../../../../linker");
|
|
7
7
|
const assert_1 = require("../../../../../../util/assert");
|
|
8
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
9
8
|
const common_1 = require("../common");
|
|
10
9
|
const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
11
10
|
const graph_1 = require("../../../../../graph/graph");
|
|
@@ -13,8 +12,6 @@ const identifier_1 = require("../../../../../environments/identifier");
|
|
|
13
12
|
const edge_1 = require("../../../../../graph/edge");
|
|
14
13
|
const control_flow_1 = require("../../../../control-flow");
|
|
15
14
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
16
|
-
const scoping_1 = require("../../../../../environments/scoping");
|
|
17
|
-
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
18
15
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
19
16
|
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
20
17
|
const apply_kill_1 = require("../../../../../environments/apply-kill");
|
|
@@ -30,8 +27,9 @@ const r_for_loop_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/node
|
|
|
30
27
|
const model_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/model");
|
|
31
28
|
const defaultmap_1 = require("../../../../../../util/collections/defaultmap");
|
|
32
29
|
const objects_1 = require("../../../../../../util/objects");
|
|
33
|
-
const frame_reflection_1 = require("../../../../../fn/frame-reflection");
|
|
34
30
|
const built_in_ambient_state_1 = require("./built-in-ambient-state");
|
|
31
|
+
const df_helper_1 = require("../../../../../graph/df-helper");
|
|
32
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
35
33
|
/**
|
|
36
34
|
* Whether the definitions of this list among the `targets` of a read cover every branch, alone or together.
|
|
37
35
|
* Only then the read is resolved here and must not bubble up as an ingoing reference.
|
|
@@ -45,7 +43,7 @@ function coveredByListDefinitions(targets, listEnvironments) {
|
|
|
45
43
|
}
|
|
46
44
|
/** Whether reading the variable defined at `id` calls a function, as for an active binding. */
|
|
47
45
|
function callsOnRead(graph, id) {
|
|
48
|
-
return vertex_2.DfgVertex.isVariableDefinition(graph.getVertex(id)) &&
|
|
46
|
+
return vertex_2.DfgVertex.isVariableDefinition(graph.getVertex(id)) && df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Calls).length > 0;
|
|
49
47
|
}
|
|
50
48
|
/** @returns whether `read` sees a definition */
|
|
51
49
|
function linkReadNameToWriteIfPossible(read, environments, listEnvironments, remainingRead, nextGraph, activeReads) {
|
|
@@ -101,7 +99,7 @@ function* transitivelyCalledDefinitions(initial, graph, resolveEnv) {
|
|
|
101
99
|
}
|
|
102
100
|
seen.add(fn.id);
|
|
103
101
|
yield { fn, direct, cds };
|
|
104
|
-
for (const [, call] of
|
|
102
|
+
for (const [, call] of df_helper_1.Dataflow.callsIn(fn, graph)) {
|
|
105
103
|
if (call.onlyBuiltin || call.name === undefined) {
|
|
106
104
|
continue;
|
|
107
105
|
}
|
|
@@ -208,6 +206,16 @@ function printMethodsOf(id, environment, graph) {
|
|
|
208
206
|
}
|
|
209
207
|
return [{ functionCall: id, called, propagateExitPoints: [] }];
|
|
210
208
|
}
|
|
209
|
+
/** The bindings of every package layer `env` sees, which a callee's environment shares while nothing writes to them. */
|
|
210
|
+
function packageLayersOf(env) {
|
|
211
|
+
const layers = new Set();
|
|
212
|
+
for (const current of environment_1.REnvironment.frames(env.current)) {
|
|
213
|
+
if (current.t !== undefined) {
|
|
214
|
+
layers.add(current.memory);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return layers;
|
|
218
|
+
}
|
|
211
219
|
function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextGraph, localDefs, idMap) {
|
|
212
220
|
for (const { functionCall, called } of calledEnvs) {
|
|
213
221
|
const callDependencies = nextGraph.getVertex(functionCall)?.cds;
|
|
@@ -224,16 +232,22 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
|
|
|
224
232
|
let environment = direct ? calledFn.subflow.environment : withoutPackageLayers(calledFn.subflow.environment);
|
|
225
233
|
if (environment.level > inputEnvironment.level) {
|
|
226
234
|
/* the callee's own frame dies with the call */
|
|
227
|
-
environment =
|
|
235
|
+
environment = environment_1.REnvironment.popLocal(environment);
|
|
228
236
|
/* frames above the caller are ones its closure captured, so fold them back instead of losing their writes */
|
|
229
237
|
while (environment.level > inputEnvironment.level) {
|
|
230
238
|
environment = foldFrameIntoParent(environment);
|
|
231
239
|
}
|
|
232
240
|
}
|
|
233
241
|
let hasUpdate = false;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
242
|
+
const seenByCaller = packageLayersOf(inputEnvironment);
|
|
243
|
+
for (const current of environment_1.REnvironment.frames(environment.current)) {
|
|
244
|
+
if (current.t !== undefined) {
|
|
245
|
+
/* the callee sees the caller's packages too, but only one attached inside the body (library()) is its doing, and propagates like R attaching globally */
|
|
246
|
+
if (seenByCaller.has(current.memory)) {
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
hasUpdate = true;
|
|
250
|
+
}
|
|
237
251
|
for (const definitions of current.memory.values()) {
|
|
238
252
|
for (const def of definitions) {
|
|
239
253
|
if (!node_id_1.NodeId.isBuiltIn(def.definedAt)) {
|
|
@@ -254,7 +268,7 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
|
|
|
254
268
|
};
|
|
255
269
|
}
|
|
256
270
|
const dependencies = cds === undefined ? callDependencies : [...callDependencies ?? [], ...cds];
|
|
257
|
-
inputEnvironment =
|
|
271
|
+
inputEnvironment = environment_1.REnvironment.overwrite(inputEnvironment, environment, dependencies);
|
|
258
272
|
}
|
|
259
273
|
}
|
|
260
274
|
return inputEnvironment;
|
|
@@ -283,7 +297,7 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
283
297
|
let initialState;
|
|
284
298
|
const hooks = [];
|
|
285
299
|
for (const arg of args) {
|
|
286
|
-
const expression =
|
|
300
|
+
const expression = r_argument_1.RArgument.unnamedValueOf(arg);
|
|
287
301
|
if (expression === undefined) {
|
|
288
302
|
processedExpressions.push(undefined);
|
|
289
303
|
continue;
|
|
@@ -330,7 +344,7 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
330
344
|
}
|
|
331
345
|
}
|
|
332
346
|
(0, info_1.addNonDefaultExitPoints)(exitPoints, invertExitCds, data.cds, processed.exitPoints);
|
|
333
|
-
environment = exitPoints.length > 0 ?
|
|
347
|
+
environment = exitPoints.length > 0 ? environment_1.REnvironment.overwrite(environment, processed.environment) : processed.environment;
|
|
334
348
|
// if the called function has global redefinitions, we have to keep them within our environment
|
|
335
349
|
environment = updateSideEffectsForCalledFunctions(calledEnvs, environment, nextGraph, processed.out, idMap);
|
|
336
350
|
// removals are already reflected in the threaded environment; we only bubble them (net of later writes)
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processForLoop = processForLoop;
|
|
4
|
+
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
4
5
|
const processor_1 = require("../../../../../processor");
|
|
5
6
|
const info_1 = require("../../../../../info");
|
|
6
7
|
const linker_1 = require("../../../../linker");
|
|
7
8
|
const known_call_handling_1 = require("../known-call-handling");
|
|
8
9
|
const assert_1 = require("../../../../../../util/assert");
|
|
9
10
|
const common_1 = require("../common");
|
|
10
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
11
11
|
const logger_1 = require("../../../../../logger");
|
|
12
|
-
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
13
|
-
const define_1 = require("../../../../../environments/define");
|
|
14
|
-
const append_1 = require("../../../../../environments/append");
|
|
15
12
|
const edge_1 = require("../../../../../graph/edge");
|
|
16
13
|
const control_flow_1 = require("../../../../control-flow");
|
|
17
14
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
@@ -22,6 +19,7 @@ const built_in_ambient_state_1 = require("./built-in-ambient-state");
|
|
|
22
19
|
const node_value_1 = require("../../../../../eval/resolve/node-value");
|
|
23
20
|
const r_binary_op_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
|
|
24
21
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
22
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
25
23
|
const ScalarTypes = new Set(['interval', 'number', 'string', 'logical']);
|
|
26
24
|
/** a value R iterates over at least once, `NULL` and empty vectors are the ones it does not */
|
|
27
25
|
function hasElement(value) {
|
|
@@ -58,7 +56,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
58
56
|
logger_1.dataflowLogger.warn(`For-Loop ${identifier_1.Identifier.toString(name.content)} does not have three arguments, skipping`);
|
|
59
57
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
60
58
|
}
|
|
61
|
-
const [variableArg, vectorArg, bodyArg] = args.map(e =>
|
|
59
|
+
const [variableArg, vectorArg, bodyArg] = args.map(e => r_argument_1.RArgument.unnamedValueOf(e));
|
|
62
60
|
/* merged back in case the loop never runs */
|
|
63
61
|
const origEnv = data.environment;
|
|
64
62
|
(0, assert_1.guard)(variableArg !== undefined && vectorArg !== undefined && bodyArg !== undefined, () => `For-Loop ${JSON.stringify(args)} has missing arguments! Bad!`);
|
|
@@ -70,7 +68,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
70
68
|
/* resolved before the loop variable is bound, as it may share the name of what the vector reads */
|
|
71
69
|
const nonEmpty = iteratesAtLeastOnce(vectorArg, vector, data);
|
|
72
70
|
const variable = (0, processor_1.processDataflowFor)(variableArg, data);
|
|
73
|
-
let headEnvironments =
|
|
71
|
+
let headEnvironments = environment_1.REnvironment.overwrite(vector.environment, variable.environment);
|
|
74
72
|
/* only the vector's references and entry point are read past this, its graph is not */
|
|
75
73
|
const headGraph = variable.graph.mergeWith(vector.graph, true, true);
|
|
76
74
|
const writtenVariable = variable.unknownReferences.concat(variable.in);
|
|
@@ -82,7 +80,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
82
80
|
value: [vectorArg.info.id],
|
|
83
81
|
iterated: true
|
|
84
82
|
};
|
|
85
|
-
headEnvironments =
|
|
83
|
+
headEnvironments = environment_1.REnvironment.define(definition, false, headEnvironments);
|
|
86
84
|
}
|
|
87
85
|
data.environment = headEnvironments;
|
|
88
86
|
const body = (0, processor_1.processDataflowFor)(bodyArg, data);
|
|
@@ -129,7 +127,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
129
127
|
control_flow_1.ControlFlow.jumpsTo(nextGraph, body, 2 /* ExitPointType.Break */, rootId);
|
|
130
128
|
// unless the body certainly runs, a removal within it only happens maybe; apply it as the merge cannot represent it
|
|
131
129
|
const loopKill = body.kill?.length ? (once ? body.kill : (0, apply_kill_1.makeKillsMaybe)(body.kill, cd)) : undefined;
|
|
132
|
-
const loopEnvironment = once ? body.environment :
|
|
130
|
+
const loopEnvironment = once ? body.environment : environment_1.REnvironment.append(origEnv, environment_1.REnvironment.append(headEnvironments, body.environment));
|
|
133
131
|
return {
|
|
134
132
|
unknownReferences: [],
|
|
135
133
|
/* we only want those not bound by a local variable */
|