@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
|
@@ -8,7 +8,7 @@ const edge_1 = require("../../../../../graph/edge");
|
|
|
8
8
|
const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
9
9
|
const environment_1 = require("../../../../../environments/environment");
|
|
10
10
|
const built_in_library_1 = require("./built-in-library");
|
|
11
|
-
const
|
|
11
|
+
const frame_memory_1 = require("../../../../../environments/frame-memory");
|
|
12
12
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
13
13
|
const program_order_1 = require("../../../../program-order");
|
|
14
14
|
const resolve_helper_1 = require("../../../../../environments/resolve-helper");
|
|
@@ -16,7 +16,7 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
|
|
|
16
16
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
17
17
|
const built_in_ambient_state_1 = require("./built-in-ambient-state");
|
|
18
18
|
const defaultmap_1 = require("../../../../../../util/collections/defaultmap");
|
|
19
|
-
const
|
|
19
|
+
const df_helper_1 = require("../../../../../graph/df-helper");
|
|
20
20
|
/**
|
|
21
21
|
* Computes, for every function-definition vertex `F`, `summary(F) = own(F)` unioned with `summary(G)` over every transitive callee `G`.
|
|
22
22
|
* @param graph - the fully linked dataflow graph
|
|
@@ -27,14 +27,12 @@ const frame_reflection_1 = require("../../../../../fn/frame-reflection");
|
|
|
27
27
|
function computeCallGraphSummaries(graph, own) {
|
|
28
28
|
const summary = new Map();
|
|
29
29
|
const callees = new Map();
|
|
30
|
-
for (const [id, vertex] of graph.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
callees.set(id, (0, frame_reflection_1.callsIn)(vertex, graph).flatMap(([node]) => (0, frame_reflection_1.calledDefinitions)(graph, node)).toArray());
|
|
34
|
-
}
|
|
30
|
+
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)) {
|
|
31
|
+
summary.set(id, new Set(own(id, vertex)));
|
|
32
|
+
callees.set(id, df_helper_1.Dataflow.callsIn(vertex, graph).flatMap(([node]) => df_helper_1.Dataflow.calleeIdsOf(graph, node)).toArray());
|
|
35
33
|
}
|
|
36
34
|
/* pull each callee's summary, its callers are revisited whenever a function grew */
|
|
37
|
-
|
|
35
|
+
df_helper_1.Dataflow.propagateToFixpoint(summary.keys(), callees, id => {
|
|
38
36
|
const effects = summary.get(id);
|
|
39
37
|
const before = effects.size;
|
|
40
38
|
for (const callee of callees.get(id) ?? []) {
|
|
@@ -65,7 +63,7 @@ function linkMaterializedExportsToLoaders(graph, environment) {
|
|
|
65
63
|
}
|
|
66
64
|
/* export node id -> its loading `library()`/`use()` call, from the final environment */
|
|
67
65
|
const loaders = new Map();
|
|
68
|
-
for (
|
|
66
|
+
for (const e of environment_1.REnvironment.frames(environment.current)) {
|
|
69
67
|
if (e.t !== environment_1.EnvType.Namespace) {
|
|
70
68
|
continue;
|
|
71
69
|
}
|
|
@@ -84,9 +82,9 @@ function linkMaterializedExportsToLoaders(graph, environment) {
|
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
/** The packages (see {@link EnvType}) attached directly within a function body, i.e. its own `library()` calls. */
|
|
87
|
-
function
|
|
85
|
+
function ownLibraryCalls(_id, fdef) {
|
|
88
86
|
const packages = [];
|
|
89
|
-
for (
|
|
87
|
+
for (const e of environment_1.REnvironment.frames(fdef.subflow.environment.current)) {
|
|
90
88
|
if (e.t === environment_1.EnvType.Namespace && e.n !== undefined) {
|
|
91
89
|
/* an export binding carries the loading `library()` call in `definedAt` */
|
|
92
90
|
let definedAt = node_id_1.NodeId.toBuiltIn(e.n);
|
|
@@ -103,10 +101,8 @@ function attachedPackages(_id, fdef) {
|
|
|
103
101
|
return packages;
|
|
104
102
|
}
|
|
105
103
|
/** The scopes outside a function's own frame, i.e. those a definition of its body can have escaped into. */
|
|
106
|
-
function
|
|
107
|
-
|
|
108
|
-
yield e;
|
|
109
|
-
}
|
|
104
|
+
function escapeTargetFrames(fdef) {
|
|
105
|
+
return environment_1.REnvironment.frames(fdef.subflow.environment.current.parent);
|
|
110
106
|
}
|
|
111
107
|
/**
|
|
112
108
|
* The non-built-in definitions a function body lets escape to an outer scope (e.g. a `<<-` super-assignment),
|
|
@@ -119,7 +115,12 @@ function escapedDefinitions(hidden) {
|
|
|
119
115
|
const defs = hidden.keys().filter(call => fdef.subflow.graph.has(call)).toArray();
|
|
120
116
|
for (const e of escapeTargetFrames(fdef)) {
|
|
121
117
|
let escaped = perFrame.get(e.memory);
|
|
122
|
-
if (escaped === undefined) {
|
|
118
|
+
if (escaped === undefined && e.memory instanceof frame_memory_1.Frame && e.memory.lazy() !== undefined) {
|
|
119
|
+
/* an attached package binds nothing but its exports, which are built-ins */
|
|
120
|
+
escaped = [];
|
|
121
|
+
perFrame.set(e.memory, escaped);
|
|
122
|
+
}
|
|
123
|
+
else if (escaped === undefined) {
|
|
123
124
|
/* a package frame holds thousands of entries and keeps none of them, so this walks them in place
|
|
124
125
|
* rather than through a spread/flatMap/filter/map chain that allocates an array per step */
|
|
125
126
|
const collected = [];
|
|
@@ -134,7 +135,10 @@ function escapedDefinitions(hidden) {
|
|
|
134
135
|
perFrame.set(e.memory, escaped);
|
|
135
136
|
}
|
|
136
137
|
for (const d of escaped) {
|
|
137
|
-
|
|
138
|
+
/* a package the caller attached is visible in the body, but only one the body attaches escapes it */
|
|
139
|
+
if (e.t === undefined || fdef.subflow.graph.has(d)) {
|
|
140
|
+
defs.push(d);
|
|
141
|
+
}
|
|
138
142
|
}
|
|
139
143
|
}
|
|
140
144
|
return defs;
|
|
@@ -142,11 +146,8 @@ function escapedDefinitions(hidden) {
|
|
|
142
146
|
}
|
|
143
147
|
/** Emits {@link EdgeType.SideEffectOnCall} edges for definitions that escape a function transitively. */
|
|
144
148
|
function propagateTransitiveDefinitions(graph, environment, ctx, summary) {
|
|
145
|
-
for (const [id
|
|
146
|
-
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
for (const target of (0, frame_reflection_1.calledDefinitions)(graph, id)) {
|
|
149
|
+
for (const [id] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
150
|
+
for (const target of df_helper_1.Dataflow.calleeIdsOf(graph, id)) {
|
|
150
151
|
for (const def of summary.get(target) ?? []) {
|
|
151
152
|
/* an escaping package export is only in the environment; materialize its vertex on demand */
|
|
152
153
|
if (node_id_1.NodeId.isBuiltIn(def)) {
|
|
@@ -163,13 +164,13 @@ function propagateTransitiveDefinitions(graph, environment, ctx, summary) {
|
|
|
163
164
|
* @returns the enriched environment and whether it grew (so the caller can re-link and re-run to a fixpoint).
|
|
164
165
|
*/
|
|
165
166
|
function propagateTransitivePackages(graph, environment, ctx) {
|
|
166
|
-
const summary = computeCallGraphSummaries(graph,
|
|
167
|
+
const summary = computeCallGraphSummaries(graph, ownLibraryCalls);
|
|
167
168
|
const reachable = new Map(); // package -> its loading `library()` call
|
|
168
|
-
for (const [id
|
|
169
|
-
if (!
|
|
169
|
+
for (const [id] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
170
|
+
if (!graph.isRoot(id)) {
|
|
170
171
|
continue;
|
|
171
172
|
}
|
|
172
|
-
for (const target of
|
|
173
|
+
for (const target of df_helper_1.Dataflow.calleeIdsOf(graph, id)) {
|
|
173
174
|
for (const { pack, definedAt } of summary.get(target) ?? []) {
|
|
174
175
|
if (!reachable.has(pack)) {
|
|
175
176
|
reachable.set(pack, definedAt);
|
|
@@ -203,7 +204,7 @@ function hiddenBuiltInWrites(graph, environment) {
|
|
|
203
204
|
continue;
|
|
204
205
|
}
|
|
205
206
|
const own = vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Function) ? undefined : vertex.name;
|
|
206
|
-
for (const target of
|
|
207
|
+
for (const target of df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Calls)) {
|
|
207
208
|
if (node_id_1.NodeId.isBuiltIn(target) && (own === undefined || node_id_1.NodeId.toBuiltIn(identifier_1.Identifier.getName(own)) !== target)) {
|
|
208
209
|
const targets = resolve_helper_1.Resolve.byNameAndType(node_id_1.NodeId.fromBuiltIn(target), { current: builtIns, level: 0 }, identifier_1.ReferenceType.Function) ?? [];
|
|
209
210
|
const defs = targets.flatMap(d => (0, built_in_ambient_state_1.writesOfHiddenBuiltIn)(d, id));
|
|
@@ -230,7 +231,7 @@ function linkHiddenReads(graph, reads) {
|
|
|
230
231
|
if (vertex.environment === undefined) {
|
|
231
232
|
continue;
|
|
232
233
|
}
|
|
233
|
-
for (const target of
|
|
234
|
+
for (const target of df_helper_1.Dataflow.calleeIdsOf(graph, id)) {
|
|
234
235
|
for (const call of summary.get(target) ?? []) {
|
|
235
236
|
for (const name of reads.get(call) ?? []) {
|
|
236
237
|
for (const def of resolve_helper_1.Resolve.byName(name, vertex.environment) ?? []) {
|
|
@@ -251,10 +252,7 @@ function escapedDefinitionMap(graph, hidden) {
|
|
|
251
252
|
const map = new Map(hidden.entries().map(([id, defs]) => [id, [...defs]]));
|
|
252
253
|
const definitionsOf = new defaultmap_1.DefaultMap(() => [], map);
|
|
253
254
|
const seen = new Set();
|
|
254
|
-
for (const [, vertex] of graph.
|
|
255
|
-
if (!vertex_1.DfgVertex.isFunctionDefinition(vertex)) {
|
|
256
|
-
continue;
|
|
257
|
-
}
|
|
255
|
+
for (const [, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)) {
|
|
258
256
|
const global = escapeTargetFrames(vertex).filter(e => e.t === undefined).reduce((_, e) => e, undefined);
|
|
259
257
|
/* a frame shared with an already-visited definition contributes the same entries */
|
|
260
258
|
if (global !== undefined && !seen.has(global.memory)) {
|
|
@@ -279,13 +277,13 @@ function propagateTransitiveEscapedDefinitions(graph, environment, defined, hidd
|
|
|
279
277
|
const defs = escapedDefinitionMap(graph, hidden);
|
|
280
278
|
const names = new Set();
|
|
281
279
|
let byName;
|
|
282
|
-
const definitionsNamed = (name) => (byName ??=
|
|
280
|
+
const definitionsNamed = (name) => (byName ??= df_helper_1.Dataflow.definitionsByName(graph)).get(name);
|
|
283
281
|
let grew = false;
|
|
284
|
-
for (const [id
|
|
285
|
-
if (!
|
|
282
|
+
for (const [id] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
283
|
+
if (!graph.isRoot(id)) {
|
|
286
284
|
continue;
|
|
287
285
|
}
|
|
288
|
-
for (const target of
|
|
286
|
+
for (const target of df_helper_1.Dataflow.calleeIdsOf(graph, id)) {
|
|
289
287
|
for (const def of (summary.get(target) ?? []).values().flatMap(nodeId => defs.get(nodeId) ?? [])) {
|
|
290
288
|
const nodeId = def.nodeId;
|
|
291
289
|
names.add(def.name);
|
|
@@ -300,7 +298,7 @@ function propagateTransitiveEscapedDefinitions(graph, environment, defined, hidd
|
|
|
300
298
|
if (resolve_helper_1.Resolve.byNameAndType(def.name, environment, def.type)?.some(d => d.nodeId === nodeId)) {
|
|
301
299
|
continue;
|
|
302
300
|
}
|
|
303
|
-
environment =
|
|
301
|
+
environment = environment_1.REnvironment.define(def, false, environment);
|
|
304
302
|
linkReadsAfter(graph, id, def, open, definitionsNamed);
|
|
305
303
|
grew = true;
|
|
306
304
|
}
|
|
@@ -315,7 +313,7 @@ function propagateTransitiveEscapedDefinitions(graph, environment, defined, hidd
|
|
|
315
313
|
function linkReadsAfter(graph, call, def, open, definitionsNamed) {
|
|
316
314
|
const before = graph.getVertex(call)?.environment;
|
|
317
315
|
const visible = before === undefined ? definitionsNamed(def.name) : resolve_helper_1.Resolve.byName(def.name, before)?.map(d => d.nodeId) ?? [];
|
|
318
|
-
const replaced = new Set([...visible, ...
|
|
316
|
+
const replaced = new Set([...visible, ...df_helper_1.Dataflow.sourcesOf(graph, call, edge_1.EdgeType.SideEffectOnCall)]);
|
|
319
317
|
const readers = new Set(open.filter(r => r.name === def.name).map(r => r.nodeId));
|
|
320
318
|
for (const [id] of graph.vertices(true)) {
|
|
321
319
|
/* an argument reads the value of a call, not a name the call may define (an ambient state is defined at its call) */
|
|
@@ -30,6 +30,8 @@ export interface ProcessAllArgumentInput<OtherInfo> {
|
|
|
30
30
|
readonly nonFunction?: ReadonlySet<NodeId>;
|
|
31
31
|
/** the arguments from this index on are alternatives of which at most one runs (the arms of `switch`) */
|
|
32
32
|
readonly alternativesFrom?: number;
|
|
33
|
+
/** keep the graph of each processed argument its own, for a caller marking what lies within an argument */
|
|
34
|
+
readonly keepGraphs?: boolean;
|
|
33
35
|
}
|
|
34
36
|
export interface ProcessAllArgumentResult {
|
|
35
37
|
readonly finalEnv: REnvironmentInformation;
|
|
@@ -56,7 +58,7 @@ export declare function convertFnArgument<OtherInfo>(this: void, arg: typeof Emp
|
|
|
56
58
|
*/
|
|
57
59
|
export declare function isPipedArgument<OtherInfo>(arg: unknown, functionRootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): boolean;
|
|
58
60
|
/** Processes all arguments for a function call, updating the given final graph and environment. */
|
|
59
|
-
export declare function processAllArguments<OtherInfo>({ functionName, args, data, finalGraph, functionRootId, forced, patchData, nonFunction, alternativesFrom }: ProcessAllArgumentInput<OtherInfo>): ProcessAllArgumentResult;
|
|
61
|
+
export declare function processAllArguments<OtherInfo>({ functionName, args, data, finalGraph, functionRootId, forced, patchData, nonFunction, alternativesFrom, keepGraphs }: ProcessAllArgumentInput<OtherInfo>): ProcessAllArgumentResult;
|
|
60
62
|
export interface PatchFunctionCallInput<OtherInfo> {
|
|
61
63
|
readonly nextGraph: DataflowGraph;
|
|
62
64
|
readonly rootId: NodeId;
|
|
@@ -17,14 +17,13 @@ const model_1 = require("../../../../../r-bridge/lang-4.x/ast/model/model");
|
|
|
17
17
|
const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
18
18
|
const identifier_1 = require("../../../../environments/identifier");
|
|
19
19
|
const built_in_ambient_state_1 = require("./built-in/built-in-ambient-state");
|
|
20
|
-
const overwrite_1 = require("../../../../environments/overwrite");
|
|
21
20
|
const resolve_by_name_1 = require("../../../../environments/resolve-by-name");
|
|
22
21
|
const process_argument_1 = require("../process-argument");
|
|
23
22
|
const vertex_1 = require("../../../../graph/vertex");
|
|
24
23
|
const edge_1 = require("../../../../graph/edge");
|
|
25
24
|
const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
26
25
|
const vertex_2 = require("../../../../graph/vertex");
|
|
27
|
-
const
|
|
26
|
+
const environment_1 = require("../../../../environments/environment");
|
|
28
27
|
function forceVertexArgumentValueReferences(rootId, value, graph, env) {
|
|
29
28
|
const valueVertex = graph.getVertex(value.entryPoint);
|
|
30
29
|
if (!valueVertex) {
|
|
@@ -80,7 +79,7 @@ function isPipedArgument(arg, functionRootId, data) {
|
|
|
80
79
|
return data.pipedArgument?.rootId === functionRootId && data.pipedArgument.argument === arg;
|
|
81
80
|
}
|
|
82
81
|
/** Processes all arguments for a function call, updating the given final graph and environment. */
|
|
83
|
-
function processAllArguments({ functionName, args, data, finalGraph, functionRootId, forced = [], patchData, nonFunction, alternativesFrom }) {
|
|
82
|
+
function processAllArguments({ functionName, args, data, finalGraph, functionRootId, forced = [], patchData, nonFunction, alternativesFrom, keepGraphs }) {
|
|
84
83
|
let finalEnv = functionName.environment;
|
|
85
84
|
const callArgs = [];
|
|
86
85
|
const processedArguments = [];
|
|
@@ -113,12 +112,12 @@ function processAllArguments({ functionName, args, data, finalGraph, functionRoo
|
|
|
113
112
|
forceVertexArgumentValueReferences(functionRootId, processed, processed.graph, data.environment);
|
|
114
113
|
}
|
|
115
114
|
processedArguments.push(processed);
|
|
116
|
-
finalEnv =
|
|
115
|
+
finalEnv = environment_1.REnvironment.overwrite(finalEnv, processed.environment);
|
|
117
116
|
if (beforeAlternatives !== undefined) {
|
|
118
|
-
afterAlternatives =
|
|
117
|
+
afterAlternatives = environment_1.REnvironment.append(afterAlternatives ?? beforeAlternatives, finalEnv);
|
|
119
118
|
}
|
|
120
|
-
/* nothing reads the argument's own graph past this point, only its entry point and references */
|
|
121
|
-
finalGraph.mergeWith(processed.graph, true, precomputed === undefined);
|
|
119
|
+
/* unless asked to keep it, nothing reads the argument's own graph past this point, only its entry point and references */
|
|
120
|
+
finalGraph.mergeWith(processed.graph, true, precomputed === undefined && !keepGraphs);
|
|
122
121
|
/* resolve reads within argument, we resolve before adding the `processed.environment` to avoid cyclic dependencies */
|
|
123
122
|
for (const original of [...processed.in, ...processed.unknownReferences]) {
|
|
124
123
|
const inId = original.nodeId;
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Deferred = void 0;
|
|
4
4
|
exports.verticesByName = verticesByName;
|
|
5
|
+
const r_string_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
5
6
|
const model_1 = require("../../../../../r-bridge/lang-4.x/ast/model/model");
|
|
6
7
|
const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
7
8
|
const node_id_1 = require("../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
8
9
|
const identifier_1 = require("../../../../environments/identifier");
|
|
9
|
-
const retriever_1 = require("../../../../../r-bridge/retriever");
|
|
10
10
|
const edge_1 = require("../../../../graph/edge");
|
|
11
11
|
const vertex_1 = require("../../../../graph/vertex");
|
|
12
12
|
const happens_before_1 = require("../../../../../control-flow/happens-before");
|
|
13
13
|
const r_symbol_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
14
14
|
const linker_1 = require("../../../linker");
|
|
15
|
-
const frame_reflection_1 = require("../../../../fn/frame-reflection");
|
|
16
15
|
const r_function_definition_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
17
16
|
const built_in_proc_name_1 = require("../../../../environments/built-in-proc-name");
|
|
17
|
+
const df_helper_1 = require("../../../../graph/df-helper");
|
|
18
18
|
/** The vertices of `type` by their unquoted name. */
|
|
19
19
|
function verticesByName(graph, type, idMap) {
|
|
20
20
|
const named = graph.vertexIdsOfType(type).filter(id => node_id_1.NodeId.recoverName(id, idMap) !== undefined);
|
|
21
|
-
return Map.groupBy(named, id =>
|
|
21
|
+
return Map.groupBy(named, id => r_string_1.RString.unquote(node_id_1.NodeId.recoverName(id, idMap)));
|
|
22
22
|
}
|
|
23
23
|
/** The names a deferred expression touches, each with the node touching it and whether it is written. */
|
|
24
24
|
function namesWithin(expr, graph, idMap) {
|
|
@@ -34,10 +34,10 @@ function namesWithin(expr, graph, idMap) {
|
|
|
34
34
|
/* a call reads the function it names, so `evalq(f())` needs the definition of `f` */
|
|
35
35
|
if (vertex_1.DfgVertex.isFunctionCall(graph.getVertex(inner.info.id))) {
|
|
36
36
|
names.push([inner.info.id, identifier_1.Identifier.getName(inner.functionName.content), false]);
|
|
37
|
-
for (const def of
|
|
37
|
+
for (const def of df_helper_1.Dataflow.sourcesOf(graph, inner.info.id, edge_1.EdgeType.SideEffectOnCall)) {
|
|
38
38
|
const name = node_id_1.NodeId.recoverName(def, idMap);
|
|
39
39
|
if (name !== undefined) {
|
|
40
|
-
names.push([def,
|
|
40
|
+
names.push([def, r_string_1.RString.unquote(name), true]);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -77,11 +77,11 @@ exports.Deferred = {
|
|
|
77
77
|
* With `viaClosures`, a closure reading a `delayedAssign` binding forces it when called.
|
|
78
78
|
*/
|
|
79
79
|
forcedAt(graph, binding, cfg, viaClosures = false) {
|
|
80
|
-
const reads =
|
|
80
|
+
const reads = df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.Reads);
|
|
81
81
|
const readSet = new Set(reads);
|
|
82
82
|
/* a closure reading it and the call of that closure may skip the read, so they never rule out a later force */
|
|
83
83
|
const calls = viaClosures
|
|
84
|
-
?
|
|
84
|
+
? df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.DefinesOnCall | edge_1.EdgeType.DefinedByOnCall).filter(r => !readSet.has(r))
|
|
85
85
|
: [];
|
|
86
86
|
if (reads.length < 2) {
|
|
87
87
|
return reads.concat(calls);
|
|
@@ -148,7 +148,7 @@ exports.Deferred = {
|
|
|
148
148
|
return always;
|
|
149
149
|
};
|
|
150
150
|
/* `delayedAssign` names its variable with a string literal, so the recovered name still carries quotes */
|
|
151
|
-
const bindingName = forces === undefined ? undefined :
|
|
151
|
+
const bindingName = forces === undefined ? undefined : r_string_1.RString.unquote(node_id_1.NodeId.recoverName(forces.binding, idMap) ?? '');
|
|
152
152
|
for (const [node, name, writes] of within) {
|
|
153
153
|
if (writes) {
|
|
154
154
|
/* a write of the bound name replaces the binding, so a read it definitely reaches sees only it */
|
|
@@ -25,6 +25,8 @@ export interface ProcessKnownFunctionCallInput<OtherInfo> {
|
|
|
25
25
|
readonly reverseOrder?: boolean;
|
|
26
26
|
/** which arguments are {@link NseKind.Reevaluated|reevaluated}, like a loop body */
|
|
27
27
|
readonly markAsNSE?: readonly number[];
|
|
28
|
+
/** see {@link ProcessAllArgumentInput#keepGraphs}, needed to mark what lies within an argument afterward */
|
|
29
|
+
readonly keepArgumentGraphs?: boolean;
|
|
28
30
|
/** allows passing a data processor in-between each argument */
|
|
29
31
|
readonly patchData?: (data: DataflowProcessorInformation<OtherInfo & ParentInformation>, arg: number) => DataflowProcessorInformation<OtherInfo & ParentInformation>;
|
|
30
32
|
/** Does the call have a side effect that we do not know a lot about which may have further consequences? */
|
|
@@ -87,17 +89,22 @@ export interface NseMarkOptions {
|
|
|
87
89
|
readonly kind?: NseKind;
|
|
88
90
|
/** ids an unquote escape splices back in, see {@link FunctionSemantics.call.nse.unquoted} */
|
|
89
91
|
readonly evaluated?: ReadonlySet<NodeId>;
|
|
92
|
+
/** the position of the argument filling the first parameter, see {@link nseArgumentPositions} */
|
|
93
|
+
readonly first?: number;
|
|
90
94
|
}
|
|
91
|
-
/**
|
|
92
|
-
|
|
95
|
+
/**
|
|
96
|
+
* The positions of the arguments `which` names among `count` arguments, where `first` is the position of the
|
|
97
|
+
* argument filling the first parameter (`-1` if none does), as a named one may come later (`mutate(z = 1, .data = d)`).
|
|
98
|
+
*/
|
|
99
|
+
export declare function nseArgumentPositions(which: NseArguments | readonly number[] | undefined, count: number, first?: number): readonly number[];
|
|
93
100
|
/**
|
|
94
101
|
* Marks the selected arguments as {@link EdgeType.NonStandardEvaluation}: a {@link NseKind.Quoted|quoted} one
|
|
95
102
|
* entirely, a {@link NseKind.DataMasked|data-masked} one only where {@link FunctionSemantics.call.nse.suppliedByMask} holds, and a
|
|
96
103
|
* {@link NseKind.Reevaluated|reevaluated} one as a whole but not within.
|
|
97
104
|
*/
|
|
98
|
-
export declare function markArgumentsAsNonStandardEvaluation(graph: DataflowGraph, rootId: NodeId, processedArguments: readonly (DataflowInformation | undefined)[], which: NseArguments | readonly number[] | undefined, { kind, evaluated }?: NseMarkOptions): void;
|
|
105
|
+
export declare function markArgumentsAsNonStandardEvaluation(graph: DataflowGraph, rootId: NodeId, processedArguments: readonly (DataflowInformation | undefined)[], which: NseArguments | readonly number[] | undefined, { kind, evaluated, first }?: NseMarkOptions): void;
|
|
99
106
|
/**
|
|
100
107
|
* The main processor for function calls for which we know the target but need not
|
|
101
108
|
* add any specific handling.
|
|
102
109
|
*/
|
|
103
|
-
export declare function processKnownFunctionCall<OtherInfo>({ name, args, rootId, data, reverseOrder, markAsNSE, sig, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom }: ProcessKnownFunctionCallInput<OtherInfo>): ProcessKnownFunctionCallResult;
|
|
110
|
+
export declare function processKnownFunctionCall<OtherInfo>({ name, args, rootId, data, reverseOrder, markAsNSE, sig, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom, keepArgumentGraphs }: ProcessKnownFunctionCallInput<OtherInfo>): ProcessKnownFunctionCallResult;
|
|
@@ -47,24 +47,27 @@ var NseKind;
|
|
|
47
47
|
/** evaluated, just not exactly once (a loop body), so only the argument itself is marked */
|
|
48
48
|
NseKind["Reevaluated"] = "reevaluated";
|
|
49
49
|
})(NseKind || (exports.NseKind = NseKind = {}));
|
|
50
|
-
/**
|
|
51
|
-
|
|
50
|
+
/**
|
|
51
|
+
* The positions of the arguments `which` names among `count` arguments, where `first` is the position of the
|
|
52
|
+
* argument filling the first parameter (`-1` if none does), as a named one may come later (`mutate(z = 1, .data = d)`).
|
|
53
|
+
*/
|
|
54
|
+
function nseArgumentPositions(which, count, first = 0) {
|
|
52
55
|
if (typeof which !== 'string') {
|
|
53
56
|
return which ?? [];
|
|
54
57
|
}
|
|
55
58
|
const all = Array.from({ length: count }, (_, i) => i);
|
|
56
59
|
if (which === NseArguments.First) {
|
|
57
|
-
return
|
|
60
|
+
return first >= 0 && first < count ? [first] : [];
|
|
58
61
|
}
|
|
59
|
-
return which === NseArguments.AllButFirst ? all.
|
|
62
|
+
return which === NseArguments.AllButFirst ? all.filter(i => i !== first) : all;
|
|
60
63
|
}
|
|
61
64
|
/**
|
|
62
65
|
* Marks the selected arguments as {@link EdgeType.NonStandardEvaluation}: a {@link NseKind.Quoted|quoted} one
|
|
63
66
|
* entirely, a {@link NseKind.DataMasked|data-masked} one only where {@link FunctionSemantics.call.nse.suppliedByMask} holds, and a
|
|
64
67
|
* {@link NseKind.Reevaluated|reevaluated} one as a whole but not within.
|
|
65
68
|
*/
|
|
66
|
-
function markArgumentsAsNonStandardEvaluation(graph, rootId, processedArguments, which, { kind = NseKind.Quoted, evaluated } = {}) {
|
|
67
|
-
for (const i of nseArgumentPositions(which, processedArguments.length)) {
|
|
69
|
+
function markArgumentsAsNonStandardEvaluation(graph, rootId, processedArguments, which, { kind = NseKind.Quoted, evaluated, first } = {}) {
|
|
70
|
+
for (const i of nseArgumentPositions(which, processedArguments.length, first)) {
|
|
68
71
|
if (i < processedArguments.length) {
|
|
69
72
|
markArgument(graph, rootId, processedArguments[i], kind, evaluated);
|
|
70
73
|
}
|
|
@@ -99,7 +102,7 @@ function markArgument(graph, rootId, arg, kind, evaluated) {
|
|
|
99
102
|
* The main processor for function calls for which we know the target but need not
|
|
100
103
|
* add any specific handling.
|
|
101
104
|
*/
|
|
102
|
-
function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = false, markAsNSE = undefined, sig, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom }) {
|
|
105
|
+
function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = false, markAsNSE = undefined, sig, patchData, hasUnknownSideEffect, origin, nonFunction, customControlFlow, alternativeArgsFrom, keepArgumentGraphs }) {
|
|
103
106
|
const functionName = (0, processor_1.processDataflowFor)(name, data);
|
|
104
107
|
const finalGraph = new graph_1.DataflowGraph(data.completeAst.idMap);
|
|
105
108
|
const functionCallName = name.content;
|
|
@@ -111,6 +114,7 @@ function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = fal
|
|
|
111
114
|
data: origin === 'default' ? control_flow_1.ControlFlow.withinPromise(data, rootId) : data,
|
|
112
115
|
finalGraph,
|
|
113
116
|
functionRootId: rootId,
|
|
117
|
+
keepGraphs: keepArgumentGraphs,
|
|
114
118
|
patchData,
|
|
115
119
|
forced,
|
|
116
120
|
nonFunction,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.markAsOnlyBuiltIn = markAsOnlyBuiltIn;
|
|
4
4
|
exports.processNamedCall = processNamedCall;
|
|
5
|
+
const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
5
6
|
const built_in_ambient_state_1 = require("./built-in/built-in-ambient-state");
|
|
6
7
|
const function_semantics_1 = require("../../../../fn/function-semantics");
|
|
7
8
|
const info_1 = require("../../../../info");
|
|
8
9
|
const known_call_handling_1 = require("./known-call-handling");
|
|
9
|
-
const append_1 = require("../../../../environments/append");
|
|
10
10
|
const r_parameter_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-parameter");
|
|
11
11
|
const r_string_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
12
12
|
const r_expression_list_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
|
|
@@ -26,6 +26,7 @@ const resolve_helper_1 = require("../../../../environments/resolve-helper");
|
|
|
26
26
|
const assert_1 = require("../../../../../util/assert");
|
|
27
27
|
const built_in_props_1 = require("../../../../environments/built-in-props");
|
|
28
28
|
const query_fn_props_1 = require("../../../../environments/query-fn-props");
|
|
29
|
+
const environment_1 = require("../../../../environments/environment");
|
|
29
30
|
function mergeInformation(info, newInfo) {
|
|
30
31
|
if (info === undefined) {
|
|
31
32
|
return newInfo;
|
|
@@ -35,7 +36,7 @@ function mergeInformation(info, newInfo) {
|
|
|
35
36
|
in: info.in.concat(newInfo.in),
|
|
36
37
|
out: info.out.concat(newInfo.out),
|
|
37
38
|
graph: info.graph.mergeWith(newInfo.graph),
|
|
38
|
-
environment:
|
|
39
|
+
environment: environment_1.REnvironment.append(info.environment, newInfo.environment),
|
|
39
40
|
entryPoint: newInfo.entryPoint,
|
|
40
41
|
cfgEntry: newInfo.cfgEntry,
|
|
41
42
|
cfgExit: newInfo.cfgExit,
|
|
@@ -79,7 +80,7 @@ function markAsOnlyBuiltIn(graph, rootId, keepEnvironment = false) {
|
|
|
79
80
|
const HandedFunction = identifier_1.ReferenceType.Function | identifier_1.ReferenceType.Parameter | identifier_1.ReferenceType.Argument;
|
|
80
81
|
/** Whether `arg` hands over a function that may draw: a symbol bound to data (`d <- read.csv(f)`, `NA`) does not, nor does a built-in stating it does not (`mean`) */
|
|
81
82
|
function handsOverFunction(arg, data) {
|
|
82
|
-
const value =
|
|
83
|
+
const value = r_argument_1.RArgument.valueOf(arg);
|
|
83
84
|
if (!r_symbol_1.RSymbol.is(value)) {
|
|
84
85
|
return r_function_definition_1.RFunctionDefinition.is(value);
|
|
85
86
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Nse = exports.Unquote = void 0;
|
|
4
|
+
const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
4
5
|
const model_1 = require("../../../../../r-bridge/lang-4.x/ast/model/model");
|
|
5
6
|
const r_unary_op_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-unary-op");
|
|
6
7
|
const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
@@ -9,7 +10,6 @@ const identifier_1 = require("../../../../environments/identifier");
|
|
|
9
10
|
const data_masking_functions_1 = require("../../../../environments/data-masking-functions");
|
|
10
11
|
const vertex_1 = require("../../../../graph/vertex");
|
|
11
12
|
const edge_1 = require("../../../../graph/edge");
|
|
12
|
-
const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
13
13
|
/** The escape a quoting function offers, a property of the function: `quote(!!x)` negates, `expr(!!x)` splices. */
|
|
14
14
|
var Unquote;
|
|
15
15
|
(function (Unquote) {
|
|
@@ -23,11 +23,11 @@ var Unquote;
|
|
|
23
23
|
/** `!!x` parses as `!(!x)`, so peel the run of `!` to reach the operand. */
|
|
24
24
|
function unquotedOperandOf(node, style) {
|
|
25
25
|
if (style === Unquote.Bquote) {
|
|
26
|
-
if (!r_function_call_1.RFunctionCall.isNamed(node
|
|
26
|
+
if (!r_function_call_1.RFunctionCall.isNamed(node, '.') || node.arguments.length !== 1) {
|
|
27
27
|
return undefined;
|
|
28
28
|
}
|
|
29
29
|
const arg = node.arguments[0];
|
|
30
|
-
return r_argument_1.RArgument.
|
|
30
|
+
return r_argument_1.RArgument.valueOf(arg);
|
|
31
31
|
}
|
|
32
32
|
if (!isNegation(node) || !isNegation(node.operand)) {
|
|
33
33
|
return undefined;
|
|
@@ -137,7 +137,7 @@ exports.Nse = {
|
|
|
137
137
|
},
|
|
138
138
|
/** Whether `id` is a name the data mask supplies, i.e. a use the caller does not bind itself. */
|
|
139
139
|
suppliedByMask(graph, id, vertex = graph.getVertex(id)) {
|
|
140
|
-
return vertex_1.DfgVertex.isUse(vertex) && !graph.
|
|
140
|
+
return vertex_1.DfgVertex.isUse(vertex) && !graph.edgesFrom(id).values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.Reads));
|
|
141
141
|
},
|
|
142
142
|
/**
|
|
143
143
|
* Whether `id` is a name a data mask supplied, which the mark the masking call carries is what records.
|
|
@@ -27,7 +27,6 @@ const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r
|
|
|
27
27
|
const happens_before_1 = require("../../../../../control-flow/happens-before");
|
|
28
28
|
const query_fn_props_1 = require("../../../../environments/query-fn-props");
|
|
29
29
|
const built_in_props_1 = require("../../../../environments/built-in-props");
|
|
30
|
-
const frame_reflection_1 = require("../../../../fn/frame-reflection");
|
|
31
30
|
const defaultmap_1 = require("../../../../../util/collections/defaultmap");
|
|
32
31
|
/** Calls whose result is a language object although they read their arguments like any other call. */
|
|
33
32
|
const CapturingCalls = new Set(['expression']);
|
|
@@ -78,7 +77,7 @@ exports.Quoted = {
|
|
|
78
77
|
for (let parent = idMap?.get(id)?.info.parent; parent !== undefined; parent = idMap?.get(parent)?.info.parent) {
|
|
79
78
|
const captured = exports.Quoted.capturedBy(graph, parent);
|
|
80
79
|
if (captured.length > 0) {
|
|
81
|
-
const evaluating = captured.flatMap(expr =>
|
|
80
|
+
const evaluating = captured.flatMap(expr => df_helper_1.Dataflow.sourcesOf(graph, expr, edge_1.EdgeType.Returns | edge_1.EdgeType.Reads | edge_1.EdgeType.Calls));
|
|
82
81
|
return [parent, ...evaluating.filter(from => from !== parent)];
|
|
83
82
|
}
|
|
84
83
|
}
|
|
@@ -110,6 +109,8 @@ exports.Quoted = {
|
|
|
110
109
|
const reaches = new defaultmap_1.DefaultMap(() => ({}));
|
|
111
110
|
const reachOf = (sites) => reaches.get(sites.join('\0'));
|
|
112
111
|
let enclosing;
|
|
112
|
+
/* every call of a function lists the arguments of all its calls, so each is linked once per forces it meets */
|
|
113
|
+
const linkedWith = new Map();
|
|
113
114
|
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
114
115
|
const masks = nse_1.Nse.dropResolvedMask(graph, id, vertex.name);
|
|
115
116
|
if (masks !== undefined) {
|
|
@@ -162,7 +163,8 @@ exports.Quoted = {
|
|
|
162
163
|
for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
|
|
163
164
|
const index = namesOnce();
|
|
164
165
|
const forces = forcesOf(graph, parameter, flow, forcing, reachOf);
|
|
165
|
-
if (forces !== undefined) {
|
|
166
|
+
if (forces !== undefined && linkedWith.get(argument) !== forces) {
|
|
167
|
+
linkedWith.set(argument, forces);
|
|
166
168
|
deferred_1.Deferred.link(graph, argument, index, idMap, forces);
|
|
167
169
|
}
|
|
168
170
|
}
|
|
@@ -185,7 +187,7 @@ function forcesOf(graph, parameter, cfg, forcing, reachOf) {
|
|
|
185
187
|
return known.forces;
|
|
186
188
|
}
|
|
187
189
|
/* counting is only needed once something touched the reads, and the same count still means the same forces */
|
|
188
|
-
const reads =
|
|
190
|
+
const reads = df_helper_1.Dataflow.sourcesOf(graph, parameter, edge_1.EdgeType.Reads).length;
|
|
189
191
|
if (known?.reads === reads) {
|
|
190
192
|
forcing.set(parameter, { ...known, version });
|
|
191
193
|
return known.forces;
|
|
@@ -197,11 +199,11 @@ function forcesOf(graph, parameter, cfg, forcing, reachOf) {
|
|
|
197
199
|
}
|
|
198
200
|
/** The name a delaying call binds, which is the definition its reads have to go through. */
|
|
199
201
|
function boundBy(graph, id) {
|
|
200
|
-
return
|
|
202
|
+
return df_helper_1.Dataflow.sourcesOf(graph, id, edge_1.EdgeType.DefinedBy).find(target => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)));
|
|
201
203
|
}
|
|
202
204
|
/** Every read of the delayed name takes the promised expression's value, so all of them get the link, not just whichever forces it first. */
|
|
203
205
|
function linkForcesToPromise(graph, binding, promise) {
|
|
204
|
-
for (const reader of
|
|
206
|
+
for (const reader of df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall)) {
|
|
205
207
|
if (reader !== promise) {
|
|
206
208
|
graph.addEdge(reader, promise, edge_1.EdgeType.Reads);
|
|
207
209
|
}
|
|
@@ -214,13 +216,13 @@ function trackedEnvOf(call, evalEnv) {
|
|
|
214
216
|
return env?.current.globalEnv || env?.current.builtInEnv ? undefined : env;
|
|
215
217
|
}
|
|
216
218
|
function* installedLanguageOf(graph, id, installers) {
|
|
217
|
-
for (const definition of
|
|
219
|
+
for (const definition of df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads)) {
|
|
218
220
|
if (!vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(definition))) {
|
|
219
221
|
continue;
|
|
220
222
|
}
|
|
221
223
|
let installs = false;
|
|
222
224
|
const captured = [];
|
|
223
|
-
for (const by of
|
|
225
|
+
for (const by of df_helper_1.Dataflow.targetsOf(graph, definition, edge_1.EdgeType.DefinedBy)) {
|
|
224
226
|
const captures = capturedArgumentsOf(graph, by, true);
|
|
225
227
|
if (captures.length > 0) {
|
|
226
228
|
captured.push(...captures);
|
|
@@ -265,7 +267,7 @@ function evaluationSites(graph, id, enclosing) {
|
|
|
265
267
|
const todo = [id];
|
|
266
268
|
for (let at = todo.pop(); at !== undefined; at = todo.pop()) {
|
|
267
269
|
for (const definition of enclosing.get(at) ?? []) {
|
|
268
|
-
for (const caller of
|
|
270
|
+
for (const caller of df_helper_1.Dataflow.sourcesOf(graph, definition, edge_1.EdgeType.Calls)) {
|
|
269
271
|
if (!sites.has(caller)) {
|
|
270
272
|
sites.add(caller);
|
|
271
273
|
todo.push(caller);
|
|
@@ -316,7 +318,7 @@ function linkAgainstAnyBinding(graph, open, bindings, sites, cfg, reach) {
|
|
|
316
318
|
}
|
|
317
319
|
}
|
|
318
320
|
function callsWithSideEffects(graph) {
|
|
319
|
-
return new Set(graph.vertices(true).flatMap(([from]) =>
|
|
321
|
+
return new Set(graph.vertices(true).flatMap(([from]) => df_helper_1.Dataflow.targetsOf(graph, from, edge_1.EdgeType.SideEffectOnCall)));
|
|
320
322
|
}
|
|
321
323
|
/** Links a capture handed to an evaluating call, in that call's scope. */
|
|
322
324
|
function resolveEvaluation(graph, call, idMap, names, bindings, cfg, reachOf, enclosing, evaluated) {
|
|
@@ -416,7 +418,7 @@ function* escapingArguments(graph, id) {
|
|
|
416
418
|
continue;
|
|
417
419
|
}
|
|
418
420
|
for (const parameter of df_helper_1.Dataflow.parametersOf(callee)) {
|
|
419
|
-
if (
|
|
421
|
+
if (df_helper_1.Dataflow.sourcesOf(graph, parameter, edge_1.EdgeType.Reads).some(reader => !closure.subflow.graph.has(reader))) {
|
|
420
422
|
continue;
|
|
421
423
|
}
|
|
422
424
|
for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
|
|
@@ -437,9 +439,9 @@ function readAtForcingCalls(graph, factoryCall, argument, closure, idMap) {
|
|
|
437
439
|
else if (!vertex_1.DfgVertex.isVariableDefinition(via) || !edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy)) {
|
|
438
440
|
return;
|
|
439
441
|
}
|
|
440
|
-
for (const reader of
|
|
442
|
+
for (const reader of df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.Reads)) {
|
|
441
443
|
const call = graph.getVertex(reader);
|
|
442
|
-
if (!vertex_1.DfgVertex.isFunctionCall(call) || !
|
|
444
|
+
if (!vertex_1.DfgVertex.isFunctionCall(call) || !df_helper_1.Dataflow.hasEdge(graph, reader, closure, edge_1.EdgeType.Calls)
|
|
443
445
|
|| call.environment === undefined || program_order_1.ProgramOrder.runsOnceAt(reader, graph) === undefined) {
|
|
444
446
|
return;
|
|
445
447
|
}
|
|
@@ -456,7 +458,7 @@ function readAtForcingCalls(graph, factoryCall, argument, closure, idMap) {
|
|
|
456
458
|
}
|
|
457
459
|
if (r_symbol_1.RSymbol.is(node)) {
|
|
458
460
|
const visible = new Set(environments.flatMap(env => resolve_helper_1.Resolve.byName(node.content, env) ?? []).map(d => d.nodeId));
|
|
459
|
-
for (const target of
|
|
461
|
+
for (const target of df_helper_1.Dataflow.targetsOf(graph, node.info.id, edge_1.EdgeType.Reads)) {
|
|
460
462
|
if (vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)) && !visible.has(target)) {
|
|
461
463
|
graph.removeEdgeType(node.info.id, target, edge_1.EdgeType.Reads);
|
|
462
464
|
}
|
|
@@ -16,7 +16,7 @@ const built_in_proc_name_1 = require("../../../../environments/built-in-proc-nam
|
|
|
16
16
|
const node_id_1 = require("../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
17
17
|
const r_access_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
|
|
18
18
|
const r_function_definition_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
19
|
-
const
|
|
19
|
+
const df_helper_1 = require("../../../../graph/df-helper");
|
|
20
20
|
exports.UnnamedFunctionCallPrefix = 'unnamed-fc-';
|
|
21
21
|
/**
|
|
22
22
|
* Whether a `$`/`[[` access callee resolved a field to a stored function: a resolved dispatch (`dispatch$foo()`)
|
|
@@ -25,7 +25,7 @@ exports.UnnamedFunctionCallPrefix = 'unnamed-fc-';
|
|
|
25
25
|
*/
|
|
26
26
|
function accessResolvesToField(graph, accessId, accessedId) {
|
|
27
27
|
const base = node_id_1.NodeId.normalize(accessedId);
|
|
28
|
-
return
|
|
28
|
+
return df_helper_1.Dataflow.targetsOf(graph, accessId, edge_1.EdgeType.Returns).some(target => node_id_1.NodeId.normalize(target) !== base);
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Processes an unnamed function call.
|