@eagleoutice/flowr 2.16.1 → 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 +15 -2
- package/dataflow/environments/built-in-props.js +31 -4
- 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 +385 -25
- package/dataflow/environments/default-builtin-config.js +186 -106
- 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 +1 -2
- package/dataflow/environments/identifier.js +5 -7
- package/dataflow/environments/overwrite.js +1 -0
- package/dataflow/environments/query-fn-props.d.ts +3 -0
- package/dataflow/environments/query-fn-props.js +7 -0
- package/dataflow/environments/resolve-by-name.js +11 -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 +21 -12
- 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 +15 -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 +14 -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 +64 -11
- 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 +526 -4
- 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/function-finder-util.d.ts +1 -1
- package/linter/rules/function-finder-util.js +1 -3
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +13 -14
- package/linter/rules/network-functions.d.ts +4 -3
- package/linter/rules/network-functions.js +14 -12
- package/linter/rules/no-leaked-credentials.d.ts +8 -3
- package/linter/rules/no-leaked-credentials.js +134 -36
- package/linter/rules/problematic-inputs.d.ts +1 -1
- package/linter/rules/problematic-inputs.js +21 -14
- 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.d.ts +13 -2
- package/linter/rules/unescaped-arguments.js +104 -15
- 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 +26 -33
- 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-source-functions.d.ts +6 -4
- package/queries/catalog/input-sources-query/input-source-functions.js +11 -6
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -3
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +1 -1
- package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -5
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +12 -4
- package/queries/catalog/input-sources-query/simple-input-classifier.js +237 -40
- 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-enrichers.js +5 -3
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/filters/all-variables.js +1 -2
- package/slicing/static/fingerprint.js +11 -2
- package/slicing/static/slice-call.d.ts +2 -8
- package/slicing/static/slice-call.js +8 -18
- package/slicing/static/static-slicer.js +81 -6
- package/util/collections/arrays.js +1 -1
- package/util/collections/set.js +1 -1
- package/util/diff-graph.d.ts +4 -0
- package/util/diff-graph.js +12 -0
- package/util/files.js +2 -6
- package/util/json.js +1 -15
- package/util/mermaid/cfg.js +10 -17
- package/util/mermaid/dfg.js +6 -8
- package/util/objects.d.ts +1 -1
- package/util/quads.js +4 -13
- package/util/r-author.js +5 -5
- package/util/range.d.ts +9 -0
- package/util/range.js +11 -0
- package/util/schema.js +3 -3
- package/util/simple-df/dfg-view.js +2 -1
- package/util/text/ansi.js +1 -2
- package/util/text/playground-link.js +2 -1
- package/util/text/r-highlight.js +2 -1
- package/util/text/strings.d.ts +2 -0
- package/util/text/strings.js +5 -0
- package/util/text/time.js +1 -2
- package/util/version.js +4 -3
- package/dataflow/fn/recursive-function.d.ts +0 -6
- package/dataflow/fn/recursive-function.js +0 -32
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +0 -16
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +0 -27
|
@@ -4,7 +4,6 @@ exports.processPurrrFormula = processPurrrFormula;
|
|
|
4
4
|
const function_semantics_1 = require("../../../../../fn/function-semantics");
|
|
5
5
|
const known_call_handling_1 = require("../known-call-handling");
|
|
6
6
|
const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
7
|
-
const linker_1 = require("../../../../linker");
|
|
8
7
|
const df_helper_1 = require("../../../../../graph/df-helper");
|
|
9
8
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
10
9
|
const common_1 = require("../common");
|
|
@@ -13,11 +12,11 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
|
|
|
13
12
|
const model_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/model");
|
|
14
13
|
const r_function_definition_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
15
14
|
const edge_1 = require("../../../../../graph/edge");
|
|
16
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
17
15
|
const logger_1 = require("../../../../../logger");
|
|
18
16
|
const graph_1 = require("../../../../../graph/graph");
|
|
19
17
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
20
18
|
const resolve_helper_1 = require("../../../../../environments/resolve-helper");
|
|
19
|
+
const assert_1 = require("../../../../../../util/assert");
|
|
21
20
|
function linkOnSymbol(rootId, filteredArgs, node, graph, data) {
|
|
22
21
|
// If the formula is a symbol naming a function, try to resolve it in the call environment.
|
|
23
22
|
try {
|
|
@@ -74,7 +73,7 @@ function processPurrrFormula(name, args, rootId, data, config) {
|
|
|
74
73
|
return information;
|
|
75
74
|
}
|
|
76
75
|
const formulaArg = r_argument_1.RArgument.getWithId(args, formulaArgId);
|
|
77
|
-
const formulaNode = formulaArg ?
|
|
76
|
+
const formulaNode = formulaArg ? r_argument_1.RArgument.unnamedValueOf(formulaArg) : undefined;
|
|
78
77
|
if (!formulaNode) {
|
|
79
78
|
return information;
|
|
80
79
|
}
|
|
@@ -100,13 +99,21 @@ function processPurrrFormula(name, args, rootId, data, config) {
|
|
|
100
99
|
}
|
|
101
100
|
else if (r_symbol_1.RSymbol.is(formulaNode)) {
|
|
102
101
|
linkOnSymbol(rootId, filteredCallArgs, formulaNode, information.graph, data);
|
|
102
|
+
/* like `lapply`, a named function handed over is called with the remaining arguments */
|
|
103
|
+
if (resolve_helper_1.Resolve.byNameAndType(formulaNode.content, data.environment, identifier_1.ReferenceType.Function)?.length) {
|
|
104
|
+
const id = formulaNode.info.id;
|
|
105
|
+
information.graph.updateToFunctionCall({ tag: vertex_1.VertexType.FunctionCall, id, name: formulaNode.content, args: filteredCallArgs, environment: data.environment, onlyBuiltin: false, cds: data.cds, origin: [built_in_proc_name_1.BuiltInProcName.Function] });
|
|
106
|
+
for (const arg of filteredCallArgs.map(graph_1.FunctionArgument.getId).filter(assert_1.isNotUndefined)) {
|
|
107
|
+
information.graph.addEdge(id, arg, edge_1.EdgeType.Argument);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
103
110
|
}
|
|
104
111
|
else {
|
|
105
112
|
try {
|
|
106
113
|
df_helper_1.Dataflow.visitDfg(information.graph, formulaNode.info.id, (vtx) => {
|
|
107
114
|
if (vertex_1.DfgVertex.isFunctionCall(vtx)) {
|
|
108
115
|
information.graph.addEdge(rootId, vtx.id, edge_1.EdgeType.Calls);
|
|
109
|
-
const targets =
|
|
116
|
+
const targets = df_helper_1.Dataflow.callTargetsOf(vtx.id, information.graph, vtx.environment);
|
|
110
117
|
for (const t of targets) {
|
|
111
118
|
information.graph.addEdge(rootId, t, edge_1.EdgeType.Calls);
|
|
112
119
|
const linked = data.completeAst.idMap.get(t);
|
|
@@ -124,7 +131,7 @@ function processPurrrFormula(name, args, rootId, data, config) {
|
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
|
-
return !
|
|
134
|
+
return !vertex_1.DfgVertex.hasOrigin(vtx, built_in_proc_name_1.BuiltInProcName.List);
|
|
128
135
|
}
|
|
129
136
|
else if (vertex_1.DfgVertex.isUse(vtx)) {
|
|
130
137
|
const node = data.completeAst.idMap.get(vtx.id);
|
|
@@ -154,7 +161,7 @@ function processPurrrFormula(name, args, rootId, data, config) {
|
|
|
154
161
|
return false;
|
|
155
162
|
}
|
|
156
163
|
const arg = r_argument_1.RArgument.getWithId(args, pid);
|
|
157
|
-
const producedNode = arg ?
|
|
164
|
+
const producedNode = arg ? r_argument_1.RArgument.unnamedValueOf(arg) : undefined;
|
|
158
165
|
if (!producedNode) {
|
|
159
166
|
return false;
|
|
160
167
|
}
|
|
@@ -171,7 +178,7 @@ function processPurrrFormula(name, args, rootId, data, config) {
|
|
|
171
178
|
const returnArgId = argMaps.get(config.returnArg)?.[0];
|
|
172
179
|
if (returnArgId) {
|
|
173
180
|
const returnArg = r_argument_1.RArgument.getWithId(args, returnArgId);
|
|
174
|
-
const producedNode = returnArg ?
|
|
181
|
+
const producedNode = returnArg ? r_argument_1.RArgument.unnamedValueOf(returnArg) : undefined;
|
|
175
182
|
if (producedNode) {
|
|
176
183
|
information.graph.addEdge(rootId, producedNode.info.id, edge_1.EdgeType.Returns);
|
|
177
184
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processQuote = processQuote;
|
|
4
|
+
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
4
5
|
const function_semantics_1 = require("../../../../../fn/function-semantics");
|
|
5
6
|
const known_call_handling_1 = require("../known-call-handling");
|
|
6
7
|
const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
@@ -12,18 +13,18 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
|
|
|
12
13
|
const graph_1 = require("../../../../../graph/graph");
|
|
13
14
|
const nse_1 = require("../nse");
|
|
14
15
|
const linker_1 = require("../../../../linker");
|
|
15
|
-
const
|
|
16
|
-
const scoping_1 = require("../../../../../environments/scoping");
|
|
16
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
17
17
|
/** Process a call to `quote` or similar nse/substitution functions. */
|
|
18
18
|
function processQuote(name, args, rootId, data, config) {
|
|
19
19
|
const startEnv = data.environment;
|
|
20
20
|
let lastEnv = startEnv;
|
|
21
21
|
const { information, processedArguments, fnRef } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
22
|
+
keepArgumentGraphs: true,
|
|
22
23
|
name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Quote, sig: config.sig,
|
|
23
24
|
patchData(data, index) {
|
|
24
25
|
if (index === config.quoteArgumentsWithIndex) {
|
|
25
26
|
lastEnv = data.environment;
|
|
26
|
-
return { ...data, environment:
|
|
27
|
+
return { ...data, environment: environment_1.REnvironment.cleanOf(data.environment) };
|
|
27
28
|
}
|
|
28
29
|
else {
|
|
29
30
|
return { ...data, environment: lastEnv };
|
|
@@ -33,7 +34,7 @@ function processQuote(name, args, rootId, data, config) {
|
|
|
33
34
|
const others = processedArguments.filter((p, i) => p !== undefined && i !== config.quoteArgumentsWithIndex);
|
|
34
35
|
const inRefs = [fnRef, ...others.flatMap(p => p.in)];
|
|
35
36
|
const quotedArg = args[config.quoteArgumentsWithIndex];
|
|
36
|
-
const evaluated = function_semantics_1.FunctionSemantics.call.nse.unquoted(r_argument_1.RArgument.
|
|
37
|
+
const evaluated = function_semantics_1.FunctionSemantics.call.nse.unquoted(r_argument_1.RArgument.valueOf(quotedArg), config.unquote ?? nse_1.Unquote.None);
|
|
37
38
|
const quotedProcessed = processedArguments[config.quoteArgumentsWithIndex];
|
|
38
39
|
if (quotedProcessed) {
|
|
39
40
|
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, [config.quoteArgumentsWithIndex], { evaluated });
|
|
@@ -83,7 +84,7 @@ function applyEnvListReplacement(information, env, expr) {
|
|
|
83
84
|
if (!vertex_1.DfgVertex.isFunctionCall(vtx)) {
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
if (!
|
|
87
|
+
if (!vertex_1.DfgVertex.hasOrigin(vtx, built_in_proc_name_1.BuiltInProcName.List)) {
|
|
87
88
|
return true;
|
|
88
89
|
}
|
|
89
90
|
useMap ??= usesByName(expr);
|
|
@@ -6,7 +6,6 @@ const info_1 = require("../../../../../info");
|
|
|
6
6
|
const linker_1 = require("../../../../linker");
|
|
7
7
|
const known_call_handling_1 = require("../known-call-handling");
|
|
8
8
|
const assert_1 = require("../../../../../../util/assert");
|
|
9
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
10
9
|
const logger_1 = require("../../../../../logger");
|
|
11
10
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
12
11
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
@@ -27,7 +26,7 @@ function processRepeatLoop(name, args, rootId, data) {
|
|
|
27
26
|
logger_1.dataflowLogger.warn(`Repeat-Loop ${identifier_1.Identifier.toString(name.content)} does not have 1 argument, skipping`);
|
|
28
27
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
29
28
|
}
|
|
30
|
-
const unpacked =
|
|
29
|
+
const unpacked = r_argument_1.RArgument.unnamedValueOf(args[0]);
|
|
31
30
|
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
32
31
|
name,
|
|
33
32
|
args: unpacked ? [unpacked] : args,
|
|
@@ -10,7 +10,6 @@ const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/
|
|
|
10
10
|
const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
11
11
|
const logger_1 = require("../../../../../logger");
|
|
12
12
|
const edge_1 = require("../../../../../graph/edge");
|
|
13
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
14
13
|
const built_in_access_1 = require("./built-in-access");
|
|
15
14
|
const built_in_1 = require("../../../../../environments/built-in");
|
|
16
15
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
@@ -44,7 +43,7 @@ args, rootId, data, config) {
|
|
|
44
43
|
if (args.length > 2 && args[1] !== r_function_call_1.EmptyArgument) {
|
|
45
44
|
tarName += built_in_s_seven_dispatch_1.S7DispatchSeparator + args[1].lexeme;
|
|
46
45
|
}
|
|
47
|
-
const uArg =
|
|
46
|
+
const uArg = r_argument_1.RArgument.valueOf(targetArg) ?? targetArg;
|
|
48
47
|
targetArg = (0, make_argument_1.toUnnamedArgument)({
|
|
49
48
|
content: tarName,
|
|
50
49
|
type: type_1.RType.Symbol,
|
|
@@ -79,7 +78,7 @@ args, rootId, data, config) {
|
|
|
79
78
|
if (vertex_1.DfgVertex.isFunctionCall(createdVert)) {
|
|
80
79
|
createdVert.origin = [built_in_proc_name_1.BuiltInProcName.Replacement];
|
|
81
80
|
}
|
|
82
|
-
const targetVert = res.graph.getVertex(
|
|
81
|
+
const targetVert = res.graph.getVertex(r_argument_1.RArgument.valueOf(args[0])?.info.id);
|
|
83
82
|
if (vertex_1.DfgVertex.isVariableDefinition(targetVert)) {
|
|
84
83
|
targetVert.par = true;
|
|
85
84
|
}
|
|
@@ -92,7 +91,7 @@ args, rootId, data, config) {
|
|
|
92
91
|
finalGraph: res.graph,
|
|
93
92
|
});
|
|
94
93
|
const cfgEntry = control_flow_1.ControlFlow.inSequence(res.graph, indexArguments, control_flow_1.ControlFlow.entryOf(res));
|
|
95
|
-
const targetNode =
|
|
94
|
+
const targetNode = r_argument_1.RArgument.valueOf(args[0]);
|
|
96
95
|
if (targetNode !== undefined && targetNode.info.id !== rootId) {
|
|
97
96
|
/*
|
|
98
97
|
* `x$a[i] <- v` becomes one replacement call per accessor, each taking what the previous one produced
|
|
@@ -110,13 +109,13 @@ args, rootId, data, config) {
|
|
|
110
109
|
if (r_argument_1.RArgument.isEmpty(a)) {
|
|
111
110
|
return undefined;
|
|
112
111
|
}
|
|
113
|
-
const entry = a.name === undefined ?
|
|
112
|
+
const entry = a.name === undefined ? r_argument_1.RArgument.unnamedValueOf(a) : a;
|
|
114
113
|
return entry === undefined ? undefined : { entryPoint: entry.info.id };
|
|
115
114
|
}),
|
|
116
115
|
origin: built_in_proc_name_1.BuiltInProcName.Replacement,
|
|
117
116
|
link: config.assignRootId ? { origin: [config.assignRootId] } : undefined
|
|
118
117
|
});
|
|
119
|
-
const firstArg =
|
|
118
|
+
const firstArg = r_argument_1.RArgument.unnamedValueOf(args[0]);
|
|
120
119
|
(0, unknown_replacement_1.handleReplacementOperator)({
|
|
121
120
|
operator: name.content,
|
|
122
121
|
target: firstArg?.lexeme,
|
|
@@ -13,13 +13,12 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
|
|
|
13
13
|
const node_value_1 = require("../../../../../eval/resolve/node-value");
|
|
14
14
|
const r_value_1 = require("../../../../../eval/values/r-value");
|
|
15
15
|
const apply_kill_1 = require("../../../../../environments/apply-kill");
|
|
16
|
-
const define_1 = require("../../../../../environments/define");
|
|
17
16
|
const built_in_envir_utils_1 = require("./built-in-envir-utils");
|
|
18
17
|
const built_in_stack_env_1 = require("./built-in-stack-env");
|
|
19
18
|
const resolve_helper_1 = require("../../../../../environments/resolve-helper");
|
|
20
19
|
const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
21
|
-
const scoping_1 = require("../../../../../environments/scoping");
|
|
22
20
|
const built_in_ambient_state_1 = require("./built-in-ambient-state");
|
|
21
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
23
22
|
/** whether `value` is a call to the *built-in* `ls`/`objects` that lists (and thus clears) the whole scope */
|
|
24
23
|
function isBuiltInLsCall(value, data) {
|
|
25
24
|
if (!r_function_call_2.RFunctionCall.isNamed(value)) {
|
|
@@ -156,7 +155,7 @@ function buildKills(targets, cds, killedBy) {
|
|
|
156
155
|
/** Removes the targets from a tracked custom environment (`rm(..., envir=e)`) instead of the lexical scope. */
|
|
157
156
|
function removeFromCustomEnv(res, envir, targets, rootId, cds) {
|
|
158
157
|
const newEnvState = (0, apply_kill_1.applyKills)(envir.envDef.envState, buildKills(targets, cds, rootId));
|
|
159
|
-
const environment =
|
|
158
|
+
const environment = environment_1.REnvironment.define({ ...envir.envDef, definedAt: rootId, envState: newEnvState }, false, res.environment);
|
|
160
159
|
return { ...res, environment };
|
|
161
160
|
}
|
|
162
161
|
/** The arguments `rm` swallows with its `...`: they name what to remove instead of being evaluated. */
|
|
@@ -181,10 +180,11 @@ function processRm(name, args, rootId, data) {
|
|
|
181
180
|
}
|
|
182
181
|
const nse = nonStandardArguments(args);
|
|
183
182
|
const { information, processedArguments, fnRef } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
183
|
+
keepArgumentGraphs: true,
|
|
184
184
|
name, args, rootId, data,
|
|
185
185
|
origin: built_in_proc_name_1.BuiltInProcName.Rm,
|
|
186
186
|
/* an unevaluated name must not resolve against the environment */
|
|
187
|
-
patchData: (d, i) => nse.has(i) ? { ...d, environment:
|
|
187
|
+
patchData: (d, i) => nse.has(i) ? { ...d, environment: environment_1.REnvironment.cleanOf(d.environment) } : d
|
|
188
188
|
});
|
|
189
189
|
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, [...nse]);
|
|
190
190
|
/* the enclosing scope would link the unevaluated names, so they must not escape this call */
|
|
@@ -9,11 +9,11 @@ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model
|
|
|
9
9
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
10
10
|
const class_declaration_1 = require("../../../../../fn/class-declaration");
|
|
11
11
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
12
|
-
const define_1 = require("../../../../../environments/define");
|
|
13
12
|
const node_value_1 = require("../../../../../eval/resolve/node-value");
|
|
14
13
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
15
14
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
16
15
|
const known_call_handling_1 = require("../known-call-handling");
|
|
16
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
17
17
|
/** marks a name in R's S4 class registry (the string-keyed table `setClass` writes and `new("P")` reads), separate from the variable scope so a class `P` stays apart from a variable `P` */
|
|
18
18
|
const S4ClassMark = '﹕s4class﹕';
|
|
19
19
|
/** The registry name of the S4 class `cls`, see {@link S4ClassMark}. */
|
|
@@ -21,12 +21,12 @@ function s4ClassName(cls) {
|
|
|
21
21
|
return S4ClassMark + cls;
|
|
22
22
|
}
|
|
23
23
|
/** The names an argument states, looking through the `c(...)`/`signature(...)` wrappers a signature may use. */
|
|
24
|
-
function
|
|
24
|
+
function classNamesOf(node, data) {
|
|
25
25
|
const known = node === undefined ? [] : node_value_1.NodeValue.knownStringsOf(node.info.id, data);
|
|
26
26
|
if (known.length > 0 || !r_function_call_1.RFunctionCall.isNamed(node)) {
|
|
27
27
|
return known;
|
|
28
28
|
}
|
|
29
|
-
return node.arguments.flatMap(arg =>
|
|
29
|
+
return node.arguments.flatMap(arg => classNamesOf(r_argument_1.RArgument.valueOf(arg), data));
|
|
30
30
|
}
|
|
31
31
|
/** Adds a read of every given name to the call, so the call depends on whatever registered them. */
|
|
32
32
|
function readNames(info, rootId, names, type, data) {
|
|
@@ -36,17 +36,17 @@ function readNames(info, rootId, names, type, data) {
|
|
|
36
36
|
}
|
|
37
37
|
/** Defines `name` in the environment and records it as an out-reference of the call at `rootId`. */
|
|
38
38
|
function defineOut(info, rootId, name, type, data) {
|
|
39
|
-
info.environment =
|
|
39
|
+
info.environment = environment_1.REnvironment.define({ name, nodeId: rootId, type, definedAt: rootId, cds: data.cds }, false, info.environment);
|
|
40
40
|
info.out = [...info.out, { nodeId: rootId, name, type, cds: data.cds }];
|
|
41
41
|
}
|
|
42
42
|
/** wires the S4 registrations a call *uses* (the classes and generic its arguments name by string), read against the registry so the call depends on whatever `setClass`/`setGeneric` wrote them */
|
|
43
43
|
function linkS4Uses(info, args, rootId, data, config) {
|
|
44
44
|
for (const ref of config.classArgs ?? []) {
|
|
45
|
-
readNames(info, rootId,
|
|
45
|
+
readNames(info, rootId, classNamesOf((0, class_declaration_1.argForImpl)(args, ref), data).map(s4ClassName), identifier_1.ReferenceType.Variable, data);
|
|
46
46
|
}
|
|
47
|
-
const generics =
|
|
47
|
+
const generics = classNamesOf((0, class_declaration_1.argForImpl)(args, config.genericArg), data).map(n => n + (config.genericSuffix ?? ''));
|
|
48
48
|
readNames(info, rootId, generics, identifier_1.ReferenceType.Function, data);
|
|
49
|
-
const registered =
|
|
49
|
+
const registered = classNamesOf((0, class_declaration_1.argForImpl)(args, config.registersArg), data).map(s4ClassName);
|
|
50
50
|
readNames(info, rootId, registered, identifier_1.ReferenceType.Variable, data);
|
|
51
51
|
for (const cls of registered) {
|
|
52
52
|
defineOut(info, rootId, cls, identifier_1.ReferenceType.Variable, data);
|
|
@@ -8,7 +8,6 @@ const known_call_handling_1 = require("../known-call-handling");
|
|
|
8
8
|
const built_in_apply_1 = require("./built-in-apply");
|
|
9
9
|
const logger_1 = require("../../../../../logger");
|
|
10
10
|
const common_1 = require("../common");
|
|
11
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
12
11
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
13
12
|
const edge_1 = require("../../../../../graph/edge");
|
|
14
13
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
@@ -37,7 +36,7 @@ function processS7NewGeneric(name, args, rootId, data, config) {
|
|
|
37
36
|
[config.args.fun]: 'fun',
|
|
38
37
|
'...': '...'
|
|
39
38
|
});
|
|
40
|
-
const argNamed = (formal) =>
|
|
39
|
+
const argNamed = (formal) => r_argument_1.RArgument.valueOf(r_argument_1.RArgument.getWithId(args, argMaps.get(formal)?.[0]));
|
|
41
40
|
const genName = argNamed('name');
|
|
42
41
|
if (!genName) {
|
|
43
42
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
@@ -7,7 +7,6 @@ const info_1 = require("../../../../../info");
|
|
|
7
7
|
const known_call_handling_1 = require("../known-call-handling");
|
|
8
8
|
const logger_1 = require("../../../../../logger");
|
|
9
9
|
const common_1 = require("../common");
|
|
10
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
11
10
|
const node_value_1 = require("../../../../../eval/resolve/node-value");
|
|
12
11
|
const edge_1 = require("../../../../../graph/edge");
|
|
13
12
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
@@ -29,11 +28,11 @@ function processS3Dispatch(name, args, rootId, data, config) {
|
|
|
29
28
|
[config.args.object]: 'object',
|
|
30
29
|
'...': '...'
|
|
31
30
|
});
|
|
32
|
-
const generic =
|
|
31
|
+
const generic = r_argument_1.RArgument.valueOf(r_argument_1.RArgument.getWithId(args, argMaps.get('generic')?.[0]));
|
|
33
32
|
if (!generic && !config.inferFromClosure) {
|
|
34
33
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
35
34
|
}
|
|
36
|
-
const obj =
|
|
35
|
+
const obj = r_argument_1.RArgument.valueOf(r_argument_1.RArgument.getWithId(args, argMaps.get('object')?.[0]));
|
|
37
36
|
const dfObj = obj ? (0, processor_1.processDataflowFor)(obj, data) : info_1.DataflowInformation.initialize(rootId, data);
|
|
38
37
|
const fnRef = { nodeId: rootId, name: name.content, cds: data.cds, type: identifier_1.ReferenceType.Function };
|
|
39
38
|
if (control_flow_1.ControlFlow.alwaysExits(dfObj, data.cds)) {
|
|
@@ -2,7 +2,7 @@ import { type AmbientStateAccess } from './built-in-ambient-state';
|
|
|
2
2
|
import { type DataflowProcessorInformation } from '../../../../../processor';
|
|
3
3
|
import { DataflowInformation } from '../../../../../info';
|
|
4
4
|
import { type FlowrLaxSourcingOptions, InferWorkingDirectory } from '../../../../../../config';
|
|
5
|
-
import {
|
|
5
|
+
import type { RParseRequest } from '../../../../../../r-bridge/retriever';
|
|
6
6
|
import { type IdGenerator, type ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
7
|
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
8
8
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
@@ -13,14 +13,11 @@ exports.standaloneSourceFile = standaloneSourceFile;
|
|
|
13
13
|
exports.mergeSourced = mergeSourced;
|
|
14
14
|
const built_in_ambient_state_1 = require("./built-in-ambient-state");
|
|
15
15
|
const processor_1 = require("../../../../../processor");
|
|
16
|
-
const append_1 = require("../../../../../environments/append");
|
|
17
16
|
const info_1 = require("../../../../../info");
|
|
18
17
|
const config_1 = require("../../../../../../config");
|
|
19
18
|
const known_call_handling_1 = require("../known-call-handling");
|
|
20
|
-
const retriever_1 = require("../../../../../../r-bridge/retriever");
|
|
21
19
|
const decorate_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate");
|
|
22
20
|
const logger_1 = require("../../../../../logger");
|
|
23
|
-
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
24
21
|
const log_1 = require("../../../../../../util/log");
|
|
25
22
|
const parser_1 = require("../../../../../../r-bridge/lang-4.x/ast/parser/json/parser");
|
|
26
23
|
const shell_executor_1 = require("../../../../../../r-bridge/shell-executor");
|
|
@@ -35,6 +32,7 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
|
|
|
35
32
|
const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
36
33
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
37
34
|
const control_flow_1 = require("../../../../control-flow");
|
|
35
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
38
36
|
/**
|
|
39
37
|
* Infers working directories based on the given option and reference chain
|
|
40
38
|
*/
|
|
@@ -148,12 +146,12 @@ function processSourceCall(name, args, rootId, data, config) {
|
|
|
148
146
|
}
|
|
149
147
|
let sourceFile;
|
|
150
148
|
if (sourceFileArgument !== r_function_call_1.EmptyArgument && r_string_1.RString.is(sourceFileArgument?.value)) {
|
|
151
|
-
sourceFile = [
|
|
149
|
+
sourceFile = [r_string_1.RString.unquote(sourceFileArgument.lexeme)];
|
|
152
150
|
}
|
|
153
151
|
else if (sourceFileArgument !== r_function_call_1.EmptyArgument) {
|
|
154
152
|
sourceFile = node_value_1.NodeValue.knownStringsOf(sourceFileArgument.info.id, data);
|
|
155
153
|
}
|
|
156
|
-
const path = sourceFile?.length === 1 ?
|
|
154
|
+
const path = sourceFile?.length === 1 ? r_string_1.RString.unquote(sourceFile[0]) : undefined;
|
|
157
155
|
const filepath = path ? findSource(data.ctx.config.solver.resolveSource, path, data) : undefined;
|
|
158
156
|
if (filepath !== undefined && filepath.length > 0) {
|
|
159
157
|
let result = information;
|
|
@@ -280,7 +278,7 @@ function sourceRequest(rootId, request, data, information, makeMaybe, getId, eva
|
|
|
280
278
|
control_flow_1.ControlFlow.continuesWith(graph, information, control_flow_1.ControlFlow.entryOf(dataflow));
|
|
281
279
|
return {
|
|
282
280
|
...information,
|
|
283
|
-
environment:
|
|
281
|
+
environment: environment_1.REnvironment.overwrite(information.environment, dataflow.environment),
|
|
284
282
|
graph,
|
|
285
283
|
in: information.in.concat(dataflow.in),
|
|
286
284
|
out: information.out.concat(dataflow.out),
|
|
@@ -316,7 +314,7 @@ function mergeSourced(information, sourced) {
|
|
|
316
314
|
return {
|
|
317
315
|
...information,
|
|
318
316
|
graph: sourced.reduce((acc, r) => acc.mergeWith(r.graph), information.graph),
|
|
319
|
-
environment: sourced.reduce((acc, r) =>
|
|
317
|
+
environment: sourced.reduce((acc, r) => environment_1.REnvironment.append(acc, r.environment), information.environment),
|
|
320
318
|
in: information.in.concat(sourced.flatMap(r => r.in)),
|
|
321
319
|
out: information.out.concat(sourced.flatMap(r => r.out)),
|
|
322
320
|
unknownReferences: information.unknownReferences.concat(sourced.flatMap(r => r.unknownReferences)),
|
|
@@ -16,7 +16,7 @@ type StackEnvContext = Pick<DataflowProcessorInformation<never>, 'environment' |
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function processStackEnv<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
|
|
18
18
|
/** The kind of stack environment `node` denotes, if it does; a user definition of the same name shadows the built-in. */
|
|
19
|
-
export declare function stackEnvKindOf<Info>(node: RNode<Info> | undefined, data: StackEnvContext): StackEnvKind | undefined;
|
|
19
|
+
export declare function stackEnvKindOf<Info>(node: RNode<Info> | undefined, data: Pick<StackEnvContext, 'environment'>): StackEnvKind | undefined;
|
|
20
20
|
/**
|
|
21
21
|
* The stack environment an AST `node` denotes directly: a `.GlobalEnv`/`.BaseEnv` symbol, a
|
|
22
22
|
* `globalenv()`/`baseenv()`/`emptyenv()` call, the current env via `environment()`, the parent via `parent.env(e)`,
|
|
@@ -45,8 +45,7 @@ function fixedStackEnv(kind, data) {
|
|
|
45
45
|
/** The kind of stack environment `node` denotes, if it does; a user definition of the same name shadows the built-in. */
|
|
46
46
|
function stackEnvKindOf(node, data) {
|
|
47
47
|
const symbol = r_symbol_1.RSymbol.is(node) ? node.content
|
|
48
|
-
: r_function_call_1.RFunctionCall.
|
|
49
|
-
: undefined;
|
|
48
|
+
: r_function_call_1.RFunctionCall.calledName(node);
|
|
50
49
|
const kind = symbol !== undefined ? stackEnvKind(String(symbol)) : undefined;
|
|
51
50
|
if (kind === undefined || !resolve_helper_1.Resolve.isBuiltIn(symbol, data.environment, r_symbol_1.RSymbol.is(node) ? identifier_1.ReferenceType.Constant : identifier_1.ReferenceType.Function)) {
|
|
52
51
|
return undefined;
|
|
@@ -89,7 +88,7 @@ function asSearchPathEnv(name, data) {
|
|
|
89
88
|
}
|
|
90
89
|
if (name.startsWith(environment_1.SearchPathPackagePrefix)) {
|
|
91
90
|
const pkg = name.slice(environment_1.SearchPathPackagePrefix.length);
|
|
92
|
-
for (
|
|
91
|
+
for (const env of environment_1.REnvironment.searchPath(data.environment.current)) {
|
|
93
92
|
if (env.n === pkg && env.t === environment_1.EnvType.Namespace) {
|
|
94
93
|
return { current: env, level: 0 };
|
|
95
94
|
}
|
|
@@ -107,11 +106,11 @@ function stackEnvStateFromSource(sourceInfo, data, entryPoint = sourceInfo.entry
|
|
|
107
106
|
return undefined;
|
|
108
107
|
}
|
|
109
108
|
const kind = stackEnvKind(String(vertex.name));
|
|
110
|
-
if (
|
|
109
|
+
if (vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.StackEnv)) {
|
|
111
110
|
return fixedStackEnv(kind, data);
|
|
112
111
|
}
|
|
113
112
|
/* `environment()` goes through the default processor; with an argument it denotes a closure's env instead */
|
|
114
|
-
return kind === default_builtin_config_1.StackEnvKind.Current && vertex.args.length === 0 &&
|
|
113
|
+
return kind === default_builtin_config_1.StackEnvKind.Current && vertex.args.length === 0 && vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Default)
|
|
115
114
|
? { current: data.environment.current, level: data.environment.level }
|
|
116
115
|
: undefined;
|
|
117
116
|
}
|
|
@@ -13,7 +13,6 @@ const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/process
|
|
|
13
13
|
const logger_1 = require("../../../../../logger");
|
|
14
14
|
const linker_1 = require("../../../../linker");
|
|
15
15
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
16
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
17
16
|
const graph_1 = require("../../../../../graph/graph");
|
|
18
17
|
const assert_1 = require("../../../../../../util/assert");
|
|
19
18
|
const edge_1 = require("../../../../../graph/edge");
|
|
@@ -31,14 +30,14 @@ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
|
31
30
|
const r_expression_list_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
|
|
32
31
|
const r_access_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
|
|
33
32
|
const resolve_helper_1 = require("../../../../../environments/resolve-helper");
|
|
34
|
-
const append_1 = require("../../../../../environments/append");
|
|
35
33
|
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
36
|
-
const
|
|
34
|
+
const df_helper_1 = require("../../../../../graph/df-helper");
|
|
35
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
37
36
|
/**
|
|
38
37
|
* Process a built-in try-catch or similar handler.
|
|
39
38
|
*/
|
|
40
39
|
function processTryCatch(name, args, rootId, data, config) {
|
|
41
|
-
const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: args.map(
|
|
40
|
+
const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: args.map(r_argument_1.RArgument.unnamedValueOrArg), rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Try, sig: function_semantics_1.FunctionSemantics.call.signature.every });
|
|
42
41
|
if (args.length < 1 || r_argument_1.RArgument.isEmpty(args[0])) {
|
|
43
42
|
logger_1.dataflowLogger.warn(`TryCatch Handler ${identifier_1.Identifier.toString(name.content)} does not have 1 argument, skipping`);
|
|
44
43
|
return res.information;
|
|
@@ -176,7 +175,7 @@ function processTryCatch(name, args, rootId, data, config) {
|
|
|
176
175
|
call.cds = [...call.cds ?? [], { id: rootId, when: true }];
|
|
177
176
|
}
|
|
178
177
|
}
|
|
179
|
-
const environment = mayAbort ?
|
|
178
|
+
const environment = mayAbort ? environment_1.REnvironment.append(data.environment, info.environment) : info.environment;
|
|
180
179
|
return {
|
|
181
180
|
...info,
|
|
182
181
|
out: info.out.concat(mayAbort ? (0, reference_to_maybe_1.makeAllMaybe)(escaping, info.graph, environment, true) : escaping),
|
|
@@ -188,7 +187,7 @@ function processTryCatch(name, args, rootId, data, config) {
|
|
|
188
187
|
function orderRaisingBodies(graph, idMap, ctx) {
|
|
189
188
|
const ordered = new Set();
|
|
190
189
|
const reach = (node) => {
|
|
191
|
-
for (const id of r_function_definition_1.RFunctionDefinition.is(node) ? [node.info.id] :
|
|
190
|
+
for (const id of r_function_definition_1.RFunctionDefinition.is(node) ? [node.info.id] : df_helper_1.Dataflow.calleeIdsOf(graph, node.info.id)) {
|
|
192
191
|
const definition = idMap.get(id);
|
|
193
192
|
if (!ordered.has(id) && r_function_definition_1.RFunctionDefinition.is(definition)) {
|
|
194
193
|
ordered.add(id);
|
|
@@ -200,7 +199,7 @@ function orderRaisingBodies(graph, idMap, ctx) {
|
|
|
200
199
|
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
201
200
|
const call = vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Try) ? idMap.get(id) : undefined;
|
|
202
201
|
for (const arg of r_function_call_1.RFunctionCall.is(call) ? call.arguments : []) {
|
|
203
|
-
if (arg !== r_function_call_1.EmptyArgument && !
|
|
202
|
+
if (arg !== r_function_call_1.EmptyArgument && !df_helper_1.Dataflow.hasEdge(graph, id, arg.info.id, edge_1.EdgeType.Calls)) {
|
|
204
203
|
model_1.RNode.visitAst(arg, n => {
|
|
205
204
|
reach(n);
|
|
206
205
|
return r_function_definition_1.RFunctionDefinition.is(n);
|
|
@@ -213,8 +212,8 @@ function orderRaisingBodies(graph, idMap, ctx) {
|
|
|
213
212
|
function raisingOrder(graph, lookup, { rootId, targetsOf, reach }) {
|
|
214
213
|
const raises = (node) => {
|
|
215
214
|
const vertex = graph.getVertex(node.info.id);
|
|
216
|
-
const name = vertex_1.DfgVertex.isFunctionCall(vertex) ? vertex.name : r_function_call_1.RFunctionCall.is(node) ?
|
|
217
|
-
if (name === undefined || built_in_props_1.CallProps.hasAny(lookup(name), built_in_props_1.CallProp.Throws) || (rootId !== undefined &&
|
|
215
|
+
const name = vertex_1.DfgVertex.isFunctionCall(vertex) ? vertex.name : r_function_call_1.RFunctionCall.is(node) ? r_function_call_1.RFunctionCall.calledName(node) : r_access_1.RAccess.is(node) ? node.operator : node.lexeme;
|
|
216
|
+
if (name === undefined || built_in_props_1.CallProps.hasAny(lookup(name), built_in_props_1.CallProp.Throws) || (rootId !== undefined && df_helper_1.Dataflow.hasEdge(graph, node.info.id, rootId, edge_1.EdgeType.Reads))) {
|
|
218
217
|
return true;
|
|
219
218
|
}
|
|
220
219
|
else if (vertex_1.DfgVertex.isFunctionCall(vertex)) {
|
|
@@ -5,7 +5,6 @@ const info_1 = require("../../../../../info");
|
|
|
5
5
|
const linker_1 = require("../../../../linker");
|
|
6
6
|
const known_call_handling_1 = require("../known-call-handling");
|
|
7
7
|
const assert_1 = require("../../../../../../util/assert");
|
|
8
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
9
8
|
const logger_1 = require("../../../../../logger");
|
|
10
9
|
const edge_1 = require("../../../../../graph/edge");
|
|
11
10
|
const control_flow_1 = require("../../../../control-flow");
|
|
@@ -13,17 +12,17 @@ const identifier_1 = require("../../../../../environments/identifier");
|
|
|
13
12
|
const node_value_1 = require("../../../../../eval/resolve/node-value");
|
|
14
13
|
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
15
14
|
const apply_kill_1 = require("../../../../../environments/apply-kill");
|
|
16
|
-
const append_1 = require("../../../../../environments/append");
|
|
17
15
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
18
16
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
19
17
|
const built_in_ambient_state_1 = require("./built-in-ambient-state");
|
|
18
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
20
19
|
/** Process a while loop like `while(cond) { ... }`. */
|
|
21
20
|
function processWhileLoop(name, args, rootId, data) {
|
|
22
21
|
if (args.length !== 2 || r_argument_1.RArgument.isEmpty(args[1])) {
|
|
23
22
|
logger_1.dataflowLogger.warn(`While-Loop ${identifier_1.Identifier.toString(name.content)} does not have 2 arguments, skipping`);
|
|
24
23
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
25
24
|
}
|
|
26
|
-
const unpackedArgs = args.map(e =>
|
|
25
|
+
const unpackedArgs = args.map(e => r_argument_1.RArgument.unnamedValueOf(e));
|
|
27
26
|
if (unpackedArgs.some(assert_1.isUndefined)) {
|
|
28
27
|
logger_1.dataflowLogger.warn(`While-Loop ${identifier_1.Identifier.toString(name.content)} has empty arguments in ${JSON.stringify(args)}, skipping`);
|
|
29
28
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
@@ -91,8 +90,8 @@ function processWhileLoop(name, args, rootId, data) {
|
|
|
91
90
|
control_flow_1.ControlFlow.jumpsTo(graph, body, 2 /* ExitPointType.Break */, rootId);
|
|
92
91
|
/* the body's environment carries its side effects (e.g. a `library()` call), the original one stays unless the body surely runs */
|
|
93
92
|
const conditionIsAlwaysTrue = conditionIsAlways(true);
|
|
94
|
-
const bodyEnvironment =
|
|
95
|
-
const loopEnvironment = conditionIsAlwaysTrue ? bodyEnvironment :
|
|
93
|
+
const bodyEnvironment = environment_1.REnvironment.append(information.environment, body.environment);
|
|
94
|
+
const loopEnvironment = conditionIsAlwaysTrue ? bodyEnvironment : environment_1.REnvironment.append(origEnv, bodyEnvironment);
|
|
96
95
|
/* unless the loop always runs, a body removal only happens maybe; apply it as the merge cannot represent it */
|
|
97
96
|
const loopKill = body.kill?.length ? (conditionIsAlwaysTrue ? body.kill : (0, apply_kill_1.makeKillsMaybe)(body.kill, cdTrue)) : undefined;
|
|
98
97
|
return {
|
|
@@ -8,7 +8,6 @@ const info_1 = require("../../../../../info");
|
|
|
8
8
|
const known_call_handling_1 = require("../known-call-handling");
|
|
9
9
|
const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
10
10
|
const resolve_helper_1 = require("../../../../../environments/resolve-helper");
|
|
11
|
-
const define_1 = require("../../../../../environments/define");
|
|
12
11
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
13
12
|
const built_in_envir_utils_1 = require("./built-in-envir-utils");
|
|
14
13
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
@@ -16,11 +15,12 @@ const common_1 = require("../common");
|
|
|
16
15
|
const edge_1 = require("../../../../../graph/edge");
|
|
17
16
|
const control_flow_1 = require("../../../../control-flow");
|
|
18
17
|
const linker_1 = require("../../../../linker");
|
|
18
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
19
19
|
/** Fallback formal parameter names for `with(data, expr, ...)` / `within(data, expr, ...)` when the signature database has no `base::with`. */
|
|
20
20
|
const withParamsFallback = ['data', 'expr'];
|
|
21
21
|
/** Normal call analysis, marking the data-masked arguments (columns of the data) as NSE. */
|
|
22
22
|
function markAsMaskedFallback(name, args, rootId, data) {
|
|
23
|
-
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.With });
|
|
23
|
+
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.With, keepArgumentGraphs: true });
|
|
24
24
|
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, known_call_handling_1.NseArguments.AllButFirst, { kind: known_call_handling_1.NseKind.DataMasked });
|
|
25
25
|
return information;
|
|
26
26
|
}
|
|
@@ -120,7 +120,7 @@ function mayWriteInto(dataNode, result, rootId, data) {
|
|
|
120
120
|
if (!r_symbol_1.RSymbol.is(dataNode) || resolve_helper_1.Resolve.byNameAndType(dataNode.content, result.environment, identifier_1.ReferenceType.Variable) === undefined) {
|
|
121
121
|
return result;
|
|
122
122
|
}
|
|
123
|
-
return { ...result, environment:
|
|
123
|
+
return { ...result, environment: environment_1.REnvironment.define({ name: dataNode.content, nodeId: rootId, definedAt: rootId, type: identifier_1.ReferenceType.Variable, cds: data.cds }, false, result.environment) };
|
|
124
124
|
}
|
|
125
125
|
/** a write in `expr` only happens because the call evaluates it */
|
|
126
126
|
function keepCallFor(written, graph, rootId) {
|