@eagleoutice/flowr 2.14.1 → 2.14.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 +142 -87
- package/abstract-interpretation/absint-visitor.d.ts +132 -25
- package/abstract-interpretation/absint-visitor.js +459 -99
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/arguments.js +1 -1
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +107 -254
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +5 -5
- package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -1
- package/abstract-interpretation/data-frame/resolve-args.js +6 -4
- package/abstract-interpretation/data-frame/shape-inference.d.ts +4 -9
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -0
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -0
- package/abstract-interpretation/domains/partial-product-domain.js +1 -1
- package/abstract-interpretation/domains/set-range-domain.d.ts +3 -2
- package/abstract-interpretation/domains/set-range-domain.js +3 -2
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +3 -2
- package/abstract-interpretation/domains/set-upper-bound-domain.js +3 -2
- package/benchmark/calibration.d.ts +11 -6
- package/benchmark/calibration.js +19 -8
- package/benchmark/slicer.d.ts +7 -1
- package/benchmark/slicer.js +38 -34
- package/benchmark/stats/count-comments.d.ts +16 -0
- package/benchmark/stats/count-comments.js +30 -0
- package/benchmark/stats/print.js +2 -0
- package/benchmark/stats/size-of.d.ts +7 -3
- package/benchmark/stats/size-of.js +7 -3
- package/benchmark/stats/stats.d.ts +7 -0
- package/benchmark/summarizer/first-phase/process.js +2 -19
- package/benchmark/summarizer/second-phase/graph.js +13 -3
- package/benchmark/summarizer/second-phase/process.js +2 -0
- package/cli/repl/commands/repl-dataflow.js +70 -27
- package/cli/repl/core.d.ts +1 -1
- package/cli/repl/core.js +1 -1
- package/cli/repl/parser/slice-query-parser.js +2 -1
- package/cli/repl/server/connection.d.ts +4 -0
- package/cli/repl/server/connection.js +19 -16
- package/cli/repl/server/messages/message-analysis.d.ts +1 -1
- package/config.d.ts +21 -8
- package/config.js +12 -5
- package/control-flow/basic-cfg-guided-visitor.d.ts +7 -2
- package/control-flow/basic-cfg-guided-visitor.js +37 -24
- package/control-flow/cfg-dead-code.js +44 -33
- package/control-flow/cfg-properties.js +2 -2
- package/control-flow/cfg-simplification.js +6 -5
- package/control-flow/cfg-to-basic-blocks.js +11 -13
- package/control-flow/control-flow-graph.d.ts +179 -189
- package/control-flow/control-flow-graph.js +400 -263
- package/control-flow/dfg-cfg-guided-visitor.d.ts +21 -3
- package/control-flow/dfg-cfg-guided-visitor.js +17 -13
- package/control-flow/diff-cfg.js +6 -14
- package/control-flow/happens-before.js +5 -4
- package/control-flow/semantic-cfg-guided-visitor.d.ts +44 -101
- package/control-flow/semantic-cfg-guided-visitor.js +6 -3
- package/control-flow/simple-visitor.js +14 -15
- package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -1
- package/control-flow/useless-loop.js +18 -14
- package/core/steps/all/core/20-dataflow.d.ts +1 -3
- package/core/steps/pipeline/default-pipelines.d.ts +141 -157
- package/dataflow/cluster.js +7 -0
- package/dataflow/environments/apply-kill.d.ts +6 -0
- package/dataflow/environments/apply-kill.js +63 -31
- package/dataflow/environments/built-in-props.d.ts +5 -1
- package/dataflow/environments/built-in-props.js +4 -0
- package/dataflow/environments/built-in.d.ts +6 -3
- package/dataflow/environments/built-in.js +8 -5
- package/dataflow/environments/clone.d.ts +3 -3
- package/dataflow/environments/clone.js +5 -5
- package/dataflow/environments/default-builtin-config.d.ts +114 -3
- package/dataflow/environments/default-builtin-config.js +137 -35
- package/dataflow/environments/environment.d.ts +5 -5
- package/dataflow/environments/environment.js +5 -5
- package/dataflow/environments/identifier.d.ts +11 -1
- package/dataflow/environments/identifier.js +4 -1
- package/dataflow/environments/resolve-by-name.d.ts +7 -0
- package/dataflow/environments/resolve-by-name.js +12 -0
- package/dataflow/environments/resolve-helper.d.ts +3 -1
- package/dataflow/environments/resolve-helper.js +2 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +3 -3
- package/dataflow/eval/resolve/alias-tracking.js +3 -3
- package/dataflow/eval/resolve/match-arguments.js +7 -5
- package/dataflow/eval/resolve/node-value.d.ts +3 -1
- package/dataflow/eval/resolve/node-value.js +12 -0
- package/dataflow/eval/resolve/resolve-argument.js +5 -4
- package/dataflow/eval/resolve/resolve-operators.js +9 -6
- package/dataflow/eval/resolve/resolve-strings.js +2 -2
- package/dataflow/eval/resolve/resolve-working-directory.js +4 -3
- package/dataflow/eval/resolve/resolve.js +3 -2
- package/dataflow/eval/values/general.js +8 -5
- package/dataflow/extractor.d.ts +1 -4
- package/dataflow/extractor.js +11 -10
- package/dataflow/fn/exceptions-of-function.d.ts +3 -1
- package/dataflow/fn/strict-function.js +7 -5
- package/dataflow/graph/call-graph.js +2 -2
- package/dataflow/graph/df-helper.d.ts +8 -1
- package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +19 -2
- package/dataflow/graph/edge.d.ts +38 -2
- package/dataflow/graph/edge.js +32 -2
- package/dataflow/graph/graph.d.ts +4 -3
- package/dataflow/graph/graph.js +6 -2
- package/dataflow/graph/match-args.d.ts +69 -0
- package/dataflow/graph/match-args.js +167 -0
- package/dataflow/info.d.ts +15 -6
- package/dataflow/info.js +0 -17
- package/dataflow/internal/control-flow.d.ts +114 -0
- package/dataflow/internal/control-flow.js +224 -0
- package/dataflow/internal/linker.d.ts +6 -31
- package/dataflow/internal/linker.js +24 -81
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +9 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +18 -37
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +11 -7
- 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.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +18 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +18 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +12 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +38 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +36 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +20 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +9 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +15 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +11 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +26 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +17 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +71 -33
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +6 -15
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +13 -14
- 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 +14 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +15 -1
- 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 +12 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +50 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +20 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +6 -2
- package/dataflow/internal/process/functions/call/common.js +5 -6
- package/dataflow/internal/process/functions/call/deferred.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +12 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +41 -15
- package/dataflow/internal/process/functions/call/named-call-handling.js +2 -0
- package/dataflow/internal/process/functions/call/nse.d.ts +1 -1
- package/dataflow/internal/process/functions/call/nse.js +6 -1
- package/dataflow/internal/process/functions/call/quoted.js +2 -2
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +19 -6
- package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/process-argument.js +12 -4
- package/dataflow/internal/process/functions/process-parameter.js +13 -0
- package/dataflow/internal/process/process-named-call.d.ts +2 -2
- package/dataflow/internal/process/process-named-call.js +9 -7
- package/documentation/data/server/doc-data-server-messages.js +4 -4
- package/documentation/doc-readme.js +33 -0
- package/documentation/doc-util/doc-cfg.d.ts +8 -7
- package/documentation/doc-util/doc-cfg.js +10 -10
- package/documentation/doc-util/doc-playground.d.ts +12 -0
- package/documentation/doc-util/doc-playground.js +21 -0
- package/documentation/doc-util/doc-query.d.ts +4 -1
- package/documentation/doc-util/doc-query.js +4 -2
- package/documentation/wiki-absint.d.ts +3 -4
- package/documentation/wiki-absint.js +17 -5
- package/documentation/wiki-analyzer.js +2 -2
- package/documentation/wiki-cfg.js +101 -106
- package/documentation/wiki-dataflow-graph.js +84 -53
- package/documentation/wiki-interface.js +1 -0
- package/documentation/wiki-linter.js +15 -1
- package/documentation/wiki-linting-and-testing.js +1 -16
- package/documentation/wiki-mk/doc-maker.js +6 -4
- package/documentation/wiki-query.js +14 -4
- package/documentation/wiki-signature-database.js +28 -2
- package/linter/linter-fix.d.ts +16 -0
- package/linter/linter-fix.js +104 -0
- package/linter/linter-format.d.ts +18 -1
- package/linter/linter-format.js +31 -1
- package/linter/linter-output.js +46 -10
- package/linter/linter-rules.d.ts +40 -9
- package/linter/linter-rules.js +2 -0
- package/linter/rules/absolute-path.js +4 -2
- package/linter/rules/dataframe-access-validation.js +6 -7
- package/linter/rules/deprecated-functions.d.ts +107 -10
- package/linter/rules/deprecated-functions.js +311 -23
- package/linter/rules/file-path-validity.js +5 -4
- package/linter/rules/function-finder-util.d.ts +6 -0
- package/linter/rules/function-finder-util.js +21 -13
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +2 -2
- package/linter/rules/stop-with-call-arg.js +2 -2
- package/linter/rules/unclosed-connection.js +2 -2
- package/linter/rules/undefined-symbol-util.js +6 -4
- package/linter/rules/undefined-symbol.js +2 -2
- package/linter/rules/unused-definition.js +8 -4
- package/linter/rules/unused-import.d.ts +60 -0
- package/linter/rules/unused-import.js +179 -0
- package/package.json +2 -2
- package/project/attached-packages.js +2 -1
- package/project/cache/flowr-analyzer-cache.d.ts +2 -5
- package/project/cache/flowr-analyzer-cache.js +4 -7
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +9 -8
- package/project/cache/flowr-analyzer-controlflow-cache.js +17 -34
- package/project/cache/flowr-cache.d.ts +9 -0
- package/project/cache/flowr-cache.js +19 -0
- package/project/context/flowr-analyzer-context.d.ts +7 -3
- package/project/context/flowr-analyzer-context.js +15 -9
- package/project/context/flowr-analyzer-dependencies-context.d.ts +24 -3
- package/project/context/flowr-analyzer-dependencies-context.js +9 -14
- package/project/context/flowr-analyzer-files-context.js +15 -17
- package/project/context/flowr-analyzer-meta-context.js +2 -12
- package/project/dependency-version-space.d.ts +1 -7
- package/project/dependency-version-space.js +9 -8
- package/project/flowr-analyzer-builder.d.ts +4 -4
- package/project/flowr-analyzer.d.ts +4 -6
- package/project/flowr-analyzer.js +4 -5
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -34
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +13 -13
- package/project/plugins/file-plugins/files/flowr-rda-file.js +131 -286
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +1 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +32 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +43 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +5 -8
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +4 -10
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +3 -10
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +1 -13
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +3 -6
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +3 -4
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -6
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -16
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +2 -8
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +2 -6
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +1 -10
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.js +2 -8
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +2 -1
- package/project/sigdb/build.d.ts +2 -2
- package/project/sigdb/decode.d.ts +0 -5
- package/project/sigdb/decode.js +0 -8
- package/project/sigdb/index-format.d.ts +4 -4
- package/project/sigdb/manifest.d.ts +2 -2
- package/project/sigdb/reader.d.ts +54 -13
- package/project/sigdb/reader.js +4 -3
- package/project/sigdb/schema.d.ts +3 -1
- package/project/sigdb/signature-db.d.ts +69 -0
- package/project/sigdb/signature-db.js +54 -0
- package/project/sigdb/signature-match.d.ts +10 -5
- package/project/sigdb/signature-match.js +13 -8
- package/queries/catalog/absint-query/absint-query-executor.js +1 -2
- package/queries/catalog/call-context-query/call-context-query-executor.js +2 -4
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +33 -6
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +8 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -35
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +13 -1
- package/queries/catalog/dependencies-query/function-info/library-functions.js +26 -22
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +9 -0
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +19 -0
- package/queries/catalog/dependencies-query/implicit-echo.d.ts +13 -0
- package/queries/catalog/dependencies-query/implicit-echo.js +133 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +1 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/signature-query/signature-query-executor.js +4 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -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 +1 -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 +4 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +6 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +13 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +8 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +8 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -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-project.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -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 +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -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 +1 -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 +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +3 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +6 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +5 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +5 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +5 -3
- package/reconstruct/inline/source-inline-map.js +3 -3
- package/reconstruct/reconstruct.js +6 -4
- package/search/flowr-search-builder.d.ts +8 -8
- package/search/flowr-search-builder.js +4 -4
- package/search/flowr-search-filters.d.ts +2 -2
- package/search/flowr-search-filters.js +3 -2
- package/search/search-executor/search-enrichers.d.ts +6 -0
- package/search/search-executor/search-enrichers.js +44 -5
- package/slicing/criterion/filters/all-variables.js +2 -1
- package/slicing/criterion/parse.js +8 -6
- package/slicing/static/slice-call.js +2 -2
- package/util/arg-matching.d.ts +3 -0
- package/util/arg-matching.js +12 -1
- package/util/collections/arrays.d.ts +0 -4
- package/util/collections/arrays.js +4 -26
- package/util/diff-graph.d.ts +1 -1
- package/util/diff-graph.js +17 -3
- package/util/diff.d.ts +6 -0
- package/util/mermaid/ast.d.ts +1 -1
- package/util/mermaid/ast.js +5 -4
- package/util/mermaid/cfg.js +130 -24
- package/util/mermaid/dfg.js +31 -10
- package/util/mermaid/mermaid.js +2 -0
- package/util/objects.d.ts +24 -4
- package/util/objects.js +12 -0
- package/util/prefix.d.ts +1 -1
- package/util/text/playground-link.d.ts +131 -0
- package/util/text/playground-link.js +214 -0
- package/util/text/strings.js +7 -3
- package/util/version.js +1 -1
- package/control-flow/cfg-builder.d.ts +0 -30
- package/control-flow/cfg-builder.js +0 -79
- package/control-flow/extract-cfg.d.ts +0 -36
- package/control-flow/extract-cfg.js +0 -693
- package/project/cfg-kind.d.ts +0 -21
- package/project/cfg-kind.js +0 -26
|
@@ -1,34 +1,159 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEPRECATED_FUNCTIONS = void 0;
|
|
4
|
-
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
5
|
-
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
3
|
+
exports.DEPRECATED_FUNCTIONS = exports.DeprecationState = void 0;
|
|
6
4
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
7
|
-
const
|
|
5
|
+
const graph_1 = require("../../dataflow/graph/graph");
|
|
6
|
+
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
7
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
8
|
+
const arrays_1 = require("../../util/collections/arrays");
|
|
8
9
|
const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
|
|
10
|
+
const assert_1 = require("../../util/assert");
|
|
9
11
|
const range_1 = require("../../util/range");
|
|
10
12
|
const linter_format_1 = require("../linter-format");
|
|
11
13
|
const linter_tags_1 = require("../linter-tags");
|
|
14
|
+
const r_version_1 = require("../../util/r-version");
|
|
15
|
+
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
16
|
+
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
12
17
|
const function_finder_util_1 = require("./function-finder-util");
|
|
18
|
+
const logic_1 = require("../../util/logic");
|
|
19
|
+
const default_builtin_config_1 = require("../../dataflow/environments/default-builtin-config");
|
|
20
|
+
const built_in_props_1 = require("../../dataflow/environments/built-in-props");
|
|
21
|
+
const dependencies_query_format_1 = require("../../queries/catalog/dependencies-query/dependencies-query-format");
|
|
22
|
+
var DeprecationState;
|
|
23
|
+
(function (DeprecationState) {
|
|
24
|
+
/** A better alternative is available, but the function is kept (softer alternative to deprecated) {@link https://lifecycle.r-lib.org/articles/stages.html#superseded} */
|
|
25
|
+
DeprecationState["Superseded"] = "superseded";
|
|
26
|
+
/** A better alternative is available, and the function is marked for removal {@link https://lifecycle.r-lib.org/articles/stages.html#deprecated} */
|
|
27
|
+
DeprecationState["Deprecated"] = "deprecated";
|
|
28
|
+
/** No longer works and is removed and replaced by another function {@link https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Defunct} */
|
|
29
|
+
DeprecationState["Defunct"] = "defunct";
|
|
30
|
+
})(DeprecationState || (exports.DeprecationState = DeprecationState = {}));
|
|
31
|
+
/**
|
|
32
|
+
* `size` names the stroke width of every line-based geom until ggplot2 4.0.0 renamed it: it gained
|
|
33
|
+
* `linewidth` beside it in 3.4.0, and 4.0.0 drops `size`.
|
|
34
|
+
*/
|
|
35
|
+
const GgplotLinewidth = {
|
|
36
|
+
whenArgs: [{ argName: 'size', state: DeprecationState.Deprecated, replacedBy: 'linewidth', sinceVersion: r_version_1.RRange.parse('>= 3.4.0') }]
|
|
37
|
+
};
|
|
38
|
+
const ConditionallyDeprecated = {
|
|
39
|
+
/* https://tidyverse.org/blog/2025/09/ggplot2-4-0-0/#violin--quantiles */
|
|
40
|
+
'ggplot2::geom_violin': { whenArgs: [{ argName: 'draw_quantiles', state: DeprecationState.Deprecated, replacedBy: 'quantile.linetype', sinceVersion: r_version_1.RRange.parse('>= 4.0.0') }] },
|
|
41
|
+
'ggplot2::element_line': GgplotLinewidth,
|
|
42
|
+
'ggplot2::element_rect': GgplotLinewidth
|
|
43
|
+
};
|
|
44
|
+
/** The entries by bare name, as a call names its package only when written `pkg::fn`. */
|
|
45
|
+
function indexConditionals(conditionally) {
|
|
46
|
+
const index = new Map();
|
|
47
|
+
for (const [key, info] of Object.entries(conditionally)) {
|
|
48
|
+
const id = identifier_1.Identifier.parse(key);
|
|
49
|
+
const name = identifier_1.Identifier.getName(id);
|
|
50
|
+
const known = index.get(name);
|
|
51
|
+
const entry = { info, pkg: identifier_1.Identifier.getNamespace(id) };
|
|
52
|
+
if (known === undefined) {
|
|
53
|
+
index.set(name, [entry]);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
known.push(entry);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return index;
|
|
60
|
+
}
|
|
61
|
+
/** The entry for `target`: its own package's, else a bare one; a call naming no package takes the first. */
|
|
62
|
+
function conditionalFor(index, target) {
|
|
63
|
+
const found = index.get(identifier_1.Identifier.getName(target));
|
|
64
|
+
if (found === undefined) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const namespace = identifier_1.Identifier.getNamespace(target);
|
|
68
|
+
return namespace === undefined ? found[0] : found.find(e => e.pkg === namespace) ?? found.find(e => e.pkg === undefined);
|
|
69
|
+
}
|
|
70
|
+
/** The packages each `always` name belongs to; `undefined` for an entry claiming none. */
|
|
71
|
+
function indexAlways(always) {
|
|
72
|
+
const index = new Map();
|
|
73
|
+
for (const entry of always) {
|
|
74
|
+
const name = identifier_1.Identifier.getName(entry);
|
|
75
|
+
const known = index.get(name);
|
|
76
|
+
const namespace = identifier_1.Identifier.getNamespace(entry);
|
|
77
|
+
if (known === undefined) {
|
|
78
|
+
index.set(name, [namespace]);
|
|
79
|
+
}
|
|
80
|
+
else if (!known.includes(namespace)) {
|
|
81
|
+
known.push(namespace);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return index;
|
|
85
|
+
}
|
|
86
|
+
/** The packages the code attaches; `undefined` when one of them cannot be named, so nothing is ruled out. */
|
|
87
|
+
async function attachedPackages(analyzer) {
|
|
88
|
+
const attached = new Set();
|
|
89
|
+
for (const lib of (await analyzer.query([{ type: 'dependencies', enabledCategories: ['library'] }]))['dependencies'].library) {
|
|
90
|
+
if (lib.value === undefined || lib.value === dependencies_query_format_1.Unknown) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
attached.add(lib.value);
|
|
94
|
+
}
|
|
95
|
+
return attached;
|
|
96
|
+
}
|
|
97
|
+
/** A call naming its package, or whose package is attached, is that function; any other is a guess. */
|
|
98
|
+
function certaintyOf(target, owners, attached) {
|
|
99
|
+
const namespace = identifier_1.Identifier.getNamespace(target);
|
|
100
|
+
const sure = owners.some(owner => owner === undefined || owner === namespace || attached === undefined || attached.has(owner));
|
|
101
|
+
return sure ? linter_format_1.LintingResultCertainty.Certain : linter_format_1.LintingResultCertainty.Uncertain;
|
|
102
|
+
}
|
|
103
|
+
function functionListFromBuiltinConfig() {
|
|
104
|
+
return default_builtin_config_1.DefaultBuiltinConfig.filter(def => def.type === 'function'
|
|
105
|
+
&& def.config?.props !== undefined
|
|
106
|
+
&& (def.config.props & built_in_props_1.CallProp.Deprecated) !== 0)
|
|
107
|
+
.flatMap(def => def.names);
|
|
108
|
+
}
|
|
13
109
|
exports.DEPRECATED_FUNCTIONS = {
|
|
14
110
|
// unlike functionFinderUtil.createSearch(config.fns), this does not pre-filter to the hardcoded list: the
|
|
15
111
|
// sigdb-driven pass below needs every resolved call, so the `fns` filtering happens in processSearchResult instead
|
|
16
112
|
createSearch: (_config) => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall).with(search_enrichers_1.Enrichment.CallTargets, {
|
|
17
113
|
onlyBuiltin: true,
|
|
18
|
-
qualifyNames:
|
|
114
|
+
qualifyNames: true
|
|
19
115
|
}),
|
|
20
116
|
processSearchResult: async (elements, config, data) => {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
117
|
+
const always = indexAlways(config.always);
|
|
118
|
+
const conditionals = indexConditionals(config.conditionally);
|
|
119
|
+
const graph = (await data.dataflow()).graph;
|
|
120
|
+
const idMap = (await data.normalize()).idMap;
|
|
121
|
+
// 1. Collect all function call targets from detected function calls
|
|
122
|
+
const detectedFunctions = elements.getElements().flatMap(e => {
|
|
123
|
+
return (0, search_enrichers_1.enrichmentContent)(e, search_enrichers_1.Enrichment.CallTargets).targets.map(target => {
|
|
124
|
+
const sourceLocation = range_1.SourceLocation.fromNode(e.node);
|
|
125
|
+
if (sourceLocation !== undefined) {
|
|
126
|
+
return {
|
|
127
|
+
node: e.node, target: identifier_1.Identifier.parse(target), sourceLocation
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}).filter(p => (0, assert_1.isNotUndefined)(p));
|
|
132
|
+
// 2. Uses hardcoded information about deprecated arguments and deprecated functions
|
|
133
|
+
const matched = detectedFunctions.map(candidate => ({
|
|
134
|
+
candidate,
|
|
135
|
+
conditional: conditionalFor(conditionals, candidate.target),
|
|
136
|
+
owners: always.get(identifier_1.Identifier.getName(candidate.target))
|
|
137
|
+
})).filter(m => m.conditional !== undefined || m.owners !== undefined);
|
|
138
|
+
/* only asked once something matched, so a clean file queries nothing */
|
|
139
|
+
const attached = matched.length === 0 ? undefined : await attachedPackages(data);
|
|
140
|
+
const packageVersions = await inferPackageVersions(data, matched.map(m => m.conditional));
|
|
141
|
+
const results = matched.map(({ candidate, conditional, owners }) => {
|
|
142
|
+
if (conditional !== undefined) {
|
|
143
|
+
return deprecateFunctionConditionally(candidate, graph, idMap, data, conditional, packageVersions, attached);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return deprecateFunctionAlways(candidate, owners, attached);
|
|
147
|
+
}
|
|
148
|
+
}).flat();
|
|
149
|
+
// 3. If available, use sigdb to flag deprecated functions
|
|
24
150
|
const deps = data.inspectContext().deps;
|
|
25
151
|
if (deps.signatureSources().length === 0) {
|
|
26
|
-
return
|
|
152
|
+
return { results, '.meta': { builtin: results.length, sigdb: 0 } };
|
|
27
153
|
}
|
|
28
154
|
// sigdb-driven detection: flag any resolved call whose signature-database entry marks it deprecated,
|
|
29
155
|
// even when it is not part of the hardcoded `fns` list above
|
|
30
|
-
const
|
|
31
|
-
const alreadyFlagged = new Set(hardcoded.results.map(r => r.involvedId));
|
|
156
|
+
const alreadyFlagged = new Set(results.map(r => r.involvedId));
|
|
32
157
|
const deprecatedByName = new Map();
|
|
33
158
|
const sigdbFlagged = [];
|
|
34
159
|
for (const element of elements.getElements()) {
|
|
@@ -43,7 +168,7 @@ exports.DEPRECATED_FUNCTIONS = {
|
|
|
43
168
|
const name = identifier_1.Identifier.toString(qualified);
|
|
44
169
|
let deprecated = deprecatedByName.get(name);
|
|
45
170
|
if (deprecated === undefined) {
|
|
46
|
-
deprecated = deps.
|
|
171
|
+
deprecated = deps.signatures().functionOf(qualified)?.props.includes('deprecated') === true;
|
|
47
172
|
deprecatedByName.set(name, deprecated);
|
|
48
173
|
}
|
|
49
174
|
if (!deprecated) {
|
|
@@ -55,31 +180,194 @@ exports.DEPRECATED_FUNCTIONS = {
|
|
|
55
180
|
}
|
|
56
181
|
alreadyFlagged.add(id);
|
|
57
182
|
sigdbFlagged.push({
|
|
183
|
+
type: 'deprecated-function',
|
|
58
184
|
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
59
185
|
involvedId: id,
|
|
60
|
-
function:
|
|
186
|
+
function: qualified,
|
|
61
187
|
loc
|
|
62
188
|
});
|
|
63
189
|
}
|
|
64
190
|
return {
|
|
65
|
-
results:
|
|
66
|
-
'.meta': {
|
|
67
|
-
totalCalls: hardcoded['.meta'].totalCalls + sigdbFlagged.length,
|
|
68
|
-
totalFunctionDefinitions: hardcoded['.meta'].totalFunctionDefinitions + sigdbFlagged.length
|
|
69
|
-
}
|
|
191
|
+
results: results.concat(sigdbFlagged),
|
|
192
|
+
'.meta': { builtin: results.length, sigdb: sigdbFlagged.length }
|
|
70
193
|
};
|
|
71
194
|
},
|
|
72
|
-
prettyPrint:
|
|
195
|
+
prettyPrint: {
|
|
196
|
+
[linter_format_1.LintingPrettyPrintContext.Query]: (result) => `${result.type === 'deprecated-argument' ? `Argument \`${result.arg}\` of ` : ''}function \`${identifier_1.Identifier.toString(result.function)}\` at ${range_1.SourceLocation.format(result.loc)}`,
|
|
197
|
+
[linter_format_1.LintingPrettyPrintContext.Full]: (result) => {
|
|
198
|
+
const str = [];
|
|
199
|
+
if (result.type === 'deprecated-argument') {
|
|
200
|
+
const argStr = typeof result.arg === 'number' ? `at position \`${result.arg}\`` : result.arg;
|
|
201
|
+
str.push(`Argument \`${argStr}\` of`);
|
|
202
|
+
}
|
|
203
|
+
str.push(`Function \`${identifier_1.Identifier.toString(result.function)}\` is ${result.state ?? 'deprecated'}`);
|
|
204
|
+
if (result.sinceVersion) {
|
|
205
|
+
str.push(`since version ${result.sinceVersion.format()}`);
|
|
206
|
+
}
|
|
207
|
+
if (result.replacedBy) {
|
|
208
|
+
str.push(`and is replaced by \`${result.replacedBy}\``);
|
|
209
|
+
}
|
|
210
|
+
return str.join(' ');
|
|
211
|
+
}
|
|
212
|
+
},
|
|
73
213
|
info: {
|
|
74
214
|
name: 'Deprecated Functions',
|
|
75
|
-
tags: [linter_tags_1.LintingRuleTag.Deprecated, linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.Usability, linter_tags_1.LintingRuleTag.Reproducibility],
|
|
76
|
-
// the hardcoded `
|
|
215
|
+
tags: [linter_tags_1.LintingRuleTag.Deprecated, linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.Usability, linter_tags_1.LintingRuleTag.Reproducibility, linter_tags_1.LintingRuleTag.QuickFix],
|
|
216
|
+
// the hardcoded `always` and `conditionally` list ensures every reported hit is real, but the list is pre-crawled and hence
|
|
77
217
|
// incomplete; the signature-database pass above adds recall for whichever packages are resolved
|
|
78
218
|
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
79
|
-
description: 'Marks deprecated functions that
|
|
219
|
+
description: 'Marks deprecated functions and deprecated arguments of still-current functions, offering the replacement as a quick fix where one is known. A call to a bare name whose package the code never attaches is reported as uncertain, as any function of that name would answer to it.',
|
|
80
220
|
defaultConfig: {
|
|
81
|
-
|
|
221
|
+
always: functionListFromBuiltinConfig(),
|
|
222
|
+
conditionally: ConditionallyDeprecated
|
|
82
223
|
}
|
|
83
224
|
}
|
|
84
225
|
};
|
|
226
|
+
/** The version of each package a matched entry constrains, asked for only when one does. */
|
|
227
|
+
async function inferPackageVersions(analyzer, matched) {
|
|
228
|
+
const packages = matched.filter(assert_1.isNotUndefined)
|
|
229
|
+
.filter(({ info }) => info.sinceVersion !== undefined || info.whenArgs?.some(arg => arg.sinceVersion) === true)
|
|
230
|
+
.map(({ pkg }) => pkg)
|
|
231
|
+
.filter(assert_1.isNotUndefined);
|
|
232
|
+
if (packages.length === 0) {
|
|
233
|
+
return new Map();
|
|
234
|
+
}
|
|
235
|
+
const queryResult = await analyzer.query([{
|
|
236
|
+
type: 'guess-dep-versions',
|
|
237
|
+
packages: (0, arrays_1.uniqueArray)(packages)
|
|
238
|
+
}]);
|
|
239
|
+
const versions = queryResult['guess-dep-versions'].dependencies
|
|
240
|
+
.map(d => [d.package, r_version_1.RRange.parse(d.range)])
|
|
241
|
+
.filter(([_, version]) => (0, assert_1.isNotUndefined)(version));
|
|
242
|
+
return new Map(versions);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The node of the deprecated argument, `undefined` when the call does not supply it. Matches as R does: a name
|
|
246
|
+
* binds wherever it stands, then the unnamed arguments fill the rest, so `f(other = 1, x)` supplies `x` at 0.
|
|
247
|
+
*/
|
|
248
|
+
function isDeprecatedArgumentPresent(vertex, info, idMap) {
|
|
249
|
+
const named = info.argName === undefined ? undefined : vertex.args.find(arg => graph_1.FunctionArgument.hasName(arg, info.argName));
|
|
250
|
+
const arg = named ?? (info.argIdx === undefined ? undefined : vertex.args.filter(graph_1.FunctionArgument.isPositional)[info.argIdx]);
|
|
251
|
+
return arg === undefined ? undefined : idMap.get(arg.nodeId);
|
|
252
|
+
}
|
|
253
|
+
function doesPackageVersionMatch(derivedVersion, info, setUncertain) {
|
|
254
|
+
if (info.sinceVersion === undefined) {
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
if (derivedVersion == undefined) {
|
|
258
|
+
setUncertain();
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
return info.sinceVersion.intersects(derivedVersion);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function doesArgumentValueMatch(info, vertex, analyzer, dataflow, setUncertain) {
|
|
266
|
+
if (info.ifValue === undefined) {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
const hasArg = (0, function_finder_util_1.hasArgumentValue)(info.ifValue, vertex, analyzer, dataflow, true, info.argName, info.argIdx);
|
|
270
|
+
if (hasArg === logic_1.Ternary.Never) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
else if (hasArg === logic_1.Ternary.Maybe) {
|
|
274
|
+
setUncertain();
|
|
275
|
+
}
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
/** The rename that carries a finding out, when a replacement name is known. */
|
|
279
|
+
function renameFix(node, replacedBy, what) {
|
|
280
|
+
const loc = node === undefined ? undefined : range_1.SourceLocation.fromNode(node);
|
|
281
|
+
if (replacedBy === undefined || loc === undefined) {
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
284
|
+
return [{ type: 'replace', description: `Replace ${what} with \`${replacedBy}\``, replacement: replacedBy, loc }];
|
|
285
|
+
}
|
|
286
|
+
/** The name to rename, `undefined` for `pkg::fn` as the replacement states no package to put back. */
|
|
287
|
+
function calledName(node) {
|
|
288
|
+
return r_function_call_1.RFunctionCall.isNamed(node) && identifier_1.Identifier.getNamespace(node.functionName.content) === undefined
|
|
289
|
+
? node.functionName : undefined;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* This function is applied to function candidates that have an entry in the {@link DeprecatedFunctionsConfig.conditionally} map.
|
|
293
|
+
*/
|
|
294
|
+
function deprecateFunctionConditionally(candidate, dataflow, idMap, analyzer, entry, packageVersions, attached) {
|
|
295
|
+
const { info, pkg } = entry;
|
|
296
|
+
const results = [];
|
|
297
|
+
const derivedRange = pkg === undefined ? undefined : packageVersions.get(pkg);
|
|
298
|
+
const known = certaintyOf(candidate.target, [pkg], attached);
|
|
299
|
+
// Deprecated Argument: If `whenArgs` is provided, only mark deprecated arguments
|
|
300
|
+
if (info.whenArgs) {
|
|
301
|
+
const vertex = dataflow.getVertex(candidate.node.info.id);
|
|
302
|
+
if (vertex === undefined || !vertex_1.FunctionCallVertex.is(vertex)) {
|
|
303
|
+
return results;
|
|
304
|
+
}
|
|
305
|
+
for (const deprecatedArgInfo of info.whenArgs) {
|
|
306
|
+
const argNode = isDeprecatedArgumentPresent(vertex, deprecatedArgInfo, idMap);
|
|
307
|
+
if (argNode === undefined) {
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
let certainty = known;
|
|
311
|
+
const setUncertain = () => {
|
|
312
|
+
certainty = linter_format_1.LintingResultCertainty.Uncertain;
|
|
313
|
+
};
|
|
314
|
+
// If `sinceVersion` is set, check package version before marking argument as deprecated
|
|
315
|
+
if (!doesPackageVersionMatch(derivedRange, deprecatedArgInfo, setUncertain)) {
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
// If `ifValue` is set, check argument value before marking argument as deprecate
|
|
319
|
+
if (!doesArgumentValueMatch(deprecatedArgInfo, vertex, analyzer, dataflow, setUncertain)) {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
// If all checks passed, mark as deprecated
|
|
323
|
+
results.push({
|
|
324
|
+
type: 'deprecated-argument',
|
|
325
|
+
certainty: certainty,
|
|
326
|
+
involvedId: vertex.id,
|
|
327
|
+
function: candidate.target,
|
|
328
|
+
arg: (deprecatedArgInfo.argName ?? deprecatedArgInfo.argIdx),
|
|
329
|
+
state: deprecatedArgInfo.state,
|
|
330
|
+
replacedBy: deprecatedArgInfo.replacedBy,
|
|
331
|
+
sinceVersion: deprecatedArgInfo.sinceVersion,
|
|
332
|
+
loc: range_1.SourceLocation.fromNode(argNode) ?? candidate.sourceLocation,
|
|
333
|
+
quickFix: deprecatedArgInfo.argName === undefined ? undefined : renameFix(argNode, deprecatedArgInfo.replacedBy, `argument \`${deprecatedArgInfo.argName}\``)
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
// Deprecated Function: If `sinceVersion` is set, check package version before marking as deprecated
|
|
338
|
+
if (info.sinceVersion) {
|
|
339
|
+
const isDeprecatedVersion = derivedRange ? info.sinceVersion.intersects(derivedRange) : undefined;
|
|
340
|
+
if (isDeprecatedVersion === true || isDeprecatedVersion === undefined) {
|
|
341
|
+
results.push({
|
|
342
|
+
type: 'deprecated-function',
|
|
343
|
+
certainty: isDeprecatedVersion === undefined ? linter_format_1.LintingResultCertainty.Uncertain : known,
|
|
344
|
+
involvedId: candidate.node.info.id,
|
|
345
|
+
loc: candidate.sourceLocation,
|
|
346
|
+
function: candidate.target,
|
|
347
|
+
state: info.state,
|
|
348
|
+
replacedBy: info.replacedBy,
|
|
349
|
+
sinceVersion: info.sinceVersion,
|
|
350
|
+
quickFix: renameFix(calledName(candidate.node), info.replacedBy, 'the call')
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return results;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* This function is applied to function candidates that have an entry in the {@link DeprecatedFunctionsConfig.always} map.
|
|
358
|
+
* A call naming a package the list does not have under that name is another function and is left alone.
|
|
359
|
+
*/
|
|
360
|
+
function deprecateFunctionAlways(candidate, owners, attached) {
|
|
361
|
+
const namespace = identifier_1.Identifier.getNamespace(candidate.target);
|
|
362
|
+
if (namespace !== undefined && !owners.some(owner => owner === undefined || owner === namespace)) {
|
|
363
|
+
return [];
|
|
364
|
+
}
|
|
365
|
+
return [{
|
|
366
|
+
type: 'deprecated-function',
|
|
367
|
+
certainty: certaintyOf(candidate.target, owners, attached),
|
|
368
|
+
involvedId: candidate.node.info.id,
|
|
369
|
+
loc: candidate.sourceLocation,
|
|
370
|
+
function: candidate.target,
|
|
371
|
+
}];
|
|
372
|
+
}
|
|
85
373
|
//# sourceMappingURL=deprecated-functions.js.map
|
|
@@ -13,7 +13,6 @@ const linter_tags_1 = require("../linter-tags");
|
|
|
13
13
|
const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
|
|
14
14
|
const resolve_working_directory_1 = require("../../dataflow/eval/resolve/resolve-working-directory");
|
|
15
15
|
const config_1 = require("../../config");
|
|
16
|
-
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
17
16
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
18
17
|
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
19
18
|
async function urlExists(url) {
|
|
@@ -166,7 +165,7 @@ function samePath(a, b, ignoreCapitalization) {
|
|
|
166
165
|
/** the string-literal path argument of a call whose resolved value is `value`, for anchoring a quick fix */
|
|
167
166
|
function pathArgStringNode(idMap, callId, value) {
|
|
168
167
|
const call = idMap.get(callId);
|
|
169
|
-
if (
|
|
168
|
+
if (!r_function_call_1.RFunctionCall.is(call)) {
|
|
170
169
|
return undefined;
|
|
171
170
|
}
|
|
172
171
|
for (const arg of call.arguments) {
|
|
@@ -179,12 +178,14 @@ function pathArgStringNode(idMap, callId, value) {
|
|
|
179
178
|
/** rewrite the read path to `found`, an existing file surfaced by the lax retry */
|
|
180
179
|
function buildDidYouMeanFix(idMap, callId, value, found) {
|
|
181
180
|
const str = pathArgStringNode(idMap, callId, value);
|
|
182
|
-
|
|
181
|
+
const loc = str === undefined ? undefined : range_1.SourceLocation.fromNode(str);
|
|
182
|
+
if (!str || loc === undefined) {
|
|
183
|
+
/* a fix that names no place cannot be carried out, so none is offered */
|
|
183
184
|
return undefined;
|
|
184
185
|
}
|
|
185
186
|
return [{
|
|
186
187
|
type: 'replace',
|
|
187
|
-
loc
|
|
188
|
+
loc,
|
|
188
189
|
description: `Replace with existing path \`${found}\``,
|
|
189
190
|
replacement: str.content.quotes + found + str.content.quotes
|
|
190
191
|
}];
|
|
@@ -2,11 +2,13 @@ import { type LintingResult, LintingResultCertainty } from '../linter-format';
|
|
|
2
2
|
import type { FlowrSearchElement, FlowrSearchElements } from '../../search/flowr-search';
|
|
3
3
|
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { MergeableRecord } from '../../util/objects';
|
|
5
|
+
import type { DataflowGraphVertexFunctionCall } from '../../dataflow/graph/vertex';
|
|
5
6
|
import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
|
|
6
7
|
import { Identifier } from '../../dataflow/environments/identifier';
|
|
7
8
|
import { Ternary } from '../../util/logic';
|
|
8
9
|
import type { ReadonlyFlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
9
10
|
import type { AsyncOrSync } from 'ts-essentials';
|
|
11
|
+
import type { DataflowGraph } from '../../dataflow/graph/graph';
|
|
10
12
|
export interface FunctionsResult extends LintingResult {
|
|
11
13
|
function: string;
|
|
12
14
|
}
|
|
@@ -37,3 +39,7 @@ export declare const functionFinderUtil: {
|
|
|
37
39
|
};
|
|
38
40
|
requireArgumentValue(element: FlowrSearchElement<ParentInformation>, pool: ReadonlyMap<string, FunctionInfo>, analyzer: ReadonlyFlowrAnalysisProvider, requireValue: RegExp | string | undefined): Promise<Ternary>;
|
|
39
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Test if a function call has an argument with a specific value
|
|
44
|
+
*/
|
|
45
|
+
export declare function hasArgumentValue(test: RegExp | string, fnVertex: DataflowGraphVertexFunctionCall, analyzer: ReadonlyFlowrAnalysisProvider, dataflow: DataflowGraph, resolveValue: boolean | 'library' | undefined, argName?: string, argIdx?: number | 'unnamed'): Ternary;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.functionFinderUtil = void 0;
|
|
4
|
+
exports.hasArgumentValue = hasArgumentValue;
|
|
4
5
|
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
5
6
|
const flowr_search_filters_1 = require("../../search/flowr-search-filters");
|
|
6
7
|
const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
|
|
@@ -68,7 +69,7 @@ exports.functionFinderUtil = {
|
|
|
68
69
|
const dataflow = await analyzer.dataflow();
|
|
69
70
|
const identifier = df_helper_1.Dataflow.qualify(element.node.info.id, dataflow.graph, true) ?? (element.node.lexeme !== undefined ? identifier_1.Identifier.parse(element.node.lexeme) : undefined);
|
|
70
71
|
/* if we have no additional info, we assume they always access the network */
|
|
71
|
-
if (identifier === undefined) {
|
|
72
|
+
if (identifier === undefined || requireValue === undefined) {
|
|
72
73
|
return logic_1.Ternary.Always;
|
|
73
74
|
}
|
|
74
75
|
// we allow our function pool to contain non-namespaced functions
|
|
@@ -78,20 +79,27 @@ exports.functionFinderUtil = {
|
|
|
78
79
|
}
|
|
79
80
|
const vert = dataflow.graph.getVertex(element.node.info.id);
|
|
80
81
|
if (vertex_1.FunctionCallVertex.is(vert)) {
|
|
81
|
-
|
|
82
|
-
// we obtain all values, at least one of them has to trigger for the request
|
|
83
|
-
const argValues = args ? args.values().flatMap(s => Array.from(s)).filter(assert_1.isNotUndefined).toArray() : [];
|
|
84
|
-
if (argValues.length === 0) {
|
|
85
|
-
return logic_1.Ternary.Maybe;
|
|
86
|
-
}
|
|
87
|
-
else if (argValues.some(v => requireValue instanceof RegExp ? requireValue.test(v) : v === requireValue)) {
|
|
88
|
-
return logic_1.Ternary.Always;
|
|
89
|
-
}
|
|
90
|
-
else if (argValues.includes(dependencies_query_format_1.Unknown)) {
|
|
91
|
-
return logic_1.Ternary.Maybe;
|
|
92
|
-
}
|
|
82
|
+
return hasArgumentValue(requireValue, vert, analyzer, dataflow.graph, info.resolveValue, info.argName, info.argIdx);
|
|
93
83
|
}
|
|
94
84
|
return logic_1.Ternary.Never;
|
|
95
85
|
}
|
|
96
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* Test if a function call has an argument with a specific value
|
|
89
|
+
*/
|
|
90
|
+
function hasArgumentValue(test, fnVertex, analyzer, dataflow, resolveValue, argName, argIdx) {
|
|
91
|
+
const args = (0, resolve_argument_1.getArgumentStringValue)(analyzer.flowrConfig.solver.variables, dataflow, fnVertex, argIdx, argName, resolveValue, analyzer.inspectContext());
|
|
92
|
+
// we obtain all values, at least one of them has to trigger for the request
|
|
93
|
+
const argValues = args ? args.values().flatMap(s => Array.from(s)).filter(assert_1.isNotUndefined).toArray() : [];
|
|
94
|
+
if (argValues.length === 0) {
|
|
95
|
+
return logic_1.Ternary.Maybe;
|
|
96
|
+
}
|
|
97
|
+
else if (argValues.some(v => test instanceof RegExp ? test.test(v) : v === test)) {
|
|
98
|
+
return logic_1.Ternary.Always;
|
|
99
|
+
}
|
|
100
|
+
else if (argValues.includes(dependencies_query_format_1.Unknown)) {
|
|
101
|
+
return logic_1.Ternary.Maybe;
|
|
102
|
+
}
|
|
103
|
+
return logic_1.Ternary.Never;
|
|
104
|
+
}
|
|
97
105
|
//# sourceMappingURL=function-finder-util.js.map
|
|
@@ -85,7 +85,7 @@ function getMostUsedCasing(symbols) {
|
|
|
85
85
|
const o = map.get(symbol.detectedCasing) ?? 0;
|
|
86
86
|
map.set(symbol.detectedCasing, o + 1);
|
|
87
87
|
}
|
|
88
|
-
// Return element with most
|
|
88
|
+
// Return element with most occurrences
|
|
89
89
|
return [...map].reduce((p, c) => p[1] > c[1] ? p : c)[0];
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { LintingRuleCertainty } from '../linter-format';
|
|
2
|
-
import {
|
|
2
|
+
import type { FunctionsMetadata, FunctionsResult } from './function-finder-util';
|
|
3
3
|
import { LintingRuleTag } from '../linter-tags';
|
|
4
|
-
import type { MergeableRecord } from '../../util/objects';
|
|
5
4
|
import type { FlowrSearchElement } from '../../search/flowr-search';
|
|
6
5
|
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
6
|
import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
|
|
8
7
|
import { Identifier } from '../../dataflow/environments/identifier';
|
|
8
|
+
import type { MergeableRecord } from '../../util/objects';
|
|
9
9
|
export interface NetworkFunctionsConfig extends MergeableRecord {
|
|
10
10
|
/**
|
|
11
11
|
* The list of function names or more detailed {@link NetworkFunction} information that should be marked in the given context if their arguments match.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.STOP_WITH_CALL_ARG = void 0;
|
|
4
|
+
const match_args_1 = require("../../dataflow/graph/match-args");
|
|
4
5
|
const linter_format_1 = require("../linter-format");
|
|
5
6
|
const range_1 = require("../../util/range");
|
|
6
7
|
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
7
8
|
const linter_tags_1 = require("../linter-tags");
|
|
8
9
|
const assert_1 = require("../../util/assert");
|
|
9
10
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
10
|
-
const linker_1 = require("../../dataflow/internal/linker");
|
|
11
11
|
const general_1 = require("../../dataflow/eval/values/general");
|
|
12
12
|
const resolve_helper_1 = require("../../dataflow/environments/resolve-helper");
|
|
13
13
|
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
@@ -36,7 +36,7 @@ exports.STOP_WITH_CALL_ARG = {
|
|
|
36
36
|
'call.': 'call.',
|
|
37
37
|
'domain': 'domain'
|
|
38
38
|
};
|
|
39
|
-
const mapping =
|
|
39
|
+
const mapping = match_args_1.MatchArgs.toSpec(fCall.args, stopParamMap);
|
|
40
40
|
const mappedToStop = mapping.get('call.') ?? [];
|
|
41
41
|
for (const argId of mappedToStop) {
|
|
42
42
|
const res = resolve_helper_1.Resolve.toValue(argId, { graph: dataflow.graph, environment: fCall.environment, ctx: data.inspectContext() });
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UNCLOSED_CONNECTION = void 0;
|
|
4
4
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
5
|
-
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
6
5
|
const graph_1 = require("../../dataflow/graph/graph");
|
|
7
6
|
const edge_1 = require("../../dataflow/graph/edge");
|
|
8
7
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
@@ -15,6 +14,7 @@ const range_1 = require("../../util/range");
|
|
|
15
14
|
const assert_1 = require("../../util/assert");
|
|
16
15
|
const linter_format_1 = require("../linter-format");
|
|
17
16
|
const linter_tags_1 = require("../linter-tags");
|
|
17
|
+
const r_expression_list_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
|
|
18
18
|
/** the edges the connection flows along, from the call opening it to the argument of the call closing it */
|
|
19
19
|
const ConnectionFlow = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall | edge_1.EdgeType.Returns | edge_1.EdgeType.Argument;
|
|
20
20
|
/** The arguments holding the handle the call acts on, all of them if it does not state which. */
|
|
@@ -58,7 +58,7 @@ function enclosingStatement(idMap, id) {
|
|
|
58
58
|
let node = idMap.get(id);
|
|
59
59
|
while (node !== undefined) {
|
|
60
60
|
const parent = node.info.parent === undefined ? undefined : idMap.get(node.info.parent);
|
|
61
|
-
if (parent === undefined ||
|
|
61
|
+
if (parent === undefined || r_expression_list_1.RExpressionList.is(parent)) {
|
|
62
62
|
return node;
|
|
63
63
|
}
|
|
64
64
|
node = parent;
|
|
@@ -12,6 +12,8 @@ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id"
|
|
|
12
12
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
13
13
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
14
14
|
const graph_1 = require("../../dataflow/graph/graph");
|
|
15
|
+
const r_access_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-access");
|
|
16
|
+
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
15
17
|
/**
|
|
16
18
|
* Path heuristic for an R package `inst/` resource (installed verbatim, not namespace source). Fallback for
|
|
17
19
|
* the authoritative `FileRole.Install`, covering requests that bypass the file-role plugins.
|
|
@@ -60,10 +62,10 @@ function isInSubscript(graph, id) {
|
|
|
60
62
|
let parentId = idMap.get(id)?.info.parent;
|
|
61
63
|
for (let guard = 0; parentId !== undefined && guard < 64; guard++) {
|
|
62
64
|
const parent = idMap.get(parentId);
|
|
63
|
-
if (parent === undefined ||
|
|
65
|
+
if (parent === undefined || r_function_definition_1.RFunctionDefinition.is(parent)) {
|
|
64
66
|
return false;
|
|
65
67
|
}
|
|
66
|
-
if (
|
|
68
|
+
if (r_access_1.RAccess.is(parent) && (parent.operator === '[' || parent.operator === '[[') && parent.accessed.info.id !== childId) {
|
|
67
69
|
return true; // reached from a subscript, not the accessed object
|
|
68
70
|
}
|
|
69
71
|
childId = parentId;
|
|
@@ -87,7 +89,7 @@ function enclosingScope(idMap, startParent) {
|
|
|
87
89
|
if (node === undefined) {
|
|
88
90
|
break;
|
|
89
91
|
}
|
|
90
|
-
if (
|
|
92
|
+
if (r_function_definition_1.RFunctionDefinition.is(node)) {
|
|
91
93
|
return { scope: cur, unconditional };
|
|
92
94
|
}
|
|
93
95
|
if (ConditionalNodeTypes.has(node.type)) {
|
|
@@ -145,7 +147,7 @@ function isDefinedInEnclosingScope(graph, defined, useId, name) {
|
|
|
145
147
|
if (node === undefined) {
|
|
146
148
|
break;
|
|
147
149
|
}
|
|
148
|
-
if (
|
|
150
|
+
if (r_function_definition_1.RFunctionDefinition.is(node) && defined.get(cur)?.has(name)) {
|
|
149
151
|
return true;
|
|
150
152
|
}
|
|
151
153
|
cur = node.info.parent;
|
|
@@ -9,12 +9,12 @@ const flowr_search_filters_1 = require("../../search/flowr-search-filters");
|
|
|
9
9
|
const assert_1 = require("../../util/assert");
|
|
10
10
|
const range_1 = require("../../util/range");
|
|
11
11
|
const flowr_file_1 = require("../../project/context/flowr-file");
|
|
12
|
-
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
13
12
|
const r_base_packages_1 = require("../../util/r-base-packages");
|
|
14
13
|
const linter_format_1 = require("../linter-format");
|
|
15
14
|
const linter_tags_1 = require("../linter-tags");
|
|
16
15
|
const undefined_symbol_util_1 = require("./undefined-symbol-util");
|
|
17
16
|
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
17
|
+
const r_symbol_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
18
18
|
/** calls that load a package; an unresolved one means we cannot enumerate all exports in scope */
|
|
19
19
|
const LibraryLoadFunctions = new Set(['library', 'require', 'requireNamespace', 'loadNamespace', 'attachNamespace', 'load_all', 'use', 'p_load']);
|
|
20
20
|
// standard packages attached by default; exports are in scope without library()
|
|
@@ -108,7 +108,7 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
108
108
|
// variable use: only plain symbols (not argument names, `...`, or empty)
|
|
109
109
|
if (vertex_1.UseVertex.is(vtx) && config.checkVariables) {
|
|
110
110
|
const node = element.node;
|
|
111
|
-
if (
|
|
111
|
+
if (!r_symbol_1.RSymbol.is(node) || node.lexeme === '...' || node.lexeme === undefined) {
|
|
112
112
|
return undefined;
|
|
113
113
|
}
|
|
114
114
|
meta.totalVariableUses++;
|