@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
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { DataflowGraph } from './graph';
|
|
2
|
+
import { EdgeType } from './edge';
|
|
2
3
|
import { emptyGraph } from './dataflowgraph-builder';
|
|
3
4
|
import { getOriginInDfg } from '../origin/dfg-get-origin';
|
|
4
5
|
import { computeCallGraphSummaries, propagateTransitiveSideEffects } from '../internal/process/functions/call/built-in/transitive-side-effects';
|
|
5
6
|
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
7
|
import type { REnvironmentInformation } from '../environments/environment';
|
|
7
|
-
import type
|
|
8
|
+
import { type DataflowGraphVertexFunctionCall, type DataflowGraphVertexFunctionDefinition, type DataflowGraphVertexInfo } from './vertex';
|
|
8
9
|
import { Identifier } from '../environments/identifier';
|
|
10
|
+
import { DefaultMap } from '../../util/collections/defaultmap';
|
|
9
11
|
/**
|
|
10
12
|
* This is the root helper object to work with the {@link DataflowGraph}.
|
|
11
13
|
*
|
|
12
14
|
* - {@link Dataflow.visualize} - for visualization helpers (e.g., rendering the DFG as a mermaid graph),
|
|
13
15
|
* - {@link Dataflow.qualify}/{@link Dataflow.qualifyAll} - for the package-qualified `pkg::fn` identifier of a call
|
|
14
16
|
* from its id and graph, or of every call of a graph at once,
|
|
17
|
+
* - {@link Dataflow.targetsOf}/{@link Dataflow.sourcesOf}/{@link Dataflow.hasEdge} - for the neighbors of a vertex by edge type,
|
|
18
|
+
* - {@link Dataflow.calleesOf}/{@link Dataflow.calleeIdsOf}/{@link Dataflow.callTargetsOf}/{@link Dataflow.callsIn} - for what a call calls and what a definition calls,
|
|
15
19
|
* - {@link Dataflow.packagesOf} - for the packages a set of nodes (e.g. a slice) calls into,
|
|
16
20
|
* - {@link Dataflow.valueIsUsed}/{@link Dataflow.hasComputedArguments} - for what a call does with, and gets as, values,
|
|
17
21
|
*
|
|
@@ -88,6 +92,52 @@ export declare const Dataflow: {
|
|
|
88
92
|
* A call among the arguments counts as computed, even one over literals such as `paste("a", "b")`.
|
|
89
93
|
*/
|
|
90
94
|
readonly hasComputedArguments: (this: void, id: NodeId, graph: DataflowGraph) => boolean;
|
|
95
|
+
/**
|
|
96
|
+
* The ids at the far end of the outgoing edges of `node` that carry any of `types` (empty if there are none).
|
|
97
|
+
* @see {@link Dataflow.sourcesOf} - for the incoming direction
|
|
98
|
+
* @see {@link Dataflow.calleeIdsOf} - for the function definitions a call resolves to
|
|
99
|
+
*/
|
|
100
|
+
readonly targetsOf: (this: void, graph: DataflowGraph, node: NodeId, types: EdgeType) => NodeId[];
|
|
101
|
+
/**
|
|
102
|
+
* The ids at the near end of the incoming edges of `node` that carry any of `types` (empty if there are none).
|
|
103
|
+
* @see {@link Dataflow.targetsOf} - for the outgoing direction
|
|
104
|
+
*/
|
|
105
|
+
readonly sourcesOf: (this: void, graph: DataflowGraph, node: NodeId, types: EdgeType) => NodeId[];
|
|
106
|
+
/** Whether there is an edge from `from` to `to` that carries any of `types`. */
|
|
107
|
+
readonly hasEdge: (this: void, graph: DataflowGraph, from: NodeId, to: NodeId, types: EdgeType) => boolean;
|
|
108
|
+
/**
|
|
109
|
+
* The ids of the function definitions a call is linked to by a {@link EdgeType.Calls} edge (empty if none, e.g. for built-ins).
|
|
110
|
+
* @see {@link Dataflow.calleesOf} - for the definition vertices instead of their ids
|
|
111
|
+
* @see {@link Dataflow.callTargetsOf} - which also follows aliases and includes built-ins
|
|
112
|
+
* @see {@link Dataflow.targetsOf} - for the raw edge targets
|
|
113
|
+
*/
|
|
114
|
+
readonly calleeIdsOf: (this: void, graph: DataflowGraph, call: NodeId) => NodeId[];
|
|
115
|
+
/**
|
|
116
|
+
* All known targets of a call, as well as the name sources which define them (empty if there are none).
|
|
117
|
+
* Prefer this over {@link Dataflow.calleeIdsOf} if the call may go through a read, an alias, or a built-in.
|
|
118
|
+
* @param call - The id of the call
|
|
119
|
+
* @param graph - The graph the call is part of
|
|
120
|
+
* @param environment - The environment to resolve the call name in, if the call does not carry one itself
|
|
121
|
+
*/
|
|
122
|
+
readonly callTargetsOf: (this: void, call: NodeId, graph: DataflowGraph, environment?: REnvironmentInformation) => NodeId[];
|
|
123
|
+
/**
|
|
124
|
+
* The calls within the body of a function definition, id and vertex paired.
|
|
125
|
+
* @see {@link Dataflow.calleeIdsOf} - for what a single call calls
|
|
126
|
+
*/
|
|
127
|
+
readonly callsIn: (this: void, definition: DataflowGraphVertexFunctionDefinition, graph: DataflowGraph) => Generator<[NodeId, DataflowGraphVertexFunctionCall]>;
|
|
128
|
+
/** Every variable definition of the graph by its unquoted name, in a single pass. */
|
|
129
|
+
readonly definitionsByName: (this: void, graph: DataflowGraph) => DefaultMap<string, NodeId[]>;
|
|
130
|
+
/**
|
|
131
|
+
* The definitions and references to the symbol with the given id (including itself), or `undefined` if it is no symbol of the graph.
|
|
132
|
+
* The symbol is the one defined or used at `id`, and the result lists its definition and every later use that definition reaches for sure.
|
|
133
|
+
*/
|
|
134
|
+
readonly refsToSymbol: (this: void, graph: DataflowGraph, id: NodeId) => NodeId[] | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Recomputes `recompute(id)` for every node reachable from `seed` along the reverse of `successors`, so a
|
|
137
|
+
* change at a node is carried on to whatever points at it, until nothing grows anymore. `recompute` updates
|
|
138
|
+
* its node's value itself and reports whether it grew.
|
|
139
|
+
*/
|
|
140
|
+
readonly propagateToFixpoint: (this: void, seed: Iterable<NodeId>, successors: ReadonlyMap<NodeId, readonly NodeId[]>, recompute: (id: NodeId) => boolean) => void;
|
|
91
141
|
/**
|
|
92
142
|
* Interprocedural propagation of escaped side effects (attached packages, `<<-` definitions) to their callers.
|
|
93
143
|
*/
|
|
@@ -154,15 +204,17 @@ export declare const Dataflow: {
|
|
|
154
204
|
};
|
|
155
205
|
};
|
|
156
206
|
readonly diff: {
|
|
207
|
+
readonly vertexCount: <Graph>(this: void, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, left: number, right: number) => void;
|
|
208
|
+
readonly missingVertex: <Graph>(this: void, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, id: NodeId) => void;
|
|
157
209
|
readonly outgoingEdges: <EdgeMap, Graph extends import("../../util/diff-graph").EdgeIndexedGraph<EdgeMap>>(this: void, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, diffEdges: (ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, id: NodeId, lEdges: EdgeMap | undefined, rEdges: EdgeMap | undefined) => void, project?: (edges: EdgeMap) => EdgeMap | undefined) => void;
|
|
158
210
|
readonly edges: <Edge, Graph>(this: void, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, id: NodeId, lEdges: ReadonlyMap<NodeId, Edge> | undefined, rEdges: ReadonlyMap<NodeId, Edge> | undefined, diffEdge: (edge: Edge, otherEdge: Edge, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, id: NodeId, target: NodeId) => void) => void;
|
|
159
211
|
};
|
|
160
212
|
readonly diffGraphs: <G extends DataflowGraph>(this: void, left: import("../../util/diff-graph").NamedGraph<G>, right: import("../../util/diff-graph").NamedGraph<G>, config?: Partial<import("../../util/diff").GenericDiffConfiguration>) => import("../../util/diff-graph").GraphDifferenceReport;
|
|
161
213
|
readonly invertGraph: <G extends DataflowGraph>(this: void, graph: G, cleanEnv: REnvironmentInformation) => G;
|
|
162
214
|
readonly resolveGraphCriteria: <G extends DataflowGraph>(graph: G, ctx: import("../../project/context/flowr-analyzer-context").ReadOnlyFlowrAnalyzerContext, idMap?: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").AstIdMap) => G;
|
|
163
|
-
readonly parametersOf: (this: void, definition:
|
|
164
|
-
readonly calleesOf: (this: void, graph: DataflowGraph, id: NodeId) => Generator<
|
|
215
|
+
readonly parametersOf: (this: void, definition: DataflowGraphVertexFunctionDefinition) => NodeId[];
|
|
216
|
+
readonly calleesOf: (this: void, graph: DataflowGraph, id: NodeId) => Generator<DataflowGraphVertexFunctionDefinition>;
|
|
165
217
|
readonly argumentsBoundTo: (this: void, graph: DataflowGraph, parameter: NodeId) => Generator<NodeId>;
|
|
166
218
|
readonly reachable: <G extends DataflowGraph>(this: void, graph: G, seed: NodeId | Iterable<NodeId>, { follow, consider, cds, stopAt }?: import("./graph-helper").ReachOptions) => Set<NodeId>;
|
|
167
|
-
readonly reaches: <G extends DataflowGraph>(this: void, from: NodeId, to: NodeId, graph: G, knownReachability?:
|
|
219
|
+
readonly reaches: <G extends DataflowGraph>(this: void, from: NodeId, to: NodeId, graph: G, knownReachability?: DefaultMap<NodeId, Set<NodeId>>) => boolean;
|
|
168
220
|
};
|
|
@@ -11,12 +11,18 @@ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id"
|
|
|
11
11
|
const vertex_1 = require("./vertex");
|
|
12
12
|
const identifier_1 = require("../environments/identifier");
|
|
13
13
|
const r_base_packages_1 = require("../../util/r-base-packages");
|
|
14
|
+
const defaultmap_1 = require("../../util/collections/defaultmap");
|
|
15
|
+
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
16
|
+
const linker_1 = require("../internal/linker");
|
|
17
|
+
const dfg_get_symbol_refs_1 = require("../origin/dfg-get-symbol-refs");
|
|
14
18
|
/**
|
|
15
19
|
* This is the root helper object to work with the {@link DataflowGraph}.
|
|
16
20
|
*
|
|
17
21
|
* - {@link Dataflow.visualize} - for visualization helpers (e.g., rendering the DFG as a mermaid graph),
|
|
18
22
|
* - {@link Dataflow.qualify}/{@link Dataflow.qualifyAll} - for the package-qualified `pkg::fn` identifier of a call
|
|
19
23
|
* from its id and graph, or of every call of a graph at once,
|
|
24
|
+
* - {@link Dataflow.targetsOf}/{@link Dataflow.sourcesOf}/{@link Dataflow.hasEdge} - for the neighbors of a vertex by edge type,
|
|
25
|
+
* - {@link Dataflow.calleesOf}/{@link Dataflow.calleeIdsOf}/{@link Dataflow.callTargetsOf}/{@link Dataflow.callsIn} - for what a call calls and what a definition calls,
|
|
20
26
|
* - {@link Dataflow.packagesOf} - for the packages a set of nodes (e.g. a slice) calls into,
|
|
21
27
|
* - {@link Dataflow.valueIsUsed}/{@link Dataflow.hasComputedArguments} - for what a call does with, and gets as, values,
|
|
22
28
|
*
|
|
@@ -126,6 +132,115 @@ exports.Dataflow = {
|
|
|
126
132
|
}
|
|
127
133
|
return false;
|
|
128
134
|
},
|
|
135
|
+
/**
|
|
136
|
+
* The ids at the far end of the outgoing edges of `node` that carry any of `types` (empty if there are none).
|
|
137
|
+
* @see {@link Dataflow.sourcesOf} - for the incoming direction
|
|
138
|
+
* @see {@link Dataflow.calleeIdsOf} - for the function definitions a call resolves to
|
|
139
|
+
*/
|
|
140
|
+
targetsOf(graph, node, types) {
|
|
141
|
+
const found = [];
|
|
142
|
+
for (const [target, edge] of graph.edgesFrom(node)) {
|
|
143
|
+
if (edge_1.DfEdge.includesType(edge, types)) {
|
|
144
|
+
found.push(target);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return found;
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* The ids at the near end of the incoming edges of `node` that carry any of `types` (empty if there are none).
|
|
151
|
+
* @see {@link Dataflow.targetsOf} - for the outgoing direction
|
|
152
|
+
*/
|
|
153
|
+
sourcesOf(graph, node, types) {
|
|
154
|
+
const found = [];
|
|
155
|
+
for (const [source, edge] of graph.edgesTo(node)) {
|
|
156
|
+
if (edge_1.DfEdge.includesType(edge, types)) {
|
|
157
|
+
found.push(source);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return found;
|
|
161
|
+
},
|
|
162
|
+
/** Whether there is an edge from `from` to `to` that carries any of `types`. */
|
|
163
|
+
hasEdge(graph, from, to, types) {
|
|
164
|
+
const edge = graph.edgesFrom(from).get(to);
|
|
165
|
+
return edge !== undefined && edge_1.DfEdge.includesType(edge, types);
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* The ids of the function definitions a call is linked to by a {@link EdgeType.Calls} edge (empty if none, e.g. for built-ins).
|
|
169
|
+
* @see {@link Dataflow.calleesOf} - for the definition vertices instead of their ids
|
|
170
|
+
* @see {@link Dataflow.callTargetsOf} - which also follows aliases and includes built-ins
|
|
171
|
+
* @see {@link Dataflow.targetsOf} - for the raw edge targets
|
|
172
|
+
*/
|
|
173
|
+
calleeIdsOf(graph, call) {
|
|
174
|
+
return exports.Dataflow.targetsOf(graph, call, edge_1.EdgeType.Calls).filter(t => vertex_1.DfgVertex.isFunctionDefinition(graph.getVertex(t)));
|
|
175
|
+
},
|
|
176
|
+
/**
|
|
177
|
+
* All known targets of a call, as well as the name sources which define them (empty if there are none).
|
|
178
|
+
* Prefer this over {@link Dataflow.calleeIdsOf} if the call may go through a read, an alias, or a built-in.
|
|
179
|
+
* @param call - The id of the call
|
|
180
|
+
* @param graph - The graph the call is part of
|
|
181
|
+
* @param environment - The environment to resolve the call name in, if the call does not carry one itself
|
|
182
|
+
*/
|
|
183
|
+
callTargetsOf(call, graph, environment) {
|
|
184
|
+
return (0, linker_1.getAllFunctionCallTargets)(call, graph, environment);
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* The calls within the body of a function definition, id and vertex paired.
|
|
188
|
+
* @see {@link Dataflow.calleeIdsOf} - for what a single call calls
|
|
189
|
+
*/
|
|
190
|
+
*callsIn(definition, graph) {
|
|
191
|
+
for (const node of definition.subflow.graph) {
|
|
192
|
+
const vertex = graph.getVertex(node);
|
|
193
|
+
if (vertex_1.DfgVertex.isFunctionCall(vertex)) {
|
|
194
|
+
yield [node, vertex];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
/** Every variable definition of the graph by its unquoted name, in a single pass. */
|
|
199
|
+
definitionsByName(graph) {
|
|
200
|
+
const byName = new defaultmap_1.DefaultMap(() => []);
|
|
201
|
+
for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
|
|
202
|
+
const name = node_id_1.NodeId.recoverName(id, graph.idMap);
|
|
203
|
+
if (name !== undefined) {
|
|
204
|
+
byName.get(r_string_1.RString.unquote(name)).push(id);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return byName;
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* The definitions and references to the symbol with the given id (including itself), or `undefined` if it is no symbol of the graph.
|
|
211
|
+
* The symbol is the one defined or used at `id`, and the result lists its definition and every later use that definition reaches for sure.
|
|
212
|
+
*/
|
|
213
|
+
refsToSymbol(graph, id) {
|
|
214
|
+
return (0, dfg_get_symbol_refs_1.getAllRefsToSymbol)(graph, id);
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* Recomputes `recompute(id)` for every node reachable from `seed` along the reverse of `successors`, so a
|
|
218
|
+
* change at a node is carried on to whatever points at it, until nothing grows anymore. `recompute` updates
|
|
219
|
+
* its node's value itself and reports whether it grew.
|
|
220
|
+
*/
|
|
221
|
+
propagateToFixpoint(seed, successors, recompute) {
|
|
222
|
+
const callers = new defaultmap_1.DefaultMap(() => []);
|
|
223
|
+
for (const [id, next] of successors) {
|
|
224
|
+
for (const to of next) {
|
|
225
|
+
callers.get(to).push(id);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const pending = [...seed];
|
|
229
|
+
const queued = new Set(pending);
|
|
230
|
+
while (pending.length > 0) {
|
|
231
|
+
const id = pending.pop();
|
|
232
|
+
queued.delete(id);
|
|
233
|
+
if (!recompute(id)) {
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
for (const caller of callers.get(id)) {
|
|
237
|
+
if (!queued.has(caller)) {
|
|
238
|
+
queued.add(caller);
|
|
239
|
+
pending.push(caller);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
129
244
|
/**
|
|
130
245
|
* Interprocedural propagation of escaped side effects (attached packages, `<<-` definitions) to their callers.
|
|
131
246
|
*/
|
|
@@ -226,7 +341,7 @@ exports.Dataflow = {
|
|
|
226
341
|
* @param start - The start id of the visitation.
|
|
227
342
|
* @param onVertex - The function to execute for each vertex, if this returns `true` the visitation will stop from this vertex.
|
|
228
343
|
*/
|
|
229
|
-
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
344
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type -- visitors that only observe return nothing, and we never stop for them
|
|
230
345
|
visitDfg(graph, start, onVertex) {
|
|
231
346
|
const queue = [start];
|
|
232
347
|
const visited = new Set();
|
|
@@ -51,10 +51,13 @@ function diffRootVertices(ctx) {
|
|
|
51
51
|
(0, diff_1.setDifference)(ctx.left.rootIds(), ctx.right.rootIds(), { ...ctx, position: `${ctx.position}Root vertices differ in graphs. ` });
|
|
52
52
|
(0, diff_1.setDifference)(new Set(ctx.left.unknownSideEffects.values().map(graph_1.UnknownSideEffect.id)), new Set(ctx.right.unknownSideEffects.values().map(graph_1.UnknownSideEffect.id)), { ...ctx, position: `${ctx.position}Unknown side effects differ in graphs. ` });
|
|
53
53
|
}
|
|
54
|
+
function reportDiffering(ctx, id, prefix, a, b) {
|
|
55
|
+
ctx.report.addComment(`${prefix}${ctx.leftname}: ${JSON.stringify(a, json_1.jsonReplacer)} vs ${ctx.rightname}: ${JSON.stringify(b, json_1.jsonReplacer)}`, { tag: 'vertex', id });
|
|
56
|
+
}
|
|
54
57
|
function diffFunctionArgumentsReferences(fn, a, b, ctx) {
|
|
55
58
|
if (a === '<value>' || b === '<value>') {
|
|
56
59
|
if (a !== b) {
|
|
57
|
-
|
|
60
|
+
reportDiffering(ctx, fn, ctx.position, a, b);
|
|
58
61
|
}
|
|
59
62
|
return;
|
|
60
63
|
}
|
|
@@ -66,12 +69,12 @@ function diffFunctionArgumentsReferences(fn, a, b, ctx) {
|
|
|
66
69
|
function diffFunctionArguments(fn, a, b, ctx) {
|
|
67
70
|
if (a === false || b === false) {
|
|
68
71
|
if (a !== b) {
|
|
69
|
-
|
|
72
|
+
reportDiffering(ctx, fn, ctx.position, a, b);
|
|
70
73
|
}
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
76
|
else if (a.length !== b.length) {
|
|
74
|
-
ctx
|
|
77
|
+
reportDiffering(ctx, fn, `${ctx.position}Differs in number of arguments. `, a, b);
|
|
75
78
|
return;
|
|
76
79
|
}
|
|
77
80
|
for (let i = 0; i < a.length; ++i) {
|
|
@@ -108,16 +111,11 @@ function diffVertices(ctx) {
|
|
|
108
111
|
// collect vertices from both sides
|
|
109
112
|
const lVert = ctx.left.vertices(true).toArray();
|
|
110
113
|
const rVert = ctx.right.vertices(true).toArray();
|
|
111
|
-
|
|
112
|
-
|| lVert.length > rVert.length && !ctx.config.rightIsSubgraph) {
|
|
113
|
-
ctx.report.addComment(`Detected different number of vertices! ${ctx.leftname} has ${lVert.length}, ${ctx.rightname} has ${rVert.length}`);
|
|
114
|
-
}
|
|
114
|
+
graph_helper_1.GraphHelper.diff.vertexCount(ctx, lVert.length, rVert.length);
|
|
115
115
|
for (const [id, lInfo] of lVert) {
|
|
116
116
|
const rInfoMay = ctx.right.get(id);
|
|
117
117
|
if (rInfoMay === undefined) {
|
|
118
|
-
|
|
119
|
-
ctx.report.addComment(`Vertex ${id} is not present in ${ctx.rightname}`, { tag: 'vertex', id });
|
|
120
|
-
}
|
|
118
|
+
graph_helper_1.GraphHelper.diff.missingVertex(ctx, id);
|
|
121
119
|
continue;
|
|
122
120
|
}
|
|
123
121
|
const [rInfo] = rInfoMay;
|
|
@@ -140,13 +138,13 @@ function diffVertices(ctx) {
|
|
|
140
138
|
// compare arrays
|
|
141
139
|
const equalArrays = lInfo.origin && rInfo.origin && (0, arrays_1.arrayEqual)(lInfo.origin, rInfo.origin);
|
|
142
140
|
if (!equalArrays) {
|
|
143
|
-
ctx
|
|
141
|
+
reportDiffering(ctx, id, `Vertex ${id} differs in origin. `, lInfo.origin, rInfo.origin);
|
|
144
142
|
}
|
|
145
143
|
}
|
|
146
144
|
if (lInfo.link !== undefined || rInfo.link !== undefined) {
|
|
147
145
|
const equal = lInfo.link && rInfo.link && (0, arrays_1.arrayEqual)(lInfo.link.origin, rInfo.link.origin);
|
|
148
146
|
if (!equal) {
|
|
149
|
-
ctx
|
|
147
|
+
reportDiffering(ctx, id, `Vertex ${id} differs in link. `, lInfo.link, rInfo.link);
|
|
150
148
|
}
|
|
151
149
|
}
|
|
152
150
|
if ((lInfo.environment === undefined && rInfo.environment !== undefined && !ctx.config.leftIsSubgraph)
|
|
@@ -186,7 +184,7 @@ function diffVertices(ctx) {
|
|
|
186
184
|
(0, info_1.diffControlDependencies)(a.cds, b.cds, { ...ctx, position: '' });
|
|
187
185
|
return true;
|
|
188
186
|
})) {
|
|
189
|
-
ctx
|
|
187
|
+
reportDiffering(ctx, id, `Vertex ${id} differs in exit points. `, lInfo.exitPoints, rInfo.exitPoints);
|
|
190
188
|
}
|
|
191
189
|
if ((lInfo.subflow.environment === undefined && rInfo.subflow.environment !== undefined && !ctx.config.leftIsSubgraph)
|
|
192
190
|
|| (lInfo.subflow.environment !== undefined && rInfo.subflow.environment === undefined && !ctx.config.rightIsSubgraph)) {
|
|
@@ -253,7 +251,7 @@ function diffReferenceLists(fn, a, b, ctx) {
|
|
|
253
251
|
// sort by id
|
|
254
252
|
if (a === undefined || b === undefined) {
|
|
255
253
|
if (a !== b) {
|
|
256
|
-
|
|
254
|
+
reportDiffering(ctx, fn, ctx.position, a, b);
|
|
257
255
|
}
|
|
258
256
|
return;
|
|
259
257
|
}
|
|
@@ -274,7 +272,7 @@ function diffReferenceLists(fn, a, b, ctx) {
|
|
|
274
272
|
function diffHooks(left, right, ctx, id) {
|
|
275
273
|
// compare length
|
|
276
274
|
if (left.length !== right.length) {
|
|
277
|
-
ctx
|
|
275
|
+
reportDiffering(ctx, id, 'Differs in number of hooks. ', left, right);
|
|
278
276
|
return;
|
|
279
277
|
}
|
|
280
278
|
// compare each hook
|
|
@@ -54,6 +54,8 @@ export declare const GraphHelper: {
|
|
|
54
54
|
* @see {@link GraphHelper.diffGraphs} - which is what you want for two dataflow graphs
|
|
55
55
|
*/
|
|
56
56
|
readonly diff: {
|
|
57
|
+
readonly vertexCount: <Graph>(this: void, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, left: number, right: number) => void;
|
|
58
|
+
readonly missingVertex: <Graph>(this: void, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, id: NodeId) => void;
|
|
57
59
|
readonly outgoingEdges: <EdgeMap, Graph extends import("../../util/diff-graph").EdgeIndexedGraph<EdgeMap>>(this: void, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, diffEdges: (ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, id: NodeId, lEdges: EdgeMap | undefined, rEdges: EdgeMap | undefined) => void, project?: (edges: EdgeMap) => EdgeMap | undefined) => void;
|
|
58
60
|
readonly edges: <Edge, Graph>(this: void, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, id: NodeId, lEdges: ReadonlyMap<NodeId, Edge> | undefined, rEdges: ReadonlyMap<NodeId, Edge> | undefined, diffEdge: (edge: Edge, otherEdge: Edge, ctx: import("../../util/diff-graph").GraphDiffContext<Graph>, id: NodeId, target: NodeId) => void) => void;
|
|
59
61
|
};
|
|
@@ -74,9 +76,27 @@ export declare const GraphHelper: {
|
|
|
74
76
|
* you can use, e.g. `2@x` as a placeholder for the first x in the second line!
|
|
75
77
|
*/
|
|
76
78
|
readonly resolveGraphCriteria: <G extends DataflowGraph>(graph: G, ctx: ReadOnlyFlowrAnalyzerContext, idMap?: AstIdMap) => G;
|
|
79
|
+
/**
|
|
80
|
+
* The ids of the parameters of a function definition, in order (empty if it has none).
|
|
81
|
+
* @see {@link Dataflow.argumentsBoundTo} - for the arguments a parameter is bound to
|
|
82
|
+
*/
|
|
77
83
|
readonly parametersOf: (this: void, definition: DataflowGraphVertexFunctionDefinition) => NodeId[];
|
|
84
|
+
/**
|
|
85
|
+
* The function definition vertices the call with the given id is linked to by a {@link EdgeType.Calls} edge (none if it is unresolved or built-in).
|
|
86
|
+
* @see {@link Dataflow.calleeIdsOf} - for their ids only
|
|
87
|
+
* @see {@link Dataflow.callTargetsOf} - which also follows aliases and includes built-ins
|
|
88
|
+
*/
|
|
78
89
|
readonly calleesOf: (this: void, graph: DataflowGraph, id: NodeId) => Generator<DataflowGraphVertexFunctionDefinition>;
|
|
90
|
+
/**
|
|
91
|
+
* The ids of the arguments a parameter of a function definition is bound to on calls ({@link EdgeType.DefinedByOnCall}), empty if there are none.
|
|
92
|
+
* @see {@link Dataflow.parametersOf}
|
|
93
|
+
*/
|
|
79
94
|
readonly argumentsBoundTo: (this: void, graph: DataflowGraph, parameter: NodeId) => Generator<NodeId>;
|
|
95
|
+
/**
|
|
96
|
+
* The ids reachable from `seed` (itself included) by following outgoing edges in the graph.
|
|
97
|
+
* @see {@link ReachOptions} - for restricting the edge types, the visited ids, and the stopping points
|
|
98
|
+
* @see {@link Dataflow.reaches} - if you only need to know whether one id reaches another
|
|
99
|
+
*/
|
|
80
100
|
readonly reachable: <G extends DataflowGraph>(this: void, graph: G, seed: NodeId | Iterable<NodeId>, { follow, consider, cds, stopAt }?: ReachOptions) => Set<NodeId>;
|
|
81
101
|
/**
|
|
82
102
|
* Determines whether there is a path from `from` to `to` in the given graph (via any edge type, only respecting direction)
|
|
@@ -107,9 +107,18 @@ exports.GraphHelper = {
|
|
|
107
107
|
}
|
|
108
108
|
return resultGraph;
|
|
109
109
|
},
|
|
110
|
+
/**
|
|
111
|
+
* The ids of the parameters of a function definition, in order (empty if it has none).
|
|
112
|
+
* @see {@link Dataflow.argumentsBoundTo} - for the arguments a parameter is bound to
|
|
113
|
+
*/
|
|
110
114
|
parametersOf(definition) {
|
|
111
115
|
return Object.keys(definition.params ?? {}).map(node_id_1.NodeId.normalize);
|
|
112
116
|
},
|
|
117
|
+
/**
|
|
118
|
+
* The function definition vertices the call with the given id is linked to by a {@link EdgeType.Calls} edge (none if it is unresolved or built-in).
|
|
119
|
+
* @see {@link Dataflow.calleeIdsOf} - for their ids only
|
|
120
|
+
* @see {@link Dataflow.callTargetsOf} - which also follows aliases and includes built-ins
|
|
121
|
+
*/
|
|
113
122
|
*calleesOf(graph, id) {
|
|
114
123
|
for (const [target, edge] of graph.edgesFrom(id)) {
|
|
115
124
|
const callee = edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls) ? graph.getVertex(target) : undefined;
|
|
@@ -118,6 +127,10 @@ exports.GraphHelper = {
|
|
|
118
127
|
}
|
|
119
128
|
}
|
|
120
129
|
},
|
|
130
|
+
/**
|
|
131
|
+
* The ids of the arguments a parameter of a function definition is bound to on calls ({@link EdgeType.DefinedByOnCall}), empty if there are none.
|
|
132
|
+
* @see {@link Dataflow.parametersOf}
|
|
133
|
+
*/
|
|
121
134
|
*argumentsBoundTo(graph, parameter) {
|
|
122
135
|
for (const [argument, edge] of graph.edgesFrom(parameter)) {
|
|
123
136
|
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedByOnCall)) {
|
|
@@ -125,6 +138,11 @@ exports.GraphHelper = {
|
|
|
125
138
|
}
|
|
126
139
|
}
|
|
127
140
|
},
|
|
141
|
+
/**
|
|
142
|
+
* The ids reachable from `seed` (itself included) by following outgoing edges in the graph.
|
|
143
|
+
* @see {@link ReachOptions} - for restricting the edge types, the visited ids, and the stopping points
|
|
144
|
+
* @see {@link Dataflow.reaches} - if you only need to know whether one id reaches another
|
|
145
|
+
*/
|
|
128
146
|
reachable(graph, seed, { follow, consider, cds, stopAt } = {}) {
|
|
129
147
|
const pending = typeof seed === 'object' ? [...seed] : [seed];
|
|
130
148
|
const visited = new Set();
|
package/dataflow/graph/graph.js
CHANGED
|
@@ -9,9 +9,9 @@ const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-fun
|
|
|
9
9
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
10
10
|
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
11
11
|
const environment_1 = require("../environments/environment");
|
|
12
|
-
const clone_1 = require("../environments/clone");
|
|
13
12
|
const vertex_2 = require("./vertex");
|
|
14
13
|
const gas_1 = require("../../gas");
|
|
14
|
+
const environment_2 = require("../environments/environment");
|
|
15
15
|
/**
|
|
16
16
|
* Helper functions to work with {@link FunctionArgument|FunctionArguments}. {@link EmptyArgument} marks an empty argument.
|
|
17
17
|
* @helper dataflow
|
|
@@ -405,6 +405,9 @@ class DataflowGraph {
|
|
|
405
405
|
const vid = vertex.id;
|
|
406
406
|
const previous = this.vertexInformation.get(vid);
|
|
407
407
|
if (previous !== undefined && !overwrite) {
|
|
408
|
+
if (vertex_2.DfgVertex.isFunctionCall(previous) && vertex_2.DfgVertex.isFunctionCall(vertex)) {
|
|
409
|
+
mergeOrigins(previous, vertex);
|
|
410
|
+
}
|
|
408
411
|
return this;
|
|
409
412
|
}
|
|
410
413
|
this.dropQualifications();
|
|
@@ -412,7 +415,7 @@ class DataflowGraph {
|
|
|
412
415
|
/* keep a clone of the original environment, isolating the snapshot from later updates */
|
|
413
416
|
let environment;
|
|
414
417
|
if (vertex.environment) {
|
|
415
|
-
environment =
|
|
418
|
+
environment = environment_2.REnvironment.clone(vertex.environment);
|
|
416
419
|
}
|
|
417
420
|
else if (vtag === vertex_1.VertexType.FunctionDefinition || (vtag === vertex_1.VertexType.FunctionCall && !vertex.onlyBuiltin)) {
|
|
418
421
|
/* only here is a fallback wanted, so a thunk spares every other vertex one it would discard */
|
|
@@ -641,16 +644,20 @@ function mergeNodeInfos(current, next) {
|
|
|
641
644
|
const n = next;
|
|
642
645
|
current.exitPoints = (0, arrays_1.uniqueArrayMerge)(current.exitPoints, n.exitPoints);
|
|
643
646
|
if (n.mode && n.mode.length > 0) {
|
|
644
|
-
current.mode
|
|
645
|
-
for (const m of n.mode) {
|
|
646
|
-
if (!current.mode.includes(m)) {
|
|
647
|
-
current.mode.push(m);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
647
|
+
current.mode = (0, arrays_1.uniqueArrayMerge)(current.mode ?? [], n.mode);
|
|
650
648
|
}
|
|
651
649
|
}
|
|
650
|
+
else if (vertex_2.DfgVertex.isFunctionCall(current) && vertex_2.DfgVertex.isFunctionCall(next)) {
|
|
651
|
+
mergeOrigins(current, next);
|
|
652
|
+
}
|
|
652
653
|
return current;
|
|
653
654
|
}
|
|
655
|
+
/** a call resolving to several callees is processed once per callee, each adding its origin */
|
|
656
|
+
function mergeOrigins(current, next) {
|
|
657
|
+
if (Array.isArray(current.origin) && Array.isArray(next.origin)) {
|
|
658
|
+
current.origin = (0, arrays_1.uniqueArrayMerge)(current.origin, next.origin);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
654
661
|
function envFromJson(json) {
|
|
655
662
|
const parent = json.parent ? envFromJson(json.parent) : undefined;
|
|
656
663
|
const env = new environment_1.Environment(parent, json.builtInEnv);
|
|
@@ -65,7 +65,7 @@ export declare const MatchArgs: {
|
|
|
65
65
|
*
|
|
66
66
|
* `graph` is what says which definition a name reaches here, because scoping, shadowing and control flow
|
|
67
67
|
* decide that and a name alone cannot. It therefore needs a finished graph rather than one under
|
|
68
|
-
* construction, and it is what says which arguments the call has (see {@link
|
|
68
|
+
* construction, and it is what says which arguments the call has (see {@link callArgumentsOf}). Cost is one
|
|
69
69
|
* {@link Dataflow.origin} lookup plus, for a package call, decoding that one function.
|
|
70
70
|
* @param call - The call whose arguments are to be bound.
|
|
71
71
|
* @param graph - The finished graph the call was analyzed into.
|
|
@@ -127,7 +127,7 @@ exports.MatchArgs = {
|
|
|
127
127
|
*
|
|
128
128
|
* `graph` is what says which definition a name reaches here, because scoping, shadowing and control flow
|
|
129
129
|
* decide that and a name alone cannot. It therefore needs a finished graph rather than one under
|
|
130
|
-
* construction, and it is what says which arguments the call has (see {@link
|
|
130
|
+
* construction, and it is what says which arguments the call has (see {@link callArgumentsOf}). Cost is one
|
|
131
131
|
* {@link Dataflow.origin} lookup plus, for a package call, decoding that one function.
|
|
132
132
|
* @param call - The call whose arguments are to be bound.
|
|
133
133
|
* @param graph - The finished graph the call was analyzed into.
|
|
@@ -136,7 +136,7 @@ exports.MatchArgs = {
|
|
|
136
136
|
*/
|
|
137
137
|
toDefinition(call, graph, ctx) {
|
|
138
138
|
const names = formalsOf(call, graph, ctx);
|
|
139
|
-
return names === undefined ? undefined : exports.MatchArgs.toNames(
|
|
139
|
+
return names === undefined ? undefined : exports.MatchArgs.toNames(callArgumentsOf(call, graph), names);
|
|
140
140
|
},
|
|
141
141
|
/** The formal names a call binds against, whichever of flowR's sources knows them; see {@link formalsOf}. */
|
|
142
142
|
formalsOf,
|
|
@@ -220,7 +220,7 @@ function searchPathPosition(name) {
|
|
|
220
220
|
return namespace === "base" /* PkgName.Base */ ? 'base' : r_base_packages_1.AttachedBasePackageSet.has(namespace) ? 'base-package' : 'attached-package';
|
|
221
221
|
}
|
|
222
222
|
/** The arguments the call binds, taken from the graph so that `x |> f(y)` binds `f(x, y)`. */
|
|
223
|
-
function
|
|
223
|
+
function callArgumentsOf(call, graph) {
|
|
224
224
|
const vertex = graph.getVertex(call.info.id);
|
|
225
225
|
if (!vertex_1.DfgVertex.isFunctionCall(vertex) || vertex.args.length !== call.arguments.length + 1) {
|
|
226
226
|
return call.arguments;
|
|
@@ -3,13 +3,12 @@ import { RNode } from '../../r-bridge/lang-4.x/ast/model/model';
|
|
|
3
3
|
import type { BuiltIn } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
5
|
import { Identifier, type IdentifierDefinition, type IdentifierReference } from '../environments/identifier';
|
|
6
|
-
import type {
|
|
7
|
-
import type { RParameter } from '../../r-bridge/lang-4.x/ast/model/nodes/r-parameter';
|
|
6
|
+
import type { DataflowGraph } from '../graph/graph';
|
|
8
7
|
import type { AstIdMap, ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
9
8
|
import { type DataflowGraphVertexFunctionCall, type DataflowGraphVertexFunctionDefinition, type DataflowGraphVertexInfo } from '../graph/vertex';
|
|
10
9
|
import type { REnvironmentInformation } from '../environments/environment';
|
|
11
10
|
import type { ExitPoint } from '../info';
|
|
12
|
-
import {
|
|
11
|
+
import type { BuiltInLookup } from '../fn/frame-reflection';
|
|
13
12
|
export type NameIdMap = DefaultMap<Identifier, IdentifierReference[]>;
|
|
14
13
|
/**
|
|
15
14
|
* Find all reads within the graph that do not reference a local definition in the graph.
|
|
@@ -19,12 +18,6 @@ export declare function findNonLocalReads(graph: DataflowGraph, ignores?: Readon
|
|
|
19
18
|
* Produces a map from names to all identifier references sharing that name.
|
|
20
19
|
*/
|
|
21
20
|
export declare function produceNameSharedIdMap(references: IdentifierReference[]): NameIdMap;
|
|
22
|
-
/**
|
|
23
|
-
* {@link FunctionSemantics.call.match.onCall|Matches} the arguments to the parameters and links them in the graph,
|
|
24
|
-
* returning the resolved map from argument ids to parameter ids.
|
|
25
|
-
* @useInstead {@link FunctionSemantics.call.match.onCallAndLink}
|
|
26
|
-
*/
|
|
27
|
-
export declare function linkArgumentsOnCall(args: readonly FunctionArgument[], params: readonly RParameter<ParentInformation>[], graph: DataflowGraph): Map<NodeId, NodeId>;
|
|
28
21
|
/**
|
|
29
22
|
* Links a function call with a single target function definition.
|
|
30
23
|
*/
|
|
@@ -45,11 +38,12 @@ export declare function linkFunctionCalls(graph: DataflowGraph, idMap: AstIdMap,
|
|
|
45
38
|
alsoCalls?: readonly NodeId[]): CalledFunctions[];
|
|
46
39
|
/**
|
|
47
40
|
* convenience function returning all known call targets, as well as the name source which defines them
|
|
41
|
+
* @useInstead {@link Dataflow.callTargetsOf}
|
|
48
42
|
*/
|
|
49
43
|
export declare function getAllFunctionCallTargets(call: NodeId, graph: DataflowGraph, environment?: REnvironmentInformation): NodeId[];
|
|
50
44
|
/**
|
|
51
45
|
* Finds all linked function definitions starting from the given read ids; expects the caller to already have resolved
|
|
52
|
-
* the accessed objects (first layer of reads/returns/calls/...). For call targets, use {@link
|
|
46
|
+
* the accessed objects (first layer of reads/returns/calls/...). For call targets, use {@link Dataflow.callTargetsOf} instead.
|
|
53
47
|
*/
|
|
54
48
|
export declare function getAllLinkedFunctionDefinitions(functionDefinitionReadIds: ReadonlySet<NodeId>, dataflowGraph: DataflowGraph): [Set<Required<DataflowGraphVertexFunctionDefinition>>, Set<BuiltIn>];
|
|
55
49
|
/**
|