@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
|
@@ -18,13 +18,13 @@ const r_value_1 = require("../../dataflow/eval/values/r-value");
|
|
|
18
18
|
const info_1 = require("../../dataflow/info");
|
|
19
19
|
const built_in_proc_name_1 = require("../../dataflow/environments/built-in-proc-name");
|
|
20
20
|
const edge_1 = require("../../dataflow/graph/edge");
|
|
21
|
-
const frame_reflection_1 = require("../../dataflow/fn/frame-reflection");
|
|
22
21
|
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
23
22
|
const function_semantics_1 = require("../../dataflow/fn/function-semantics");
|
|
24
23
|
const logic_1 = require("../../util/logic");
|
|
25
24
|
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
26
25
|
const built_in_props_1 = require("../../dataflow/environments/built-in-props");
|
|
27
26
|
const resolve_helper_1 = require("../../dataflow/environments/resolve-helper");
|
|
27
|
+
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
28
28
|
exports.SEEDED_RANDOMNESS = {
|
|
29
29
|
createSearch: config => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall)
|
|
30
30
|
.with(search_enrichers_1.Enrichment.CallTargets, {
|
|
@@ -81,13 +81,13 @@ exports.SEEDED_RANDOMNESS = {
|
|
|
81
81
|
return loops.some(loop => writerCds?.some(cd => info_1.ControlDependency.same(cd, loop)));
|
|
82
82
|
};
|
|
83
83
|
/** a call of a draw by another name, like a parameter `f` bound to `runif` */
|
|
84
|
-
const drawsThrough = (call) =>
|
|
84
|
+
const drawsThrough = (call) => df_helper_1.Dataflow.targetsOf(graph, call, edge_1.EdgeType.Calls).some(t => node_id_1.NodeId.isBuiltIn(t) && consumers.has(node_id_1.NodeId.fromBuiltIn(t))) ? 'draw' : undefined;
|
|
85
85
|
/** the writes a draw reads the generator state from: its own, and those of the calls running the function it sits in, which link what was written before them */
|
|
86
86
|
const statesReadBy = (id) => {
|
|
87
87
|
const within = idMap === undefined ? undefined : model_1.RNode.findEnclosing(id, idMap, r_function_definition_1.RFunctionDefinition.is);
|
|
88
|
-
const callers = within === undefined ? [] :
|
|
89
|
-
const ownReads =
|
|
90
|
-
return [...ownReads, ...callers.flatMap(c =>
|
|
88
|
+
const callers = within === undefined ? [] : df_helper_1.Dataflow.sourcesOf(graph, within, edge_1.EdgeType.Calls);
|
|
89
|
+
const ownReads = df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall);
|
|
90
|
+
return [...ownReads, ...callers.flatMap(c => df_helper_1.Dataflow.targetsOf(graph, c, edge_1.EdgeType.DefinedByOnCall))];
|
|
91
91
|
};
|
|
92
92
|
/** follows the draws behind the generator state `id` reads back to where it was seeded */
|
|
93
93
|
const collectSeeding = (id, visiting, seeding) => {
|
|
@@ -10,7 +10,7 @@ export interface SoftwareHasLicenseConfig extends MergeableRecord {
|
|
|
10
10
|
}
|
|
11
11
|
export type SoftwareHasLicenseMetadata = MergeableRecord;
|
|
12
12
|
export declare const SOFTWARE_HAS_LICENSE: {
|
|
13
|
-
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from
|
|
13
|
+
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from", [], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
|
|
14
14
|
readonly processSearchResult: (_elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: SoftwareHasLicenseConfig, data: import("../..").ReadonlyFlowrAnalysisProvider<import("../..").KnownParser>) => {
|
|
15
15
|
results: SoftwareHasLicenseResult[];
|
|
16
16
|
'.meta': {};
|
|
@@ -8,7 +8,7 @@ const linter_tags_1 = require("../linter-tags");
|
|
|
8
8
|
const flowr_file_1 = require("../../project/context/flowr-file");
|
|
9
9
|
const flowr_description_file_1 = require("../../project/plugins/file-plugins/files/flowr-description-file");
|
|
10
10
|
exports.SOFTWARE_HAS_LICENSE = {
|
|
11
|
-
createSearch: () => flowr_search_builder_1.Q.
|
|
11
|
+
createSearch: () => flowr_search_builder_1.Q.from([]),
|
|
12
12
|
processSearchResult: (_elements, config, data) => {
|
|
13
13
|
const ctx = data.inspectContext();
|
|
14
14
|
const licenseFiles = ctx.files.getFilesByRole(flowr_file_1.FileRole.License);
|
|
@@ -11,7 +11,7 @@ const info_1 = require("../../dataflow/info");
|
|
|
11
11
|
const built_in_props_1 = require("../../dataflow/environments/built-in-props");
|
|
12
12
|
const query_fn_props_1 = require("../../dataflow/environments/query-fn-props");
|
|
13
13
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
14
|
-
const
|
|
14
|
+
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
15
15
|
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
16
16
|
const range_1 = require("../../util/range");
|
|
17
17
|
const assert_1 = require("../../util/assert");
|
|
@@ -52,7 +52,7 @@ function openCallsReaching(graph, start, opens, out) {
|
|
|
52
52
|
}
|
|
53
53
|
/** The variable definition the opened connection is bound to, if it is bound to one. */
|
|
54
54
|
function bindingOf(graph, open) {
|
|
55
|
-
return
|
|
55
|
+
return df_helper_1.Dataflow.sourcesOf(graph, open, edge_1.EdgeType.DefinedBy).find(source => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(source)));
|
|
56
56
|
}
|
|
57
57
|
/** The statement `id` belongs to, i.e. the ancestor that is an element of an expression list. */
|
|
58
58
|
function enclosingStatement(idMap, id) {
|
|
@@ -79,7 +79,7 @@ function closeFix(graph, open) {
|
|
|
79
79
|
if (idMap === undefined || definition === undefined || name === undefined) {
|
|
80
80
|
return undefined;
|
|
81
81
|
}
|
|
82
|
-
const reads =
|
|
82
|
+
const reads = df_helper_1.Dataflow.sourcesOf(graph, definition, edge_1.EdgeType.Reads);
|
|
83
83
|
const statements = [definition, ...reads]
|
|
84
84
|
.map(id => range_1.SourceLocation.fromNode(enclosingStatement(idMap, liftedOutOfLoops(idMap, id, definition))))
|
|
85
85
|
.filter(assert_1.isNotUndefined);
|
|
@@ -13,6 +13,7 @@ const vertex_1 = require("../../dataflow/graph/vertex");
|
|
|
13
13
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
14
14
|
const r_access_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-access");
|
|
15
15
|
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
16
|
+
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
16
17
|
/**
|
|
17
18
|
* Path heuristic for an R package `inst/` resource (installed verbatim, not namespace source). Fallback for
|
|
18
19
|
* the authoritative `FileRole.Install`, covering requests that bypass the file-role plugins.
|
|
@@ -58,43 +59,34 @@ function isInSubscript(graph, id) {
|
|
|
58
59
|
return false;
|
|
59
60
|
}
|
|
60
61
|
let childId = id;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const parent = idMap.get(parentId);
|
|
64
|
-
if (parent === undefined || r_function_definition_1.RFunctionDefinition.is(parent)) {
|
|
62
|
+
for (const parent of model_1.RNode.iterateParents(idMap.get(id), idMap)) {
|
|
63
|
+
if (r_function_definition_1.RFunctionDefinition.is(parent)) {
|
|
65
64
|
return false;
|
|
66
65
|
}
|
|
67
|
-
if (r_access_1.RAccess.
|
|
66
|
+
if (r_access_1.RAccess.isIndex(parent) && parent.accessed.info.id !== childId) {
|
|
68
67
|
return true; // reached from a subscript, not the accessed object
|
|
69
68
|
}
|
|
70
|
-
childId =
|
|
71
|
-
parentId = parent.info.parent;
|
|
69
|
+
childId = parent.info.id;
|
|
72
70
|
}
|
|
73
71
|
return false;
|
|
74
72
|
}
|
|
75
73
|
/** AST nodes that make their children conditionally executed within their scope. */
|
|
76
74
|
const ConditionalNodeTypes = new Set([type_1.RType.IfThenElse, type_1.RType.ForLoop, type_1.RType.WhileLoop, type_1.RType.RepeatLoop]);
|
|
77
75
|
/**
|
|
78
|
-
* Walk from `
|
|
76
|
+
* Walk from the parent of `id` up to the nearest enclosing {@link RType.FunctionDefinition} (or the top level),
|
|
79
77
|
* reporting that scope and whether the walk crossed no `if`/loop block - so a binding at the origin is
|
|
80
78
|
* guaranteed to execute whenever its scope runs. (`cds` is unsuitable: guard clauses like `if(...) stop()`
|
|
81
79
|
* add a control dependency to otherwise-unconditional sibling statements.)
|
|
82
80
|
*/
|
|
83
|
-
function enclosingScope(idMap,
|
|
84
|
-
let cur = startParent;
|
|
81
|
+
function enclosingScope(idMap, id) {
|
|
85
82
|
let unconditional = true;
|
|
86
|
-
for (
|
|
87
|
-
const node = idMap.get(cur);
|
|
88
|
-
if (node === undefined) {
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
83
|
+
for (const node of model_1.RNode.iterateParents(idMap.get(id), idMap)) {
|
|
91
84
|
if (r_function_definition_1.RFunctionDefinition.is(node)) {
|
|
92
|
-
return { scope:
|
|
85
|
+
return { scope: node.info.id, unconditional };
|
|
93
86
|
}
|
|
94
87
|
if (ConditionalNodeTypes.has(node.type)) {
|
|
95
88
|
unconditional = false;
|
|
96
89
|
}
|
|
97
|
-
cur = node.info.parent;
|
|
98
90
|
}
|
|
99
91
|
return { scope: 'top', unconditional };
|
|
100
92
|
}
|
|
@@ -110,15 +102,13 @@ function collectScopeDefinedNames(graph) {
|
|
|
110
102
|
if (idMap === undefined) {
|
|
111
103
|
return byScope;
|
|
112
104
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
const name = idMap.get(id)?.lexeme;
|
|
105
|
+
/* function bindings/params surface as variable definitions of their name symbol */
|
|
106
|
+
for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
|
|
107
|
+
const name = node_id_1.NodeId.recoverName(id, idMap);
|
|
118
108
|
if (name === undefined) {
|
|
119
109
|
continue;
|
|
120
110
|
}
|
|
121
|
-
const { scope, unconditional } = enclosingScope(idMap,
|
|
111
|
+
const { scope, unconditional } = enclosingScope(idMap, id);
|
|
122
112
|
if (!unconditional) {
|
|
123
113
|
continue;
|
|
124
114
|
}
|
|
@@ -139,20 +129,14 @@ function isDefinedInEnclosingScope(graph, defined, useId, name) {
|
|
|
139
129
|
if (idMap === undefined) {
|
|
140
130
|
return false;
|
|
141
131
|
}
|
|
142
|
-
const own = enclosingScope(idMap,
|
|
132
|
+
const own = enclosingScope(idMap, useId).scope;
|
|
143
133
|
if (own !== 'top' && defined.get('top')?.has(name)) {
|
|
144
134
|
return true;
|
|
145
135
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const node = idMap.get(cur);
|
|
149
|
-
if (node === undefined) {
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
if (r_function_definition_1.RFunctionDefinition.is(node) && cur !== own && defined.get(cur)?.has(name)) {
|
|
136
|
+
for (const node of model_1.RNode.iterateParents(idMap.get(useId), idMap)) {
|
|
137
|
+
if (r_function_definition_1.RFunctionDefinition.is(node) && node.info.id !== own && defined.get(node.info.id)?.has(name)) {
|
|
153
138
|
return true;
|
|
154
139
|
}
|
|
155
|
-
cur = node.info.parent;
|
|
156
140
|
}
|
|
157
141
|
return false;
|
|
158
142
|
}
|
|
@@ -40,6 +40,8 @@ export interface SuppressionCounts {
|
|
|
40
40
|
subscript: number;
|
|
41
41
|
/** a bare name a `library()` flowR could not resolve may export */
|
|
42
42
|
unresolvedLibrary: number;
|
|
43
|
+
/** declared by `utils::globalVariables()` or set by R's method dispatch (`.Generic`, `.Method`, `.Class`) */
|
|
44
|
+
declaredGlobal: number;
|
|
43
45
|
}
|
|
44
46
|
export interface UndefinedSymbolMetadata extends MergeableRecord {
|
|
45
47
|
totalFunctionCalls: number;
|
|
@@ -15,8 +15,31 @@ const defaultmap_1 = require("../../util/collections/defaultmap");
|
|
|
15
15
|
const linter_format_1 = require("../linter-format");
|
|
16
16
|
const linter_tags_1 = require("../linter-tags");
|
|
17
17
|
const undefined_symbol_util_1 = require("./undefined-symbol-util");
|
|
18
|
+
const resolve_argument_1 = require("../../dataflow/eval/resolve/resolve-argument");
|
|
18
19
|
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
19
20
|
const r_symbol_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
21
|
+
/** the variables R's S3 dispatch binds in the frame of a method */
|
|
22
|
+
const DispatchVariables = ['.Generic', '.Method', '.Class'];
|
|
23
|
+
/**
|
|
24
|
+
* The names declared by the `utils::globalVariables(names)` calls of the code (resolved by flowR), which is how a
|
|
25
|
+
* package tells `R CMD check` about names it uses through non-standard evaluation, and the variables of R's dispatch.
|
|
26
|
+
*/
|
|
27
|
+
function declaredGlobalVariables(graph, ctx) {
|
|
28
|
+
const names = new Set(DispatchVariables);
|
|
29
|
+
for (const [, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
30
|
+
const [name, ns] = identifier_1.Identifier.toArray(vertex.name);
|
|
31
|
+
if (name !== 'globalVariables' || (ns !== undefined && ns !== 'utils')) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const values = (0, resolve_argument_1.getArgumentStringValue)(ctx.config.solver.variables, graph, vertex, 0, 'names', true, ctx);
|
|
35
|
+
for (const str of values?.values().flatMap(v => [...v]) ?? []) {
|
|
36
|
+
if (str !== undefined) {
|
|
37
|
+
names.add(str);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return names;
|
|
42
|
+
}
|
|
20
43
|
/** calls that load a package; an unresolved one means we cannot enumerate all exports in scope */
|
|
21
44
|
const LibraryLoadFunctions = new Set(['library', 'require', 'requireNamespace', 'loadNamespace', 'attachNamespace', 'load_all', 'use', 'p_load']);
|
|
22
45
|
/** test frameworks whose namespace a test file runs under implicitly (e.g. `tests/testthat/test-*.R` sees testthat's exports without a `library()`) */
|
|
@@ -47,7 +70,7 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
47
70
|
const meta = {
|
|
48
71
|
totalFunctionCalls: 0,
|
|
49
72
|
totalVariableUses: 0,
|
|
50
|
-
suppressed: { installed: 0, loadedPackage: 0, enclosingScope: 0, nonStandardEval: 0, subscript: 0, unresolvedLibrary: 0 }
|
|
73
|
+
suppressed: { installed: 0, loadedPackage: 0, enclosingScope: 0, nonStandardEval: 0, subscript: 0, unresolvedLibrary: 0, declaredGlobal: 0 }
|
|
51
74
|
};
|
|
52
75
|
const suppress = (reason) => {
|
|
53
76
|
meta.suppressed[reason]++;
|
|
@@ -65,6 +88,8 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
65
88
|
const unknownIds = new Set([...graph.unknownSideEffects].map(e => graph_1.UnknownSideEffect.id(e)));
|
|
66
89
|
const unresolvedLibraryInScope = unknownIds.size > 0 && [...graph.verticesOfType(vertex_1.VertexType.FunctionCall)]
|
|
67
90
|
.some(([id, v]) => unknownIds.has(id) && LibraryLoadFunctions.has(identifier_1.Identifier.getName(v.name)));
|
|
91
|
+
// names a package declares global (`utils::globalVariables`) are no undefined symbols to R CMD check either
|
|
92
|
+
const declaredGlobals = declaredGlobalVariables(graph, ctx);
|
|
68
93
|
// scope-defined names, a fallback for closure variables flowR's dataflow did not statically link
|
|
69
94
|
const scopeDefined = (0, undefined_symbol_util_1.collectScopeDefinedNames)(graph);
|
|
70
95
|
// packages whose exports are in scope: DESCRIPTION/library() deps plus the default-attached base
|
|
@@ -93,8 +118,9 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
93
118
|
if (kind === 'function' && namespace === undefined && ctx.env.builtInEnvironment.memory.has(name)) {
|
|
94
119
|
return undefined;
|
|
95
120
|
}
|
|
96
|
-
// a bare name from a default-attached base package (or a primitive) is defined without a library() call
|
|
97
|
-
|
|
121
|
+
// a bare name from a default-attached base package (or a primitive) is defined without a library() call,
|
|
122
|
+
// and `base::name` (or any other base package) is known to flowR without a signature database
|
|
123
|
+
if (namespace === undefined ? isAttachedBaseName(name) : (0, r_base_packages_1.baseRExportOwner)(name) === namespace) {
|
|
98
124
|
return undefined;
|
|
99
125
|
}
|
|
100
126
|
// a bare name a test framework exports, used in a test file where that framework's namespace is attached
|
|
@@ -110,6 +136,10 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
110
136
|
if (exported) {
|
|
111
137
|
return suppress('loadedPackage');
|
|
112
138
|
}
|
|
139
|
+
// declared global (as R CMD check honors it) or bound by R's method dispatch
|
|
140
|
+
if (namespace === undefined && declaredGlobals.has(name)) {
|
|
141
|
+
return suppress('declaredGlobal');
|
|
142
|
+
}
|
|
113
143
|
// forward-referenced closure binding flowR's dataflow did not link (unconditional bindings only)
|
|
114
144
|
if ((0, undefined_symbol_util_1.isDefinedInEnclosingScope)(graph, scopeDefined, id, name)) {
|
|
115
145
|
return suppress('enclosingScope');
|
|
@@ -11,7 +11,6 @@ const identify_link_to_last_call_relation_1 = require("../../queries/catalog/cal
|
|
|
11
11
|
const input_source_functions_1 = require("../../queries/catalog/input-sources-query/input-source-functions");
|
|
12
12
|
const simple_input_classifier_1 = require("../../queries/catalog/input-sources-query/simple-input-classifier");
|
|
13
13
|
const edge_1 = require("../../dataflow/graph/edge");
|
|
14
|
-
const frame_reflection_1 = require("../../dataflow/fn/frame-reflection");
|
|
15
14
|
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
16
15
|
const r_symbol_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
17
16
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
@@ -24,6 +23,8 @@ const range_1 = require("../../util/range");
|
|
|
24
23
|
const record_1 = require("../../util/record");
|
|
25
24
|
const linter_format_1 = require("../linter-format");
|
|
26
25
|
const linter_tags_1 = require("../linter-tags");
|
|
26
|
+
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
27
|
+
const arrays_1 = require("../../util/collections/arrays");
|
|
27
28
|
/**
|
|
28
29
|
* The kinds of critical operations to check for unescaped arguments.
|
|
29
30
|
*/
|
|
@@ -126,13 +127,13 @@ function methodCalls(graph, methods) {
|
|
|
126
127
|
return means(value, receiver, depth - 1);
|
|
127
128
|
}
|
|
128
129
|
return vertex_1.DfgVertex.isFunctionCall(made) && (identifier_1.Identifier.matches(made.name, receiver)
|
|
129
|
-
|| (depth > 0 &&
|
|
130
|
+
|| (depth > 0 && df_helper_1.Dataflow.targetsOf(graph, v, edge_1.EdgeType.Returns).some(r => holds(r, receiver, depth - 1))));
|
|
130
131
|
};
|
|
131
132
|
/* the named object where no binding of the program surely shadows it, otherwise what a binding holds */
|
|
132
133
|
const means = (symbol, receiver, depth = 4) => {
|
|
133
|
-
const defs =
|
|
134
|
+
const defs = df_helper_1.Dataflow.targetsOf(graph, symbol.info.id, edge_1.EdgeType.Reads).filter(d => !node_id_1.NodeId.isBuiltIn(d));
|
|
134
135
|
return (defs.every(d => graph.getVertex(d)?.cds?.length) && identifier_1.Identifier.matches(symbol.content, receiver))
|
|
135
|
-
|| (depth > 0 && defs.some(def =>
|
|
136
|
+
|| (depth > 0 && defs.some(def => df_helper_1.Dataflow.targetsOf(graph, def, edge_1.EdgeType.DefinedBy).some(v => holds(v, receiver, depth))));
|
|
136
137
|
};
|
|
137
138
|
return graph.verticesOfType(vertex_1.VertexType.FunctionCall).flatMap(([id, call]) => {
|
|
138
139
|
const node = graph.idMap?.get(id);
|
|
@@ -147,12 +148,12 @@ function methodCalls(graph, methods) {
|
|
|
147
148
|
}
|
|
148
149
|
/** The names of the built-ins `id` links to with an edge of the given type, none if it may link to anything else (a closure checked where its body calls them) */
|
|
149
150
|
function linkedBuiltIns(graph, id, type) {
|
|
150
|
-
const linked =
|
|
151
|
+
const linked = df_helper_1.Dataflow.targetsOf(graph, id, type);
|
|
151
152
|
return linked.every(node_id_1.NodeId.isBuiltIn) ? linked.map(node_id_1.NodeId.fromBuiltIn) : [];
|
|
152
153
|
}
|
|
153
154
|
/** the built-ins handed to the call a called variable holds the result of, as `p` holds `purrr::partial(system)` */
|
|
154
155
|
function wrappedBuiltIns(graph, id) {
|
|
155
|
-
return
|
|
156
|
+
return df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads).flatMap(v => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(v)) ? df_helper_1.Dataflow.targetsOf(graph, v, edge_1.EdgeType.DefinedBy) : [])
|
|
156
157
|
.flatMap(w => {
|
|
157
158
|
const wrapper = graph.getVertex(w);
|
|
158
159
|
return vertex_1.DfgVertex.isFunctionCall(wrapper) ? wrapper.args.flatMap(a => linkedBuiltIns(graph, graph_1.FunctionArgument.getReference(a) ?? '', edge_1.EdgeType.Reads)) : [];
|
|
@@ -213,7 +214,7 @@ async function getUnescapedSources(category, targets, config, data, graph) {
|
|
|
213
214
|
const found = new Map();
|
|
214
215
|
let entries = targets.map(target => ({ target, call: target.call.id, only: new Set([target.arg]), depth: 0 }));
|
|
215
216
|
while (entries.length > 0) {
|
|
216
|
-
const criteria =
|
|
217
|
+
const criteria = (0, arrays_1.uniqueArray)(entries.map(entry => parse_1.SlicingCriterion.fromId(entry.call)));
|
|
217
218
|
const queryResult = await data.query([{ type: 'input-sources', criterion: criteria, config: queryConfig }]);
|
|
218
219
|
const classified = queryResult['input-sources']?.results ?? {};
|
|
219
220
|
const next = [];
|
|
@@ -279,14 +280,14 @@ function createResult(target, sources, config, idMap) {
|
|
|
279
280
|
category: target.category,
|
|
280
281
|
function: target.callee ?? identifier_1.Identifier.toString(target.call.name),
|
|
281
282
|
sources,
|
|
282
|
-
input:
|
|
283
|
+
input: (0, arrays_1.uniqueArray)(sources.flatMap(source => source.types).filter(type => !config.acceptedInputs.includes(type))),
|
|
283
284
|
...(quickFix.length > 0 ? { quickFix } : {})
|
|
284
285
|
};
|
|
285
286
|
}
|
|
286
287
|
exports.UNESCAPED_ARGUMENTS = {
|
|
287
288
|
createSearch: (config, data) => flowr_search_builder_1.Q.fromQuery({
|
|
288
289
|
type: 'call-context',
|
|
289
|
-
callName:
|
|
290
|
+
callName: (0, arrays_1.uniqueArray)(getEnabledCriticalCalls(config, data.inspectContext().env.builtInIndex).map(({ name }) => identifier_1.Identifier.getName(name))),
|
|
290
291
|
callTargets: identify_link_to_last_call_relation_1.CallTargets.MustIncludeGlobal
|
|
291
292
|
}),
|
|
292
293
|
processSearchResult: async (elements, config, data) => {
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UNUSED_DEFINITION = void 0;
|
|
4
4
|
exports.collectCalledNames = collectCalledNames;
|
|
5
5
|
exports.isS3MethodName = isS3MethodName;
|
|
6
|
+
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
6
7
|
const linter_format_1 = require("../linter-format");
|
|
7
8
|
const function_semantics_1 = require("../../dataflow/fn/function-semantics");
|
|
8
9
|
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
9
10
|
const range_1 = require("../../util/range");
|
|
10
11
|
const linter_tags_1 = require("../linter-tags");
|
|
11
|
-
const frame_reflection_1 = require("../../dataflow/fn/frame-reflection");
|
|
12
12
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
13
13
|
const edge_1 = require("../../dataflow/graph/edge");
|
|
14
14
|
const flowr_search_filters_1 = require("../../search/flowr-search-filters");
|
|
@@ -16,7 +16,7 @@ const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
|
16
16
|
const flowr_file_1 = require("../../project/context/flowr-file");
|
|
17
17
|
const flowr_namespace_file_1 = require("../../project/plugins/file-plugins/files/flowr-namespace-file");
|
|
18
18
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
19
|
-
const
|
|
19
|
+
const r_s3_generics_generated_1 = require("../../data/r-s3-generics.generated");
|
|
20
20
|
const query_fn_props_1 = require("../../dataflow/environments/query-fn-props");
|
|
21
21
|
const built_in_props_1 = require("../../dataflow/environments/built-in-props");
|
|
22
22
|
const group_generics_1 = require("../../dataflow/environments/group-generics");
|
|
@@ -26,24 +26,19 @@ const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes
|
|
|
26
26
|
const r_parameter_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-parameter");
|
|
27
27
|
const r_expression_list_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
|
|
28
28
|
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
29
|
+
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
29
30
|
/**
|
|
30
31
|
* The dots parameter is a special parameter and must never be reported as an unused definition.
|
|
31
32
|
*/
|
|
32
33
|
const DotsParameter = '...';
|
|
33
|
-
/** the standard-library S3 generics flowR models no built-in for, so the store cannot state them */
|
|
34
|
-
const OtherKnownS3Generics = new Set([
|
|
35
|
-
'summary', 'coef', 'vcov', 'residuals', 'fitted', 'predict', 'as.vector', 'str', 'toString', 'all.equal',
|
|
36
|
-
'aggregate', 'update', 'anova', 'confint', 'logLik', 'AIC', 'BIC', 'deviance', 'df.residual',
|
|
37
|
-
'model.matrix', 'terms', 'weights', 'merge', 'split', 'window'
|
|
38
|
-
]);
|
|
39
34
|
/**
|
|
40
35
|
* The generics a definition named `name.class` may be an S3 method for: the built-ins flowR labels
|
|
41
|
-
* {@link CallProp.Generic} plus {@link
|
|
36
|
+
* {@link CallProp.Generic} plus the S3 generics R itself has (see {@link RS3Generics}). Such a method is dispatched indirectly
|
|
42
37
|
* (`print(x)` on an object of that class), so it is used without a textual call. Kept per configuration,
|
|
43
38
|
* as a process-wide memo would let the first analyzer's built-ins answer for every later one.
|
|
44
39
|
*/
|
|
45
40
|
function knownS3Generics(index) {
|
|
46
|
-
return new Set([...
|
|
41
|
+
return new Set([...Object.keys(r_s3_generics_generated_1.RS3Generics.genericFormals), ...Object.keys(group_generics_1.RGroupGenerics),
|
|
47
42
|
...index.with(built_in_props_1.CallProp.Generic).map(g => identifier_1.Identifier.getName(g))]);
|
|
48
43
|
}
|
|
49
44
|
/** Whether `generic`, or any member of it when it is a group generic (`Ops.cls` dispatches on `+`), is called. */
|
|
@@ -74,7 +69,7 @@ function collectCalledNames(dfg) {
|
|
|
74
69
|
const GenericDispatchers = new Set(['UseMethod', 'standardGeneric']);
|
|
75
70
|
/** Whether a function body is a single call to a generic dispatcher. */
|
|
76
71
|
function isGenericDispatcherOnlyBody(node) {
|
|
77
|
-
const isDispatcherCall = (n) => r_function_call_1.RFunctionCall.isNamed(n
|
|
72
|
+
const isDispatcherCall = (n) => r_function_call_1.RFunctionCall.isNamed(n, GenericDispatchers);
|
|
78
73
|
return isDispatcherCall(node) || (r_expression_list_1.RExpressionList.is(node) && node.children.length === 1 && isDispatcherCall(node.children[0]));
|
|
79
74
|
}
|
|
80
75
|
/** Collects the parameter IDs of generic dispatcher functions, which hand them on to their methods. */
|
|
@@ -102,8 +97,7 @@ function isConsideredUsed(lexeme, config, pkg, called, ctx) {
|
|
|
102
97
|
return false;
|
|
103
98
|
}
|
|
104
99
|
/* non-syntactic definition names (e.g. S3 methods like `"[.irts"`) carry their R quotes or backticks in the lexeme */
|
|
105
|
-
const
|
|
106
|
-
const name = unquoted.length > 1 && unquoted.startsWith('`') && unquoted.endsWith('`') ? unquoted.slice(1, -1) : unquoted;
|
|
100
|
+
const name = r_string_1.RString.unquote(lexeme);
|
|
107
101
|
/* the dots are a special parameter, and package lifecycle hooks are called by R's package machinery */
|
|
108
102
|
if (name === DotsParameter || PackageHookFunctions.has(name)) {
|
|
109
103
|
return true;
|
|
@@ -193,7 +187,7 @@ function hasImportantArgs(definedBys, df, binds) {
|
|
|
193
187
|
|| dfg.edgesTo(d).values().some(edge => edge_1.DfEdge.includesType(edge, InterestingEdgesTargets))
|
|
194
188
|
|| dfg.edgesFrom(d).entries().some(([target, edge]) => edge_1.DfEdge.includesType(edge, InterestingEdgesTargets) || dfg.unknownSideEffects.has(target)));
|
|
195
189
|
}
|
|
196
|
-
function
|
|
190
|
+
function quickFixForUnused(variable, df, ast) {
|
|
197
191
|
const dfg = df.graph;
|
|
198
192
|
// first we check whether any of the 'Defined by' targets have any obligations - if so, we can not remove the definition
|
|
199
193
|
// otherwise we can automatically remove the full definition!
|
|
@@ -201,7 +195,7 @@ function buildQuickFix(variable, df, ast) {
|
|
|
201
195
|
// this is an access or a for variable, we can not remove it currently
|
|
202
196
|
return undefined;
|
|
203
197
|
}
|
|
204
|
-
const definedBys =
|
|
198
|
+
const definedBys = df_helper_1.Dataflow.targetsOf(dfg, variable.info.id, edge_1.EdgeType.DefinedBy);
|
|
205
199
|
if (hasImportantArgs(definedBys, df, variable.info.parent)) {
|
|
206
200
|
return undefined;
|
|
207
201
|
}
|
|
@@ -209,7 +203,7 @@ function buildQuickFix(variable, df, ast) {
|
|
|
209
203
|
const totalRangeToRemove = range_1.SourceLocation.merge([
|
|
210
204
|
...definedBys.map(d => range_1.SourceLocation.fromNode(ast.idMap.get(d))),
|
|
211
205
|
range_1.SourceLocation.fromNode(assignment?.value),
|
|
212
|
-
|
|
206
|
+
range_1.SourceLocation.fromNode(variable)
|
|
213
207
|
]);
|
|
214
208
|
if (totalRangeToRemove === undefined) {
|
|
215
209
|
/* a fix that names no place cannot be carried out, so none is offered */
|
|
@@ -220,7 +214,7 @@ function buildQuickFix(variable, df, ast) {
|
|
|
220
214
|
if (isStandaloneStatement(statement, ast)) {
|
|
221
215
|
return yieldsFunctionValue(statement, ast, dfg) ? undefined : [{ type: 'remove', loc: totalRangeToRemove, description }];
|
|
222
216
|
}
|
|
223
|
-
const replacement =
|
|
217
|
+
const replacement = model_1.RNode.lexeme(assignment?.value);
|
|
224
218
|
return replacement === undefined ? undefined : [{ type: 'replace', loc: totalRangeToRemove, replacement, description }];
|
|
225
219
|
}
|
|
226
220
|
/**
|
|
@@ -241,7 +235,7 @@ function isWithinPromise(node, idMap) {
|
|
|
241
235
|
let child = node;
|
|
242
236
|
for (const parent of model_1.RNode.iterateParents(node, idMap)) {
|
|
243
237
|
if ((r_parameter_1.RParameter.is(parent) && parent.defaultValue?.info.id === child.info.id)
|
|
244
|
-
|| (r_function_call_1.RFunctionCall.isNamed(parent
|
|
238
|
+
|| (r_function_call_1.RFunctionCall.isNamed(parent, 'delayedAssign'))) {
|
|
245
239
|
return true;
|
|
246
240
|
}
|
|
247
241
|
child = parent;
|
|
@@ -298,7 +292,7 @@ exports.UNUSED_DEFINITION = {
|
|
|
298
292
|
variableName: node.lexeme,
|
|
299
293
|
involvedId: node.info.id,
|
|
300
294
|
loc: range_1.SourceLocation.fromNode(node) ?? range_1.SourceLocation.invalid(),
|
|
301
|
-
quickFix:
|
|
295
|
+
quickFix: quickFixForUnused(node, dataflow, normalize)
|
|
302
296
|
}];
|
|
303
297
|
})),
|
|
304
298
|
'.meta': metadata
|
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@ class FlowrAnalyzerCache extends flowr_cache_1.FlowrCache {
|
|
|
66
66
|
this.receive({ type: "full" /* InvalidationEventType.Full */ });
|
|
67
67
|
}
|
|
68
68
|
async runTapeUntil(force, until) {
|
|
69
|
-
(0, assert_1.guard)(this.args.context.files.
|
|
69
|
+
(0, assert_1.guard)(this.args.context.files.hasRequests(), 'At least one request must be set to run the analysis pipeline');
|
|
70
70
|
if (force) {
|
|
71
71
|
this.reset();
|
|
72
72
|
}
|
|
@@ -155,7 +155,7 @@ class FlowrAnalyzerContext {
|
|
|
155
155
|
const loadingOrder = new flowr_analyzer_loading_order_context_1.FlowrAnalyzerLoadingOrderContext(this, byType.get(flowr_analyzer_plugin_1.PluginType.LoadingOrder));
|
|
156
156
|
this.files = new flowr_analyzer_files_context_1.FlowrAnalyzerFilesContext(this, loadingOrder, (byType.get(flowr_analyzer_plugin_1.PluginType.ProjectDiscovery) ?? []), (byType.get(flowr_analyzer_plugin_1.PluginType.FileLoad) ?? []));
|
|
157
157
|
this.env = new flowr_analyzer_environment_context_1.FlowrAnalyzerEnvironmentContext(this);
|
|
158
|
-
this.inc = new flowr_analyzer_incremental_analysis_context_1.FlowrAnalyzerIncrementalAnalysisContext(
|
|
158
|
+
this.inc = new flowr_analyzer_incremental_analysis_context_1.FlowrAnalyzerIncrementalAnalysisContext();
|
|
159
159
|
const functions = new flowr_analyzer_functions_context_1.FlowrAnalyzerFunctionsContext(this);
|
|
160
160
|
this.deps = new flowr_analyzer_dependencies_context_1.FlowrAnalyzerDependenciesContext(functions, (byType.get(flowr_analyzer_plugin_1.PluginType.DependencyIdentification) ?? []));
|
|
161
161
|
// the plugins contributing the metadata are the ones the dependency context runs on demand
|
|
@@ -37,7 +37,7 @@ export interface ReadOnlyFlowrAnalyzerEnvironmentContext {
|
|
|
37
37
|
get emptyBuiltInEnvironment(): DeepReadonly<IEnvironment>;
|
|
38
38
|
/**
|
|
39
39
|
* Create a new {@link REnvironmentInformation|environment} with the configured built-in environment as base.
|
|
40
|
-
* Knows only the built-ins, no attached package, so prefer {@link
|
|
40
|
+
* Knows only the built-ins, no attached package, so prefer {@link REnvironment.cleanOf} wherever an environment is at hand.
|
|
41
41
|
*/
|
|
42
42
|
makeCleanEnv(): REnvironmentInformation;
|
|
43
43
|
/**
|
|
@@ -148,6 +148,11 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
|
|
|
148
148
|
* @returns The number of files currently held by this context.
|
|
149
149
|
*/
|
|
150
150
|
getFileCount(): number;
|
|
151
|
+
/**
|
|
152
|
+
* Whether there is any code to analyze, i.e. whether the analysis was handed at least one request. Without one
|
|
153
|
+
* (e.g. for a package holding data only, or a folder with no R files), the analysis cannot run.
|
|
154
|
+
*/
|
|
155
|
+
hasRequests(): boolean;
|
|
151
156
|
}
|
|
152
157
|
/**
|
|
153
158
|
* This is the analyzer file context to be modified by all plugins that affect the files.
|
|
@@ -248,4 +253,5 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
|
|
|
248
253
|
getAllFiles(): FlowrFileProvider[];
|
|
249
254
|
getFileByPath(path: string): FlowrFileProvider | undefined;
|
|
250
255
|
getFileCount(): number;
|
|
256
|
+
hasRequests(): boolean;
|
|
251
257
|
}
|
|
@@ -435,6 +435,9 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
435
435
|
getFileCount() {
|
|
436
436
|
return this.files.size + this.inlineFiles.length;
|
|
437
437
|
}
|
|
438
|
+
hasRequests() {
|
|
439
|
+
return this.loadingOrder.getUnorderedRequests().length > 0;
|
|
440
|
+
}
|
|
438
441
|
}
|
|
439
442
|
exports.FlowrAnalyzerFilesContext = FlowrAnalyzerFilesContext;
|
|
440
443
|
//# sourceMappingURL=flowr-analyzer-files-context.js.map
|
|
@@ -16,14 +16,12 @@ export interface ReadOnlyFlowrAnalyzerIncrementalAnalysisContext {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class FlowrAnalyzerIncrementalAnalysisContext implements ReadOnlyFlowrAnalyzerIncrementalAnalysisContext, InvalidationEventReceiver {
|
|
18
18
|
readonly name = "flowr-analyzer-incremental-analysis-context";
|
|
19
|
-
private readonly context;
|
|
20
19
|
/**
|
|
21
20
|
* The files that have been changed since the last analysis mapping to their old content.
|
|
22
21
|
*/
|
|
23
22
|
private changedFilesWithOldContent;
|
|
24
23
|
private oldParseResults;
|
|
25
24
|
private readonly lastKnownMtime;
|
|
26
|
-
constructor(context: FlowrAnalyzerContext);
|
|
27
25
|
reset(): void;
|
|
28
26
|
handleFileInvalidate(filePath: FilePath, oldContent: string | undefined): void;
|
|
29
27
|
handleShouldReparse(filePath: FilePath, ctx: FlowrAnalyzerContext): boolean;
|
|
@@ -11,16 +11,12 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
11
11
|
*/
|
|
12
12
|
class FlowrAnalyzerIncrementalAnalysisContext {
|
|
13
13
|
name = 'flowr-analyzer-incremental-analysis-context';
|
|
14
|
-
context;
|
|
15
14
|
/**
|
|
16
15
|
* The files that have been changed since the last analysis mapping to their old content.
|
|
17
16
|
*/
|
|
18
17
|
changedFilesWithOldContent = new Map();
|
|
19
18
|
oldParseResults = new Map();
|
|
20
19
|
lastKnownMtime = new Map();
|
|
21
|
-
constructor(context) {
|
|
22
|
-
this.context = context;
|
|
23
|
-
}
|
|
24
20
|
reset() {
|
|
25
21
|
this.changedFilesWithOldContent = new Map();
|
|
26
22
|
this.oldParseResults = new Map();
|
|
@@ -97,6 +97,8 @@ export interface FlowrFileProvider<Content extends {
|
|
|
97
97
|
* So make sure your implementation closes the resource as soon as possible.
|
|
98
98
|
*/
|
|
99
99
|
content(): Content;
|
|
100
|
+
/** The text the {@link content} was parsed from, for files whose content is not their text (e.g. a DESCRIPTION or an R Markdown document). */
|
|
101
|
+
rawText?(): string;
|
|
100
102
|
/**
|
|
101
103
|
* Assign a role to this file, this should be done by the loader plugins (cf. {@link PluginType}).
|
|
102
104
|
* **Do not call this method yourself unless you are a file-loader plugin and/or really know what you are doing, this may break plugin assumptions!**
|
|
@@ -175,6 +177,8 @@ export declare class FlowrInlineTextFile extends FlowrFile<string> {
|
|
|
175
177
|
export declare abstract class FlowrWrappedFile<Content extends StringableContent = StringableContent> extends FlowrFile<Content> {
|
|
176
178
|
protected readonly wrapped: FlowrFileProvider;
|
|
177
179
|
constructor(wrapped: FlowrFileProvider);
|
|
180
|
+
/** The text the content was parsed from, e.g. to locate what the parsed content holds in the file. */
|
|
181
|
+
rawText(): string;
|
|
178
182
|
/** Lifts a file to the class this is called on, reusing it if already one and assigning `role`. */
|
|
179
183
|
static from<T>(this: new (file: FlowrFileProvider) => T, file: FlowrFileProvider, role?: FileRole): T;
|
|
180
184
|
}
|
|
@@ -177,6 +177,10 @@ class FlowrWrappedFile extends FlowrFile {
|
|
|
177
177
|
super(wrapped.path(), wrapped.roles);
|
|
178
178
|
this.wrapped = wrapped;
|
|
179
179
|
}
|
|
180
|
+
/** The text the content was parsed from, e.g. to locate what the parsed content holds in the file. */
|
|
181
|
+
rawText() {
|
|
182
|
+
return this.wrapped.content().toString();
|
|
183
|
+
}
|
|
180
184
|
/** Lifts a file to the class this is called on, reusing it if already one and assigning `role`. */
|
|
181
185
|
static from(file, role) {
|
|
182
186
|
if (role) {
|
|
@@ -58,7 +58,7 @@ class FlowrAnalyzerBuilder {
|
|
|
58
58
|
* Per default, the value returned by {@link FlowrConfig.default} is used.
|
|
59
59
|
* @param func - Receives the current configuration of the builder and allows for amendment.
|
|
60
60
|
*/
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type -- amendments usually mutate in place and return nothing
|
|
62
62
|
amendConfig(func) {
|
|
63
63
|
this.flowrConfig = config_1.FlowrConfig.amend(this.flowrConfig, func);
|
|
64
64
|
return this;
|