@eagleoutice/flowr 2.14.1 → 2.14.2
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 +154 -87
- package/abstract-interpretation/absint-visitor.d.ts +91 -25
- package/abstract-interpretation/absint-visitor.js +235 -74
- 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 +6 -0
- package/config.js +8 -4
- 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 -26
- 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 +112 -7
- package/dataflow/environments/default-builtin-config.js +82 -34
- 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 +2 -2
- package/dataflow/eval/resolve/alias-tracking.js +2 -2
- 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 +14 -0
- package/dataflow/internal/control-flow.d.ts +102 -0
- package/dataflow/internal/control-flow.js +200 -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 +8 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +11 -0
- 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 +27 -20
- 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 +35 -6
- 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 +8 -3
- 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.js +2 -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 +12 -13
- 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 +45 -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 +19 -3
- 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 +23 -1
- 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 +45 -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 +12 -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-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 +309 -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 +0 -7
- package/project/dependency-version-space.js +8 -7
- 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 +48 -13
- package/project/sigdb/reader.js +2 -1
- 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 +1 -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 +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/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 -4
- 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 +9 -0
- 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
|
@@ -12,7 +12,6 @@ const flowr_search_filters_1 = require("../../search/flowr-search-filters");
|
|
|
12
12
|
const flowr_file_1 = require("../../project/context/flowr-file");
|
|
13
13
|
const flowr_namespace_file_1 = require("../../project/plugins/file-plugins/files/flowr-namespace-file");
|
|
14
14
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
15
|
-
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
16
15
|
const retriever_1 = require("../../r-bridge/retriever");
|
|
17
16
|
const query_fn_props_1 = require("../../dataflow/environments/query-fn-props");
|
|
18
17
|
const built_in_props_1 = require("../../dataflow/environments/built-in-props");
|
|
@@ -20,6 +19,7 @@ const default_builtin_config_1 = require("../../dataflow/environments/default-bu
|
|
|
20
19
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
21
20
|
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
22
21
|
const graph_1 = require("../../dataflow/graph/graph");
|
|
22
|
+
const r_parameter_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-parameter");
|
|
23
23
|
/**
|
|
24
24
|
* The dots parameter is a special parameter and must never be reported as an unused definition.
|
|
25
25
|
*/
|
|
@@ -167,9 +167,13 @@ function buildQuickFix(variable, dfg, ast) {
|
|
|
167
167
|
return vertex ? range_1.SourceLocation.fromNode(vertex) : undefined;
|
|
168
168
|
}),
|
|
169
169
|
variable.info.fullRange ?? variable.location]);
|
|
170
|
+
if (totalRangeToRemove === undefined) {
|
|
171
|
+
/* a fix that names no place cannot be carried out, so none is offered */
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
170
174
|
return [{
|
|
171
175
|
type: 'remove',
|
|
172
|
-
loc: totalRangeToRemove
|
|
176
|
+
loc: totalRangeToRemove,
|
|
173
177
|
description: `Remove unused definition of \`${variable.lexeme}\``
|
|
174
178
|
}];
|
|
175
179
|
}
|
|
@@ -195,10 +199,10 @@ function isWithinPromise(node, idMap) {
|
|
|
195
199
|
if (parent === undefined) {
|
|
196
200
|
return false;
|
|
197
201
|
}
|
|
198
|
-
if (
|
|
202
|
+
if (r_parameter_1.RParameter.is(parent) && parent.defaultValue?.info.id === child.info.id) {
|
|
199
203
|
return true;
|
|
200
204
|
}
|
|
201
|
-
if (
|
|
205
|
+
if (r_function_call_1.RFunctionCall.isNamed(parent) && identifier_1.Identifier.getName(parent.functionName.content) === 'delayedAssign') {
|
|
202
206
|
return true;
|
|
203
207
|
}
|
|
204
208
|
child = parent;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type LintingResult, LintingResultCertainty, LintingRuleCertainty, type LintQuickFix } from '../linter-format';
|
|
2
|
+
import type { MergeableRecord } from '../../util/objects';
|
|
3
|
+
import { LintingRuleTag } from '../linter-tags';
|
|
4
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
|
+
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
6
|
+
export interface UnusedImportResult extends LintingResult {
|
|
7
|
+
/** the package the flagged call attaches */
|
|
8
|
+
readonly package: string;
|
|
9
|
+
/** the version whose exports the finding was checked against, as the signature database resolved it */
|
|
10
|
+
readonly version: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UnusedImportConfig extends MergeableRecord {
|
|
13
|
+
/** packages that do their work on load and hence should never be reported, however unused they look */
|
|
14
|
+
whitelist: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface UnusedImportMetadata extends MergeableRecord {
|
|
17
|
+
/** attaching calls the rule looked at */
|
|
18
|
+
totalConsidered: number;
|
|
19
|
+
/** skipped because the database could not resolve the package the call names */
|
|
20
|
+
totalUnresolved: number;
|
|
21
|
+
/** skipped because one call attaches several packages at once */
|
|
22
|
+
totalMultiPackage: number;
|
|
23
|
+
/** the attaches reported as unused */
|
|
24
|
+
totalUnused: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Flags packages that are attached but never used, so dropping the `library`/`require` call would leave the code running
|
|
28
|
+
* just the same. A package counts as used as soon as any call resolves into it or anything reads one of its exports.
|
|
29
|
+
*
|
|
30
|
+
* Needs a signature database to know what a package exports; without one the rule reports nothing. Packages the database
|
|
31
|
+
* does not know, packages whose namespace loads with side effects, and those in the
|
|
32
|
+
* {@link UnusedImportConfig#whitelist|whitelist} are skipped. Every step errs towards keeping an import.
|
|
33
|
+
*/
|
|
34
|
+
export declare const UNUSED_IMPORT: {
|
|
35
|
+
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], ParentInformation, import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
|
|
36
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: UnusedImportConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
|
|
37
|
+
results: {
|
|
38
|
+
certainty: LintingResultCertainty;
|
|
39
|
+
involvedId: NodeId;
|
|
40
|
+
loc: [startLine: number, startColumn: number, endLine: number, endColumn: number, f?: string | undefined];
|
|
41
|
+
package: string;
|
|
42
|
+
version: string;
|
|
43
|
+
quickFix: LintQuickFix[] | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
'.meta': UnusedImportMetadata;
|
|
46
|
+
}>;
|
|
47
|
+
readonly prettyPrint: {
|
|
48
|
+
readonly query: (result: UnusedImportResult) => string;
|
|
49
|
+
readonly full: (result: UnusedImportResult) => string;
|
|
50
|
+
};
|
|
51
|
+
readonly info: {
|
|
52
|
+
readonly name: "Unused Import";
|
|
53
|
+
readonly tags: readonly [LintingRuleTag.Smell, LintingRuleTag.Readability, LintingRuleTag.QuickFix];
|
|
54
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
55
|
+
readonly description: "Highlights packages that are attached but never used, so the code runs just the same without them. Requires a signature database, and packages that only do their work on load should be whitelisted in the configuration.";
|
|
56
|
+
readonly defaultConfig: {
|
|
57
|
+
readonly whitelist: readonly [];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UNUSED_IMPORT = void 0;
|
|
4
|
+
const linter_format_1 = require("../linter-format");
|
|
5
|
+
const range_1 = require("../../util/range");
|
|
6
|
+
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
7
|
+
const linter_tags_1 = require("../linter-tags");
|
|
8
|
+
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
9
|
+
const graph_1 = require("../../dataflow/graph/graph");
|
|
10
|
+
const edge_1 = require("../../dataflow/graph/edge");
|
|
11
|
+
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
12
|
+
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
13
|
+
const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
|
|
14
|
+
const dependencies_query_format_1 = require("../../queries/catalog/dependencies-query/dependencies-query-format");
|
|
15
|
+
const library_functions_1 = require("../../queries/catalog/dependencies-query/function-info/library-functions");
|
|
16
|
+
const r_expression_list_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
|
|
17
|
+
/**
|
|
18
|
+
* Whether the loader a `library`-category finding came from attaches the package, taken from the one place that
|
|
19
|
+
* says so. A call this does not know attaches nothing either: `pkg::fn` is reported as a loader of `pkg` and is no
|
|
20
|
+
* import of its own, and neither is whatever else may come to be reported here. Matching ignores the loader's own
|
|
21
|
+
* namespace, so `base::require` is caught just as well as a bare `require`.
|
|
22
|
+
*/
|
|
23
|
+
function attachesPackage(info) {
|
|
24
|
+
return library_functions_1.LibraryFunctions.some(loader => loader.attaches && identifier_1.Identifier.matches(loader.name, info.functionName));
|
|
25
|
+
}
|
|
26
|
+
/** whether the call reaches no definition of the analyzed code itself */
|
|
27
|
+
function isUnbound(graph, id) {
|
|
28
|
+
const origins = df_helper_1.Dataflow.origin(graph, id);
|
|
29
|
+
return origins === undefined || origins.every(o => o.type === 3 /* OriginType.BuiltInFunctionOrigin */);
|
|
30
|
+
}
|
|
31
|
+
/** whether removing the call would empty a slot the syntax requires, as in an unbraced `if(c) library(x)` */
|
|
32
|
+
function removalWouldBreakSyntax(node, idMap) {
|
|
33
|
+
const parent = node.info.parent === undefined ? undefined : idMap.get(node.info.parent);
|
|
34
|
+
return r_expression_list_1.RExpressionList.isImplicit(parent) && parent.children.length === 1 && parent.info.role !== "root" /* RoleInParent.Root */;
|
|
35
|
+
}
|
|
36
|
+
/** whether anything reads out of the attach itself */
|
|
37
|
+
function isReadFrom(graph, id) {
|
|
38
|
+
for (const edge of (graph.ingoingEdges(id) ?? graph_1.NoEdges).values()) {
|
|
39
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads)) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Which of the `attachments` the program never makes use of. A call that resolves names its package outright;
|
|
47
|
+
* one that does not bind yet (a call in a function body) keeps every attached package exporting its name.
|
|
48
|
+
*/
|
|
49
|
+
function unusedPackages(attachments, graph) {
|
|
50
|
+
const pending = new Set(attachments.map(a => a.name));
|
|
51
|
+
const unbound = new Set();
|
|
52
|
+
for (const [id, qualified] of df_helper_1.Dataflow.qualifyAll(graph)) {
|
|
53
|
+
const namespace = qualified === undefined ? undefined : identifier_1.Identifier.getNamespace(qualified);
|
|
54
|
+
if (namespace !== undefined) {
|
|
55
|
+
pending.delete(namespace);
|
|
56
|
+
if (pending.size === 0) {
|
|
57
|
+
return pending;
|
|
58
|
+
}
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const vertex = graph.getVertex(id);
|
|
62
|
+
if (vertex_1.FunctionCallVertex.is(vertex) && isUnbound(graph, id)) {
|
|
63
|
+
unbound.add(identifier_1.Identifier.getName(vertex.name));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
for (const { name, callable } of attachments) {
|
|
67
|
+
if (!pending.has(name)) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
for (const call of unbound) {
|
|
71
|
+
if (callable.has(call)) {
|
|
72
|
+
pending.delete(name);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return pending;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Flags packages that are attached but never used, so dropping the `library`/`require` call would leave the code running
|
|
81
|
+
* just the same. A package counts as used as soon as any call resolves into it or anything reads one of its exports.
|
|
82
|
+
*
|
|
83
|
+
* Needs a signature database to know what a package exports; without one the rule reports nothing. Packages the database
|
|
84
|
+
* does not know, packages whose namespace loads with side effects, and those in the
|
|
85
|
+
* {@link UnusedImportConfig#whitelist|whitelist} are skipped. Every step errs towards keeping an import.
|
|
86
|
+
*/
|
|
87
|
+
exports.UNUSED_IMPORT = {
|
|
88
|
+
createSearch: () => flowr_search_builder_1.Q.fromQuery({ type: 'dependencies', enabledCategories: ['library'] }),
|
|
89
|
+
processSearchResult: async (elements, config, data) => {
|
|
90
|
+
const metadata = { totalConsidered: 0, totalUnresolved: 0, totalMultiPackage: 0, totalUnused: 0 };
|
|
91
|
+
const deps = data.inspectContext().deps;
|
|
92
|
+
if (!deps.hasSignatureDatabase()) {
|
|
93
|
+
return { results: [], '.meta': metadata };
|
|
94
|
+
}
|
|
95
|
+
const whitelist = new Set(config.whitelist);
|
|
96
|
+
// one call may name more than one package, so the query can report it several times under the same id
|
|
97
|
+
const attachedBy = new Map();
|
|
98
|
+
for (const info of elements.enrichmentContent(search_enrichers_1.Enrichment.QueryData).queries['dependencies'].library) {
|
|
99
|
+
const known = attachedBy.get(info.nodeId);
|
|
100
|
+
if (known === undefined) {
|
|
101
|
+
attachedBy.set(info.nodeId, [info]);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
known.push(info);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const attachments = [];
|
|
108
|
+
const seen = new Set();
|
|
109
|
+
for (const { node } of elements.getElements()) {
|
|
110
|
+
const infos = attachedBy.get(node.info.id);
|
|
111
|
+
if (infos === undefined || seen.has(node.info.id) || !attachesPackage(infos[0])) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
seen.add(node.info.id);
|
|
115
|
+
metadata.totalConsidered++;
|
|
116
|
+
if (infos.length > 1) {
|
|
117
|
+
// a dynamic attach, e.g. `for(p in pkgs) library(p, character.only = TRUE)`; naming one of them would be a guess
|
|
118
|
+
metadata.totalMultiPackage++;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const name = infos[0].value;
|
|
122
|
+
if (name === undefined || name === dependencies_query_format_1.Unknown) {
|
|
123
|
+
metadata.totalUnresolved++;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (whitelist.has(name)) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const pkg = deps.getDependency(name);
|
|
130
|
+
const loc = range_1.SourceLocation.fromNode(node);
|
|
131
|
+
if (pkg?.resolvedVersion === undefined || loc === undefined) {
|
|
132
|
+
metadata.totalUnresolved++;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (pkg.namespaceInfo?.loadsWithSideEffects) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
attachments.push({
|
|
139
|
+
id: node.info.id,
|
|
140
|
+
node,
|
|
141
|
+
loc,
|
|
142
|
+
name,
|
|
143
|
+
version: pkg.resolvedVersion,
|
|
144
|
+
callable: new Set(pkg.namespaceInfo?.callable)
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (attachments.length === 0) {
|
|
148
|
+
return { results: [], '.meta': metadata };
|
|
149
|
+
}
|
|
150
|
+
const { graph } = await data.dataflow();
|
|
151
|
+
const idMap = (await data.normalize()).idMap;
|
|
152
|
+
const unused = unusedPackages(attachments, graph);
|
|
153
|
+
const results = attachments.filter(({ id, name }) => unused.has(name) && !isReadFrom(graph, id)).map(({ id, node, loc, name, version }) => ({
|
|
154
|
+
certainty: linter_format_1.LintingResultCertainty.Uncertain,
|
|
155
|
+
involvedId: id,
|
|
156
|
+
loc,
|
|
157
|
+
package: name,
|
|
158
|
+
version,
|
|
159
|
+
quickFix: removalWouldBreakSyntax(node, idMap) ? undefined
|
|
160
|
+
: [{ type: 'remove', description: `Remove the unused import of ${name}`, loc }]
|
|
161
|
+
}));
|
|
162
|
+
metadata.totalUnused = results.length;
|
|
163
|
+
return { results, '.meta': metadata };
|
|
164
|
+
},
|
|
165
|
+
prettyPrint: {
|
|
166
|
+
[linter_format_1.LintingPrettyPrintContext.Query]: result => `Import of ${result.package} at ${range_1.SourceLocation.format(result.loc)}`,
|
|
167
|
+
[linter_format_1.LintingPrettyPrintContext.Full]: result => `Import of ${result.package} at ${range_1.SourceLocation.format(result.loc)} is unused (checked v${result.version}).`
|
|
168
|
+
},
|
|
169
|
+
info: {
|
|
170
|
+
name: 'Unused Import',
|
|
171
|
+
tags: [linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.Readability, linter_tags_1.LintingRuleTag.QuickFix],
|
|
172
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
173
|
+
description: 'Highlights packages that are attached but never used, so the code runs just the same without them. Requires a signature database, and packages that only do their work on load should be whitelisted in the configuration.',
|
|
174
|
+
defaultConfig: {
|
|
175
|
+
whitelist: []
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=unused-import.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagleoutice/flowr",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.2",
|
|
4
4
|
"description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"@codemirror/legacy-modes": "^6.5.3",
|
|
187
187
|
"@commitlint/cli": "^20.5.0",
|
|
188
188
|
"@commitlint/config-angular": "^20.5.0",
|
|
189
|
-
"@eagleoutice/eslint-config-flowr": "^2.1.
|
|
189
|
+
"@eagleoutice/eslint-config-flowr": "^2.1.3",
|
|
190
190
|
"@j-ulrich/release-it-regex-bumper": "^5.6.0",
|
|
191
191
|
"@types/command-line-args": "^5.2.3",
|
|
192
192
|
"@types/command-line-usage": "^5.0.4",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MetaPackageCores = void 0;
|
|
4
4
|
exports.attachedAlongside = attachedAlongside;
|
|
5
|
+
const arrays_1 = require("../util/collections/arrays");
|
|
5
6
|
/**
|
|
6
7
|
* Packages that attach further packages from their `.onAttach` hook, which no package metadata records: their core
|
|
7
8
|
* set sits in `Imports`, indistinguishable from the packages they merely use. Whoever loads one of them gets the
|
|
@@ -25,6 +26,6 @@ function attachedAlongside(pack, sources, version) {
|
|
|
25
26
|
.flatMap(src => src.dependencies(pack, version) ?? [])
|
|
26
27
|
.filter(d => d.type === 0 /* DepType.Depends */ && d.name !== 'R')
|
|
27
28
|
.map(d => d.name);
|
|
28
|
-
return
|
|
29
|
+
return (0, arrays_1.uniqueArray)([...depends, ...exports.MetaPackageCores.get(pack) ?? []]);
|
|
29
30
|
}
|
|
30
31
|
//# sourceMappingURL=attached-packages.js.map
|
|
@@ -7,7 +7,6 @@ import type { TreeSitterExecutor } from '../../r-bridge/lang-4.x/tree-sitter/tre
|
|
|
7
7
|
import type { PipelineOutput } from '../../core/steps/pipeline/pipeline';
|
|
8
8
|
import type { CfgSimplificationPassName } from '../../control-flow/cfg-simplification';
|
|
9
9
|
import type { ControlFlowInformation } from '../../control-flow/control-flow-graph';
|
|
10
|
-
import type { CfgKind } from '../cfg-kind';
|
|
11
10
|
import type { FlowrAnalyzerContext } from '../context/flowr-analyzer-context';
|
|
12
11
|
import { CallGraph } from '../../dataflow/graph/call-graph';
|
|
13
12
|
interface FlowrAnalyzerCacheOptions<Parser extends KnownParser> {
|
|
@@ -75,17 +74,15 @@ export declare class FlowrAnalyzerCache<Parser extends KnownParser> extends Flow
|
|
|
75
74
|
/**
|
|
76
75
|
* Get the control flow graph (CFG) for the request, computing if necessary.
|
|
77
76
|
* @param force - Do not use the cache, instead force new analyses.
|
|
78
|
-
* @param kind - The kind of CFG that is requested.
|
|
79
77
|
* @param simplifications - Simplification passes to be applied to the CFG.
|
|
80
78
|
*/
|
|
81
|
-
controlflow(force: boolean | undefined,
|
|
79
|
+
controlflow(force: boolean | undefined, simplifications?: readonly CfgSimplificationPassName[]): Promise<ControlFlowInformation>;
|
|
82
80
|
/**
|
|
83
81
|
* Get the control flow graph (CFG) for the request if already available, otherwise return `undefined`.
|
|
84
|
-
* @param kind - The kind of CFG that is requested.
|
|
85
82
|
* @param simplifications - Simplification passes to be applied to the CFG.
|
|
86
83
|
* @see {@link FlowrAnalyzerCache#controlflow} - to get the control flow graph, computing if necessary.
|
|
87
84
|
*/
|
|
88
|
-
peekControlflow(
|
|
85
|
+
peekControlflow(simplifications: readonly CfgSimplificationPassName[] | undefined): ControlFlowInformation | undefined;
|
|
89
86
|
/**
|
|
90
87
|
* Get the call graph for the request, computing if necessary.
|
|
91
88
|
* @param force - Do not use the cache, instead force new analyses.
|
|
@@ -145,26 +145,23 @@ class FlowrAnalyzerCache extends flowr_cache_1.FlowrCache {
|
|
|
145
145
|
/**
|
|
146
146
|
* Get the control flow graph (CFG) for the request, computing if necessary.
|
|
147
147
|
* @param force - Do not use the cache, instead force new analyses.
|
|
148
|
-
* @param kind - The kind of CFG that is requested.
|
|
149
148
|
* @param simplifications - Simplification passes to be applied to the CFG.
|
|
150
149
|
*/
|
|
151
|
-
async controlflow(force,
|
|
150
|
+
async controlflow(force, simplifications) {
|
|
152
151
|
const cfgInfo = {
|
|
153
152
|
ctx: this.args.context,
|
|
154
|
-
cfgQuick: this.peekDataflow()?.cfgQuick,
|
|
155
153
|
ast: async () => await this.normalize(),
|
|
156
154
|
dfg: async () => await this.dataflow()
|
|
157
155
|
};
|
|
158
|
-
return this.controlFlowCache.get(force,
|
|
156
|
+
return this.controlFlowCache.get(force, cfgInfo, simplifications);
|
|
159
157
|
}
|
|
160
158
|
/**
|
|
161
159
|
* Get the control flow graph (CFG) for the request if already available, otherwise return `undefined`.
|
|
162
|
-
* @param kind - The kind of CFG that is requested.
|
|
163
160
|
* @param simplifications - Simplification passes to be applied to the CFG.
|
|
164
161
|
* @see {@link FlowrAnalyzerCache#controlflow} - to get the control flow graph, computing if necessary.
|
|
165
162
|
*/
|
|
166
|
-
peekControlflow(
|
|
167
|
-
return this.controlFlowCache.peek(
|
|
163
|
+
peekControlflow(simplifications) {
|
|
164
|
+
return this.controlFlowCache.peek(simplifications);
|
|
168
165
|
}
|
|
169
166
|
/**
|
|
170
167
|
* Get the call graph for the request, computing if necessary.
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import type { CfgSimplificationPassName } from '../../control-flow/cfg-simplification';
|
|
2
|
-
import { CfgKind } from '../cfg-kind';
|
|
3
2
|
import type { ControlFlowInformation } from '../../control-flow/control-flow-graph';
|
|
4
3
|
import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
4
|
import type { DataflowInformation } from '../../dataflow/info';
|
|
6
5
|
import type { FlowrAnalyzerContext } from '../context/flowr-analyzer-context';
|
|
7
6
|
interface CfgInfo {
|
|
8
7
|
ctx: FlowrAnalyzerContext;
|
|
9
|
-
cfgQuick: ControlFlowInformation | undefined;
|
|
10
8
|
dfg: () => Promise<DataflowInformation>;
|
|
11
9
|
ast: () => Promise<NormalizedAst>;
|
|
12
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Caches the control flow graph of a request.
|
|
13
|
+
*
|
|
14
|
+
* The control flow graph is a view on the dataflow graph (see {@link ControlFlowGraph}), so what is
|
|
15
|
+
* cached here is not the analysis but the simplification passes applied on top of it: the projection itself
|
|
16
|
+
* is lazy and costs nothing until something walks it.
|
|
17
|
+
*/
|
|
13
18
|
export declare class FlowrAnalyzerControlFlowCache {
|
|
14
19
|
private readonly cache;
|
|
15
|
-
peek(
|
|
16
|
-
get(force: boolean | undefined,
|
|
17
|
-
/**
|
|
18
|
-
* Create and cache the base CFG without simplifications.
|
|
19
|
-
*/
|
|
20
|
-
private createAndCacheBaseCfg;
|
|
20
|
+
peek(simplifications: readonly CfgSimplificationPassName[] | undefined): ControlFlowInformation | undefined;
|
|
21
|
+
get(force: boolean | undefined, cfgCacheInfo: CfgInfo, simplifications?: readonly CfgSimplificationPassName[]): Promise<ControlFlowInformation>;
|
|
21
22
|
/**
|
|
22
23
|
* Try to get a cached CFG with some of the requested simplifications already applied.
|
|
23
24
|
* Matches the longest prefix of simplifications available.
|
|
@@ -3,63 +3,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FlowrAnalyzerControlFlowCache = void 0;
|
|
4
4
|
const objectmap_1 = require("../../util/collections/objectmap");
|
|
5
5
|
const cfg_simplification_1 = require("../../control-flow/cfg-simplification");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const control_flow_graph_1 = require("../../control-flow/control-flow-graph");
|
|
7
|
+
/**
|
|
8
|
+
* Caches the control flow graph of a request.
|
|
9
|
+
*
|
|
10
|
+
* The control flow graph is a view on the dataflow graph (see {@link ControlFlowGraph}), so what is
|
|
11
|
+
* cached here is not the analysis but the simplification passes applied on top of it: the projection itself
|
|
12
|
+
* is lazy and costs nothing until something walks it.
|
|
13
|
+
*/
|
|
9
14
|
class FlowrAnalyzerControlFlowCache {
|
|
10
15
|
cache = new objectmap_1.ObjectMap();
|
|
11
|
-
peek(
|
|
12
|
-
return this.cache.get([simplifications ?? []
|
|
16
|
+
peek(simplifications) {
|
|
17
|
+
return this.cache.get([simplifications ?? []]);
|
|
13
18
|
}
|
|
14
|
-
async get(force,
|
|
15
|
-
(0, assert_1.guard)(kind === cfg_kind_1.CfgKind.Quick ? simplifications === undefined : true, 'Cannot apply simplifications to quick CFG');
|
|
19
|
+
async get(force, cfgCacheInfo, simplifications) {
|
|
16
20
|
simplifications ??= [];
|
|
17
21
|
const orderedSimplifications = this.normalizeSimplificationOrder(simplifications);
|
|
18
22
|
const cached = force ?
|
|
19
23
|
{ cfg: undefined, missingSimplifications: orderedSimplifications }
|
|
20
|
-
: this.tryGetCachedCfg(orderedSimplifications
|
|
24
|
+
: this.tryGetCachedCfg(orderedSimplifications);
|
|
21
25
|
let cfg = cached.cfg;
|
|
22
26
|
if (!cfg) {
|
|
23
|
-
cfg =
|
|
27
|
+
cfg = (0, control_flow_graph_1.extractCfg)(await cfgCacheInfo.dfg());
|
|
28
|
+
this.cache.set([[]], cfg);
|
|
24
29
|
}
|
|
25
30
|
if (cached.missingSimplifications.length > 0) {
|
|
26
31
|
const cfgPassInfo = { dfg: (await cfgCacheInfo.dfg()).graph, ctx: cfgCacheInfo.ctx, ast: await cfgCacheInfo.ast() };
|
|
27
32
|
cfg = (0, cfg_simplification_1.simplifyControlFlowInformation)(cfg, cfgPassInfo, cached.missingSimplifications);
|
|
28
33
|
}
|
|
29
|
-
this.cache.set([orderedSimplifications
|
|
34
|
+
this.cache.set([orderedSimplifications], cfg);
|
|
30
35
|
return cfg;
|
|
31
36
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Create and cache the base CFG without simplifications.
|
|
34
|
-
*/
|
|
35
|
-
async createAndCacheBaseCfg(kind, { cfgQuick, dfg, ctx, ast }) {
|
|
36
|
-
let result;
|
|
37
|
-
switch (kind) {
|
|
38
|
-
case cfg_kind_1.CfgKind.WithDataflow:
|
|
39
|
-
result = (0, extract_cfg_1.extractCfg)(await ast(), ctx, (await dfg()).graph);
|
|
40
|
-
break;
|
|
41
|
-
case cfg_kind_1.CfgKind.NoDataflow:
|
|
42
|
-
result = (0, extract_cfg_1.extractCfg)(await ast(), ctx);
|
|
43
|
-
break;
|
|
44
|
-
case cfg_kind_1.CfgKind.NoFunctionDefs:
|
|
45
|
-
result = (0, extract_cfg_1.extractCfg)(await ast(), ctx, undefined, undefined, true);
|
|
46
|
-
break;
|
|
47
|
-
case cfg_kind_1.CfgKind.Quick:
|
|
48
|
-
result = cfgQuick ?? (0, extract_cfg_1.extractCfgQuick)(await ast());
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
this.cache.set([[], kind], result);
|
|
52
|
-
return result;
|
|
53
|
-
}
|
|
54
37
|
/**
|
|
55
38
|
* Try to get a cached CFG with some of the requested simplifications already applied.
|
|
56
39
|
* Matches the longest prefix of simplifications available.
|
|
57
40
|
* @returns The cached CFG and the missing simplifications to be applied, or `undefined` if no cached CFG is available.
|
|
58
41
|
*/
|
|
59
|
-
tryGetCachedCfg(simplifications
|
|
42
|
+
tryGetCachedCfg(simplifications) {
|
|
60
43
|
for (let prefixLen = simplifications.length; prefixLen >= 0; prefixLen--) {
|
|
61
44
|
const prefix = simplifications.slice(0, prefixLen);
|
|
62
|
-
const cached = this.cache.get([prefix
|
|
45
|
+
const cached = this.cache.get([prefix]);
|
|
63
46
|
if (cached !== undefined) {
|
|
64
47
|
return {
|
|
65
48
|
cfg: cached,
|
|
@@ -34,6 +34,15 @@ export type InvalidationEventHandler<Content extends StringableContent = Stringa
|
|
|
34
34
|
export interface InvalidationEventReceiver<Content extends StringableContent = StringableContent> {
|
|
35
35
|
receive: InvalidationEventHandler<Content>;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The {@link InvalidationEventReceiver.receive} of every context that only caches project-wide state: a full
|
|
39
|
+
* invalidation drops it, a single changed file leaves it valid.
|
|
40
|
+
* @param target - The receiver whose state is dropped.
|
|
41
|
+
* @param event - The invalidation to handle.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resetOnFullInvalidation(target: {
|
|
44
|
+
reset(): void;
|
|
45
|
+
}, event: InvalidationEvent): void;
|
|
37
46
|
/**
|
|
38
47
|
* Central class for caching analysis results in FlowR.
|
|
39
48
|
*/
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowrCache = void 0;
|
|
4
|
+
exports.resetOnFullInvalidation = resetOnFullInvalidation;
|
|
4
5
|
const assert_1 = require("../../util/assert");
|
|
6
|
+
/**
|
|
7
|
+
* The {@link InvalidationEventReceiver.receive} of every context that only caches project-wide state: a full
|
|
8
|
+
* invalidation drops it, a single changed file leaves it valid.
|
|
9
|
+
* @param target - The receiver whose state is dropped.
|
|
10
|
+
* @param event - The invalidation to handle.
|
|
11
|
+
*/
|
|
12
|
+
function resetOnFullInvalidation(target, event) {
|
|
13
|
+
const type = event.type;
|
|
14
|
+
switch (type) {
|
|
15
|
+
case "full" /* InvalidationEventType.Full */:
|
|
16
|
+
target.reset();
|
|
17
|
+
break;
|
|
18
|
+
case "single-file-invalidate" /* InvalidationEventType.SingleFileInvalidate */:
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
(0, assert_1.assertUnreachable)(type);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
5
24
|
/**
|
|
6
25
|
* Central class for caching analysis results in FlowR.
|
|
7
26
|
*/
|
|
@@ -77,8 +77,8 @@ export declare const enum RVersionOrigin {
|
|
|
77
77
|
* Besides these, this layer only orchestrates the different steps and layers, providing a collection of convenience methods.
|
|
78
78
|
* In general, you do not have to worry about these details, as the {@link FlowrAnalyzerBuilder} and {@link FlowrAnalyzer} take care of them.
|
|
79
79
|
*
|
|
80
|
-
* To inspect, e.g., the loading order, you can do so via {@link files.loadingOrder.getLoadingOrder}.
|
|
81
|
-
* {@link deps.getDependency}.
|
|
80
|
+
* To inspect, e.g., the loading order, you can do so via {@link ReadOnlyFlowrAnalyzerLoadingOrderContext#getLoadingOrder|files.loadingOrder.getLoadingOrder}.
|
|
81
|
+
* To get information on a specific library, use {@link ReadOnlyFlowrAnalyzerDependenciesContext#getDependency|deps.getDependency}.
|
|
82
82
|
* If you are just interested in inspecting the context, you can use {@link ReadOnlyFlowrAnalyzerContext} instead (e.g., via {@link inspect}).
|
|
83
83
|
*/
|
|
84
84
|
export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContext, InvalidationEventReceiver {
|
|
@@ -130,7 +130,11 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
|
|
|
130
130
|
} | undefined;
|
|
131
131
|
/** {@link projectKind}, resolved with {@link baseConfig}, as classifying the project reads the config again */
|
|
132
132
|
private kindToSpecializeFor;
|
|
133
|
-
|
|
133
|
+
/**
|
|
134
|
+
* @param config - The configuration to analyze with.
|
|
135
|
+
* @param plugins - The plugins to run, either already grouped by their {@link PluginType} or as a plain list.
|
|
136
|
+
*/
|
|
137
|
+
constructor(config: FlowrConfig, plugins?: ReadonlyMap<PluginType, readonly FlowrAnalyzerPlugin[]> | readonly FlowrAnalyzerPlugin[]);
|
|
134
138
|
/**
|
|
135
139
|
* Provides the analyzer associated with this context, if any.
|
|
136
140
|
* This is usually set when the context is used within an analyzer instance.
|
|
@@ -25,8 +25,8 @@ const flowr_analyzer_gas_context_1 = require("./flowr-analyzer-gas-context");
|
|
|
25
25
|
* Besides these, this layer only orchestrates the different steps and layers, providing a collection of convenience methods.
|
|
26
26
|
* In general, you do not have to worry about these details, as the {@link FlowrAnalyzerBuilder} and {@link FlowrAnalyzer} take care of them.
|
|
27
27
|
*
|
|
28
|
-
* To inspect, e.g., the loading order, you can do so via {@link files.loadingOrder.getLoadingOrder}.
|
|
29
|
-
* {@link deps.getDependency}.
|
|
28
|
+
* To inspect, e.g., the loading order, you can do so via {@link ReadOnlyFlowrAnalyzerLoadingOrderContext#getLoadingOrder|files.loadingOrder.getLoadingOrder}.
|
|
29
|
+
* To get information on a specific library, use {@link ReadOnlyFlowrAnalyzerDependenciesContext#getDependency|deps.getDependency}.
|
|
30
30
|
* If you are just interested in inspecting the context, you can use {@link ReadOnlyFlowrAnalyzerContext} instead (e.g., via {@link inspect}).
|
|
31
31
|
*/
|
|
32
32
|
class FlowrAnalyzerContext {
|
|
@@ -141,18 +141,24 @@ class FlowrAnalyzerContext {
|
|
|
141
141
|
this._classifying = false;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
/**
|
|
145
|
+
* @param config - The configuration to analyze with.
|
|
146
|
+
* @param plugins - The plugins to run, either already grouped by their {@link PluginType} or as a plain list.
|
|
147
|
+
*/
|
|
148
|
+
constructor(config, plugins = []) {
|
|
149
|
+
const byType = Array.isArray(plugins) ? (0, arrays_1.arraysGroupBy)(plugins, p => p.type)
|
|
150
|
+
: plugins;
|
|
145
151
|
this.baseConfig = config;
|
|
146
152
|
this._config = config;
|
|
147
|
-
const loadingOrder = new flowr_analyzer_loading_order_context_1.FlowrAnalyzerLoadingOrderContext(this,
|
|
148
|
-
this.files = new flowr_analyzer_files_context_1.FlowrAnalyzerFilesContext(this, loadingOrder, (
|
|
153
|
+
const loadingOrder = new flowr_analyzer_loading_order_context_1.FlowrAnalyzerLoadingOrderContext(this, byType.get(flowr_analyzer_plugin_1.PluginType.LoadingOrder));
|
|
154
|
+
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) ?? []));
|
|
149
155
|
this.env = new flowr_analyzer_environment_context_1.FlowrAnalyzerEnvironmentContext(this);
|
|
150
156
|
this.inc = new flowr_analyzer_incremental_analysis_context_1.FlowrAnalyzerIncrementalAnalysisContext(this);
|
|
151
157
|
const functions = new flowr_analyzer_functions_context_1.FlowrAnalyzerFunctionsContext(this);
|
|
152
|
-
this.deps = new flowr_analyzer_dependencies_context_1.FlowrAnalyzerDependenciesContext(functions, (
|
|
158
|
+
this.deps = new flowr_analyzer_dependencies_context_1.FlowrAnalyzerDependenciesContext(functions, (byType.get(flowr_analyzer_plugin_1.PluginType.DependencyIdentification) ?? []));
|
|
153
159
|
// the plugins contributing the metadata are the ones the dependency context runs on demand
|
|
154
160
|
this.meta = new flowr_analyzer_meta_context_1.FlowrAnalyzerMetaContext(() => this.deps.ensureStaticsLoaded());
|
|
155
|
-
this.gas = new flowr_analyzer_gas_context_1.FlowrAnalyzerGasContext(this, config.gas, (
|
|
161
|
+
this.gas = new flowr_analyzer_gas_context_1.FlowrAnalyzerGasContext(this, config.gas, (byType.get(flowr_analyzer_plugin_1.PluginType.Gas) ?? []));
|
|
156
162
|
}
|
|
157
163
|
/**
|
|
158
164
|
* Provides the analyzer associated with this context, if any.
|
|
@@ -249,7 +255,7 @@ exports.FlowrAnalyzerContext = FlowrAnalyzerContext;
|
|
|
249
255
|
* @see {@link contextFromSources} - to create a context from source code strings directly.
|
|
250
256
|
*/
|
|
251
257
|
function contextFromInput(input, config = config_1.FlowrConfig.default(), plugins) {
|
|
252
|
-
const context = new FlowrAnalyzerContext(config,
|
|
258
|
+
const context = new FlowrAnalyzerContext(config, plugins);
|
|
253
259
|
if (typeof input === 'string' || Array.isArray(input) && input.every(i => typeof i === 'string')) {
|
|
254
260
|
const requests = (0, retriever_1.requestFromInput)(input);
|
|
255
261
|
context.addRequests(Array.isArray(requests) ? requests : [requests]);
|
|
@@ -269,7 +275,7 @@ function contextFromInput(input, config = config_1.FlowrConfig.default(), plugin
|
|
|
269
275
|
* @see {@link FlowrInlineTextFile} - to create inline text files for the sources.
|
|
270
276
|
*/
|
|
271
277
|
function contextFromSources(sources, config = config_1.FlowrConfig.default(), plugins) {
|
|
272
|
-
const context = new FlowrAnalyzerContext(config,
|
|
278
|
+
const context = new FlowrAnalyzerContext(config, plugins);
|
|
273
279
|
for (const [p, c] of Object.entries(sources)) {
|
|
274
280
|
context.addFile(new flowr_file_1.FlowrInlineTextFile(p, c));
|
|
275
281
|
}
|