@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
|
@@ -17,6 +17,7 @@ const cascade_action_1 = require("./cascade-action");
|
|
|
17
17
|
const control_flow_graph_1 = require("../../../control-flow/control-flow-graph");
|
|
18
18
|
const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
|
|
19
19
|
const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
20
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
20
21
|
var CallTargets;
|
|
21
22
|
(function (CallTargets) {
|
|
22
23
|
/** call targets a function that is not defined locally in the script (e.g., the call targets a library function) */
|
|
@@ -38,10 +39,7 @@ function satisfiesCallTargets(info, graph, callTarget) {
|
|
|
38
39
|
if (outgoing === undefined) {
|
|
39
40
|
return 'no';
|
|
40
41
|
}
|
|
41
|
-
const callTargets =
|
|
42
|
-
.filter(([, e]) => edge_1.DfEdge.includesType(e, edge_1.EdgeType.Calls))
|
|
43
|
-
.map(([t]) => t)
|
|
44
|
-
.toArray();
|
|
42
|
+
const callTargets = df_helper_1.Dataflow.targetsOf(graph, info.id, edge_1.EdgeType.Calls);
|
|
45
43
|
let builtIn = false;
|
|
46
44
|
/*
|
|
47
45
|
* a resolved call target that is itself a built-in - a base builtin or a loaded-package export
|
|
@@ -20,10 +20,7 @@ async function identifyLinkToNestedRelation(from, analyzer, { callName, ignoreIf
|
|
|
20
20
|
const found = [];
|
|
21
21
|
const cg = await analyzer.callGraph();
|
|
22
22
|
const subCg = call_graph_1.CallGraph.computeSubCallGraph(cg, new Set([from]));
|
|
23
|
-
for (const [, t] of subCg.
|
|
24
|
-
if (!vertex_1.DfgVertex.isFunctionCall(t)) {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
23
|
+
for (const [, t] of subCg.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
27
24
|
if (test(identifier_1.Identifier.toString(t.name))) {
|
|
28
25
|
found.push(t.id);
|
|
29
26
|
}
|
|
@@ -5,8 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CallGraphQueryDefinition = void 0;
|
|
7
7
|
const call_graph_query_executor_1 = require("./call-graph-query-executor");
|
|
8
|
-
const
|
|
9
|
-
const time_1 = require("../../../util/text/time");
|
|
8
|
+
const query_print_1 = require("../../query-print");
|
|
10
9
|
const joi_1 = __importDefault(require("joi"));
|
|
11
10
|
const call_graph_1 = require("../../../dataflow/graph/call-graph");
|
|
12
11
|
exports.CallGraphQueryDefinition = {
|
|
@@ -14,7 +13,7 @@ exports.CallGraphQueryDefinition = {
|
|
|
14
13
|
executor: call_graph_query_executor_1.executeCallGraphQuery,
|
|
15
14
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
16
15
|
const out = queryResults;
|
|
17
|
-
result.push(
|
|
16
|
+
result.push((0, query_print_1.queryHeader)('call-graph', formatter, out['.meta'].timing));
|
|
18
17
|
result.push(` ╰ [Call Graph](${call_graph_1.CallGraph.visualize.mermaid.url(out.graph)})`);
|
|
19
18
|
if (out.unreachable !== undefined) {
|
|
20
19
|
result.push(` ╰ Unreachable calls: {${out.unreachable.join(', ')}}`);
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ConfigQueryDefinition = void 0;
|
|
7
7
|
exports.validateConfigUpdate = validateConfigUpdate;
|
|
8
8
|
const config_query_executor_1 = require("./config-query-executor");
|
|
9
|
+
const query_print_1 = require("../../query-print");
|
|
9
10
|
const ansi_1 = require("../../../util/text/ansi");
|
|
10
|
-
const time_1 = require("../../../util/text/time");
|
|
11
11
|
const joi_1 = __importDefault(require("joi"));
|
|
12
12
|
const config_1 = require("../../../config");
|
|
13
13
|
const json_1 = require("../../../util/json");
|
|
@@ -98,7 +98,7 @@ function configGlobMatcher(pattern) {
|
|
|
98
98
|
regex += last ? '[^.]+(?:\\.[^.]+)*' : '(?:[^.]+\\.)*';
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
|
-
regex += segments[i].split('*').map(part =>
|
|
101
|
+
regex += segments[i].split('*').map(part => (0, strings_1.escapeRegex)(part)).join('[^.]*') + (last ? '' : '\\.');
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
const matches = new RegExp(regex + '$');
|
|
@@ -295,7 +295,7 @@ exports.ConfigQueryDefinition = {
|
|
|
295
295
|
executor: config_query_executor_1.executeConfigQuery,
|
|
296
296
|
asciiSummarizer: (formatter, _analyzer, queryResults, result, queries) => {
|
|
297
297
|
const out = queryResults;
|
|
298
|
-
result.push(
|
|
298
|
+
result.push((0, query_print_1.queryHeader)('config', formatter, out['.meta'].timing));
|
|
299
299
|
const configQueries = queries.filter(q => q.type === 'config');
|
|
300
300
|
const inspects = configQueries.filter(q => q.inspect).map(q => q.inspect);
|
|
301
301
|
if (configQueries.some(q => q.reset)) {
|
|
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DataflowLensQueryDefinition = void 0;
|
|
7
|
+
const query_print_1 = require("../../query-print");
|
|
7
8
|
const dataflow_lens_query_executor_1 = require("./dataflow-lens-query-executor");
|
|
8
|
-
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
-
const time_1 = require("../../../util/text/time");
|
|
10
9
|
const joi_1 = __importDefault(require("joi"));
|
|
11
10
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
12
11
|
exports.DataflowLensQueryDefinition = {
|
|
@@ -14,7 +13,7 @@ exports.DataflowLensQueryDefinition = {
|
|
|
14
13
|
executor: dataflow_lens_query_executor_1.executeDataflowLensQuery,
|
|
15
14
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
16
15
|
const out = queryResults;
|
|
17
|
-
result.push(
|
|
16
|
+
result.push((0, query_print_1.queryHeader)('dataflow-lens', formatter, out['.meta'].timing));
|
|
18
17
|
result.push(` ╰ [Simplified Graph](${df_helper_1.Dataflow.visualize.mermaid.url(out.simplifiedGraph, false, undefined, true)})`);
|
|
19
18
|
return true;
|
|
20
19
|
},
|
|
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DataflowQueryDefinition = void 0;
|
|
7
|
+
const query_print_1 = require("../../query-print");
|
|
7
8
|
const dataflow_query_executor_1 = require("./dataflow-query-executor");
|
|
8
|
-
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
-
const time_1 = require("../../../util/text/time");
|
|
10
9
|
const joi_1 = __importDefault(require("joi"));
|
|
11
10
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
12
11
|
/** Above this many characters, the mermaid.live link is dropped from the REPL output (large graphs produce megabyte-sized base64 urls). */
|
|
@@ -16,7 +15,7 @@ exports.DataflowQueryDefinition = {
|
|
|
16
15
|
executor: dataflow_query_executor_1.executeDataflowQuery,
|
|
17
16
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
18
17
|
const out = queryResults;
|
|
19
|
-
result.push(
|
|
18
|
+
result.push((0, query_print_1.queryHeader)('dataflow', formatter, out['.meta'].timing));
|
|
20
19
|
const url = df_helper_1.Dataflow.visualize.mermaid.url(out.graph);
|
|
21
20
|
if (url.length <= MaxMermaidUrlLength) {
|
|
22
21
|
result.push(` ╰ [Dataflow Graph](${url})`);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type DataflowGraphVertexFunctionCall } from '../../../dataflow/graph/vertex';
|
|
2
|
+
import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
|
+
import type { NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
+
import type { DataflowInformation } from '../../../dataflow/info';
|
|
5
|
+
/** The variable an assignment stores a result in. */
|
|
6
|
+
export interface AssignmentTarget {
|
|
7
|
+
readonly id: NodeId;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What the dependencies query asks about the same calls again and again (the roles of their arguments, whether a
|
|
12
|
+
* value is a plot, where a value is assigned to), kept for one run of the query only.
|
|
13
|
+
*/
|
|
14
|
+
export interface FlowMemo {
|
|
15
|
+
readonly roles: Map<NodeId, [NodeId, number][]>;
|
|
16
|
+
readonly plots: Map<NodeId, boolean>;
|
|
17
|
+
readonly assignments: Map<NodeId, AssignmentTarget | undefined>;
|
|
18
|
+
readonly inputs: Map<NodeId, ReadonlySet<string>>;
|
|
19
|
+
}
|
|
20
|
+
/** A fresh {@link FlowMemo}, to be dropped with the query run it serves. */
|
|
21
|
+
export declare function makeFlowMemo(): FlowMemo;
|
|
22
|
+
/**
|
|
23
|
+
* The arguments of the call, each with the roles its signature states for the parameter it fills (see
|
|
24
|
+
* {@link FnSig.slots}). A call flowR states nothing about uses every argument in an unknown way.
|
|
25
|
+
*/
|
|
26
|
+
export declare function argumentRoles(dataflow: DataflowInformation, call: DataflowGraphVertexFunctionCall, memo?: FlowMemo): [NodeId, number][];
|
|
27
|
+
/**
|
|
28
|
+
* The variables the result of a call is computed from, resolved through the dataflow graph: the variables read
|
|
29
|
+
* by its arguments, through every call in between. An argument whose role in the signature carries no data is no
|
|
30
|
+
* input (the file of `write.csv`, a flag, a callee), nor is what a call quotes or looks up in a data mask (`x` in
|
|
31
|
+
* `filter(df, x > 1)`), or a use that only names a function.
|
|
32
|
+
*/
|
|
33
|
+
export declare function inputVariablesOf(dataflow: DataflowInformation, ast: NormalizedAst, call: DataflowGraphVertexFunctionCall, memo?: FlowMemo): string[];
|
|
34
|
+
/**
|
|
35
|
+
* The arguments the call hands on as its own result: the {@link ArgProp.Alias} one of its signature (`(x)`, a pipe
|
|
36
|
+
* into a call), or both operands of a `+` that adds to a plot, as ggplot's method for it returns the plot.
|
|
37
|
+
*/
|
|
38
|
+
export declare function handedOn(dataflow: DataflowInformation, ast: NormalizedAst, call: DataflowGraphVertexFunctionCall, memo?: FlowMemo): NodeId[];
|
|
39
|
+
/**
|
|
40
|
+
* The variable the value of the call `id` is assigned to, following every call that hands the value on (see
|
|
41
|
+
* {@link handedOn}) up to the assignment. A value used by anything else, as in `f(mutate(df))`, is assigned to nothing.
|
|
42
|
+
*/
|
|
43
|
+
export declare function assignmentOf(dataflow: DataflowInformation, ast: NormalizedAst, id: NodeId, memo?: FlowMemo): AssignmentTarget | undefined;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeFlowMemo = makeFlowMemo;
|
|
4
|
+
exports.argumentRoles = argumentRoles;
|
|
5
|
+
exports.inputVariablesOf = inputVariablesOf;
|
|
6
|
+
exports.handedOn = handedOn;
|
|
7
|
+
exports.assignmentOf = assignmentOf;
|
|
8
|
+
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
9
|
+
const graph_1 = require("../../../dataflow/graph/graph");
|
|
10
|
+
const edge_1 = require("../../../dataflow/graph/edge");
|
|
11
|
+
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
12
|
+
const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
13
|
+
const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
14
|
+
const r_string_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
15
|
+
const r_binary_op_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
|
|
16
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
17
|
+
const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
|
|
18
|
+
const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
|
|
19
|
+
const plot_objects_1 = require("./plot-objects");
|
|
20
|
+
/** A fresh {@link FlowMemo}, to be dropped with the query run it serves. */
|
|
21
|
+
function makeFlowMemo() {
|
|
22
|
+
return { roles: new Map(), plots: new Map(), assignments: new Map(), inputs: new Map() };
|
|
23
|
+
}
|
|
24
|
+
/** the roles of an argument that carries no data into the result, whatever else the call does with it */
|
|
25
|
+
const CarriesNoData = built_in_props_1.ArgProp.Resource | built_in_props_1.ArgProp.Flag | built_in_props_1.ArgProp.Nse | built_in_props_1.ArgProp.Callee | built_in_props_1.ArgProp.Presence | built_in_props_1.ArgProp.Handle | built_in_props_1.ArgProp.Written | built_in_props_1.ArgProp.Lazy;
|
|
26
|
+
function carriesData(roles) {
|
|
27
|
+
return (roles & CarriesNoData) === 0;
|
|
28
|
+
}
|
|
29
|
+
function nameOf(ast, id) {
|
|
30
|
+
const node = ast.idMap.get(id);
|
|
31
|
+
return r_symbol_1.RSymbol.is(node) ? identifier_1.Identifier.getName(node.content) : r_string_1.RString.is(node) ? node.content.str : undefined;
|
|
32
|
+
}
|
|
33
|
+
/** the calls the value `id` is an argument of */
|
|
34
|
+
function consumersOf(dataflow, id) {
|
|
35
|
+
return dataflow.graph.edgesTo(id).entries()
|
|
36
|
+
.filter(([, edge]) => edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Argument))
|
|
37
|
+
.map(([from]) => dataflow.graph.getVertex(from))
|
|
38
|
+
.filter(v => vertex_1.DfgVertex.isFunctionCall(v))
|
|
39
|
+
.toArray();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The arguments of the call, each with the roles its signature states for the parameter it fills (see
|
|
43
|
+
* {@link FnSig.slots}). A call flowR states nothing about uses every argument in an unknown way.
|
|
44
|
+
*/
|
|
45
|
+
function argumentRoles(dataflow, call, memo) {
|
|
46
|
+
const known = memo?.roles.get(call.id);
|
|
47
|
+
if (known !== undefined) {
|
|
48
|
+
return known;
|
|
49
|
+
}
|
|
50
|
+
const roles = computeArgumentRoles(dataflow, call);
|
|
51
|
+
memo?.roles.set(call.id, roles);
|
|
52
|
+
return roles;
|
|
53
|
+
}
|
|
54
|
+
function computeArgumentRoles(dataflow, call) {
|
|
55
|
+
const sig = (0, query_fn_props_1.queryFnProps)(df_helper_1.Dataflow.qualify(call.id, dataflow.graph, false) ?? call.name, { environment: dataflow.environment })?.sig;
|
|
56
|
+
const layout = sig === undefined ? undefined : built_in_props_1.FnSig.layout(sig);
|
|
57
|
+
const slots = layout === undefined ? undefined : built_in_props_1.FnSig.slots(layout, call.args.map(a => graph_1.FunctionArgument.isNamed(a) ? a.name : undefined));
|
|
58
|
+
return call.args.flatMap((arg, at) => {
|
|
59
|
+
const ref = graph_1.FunctionArgument.getReference(arg);
|
|
60
|
+
const slot = slots?.[at] ?? -1;
|
|
61
|
+
return ref === undefined ? [] : [[ref, layout === undefined || slot < 0 ? 0 : layout.props[slot]]];
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** whether the use only names a function, as `sum` in `aggregate(x, by, FUN = sum)` does */
|
|
65
|
+
function namesFunction(dataflow, id) {
|
|
66
|
+
const targets = df_helper_1.Dataflow.targetsOf(dataflow.graph, id, edge_1.EdgeType.Reads);
|
|
67
|
+
return targets.length > 0 && targets.every(t => node_id_1.NodeId.isBuiltIn(t) || vertex_1.DfgVertex.isFunctionDefinition(dataflow.graph.getVertex(t)));
|
|
68
|
+
}
|
|
69
|
+
/** whether a call evaluates the node other than in the caller, quoting it or looking it up in a data mask */
|
|
70
|
+
function escapesEvaluation(dataflow, id) {
|
|
71
|
+
return dataflow.graph.edgesTo(id).values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.NonStandardEvaluation));
|
|
72
|
+
}
|
|
73
|
+
/** the variables the value `id` is computed from, in the order they are met; see {@link inputVariablesOf} */
|
|
74
|
+
function variablesOf(dataflow, ast, id, seen, memo) {
|
|
75
|
+
const known = memo?.inputs.get(id);
|
|
76
|
+
if (known !== undefined) {
|
|
77
|
+
return known;
|
|
78
|
+
}
|
|
79
|
+
if (seen.has(id) || escapesEvaluation(dataflow, id)) {
|
|
80
|
+
return EmptyNames;
|
|
81
|
+
}
|
|
82
|
+
seen.add(id);
|
|
83
|
+
const into = new Set();
|
|
84
|
+
const vertex = dataflow.graph.getVertex(id);
|
|
85
|
+
if (vertex_1.DfgVertex.isUse(vertex)) {
|
|
86
|
+
const name = nameOf(ast, id);
|
|
87
|
+
if (name !== undefined && !namesFunction(dataflow, id)) {
|
|
88
|
+
into.add(name);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else if (vertex_1.DfgVertex.isFunctionCall(vertex)) {
|
|
92
|
+
for (const [arg, roles] of argumentRoles(dataflow, vertex, memo)) {
|
|
93
|
+
if (carriesData(roles)) {
|
|
94
|
+
for (const name of variablesOf(dataflow, ast, arg, seen, memo)) {
|
|
95
|
+
into.add(name);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/* `seen` only guards against cycles, a value shared by two arguments is asked again (and then known) */
|
|
101
|
+
seen.delete(id);
|
|
102
|
+
memo?.inputs.set(id, into);
|
|
103
|
+
return into;
|
|
104
|
+
}
|
|
105
|
+
const EmptyNames = new Set();
|
|
106
|
+
/**
|
|
107
|
+
* The variables the result of a call is computed from, resolved through the dataflow graph: the variables read
|
|
108
|
+
* by its arguments, through every call in between. An argument whose role in the signature carries no data is no
|
|
109
|
+
* input (the file of `write.csv`, a flag, a callee), nor is what a call quotes or looks up in a data mask (`x` in
|
|
110
|
+
* `filter(df, x > 1)`), or a use that only names a function.
|
|
111
|
+
*/
|
|
112
|
+
function inputVariablesOf(dataflow, ast, call, memo) {
|
|
113
|
+
const into = new Set();
|
|
114
|
+
const seen = new Set([call.id]);
|
|
115
|
+
for (const [arg, roles] of argumentRoles(dataflow, call, memo)) {
|
|
116
|
+
if (carriesData(roles)) {
|
|
117
|
+
for (const name of variablesOf(dataflow, ast, arg, seen, memo)) {
|
|
118
|
+
into.add(name);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return [...into];
|
|
123
|
+
}
|
|
124
|
+
function targetOf(dataflow, assignment, value) {
|
|
125
|
+
return dataflow.graph.edgesFrom(assignment.id).entries()
|
|
126
|
+
.find(([to, edge]) => to !== value && edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Returns) && vertex_1.DfgVertex.isVariableDefinition(dataflow.graph.getVertex(to)))?.[0];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The arguments the call hands on as its own result: the {@link ArgProp.Alias} one of its signature (`(x)`, a pipe
|
|
130
|
+
* into a call), or both operands of a `+` that adds to a plot, as ggplot's method for it returns the plot.
|
|
131
|
+
*/
|
|
132
|
+
function handedOn(dataflow, ast, call, memo) {
|
|
133
|
+
const node = ast.idMap.get(call.id);
|
|
134
|
+
return argumentRoles(dataflow, call, memo).filter(([, roles]) => (roles & built_in_props_1.ArgProp.Alias) !== 0 || (r_binary_op_1.RBinaryOp.is(node) && (0, plot_objects_1.isPlot)(node, dataflow, undefined, memo?.plots)))
|
|
135
|
+
.map(([arg]) => arg);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The variable the value of the call `id` is assigned to, following every call that hands the value on (see
|
|
139
|
+
* {@link handedOn}) up to the assignment. A value used by anything else, as in `f(mutate(df))`, is assigned to nothing.
|
|
140
|
+
*/
|
|
141
|
+
function assignmentOf(dataflow, ast, id, memo) {
|
|
142
|
+
/* every value along the way is assigned to what the start is, so a later ask from any of them is answered at once */
|
|
143
|
+
const path = [];
|
|
144
|
+
const settle = (target) => {
|
|
145
|
+
for (const at of path) {
|
|
146
|
+
memo?.assignments.set(at, target);
|
|
147
|
+
}
|
|
148
|
+
return target;
|
|
149
|
+
};
|
|
150
|
+
const seen = new Set();
|
|
151
|
+
for (let current = id; !seen.has(current);) {
|
|
152
|
+
if (memo?.assignments.has(current)) {
|
|
153
|
+
return settle(memo.assignments.get(current));
|
|
154
|
+
}
|
|
155
|
+
seen.add(current);
|
|
156
|
+
path.push(current);
|
|
157
|
+
const consumers = consumersOf(dataflow, current);
|
|
158
|
+
for (const consumer of consumers) {
|
|
159
|
+
const target = targetOf(dataflow, consumer, current);
|
|
160
|
+
const name = target === undefined ? undefined : nameOf(ast, target);
|
|
161
|
+
if (target !== undefined && name !== undefined) {
|
|
162
|
+
return settle({ id: target, name });
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const next = consumers.find(c => handedOn(dataflow, ast, c, memo).includes(current));
|
|
166
|
+
if (next === undefined) {
|
|
167
|
+
return settle(undefined);
|
|
168
|
+
}
|
|
169
|
+
current = next.id;
|
|
170
|
+
}
|
|
171
|
+
return settle(undefined);
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=data-flow.js.map
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { type DependenciesQuery, type DependenciesQueryResult } from './dependencies-query-format';
|
|
2
|
+
import { type DataflowGraphVertexFunctionCall } from '../../../dataflow/graph/vertex';
|
|
3
|
+
import { Identifier } from '../../../dataflow/environments/identifier';
|
|
2
4
|
import type { BasicQueryData } from '../../base-query-format';
|
|
5
|
+
import type { DataflowInformation } from '../../../dataflow/info';
|
|
6
|
+
import type { FlowrConfig } from '../../../config';
|
|
7
|
+
import type { NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
|
+
import { type FlowMemo } from './data-flow';
|
|
3
9
|
/**
|
|
4
10
|
* Executes a dependencies query.
|
|
5
11
|
*/
|
|
6
12
|
export declare function executeDependenciesQuery({ analyzer, }: BasicQueryData, queries: readonly DependenciesQuery[]): Promise<DependenciesQueryResult>;
|
|
13
|
+
/**
|
|
14
|
+
* What one run of the query computes once and hands to every part: the analysis results, the memo of what is asked
|
|
15
|
+
* about the same calls again and again, and the formals of the calls. Nothing of it outlives the run.
|
|
16
|
+
*/
|
|
17
|
+
export interface QueryRun {
|
|
18
|
+
readonly dataflow: DataflowInformation;
|
|
19
|
+
readonly config: FlowrConfig;
|
|
20
|
+
readonly normalize: NormalizedAst;
|
|
21
|
+
readonly memo: FlowMemo;
|
|
22
|
+
/** the formals of the call, give its qualified name if known already */
|
|
23
|
+
readonly formals: (vertex: DataflowGraphVertexFunctionCall, qualified?: Identifier) => readonly string[] | undefined;
|
|
24
|
+
}
|
|
@@ -6,6 +6,8 @@ const dependencies_query_format_1 = require("./dependencies-query-format");
|
|
|
6
6
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
7
7
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
8
8
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
9
|
+
const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
10
|
+
const edge_1 = require("../../../dataflow/graph/edge");
|
|
9
11
|
const objects_1 = require("../../../util/objects");
|
|
10
12
|
const function_info_1 = require("./function-info/function-info");
|
|
11
13
|
const identify_link_to_last_call_relation_1 = require("../call-context-query/identify-link-to-last-call-relation");
|
|
@@ -15,6 +17,12 @@ const log_1 = require("../../../util/log");
|
|
|
15
17
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
16
18
|
const graph_1 = require("../../../dataflow/graph/graph");
|
|
17
19
|
const link_devices_1 = require("./link-devices");
|
|
20
|
+
const arrays_1 = require("../../../util/collections/arrays");
|
|
21
|
+
const library_functions_1 = require("./function-info/library-functions");
|
|
22
|
+
const plot_description_1 = require("./plot-description");
|
|
23
|
+
const data_flow_1 = require("./data-flow");
|
|
24
|
+
const match_args_1 = require("../../../dataflow/graph/match-args");
|
|
25
|
+
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
18
26
|
const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
19
27
|
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
20
28
|
/**
|
|
@@ -55,8 +63,12 @@ async function executeDependenciesQuery({ analyzer, }, queries) {
|
|
|
55
63
|
await (0, query_1.executeQueriesOfSameType)(data, functions.entries().flatMap(makeCallContextQuery).toArray());
|
|
56
64
|
const g = (0, dependencies_query_format_1.getAllCategories)(queries, ctx);
|
|
57
65
|
const enabled = query.enabledCategories;
|
|
66
|
+
const run = { dataflow, config, normalize, memo: (0, data_flow_1.makeFlowMemo)(), formals: formalsLookup(dataflow.graph, ctx) };
|
|
67
|
+
/* the packages the code attaches decide which package a bare call further down belongs to */
|
|
68
|
+
const library = getResults(g, run, queryResults, 'library', functions.get('library') ?? [], data);
|
|
69
|
+
const attaching = library.filter(library_functions_1.attachesPackage);
|
|
58
70
|
const results = Object.fromEntries(await Promise.all(functions.entries().map(async ([c, f]) => {
|
|
59
|
-
const results = getResults(g,
|
|
71
|
+
const results = c === 'library' ? library : getResults(g, run, queryResults, c, f, data, attaching);
|
|
60
72
|
/* only default categories allow additional analyses */
|
|
61
73
|
if (enabled === undefined || enabled.includes(c)) {
|
|
62
74
|
await g[c]?.additionalAnalysis?.(data, ignoreDefault, f, queryResults, results);
|
|
@@ -65,7 +77,9 @@ async function executeDependenciesQuery({ analyzer, }, queries) {
|
|
|
65
77
|
})));
|
|
66
78
|
/* also without a device: a plot on screen has no file, but still has the addons drawn onto it */
|
|
67
79
|
if (results.visualize?.length) {
|
|
68
|
-
(0, link_devices_1.linkPlotsToDevices)(results.write ?? [], results.visualize, dataflow, normalize);
|
|
80
|
+
(0, link_devices_1.linkPlotsToDevices)(results.write ?? [], results.visualize, dataflow, normalize, ctx);
|
|
81
|
+
(0, plot_description_1.describePlots)(results.write ?? [], results.visualize, run, ctx);
|
|
82
|
+
inheritPlotInputs(results.visualize);
|
|
69
83
|
}
|
|
70
84
|
if (query.assumedPackages && (enabled === undefined || enabled.includes('library'))) {
|
|
71
85
|
const explicit = new Set((results.library ?? []).map(r => r.value).filter((v) => v !== undefined && v !== dependencies_query_format_1.Unknown && v !== dependencies_query_format_1.Constant));
|
|
@@ -81,6 +95,37 @@ async function executeDependenciesQuery({ analyzer, }, queries) {
|
|
|
81
95
|
...results,
|
|
82
96
|
};
|
|
83
97
|
}
|
|
98
|
+
/** whether the call may reach a function definition of the code, whose formals differ from call to call */
|
|
99
|
+
function callsDefinition(dfg, id) {
|
|
100
|
+
for (const [target, edge] of dfg.edgesFrom(id)) {
|
|
101
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls) && !node_id_1.NodeId.isBuiltIn(target)) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The formals of a call (see {@link MatchArgs.formalsOf}), looked up once per function the calls reach among the
|
|
109
|
+
* built-ins and the signature database, as decoding the database's entry is what makes this costly. A call that
|
|
110
|
+
* may reach a definition of the code is asked directly, its formals are in the AST.
|
|
111
|
+
*/
|
|
112
|
+
function formalsLookup(dfg, ctx) {
|
|
113
|
+
const byFunction = new Map();
|
|
114
|
+
return (vertex, qualified) => {
|
|
115
|
+
const call = dfg.idMap?.get(vertex.id);
|
|
116
|
+
if (!r_function_call_1.RFunctionCall.is(call)) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
else if (callsDefinition(dfg, vertex.id)) {
|
|
120
|
+
return match_args_1.MatchArgs.formalsOf(call, dfg, ctx);
|
|
121
|
+
}
|
|
122
|
+
const key = identifier_1.Identifier.toString(qualified ?? df_helper_1.Dataflow.qualify(vertex.id, dfg, false) ?? vertex.name);
|
|
123
|
+
if (!byFunction.has(key)) {
|
|
124
|
+
byFunction.set(key, match_args_1.MatchArgs.formalsOf(call, dfg, ctx));
|
|
125
|
+
}
|
|
126
|
+
return byFunction.get(key);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
84
129
|
/** One implicit `library` entry per attached base package that the graph uses but that is not loaded explicitly. */
|
|
85
130
|
function assumedBasePackageEntries(dfg, rVersion, explicit) {
|
|
86
131
|
const used = [];
|
|
@@ -111,6 +156,47 @@ function makeCallContextQuery([kind, functions]) {
|
|
|
111
156
|
kind
|
|
112
157
|
}));
|
|
113
158
|
}
|
|
159
|
+
/** An addon draws the data of the plot it builds (`geom_point()` that of `ggplot(df)`), unless it is given its own. */
|
|
160
|
+
function inheritPlotInputs(plots) {
|
|
161
|
+
const inputsOf = new Map(plots.flatMap(p => p.nodeId === undefined || p.linkedIds?.length ? [] : [[p.nodeId, p.inputVariables ?? []]]));
|
|
162
|
+
for (const [at, plot] of plots.entries()) {
|
|
163
|
+
const inherited = plot.inputVariables === undefined ? (0, arrays_1.uniqueArray)(plot.linkedIds?.flatMap(root => inputsOf.get(root) ?? []) ?? []) : [];
|
|
164
|
+
if (inherited.length > 0) {
|
|
165
|
+
plots[at] = { ...plot, inputVariables: inherited };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/** the categories whose calls consume data, and the ones that produce it, see {@link DependencyInfo#inputVariables} and {@link DependencyInfo#assignedTo} */
|
|
170
|
+
const ConsumingCategories = new Set(['write', 'visualize', 'transform']);
|
|
171
|
+
const ProducingCategories = new Set(['read', 'visualize', 'transform']);
|
|
172
|
+
function dataFlowOf(kind, call, { dataflow, normalize, memo }) {
|
|
173
|
+
const input = ConsumingCategories.has(kind) ? (0, data_flow_1.inputVariablesOf)(dataflow, normalize, call, memo) : [];
|
|
174
|
+
return {
|
|
175
|
+
inputVariables: input.length > 0 ? input : undefined,
|
|
176
|
+
assignedTo: ProducingCategories.has(kind) ? (0, data_flow_1.assignmentOf)(dataflow, normalize, call.id, memo)?.name : undefined
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The package a call belongs to: the one written, else the one it resolves to. A bare call that resolves to nothing is
|
|
181
|
+
* the base package exporting it (`stats` for `filter`), unless the project loads a package the category declares
|
|
182
|
+
* the name for, which then masks the base one as in R.
|
|
183
|
+
*/
|
|
184
|
+
function namespaceOf(id, functionName, dfg, candidates, isLoaded) {
|
|
185
|
+
const written = identifier_1.Identifier.getNamespace(functionName);
|
|
186
|
+
if (written !== undefined || candidates.some(c => c.package !== undefined && isLoaded(c.package))) {
|
|
187
|
+
return written;
|
|
188
|
+
}
|
|
189
|
+
const qualified = df_helper_1.Dataflow.qualify(id, dfg, true);
|
|
190
|
+
return qualified === undefined ? undefined : identifier_1.Identifier.getNamespace(qualified);
|
|
191
|
+
}
|
|
192
|
+
/** the packages attached by the loader calls the call `id` resolves its definition through */
|
|
193
|
+
function attachingPackagesOf(id, dfg, attaching) {
|
|
194
|
+
if (attaching.length === 0) {
|
|
195
|
+
return new Set();
|
|
196
|
+
}
|
|
197
|
+
const targets = new Set(df_helper_1.Dataflow.callTargetsOf(id, dfg));
|
|
198
|
+
return new Set(attaching.flatMap(a => a.nodeId !== undefined && a.value !== undefined && targets.has(a.nodeId) ? [a.value] : []));
|
|
199
|
+
}
|
|
114
200
|
const readOnlyModes = new Set(['r', 'rt', 'rb']);
|
|
115
201
|
const writeOnlyModes = new Set(['w', 'wt', 'wb', 'a', 'at', 'ab']);
|
|
116
202
|
/**
|
|
@@ -128,7 +214,8 @@ function pickFunctionInfo(candidates, callNamespace, isLoaded) {
|
|
|
128
214
|
}
|
|
129
215
|
return candidates.find(c => c.package !== undefined && isLoaded(c.package)) ?? candidates[0];
|
|
130
216
|
}
|
|
131
|
-
function getResults(categories,
|
|
217
|
+
function getResults(categories, run, results, kind, functions, data, attaching = []) {
|
|
218
|
+
const { dataflow, config, normalize } = run;
|
|
132
219
|
const defaultValue = categories[kind].defaultValue;
|
|
133
220
|
const vars = config.solver.variables;
|
|
134
221
|
const functionMap = Map.groupBy(functions, f => f.name);
|
|
@@ -138,18 +225,24 @@ function getResults(categories, { dataflow, config, normalize }, results, kind,
|
|
|
138
225
|
const d = ictx.deps;
|
|
139
226
|
/* only asked when a name is declared by more than one package, keeping the resolution it may trigger off the common path */
|
|
140
227
|
let loadedPackages;
|
|
141
|
-
const isLoadedPackage = (pkg) => (loadedPackages ??= new Set(d.getDependencies().map(p => p.name))).has(pkg);
|
|
228
|
+
const isLoadedPackage = (pkg) => (loadedPackages ??= new Set([...d.getDependencies().map(p => p.name), ...config.solver.assumeAttachedPackages ?? []])).has(pkg);
|
|
142
229
|
const dfg = dataflow.graph;
|
|
143
230
|
for (const [name, results] of kindEntries) {
|
|
144
231
|
for (const { id, linkedIds } of results) {
|
|
145
232
|
const vertex = dfg.getVertex(id);
|
|
146
233
|
const functionName = df_helper_1.Dataflow.qualify(id, dfg, false) ?? vertex.name;
|
|
147
|
-
const
|
|
234
|
+
const candidates = functionMap.get(name);
|
|
235
|
+
/* a package whose attached definition the call resolves to is loaded there, as R resolves the bare name to it;
|
|
236
|
+
* only asked when a name is declared for a package, which is what makes it worth the call targets */
|
|
237
|
+
let attachedBy;
|
|
238
|
+
const isLoaded = (pkg) => (attachedBy ??= attachingPackagesOf(id, dfg, attaching)).has(pkg) || isLoadedPackage(pkg);
|
|
239
|
+
const info = pickFunctionInfo(candidates, namespaceOf(id, functionName, dfg, candidates, isLoaded), isLoaded);
|
|
148
240
|
if (info === undefined) {
|
|
149
241
|
continue;
|
|
150
242
|
}
|
|
151
|
-
const
|
|
152
|
-
const
|
|
243
|
+
const formals = run.formals(vertex, functionName);
|
|
244
|
+
const args = (0, resolve_argument_1.getArgumentStringValue)(vars, dfg, vertex, info.argIdx, info.argName, info.resolveValue, ictx, formals);
|
|
245
|
+
const linkedArgs = collectValuesFromLinks(args, { dataflow, config, ctx: ictx, formals: run.formals }, linkedIds);
|
|
153
246
|
const linked = linkedIds?.map(linkedId => typeof linkedId === 'object' ? linkedId.id : linkedId);
|
|
154
247
|
const ignoreOnArgVal = () => {
|
|
155
248
|
if (info.ignoreIf !== 'arg-true' && info.ignoreIf !== 'arg-false') {
|
|
@@ -157,7 +250,7 @@ function getResults(categories, { dataflow, config, normalize }, results, kind,
|
|
|
157
250
|
}
|
|
158
251
|
const margs = info.additionalArgs?.val;
|
|
159
252
|
(0, assert_1.guard)(margs, 'Need additional argument val when checking for arg-true');
|
|
160
|
-
const valArgs = (0, resolve_argument_1.getArgumentStringValue)(vars, dfg, vertex, margs.argIdx, margs.argName, margs.resolveValue,
|
|
253
|
+
const valArgs = (0, resolve_argument_1.getArgumentStringValue)(vars, dfg, vertex, margs.argIdx, margs.argName, margs.resolveValue, ictx, formals);
|
|
161
254
|
const valValues = valArgs?.values().flatMap(v => Array.from(v)).toArray() ?? [];
|
|
162
255
|
/* ignore only if every value is the one the check asks for */
|
|
163
256
|
const ignoredValue = info.ignoreIf === 'arg-true' ? 'TRUE' : 'FALSE';
|
|
@@ -176,6 +269,7 @@ function getResults(categories, { dataflow, config, normalize }, results, kind,
|
|
|
176
269
|
(0, assert_1.guard)(margs, 'Need additional argument argSet when checking for arg-set');
|
|
177
270
|
return hasArg(margs.argName, margs.argIdx);
|
|
178
271
|
};
|
|
272
|
+
const flow = dataFlowOf(kind, vertex, run);
|
|
179
273
|
const foundValues = linkedArgs ?? args;
|
|
180
274
|
if (!foundValues) {
|
|
181
275
|
if (info.ignoreIf !== 'arg-missing' && !ignoreOnArgVal() && !ignoreOnArgSet()) {
|
|
@@ -184,6 +278,7 @@ function getResults(categories, { dataflow, config, normalize }, results, kind,
|
|
|
184
278
|
functionName,
|
|
185
279
|
lexemeOfArgument: undefined,
|
|
186
280
|
linkedIds: linked?.length ? linked : undefined,
|
|
281
|
+
...flow,
|
|
187
282
|
value: info.defaultValue ?? defaultValue
|
|
188
283
|
}));
|
|
189
284
|
}
|
|
@@ -193,7 +288,7 @@ function getResults(categories, { dataflow, config, normalize }, results, kind,
|
|
|
193
288
|
const margs = info.additionalArgs?.mode;
|
|
194
289
|
(0, assert_1.guard)(margs, 'Need additional argument mode when checking for mode');
|
|
195
290
|
const modes = info.ignoreIf === 'mode-only-read' ? readOnlyModes : writeOnlyModes;
|
|
196
|
-
const modeArgs = (0, resolve_argument_1.getArgumentStringValue)(vars, dfg, vertex, margs.argIdx, margs.argName, margs.resolveValue,
|
|
291
|
+
const modeArgs = (0, resolve_argument_1.getArgumentStringValue)(vars, dfg, vertex, margs.argIdx, margs.argName, margs.resolveValue, ictx, formals);
|
|
197
292
|
const modeValues = modeArgs?.values().flatMap(v => Array.from(v)) ?? [];
|
|
198
293
|
/* all modes are read-only (resp. write-only), so we can ignore this */
|
|
199
294
|
if (modeValues.every(m => m && modes.has(m))) {
|
|
@@ -210,7 +305,7 @@ function getResults(categories, { dataflow, config, normalize }, results, kind,
|
|
|
210
305
|
resolvedValue = info.stringReplacements[value];
|
|
211
306
|
}
|
|
212
307
|
const dep = resolvedValue ? d.getDependency(resolvedValue) ?? undefined : undefined;
|
|
213
|
-
const lexeme =
|
|
308
|
+
const lexeme = unresolvedArgumentCode(value, arg);
|
|
214
309
|
finalResults.push((0, objects_1.compactRecord)({
|
|
215
310
|
nodeId: id,
|
|
216
311
|
functionName,
|
|
@@ -218,6 +313,7 @@ function getResults(categories, { dataflow, config, normalize }, results, kind,
|
|
|
218
313
|
argumentId: lexeme === undefined ? undefined : arg,
|
|
219
314
|
lexemeOfArgument: lexeme,
|
|
220
315
|
linkedIds: linked?.length ? linked : undefined,
|
|
316
|
+
...flow,
|
|
221
317
|
value: resolvedValue ?? info.defaultValue ?? defaultValue,
|
|
222
318
|
versionConstraints: dep?.versionConstraints,
|
|
223
319
|
derivedRange: dep?.effectiveRange,
|
|
@@ -228,7 +324,7 @@ function getResults(categories, { dataflow, config, normalize }, results, kind,
|
|
|
228
324
|
}
|
|
229
325
|
}
|
|
230
326
|
return finalResults;
|
|
231
|
-
function
|
|
327
|
+
function unresolvedArgumentCode(argument, id) {
|
|
232
328
|
if ((argument && argument !== dependencies_query_format_1.Unknown && argument !== dependencies_query_format_1.Constant) || !id) {
|
|
233
329
|
return undefined;
|
|
234
330
|
}
|
|
@@ -253,7 +349,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
|
|
|
253
349
|
if (!vertex_1.DfgVertex.isFunctionCall(vertex)) {
|
|
254
350
|
continue;
|
|
255
351
|
}
|
|
256
|
-
const args = (0, resolve_argument_1.getArgumentStringValue)(data.config.solver.variables, data.dataflow.graph, vertex, info.argIdx, info.argName, info.resolveValue, data.ctx);
|
|
352
|
+
const args = (0, resolve_argument_1.getArgumentStringValue)(data.config.solver.variables, data.dataflow.graph, vertex, info.argIdx, info.argName, info.resolveValue, data.ctx, data.formals(vertex));
|
|
257
353
|
for (const [arg, values] of args?.entries() ?? []) {
|
|
258
354
|
map.set(arg, (map.get(arg) ?? new Set()).union(values));
|
|
259
355
|
}
|
|
@@ -33,7 +33,7 @@ export interface DependencyCategorySettings {
|
|
|
33
33
|
additionalAnalysis?: (data: BasicQueryData, ignoreDefault: boolean, functions: readonly FunctionInfo[], queryResults: CallContextQueryResult, result: DependencyInfo[]) => AsyncOrSync<void>;
|
|
34
34
|
}
|
|
35
35
|
/** the built-in categories; what each searches for is derived per configuration, see {@link defaultDependencyCategories} */
|
|
36
|
-
export declare const DefaultDependencyCategoryNames: readonly ["library", "remote", "source", "read", "write", "visualize", "test", "statistics"];
|
|
36
|
+
export declare const DefaultDependencyCategoryNames: readonly ["library", "remote", "source", "read", "write", "visualize", "transform", "test", "statistics"];
|
|
37
37
|
export type DefaultDependencyCategoryName = typeof DefaultDependencyCategoryNames[number];
|
|
38
38
|
/**
|
|
39
39
|
* The categories flowR searches for by default. The functions of the categories flowR derives from its
|
|
@@ -82,6 +82,22 @@ export interface DependencyInfo extends Record<string, unknown> {
|
|
|
82
82
|
lexemeOfArgument?: string;
|
|
83
83
|
/** The library name, file, source, destination etc. being sourced, read from, or written to. */
|
|
84
84
|
value?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The variables the result of the call is computed from, resolved through the dataflow graph: `df` for
|
|
87
|
+
* `df |> filter(x > 1)` (where `x` names a column) and `a`, `b` for `left_join(a, b)`; an addon to a plot draws its
|
|
88
|
+
* data. Reported for the `write`, `visualize` and `transform` categories.
|
|
89
|
+
*/
|
|
90
|
+
inputVariables?: readonly string[];
|
|
91
|
+
/**
|
|
92
|
+
* The variable the result of the call is assigned to, following every call that hands it on (a pipe into a call,
|
|
93
|
+
* `( )`, a `+` adding to a plot) up to `<-`, `=` or `->`.
|
|
94
|
+
* Reported for the `read`, `visualize` and `transform` categories.
|
|
95
|
+
*/
|
|
96
|
+
assignedTo?: string;
|
|
97
|
+
/** for a plot, the title its `ggtitle`, `labs(title = )` or `main =` states */
|
|
98
|
+
title?: string;
|
|
99
|
+
/** for a plot, the file it is written to by `ggsave` or by a graphics device open when it is drawn */
|
|
100
|
+
savedTo?: string;
|
|
85
101
|
/** the output is not written by a call asking for it: R echoes the top-level statement on its own */
|
|
86
102
|
implicit?: boolean;
|
|
87
103
|
versionConstraints?: readonly Range[];
|