@eagleoutice/flowr 2.14.0 → 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 +169 -91
- 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 +18 -11
- package/benchmark/calibration.js +37 -27
- package/benchmark/slicer.d.ts +9 -2
- package/benchmark/slicer.js +44 -37
- 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/benchmark-app.js +4 -1
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +2 -2
- package/cli/common/options.d.ts +5 -0
- package/cli/common/options.js +1 -0
- package/cli/common/scripts-info.d.ts +5 -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/execute.d.ts +2 -2
- package/cli/repl/execute.js +2 -2
- 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 +12 -9
- 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 +64 -32
- package/dataflow/environments/built-in-props.d.ts +10 -2
- package/dataflow/environments/built-in-props.js +9 -1
- 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 +188 -8
- package/dataflow/environments/default-builtin-config.js +112 -39
- package/dataflow/environments/environment.d.ts +9 -1
- package/dataflow/environments/environment.js +25 -7
- package/dataflow/environments/identifier.d.ts +12 -1
- package/dataflow/environments/identifier.js +4 -1
- package/dataflow/environments/query-fn-props.d.ts +6 -0
- package/dataflow/environments/query-fn-props.js +20 -0
- package/dataflow/environments/resolve-by-name.d.ts +7 -0
- package/dataflow/environments/resolve-by-name.js +26 -2
- 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 +10 -7
- package/dataflow/eval/resolve/resolve-strings.js +2 -2
- package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
- package/dataflow/eval/resolve/resolve-working-directory.js +5 -5
- 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 +6 -2
- package/dataflow/fn/exceptions-of-function.js +85 -38
- package/dataflow/fn/strict-function.d.ts +40 -0
- package/dataflow/fn/strict-function.js +339 -0
- package/dataflow/graph/call-graph.js +2 -2
- package/dataflow/graph/df-helper.d.ts +17 -2
- package/dataflow/graph/df-helper.js +19 -3
- 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 +32 -5
- package/dataflow/graph/graph.js +65 -4
- package/dataflow/graph/match-args.d.ts +69 -0
- package/dataflow/graph/match-args.js +167 -0
- package/dataflow/info.d.ts +40 -0
- package/dataflow/info.js +28 -1
- 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 +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +97 -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 +15 -12
- 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/built-in/transitive-side-effects.js +29 -8
- 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-core.js +1 -1
- package/documentation/wiki-dataflow-graph.js +85 -53
- package/documentation/wiki-linter.js +16 -1
- package/documentation/wiki-linting-and-testing.js +1 -16
- package/documentation/wiki-mk/doc-maker.js +6 -4
- package/documentation/wiki-query.js +67 -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 +47 -11
- package/linter/linter-rules.d.ts +64 -9
- package/linter/linter-rules.js +5 -1
- 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 +3 -3
- package/linter/rules/stop-with-call-arg.js +2 -2
- package/linter/rules/unclosed-connection.d.ts +44 -0
- package/linter/rules/unclosed-connection.js +200 -0
- 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 +5 -8
- 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 +3 -10
- package/project/dependency-version-space.js +10 -9
- package/project/flowr-analyzer.d.ts +4 -6
- package/project/flowr-analyzer.js +4 -5
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +23 -35
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
- 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/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +33 -6
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- 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 +5 -3
- package/project/sigdb/manifest.js +50 -9
- package/project/sigdb/reader.d.ts +48 -13
- package/project/sigdb/reader.js +3 -2
- package/project/sigdb/schema.d.ts +5 -3
- package/project/sigdb/schema.js +2 -2
- 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/dependencies-query/link-devices.js +2 -8
- 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-executor.js +2 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
- package/queries/catalog/signature-query/signature-query-executor.js +4 -3
- package/queries/catalog/slice-query-options.d.ts +1 -1
- package/queries/catalog/slice-query-options.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/queries/query-function-filter.d.ts +8 -2
- package/queries/query-function-filter.js +11 -1
- package/queries/query.d.ts +11 -1
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/model.js +4 -4
- 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 +4 -15
- 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.d.ts +2 -2
- package/slicing/criterion/parse.js +10 -8
- package/slicing/static/fingerprint.js +1 -1
- 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 +21 -0
- package/util/objects.js +60 -0
- package/util/prefix.d.ts +1 -1
- package/util/simple-df/dfg-ascii.js +14 -3
- package/util/text/name-rank.d.ts +1 -1
- package/util/text/name-rank.js +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
|
@@ -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
|
}
|
|
@@ -7,6 +7,7 @@ import type { DecodedFunction } from '../sigdb/decode';
|
|
|
7
7
|
import type { Range } from 'semver';
|
|
8
8
|
import type { FlowrAnalyzerFunctionsContext, ReadOnlyFlowrAnalyzerFunctionsContext } from './flowr-analyzer-functions-context';
|
|
9
9
|
import type { InvalidationEvent, InvalidationEventReceiver } from '../cache/flowr-cache';
|
|
10
|
+
import { type SignatureDb } from '../sigdb/signature-db';
|
|
10
11
|
/**
|
|
11
12
|
* Read-only interface to the {@link FlowrAnalyzerDependenciesContext} for inspecting dependencies without modifying them.
|
|
12
13
|
*/
|
|
@@ -71,14 +72,33 @@ export interface ReadOnlyFlowrAnalyzerDependenciesContext {
|
|
|
71
72
|
* available or the signature database is disabled.
|
|
72
73
|
*/
|
|
73
74
|
packagesExporting(name: string): readonly string[];
|
|
74
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* The way to reach the signature database programmatically.
|
|
77
|
+
*
|
|
78
|
+
* Everything the database can answer is on the returned {@link SignatureDb}, and it answers for the version
|
|
79
|
+
* _this project_ assumes for each package, which is the one `solver.sigdb.versionOverrides`,
|
|
80
|
+
* `solver.sigdb.versionSelection` and `solver.sigdb.assumedRVersion` produced. A bare
|
|
81
|
+
* {@link PackageSignatureSource} would instead answer for whatever it happens to hold as newest.
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const db = analyzer.inspectContext().deps.signatures();
|
|
85
|
+
* db.versionOf('dplyr'); // the version the analysis assumes
|
|
86
|
+
* db.functionOf(Identifier.make('lead', 'dplyr')); // its database entry
|
|
87
|
+
* db.parametersOf(Identifier.make('lead', 'dplyr')); // its formals, ready for MatchArgs.toNames
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
signatures(): SignatureDb;
|
|
91
|
+
/**
|
|
92
|
+
* The signature sources the version plugins currently have loaded, as they are. Prefer
|
|
93
|
+
* {@link signatures}, which is the same sources as one database with the versions already resolved.
|
|
94
|
+
*/
|
|
75
95
|
signatureSources(): readonly PackageSignatureSource[];
|
|
76
96
|
/**
|
|
77
97
|
* The signature-database entry for the qualified call `id` (a `pkg::fn` {@link Identifier}) from the first
|
|
78
98
|
* {@link signatureSources|source} that has it, resolving the package version from the project's dependency info
|
|
79
99
|
* unless `version` overrides it. This is the easy way to obtain a function's parameters from a context: pass
|
|
80
|
-
* `fn.signature`
|
|
81
|
-
*
|
|
100
|
+
* `fn.signature` to {@link MatchArgs.toNames}. `undefined` if `id` is unqualified or no loaded source defines it.
|
|
101
|
+
* @useInstead {@link SignatureDb.functionOf}
|
|
82
102
|
*/
|
|
83
103
|
signatureOf(id: Identifier, version?: string): DecodedFunction | undefined;
|
|
84
104
|
}
|
|
@@ -102,6 +122,7 @@ export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnaly
|
|
|
102
122
|
availableSignatureDatabases(): readonly string[];
|
|
103
123
|
hasSignatureDatabase(): boolean;
|
|
104
124
|
packagesExporting(name: string): readonly string[];
|
|
125
|
+
signatures(): SignatureDb;
|
|
105
126
|
signatureSources(): readonly PackageSignatureSource[];
|
|
106
127
|
signatureOf(id: Identifier, version?: string): DecodedFunction | undefined;
|
|
107
128
|
/** Whether any version plugin can resolve the base-R packages (a versioned signature source is available). */
|
|
@@ -5,9 +5,11 @@ const abstract_flowr_analyzer_context_1 = require("./abstract-flowr-analyzer-con
|
|
|
5
5
|
const flowr_analyzer_package_versions_plugin_1 = require("../plugins/package-version-plugins/flowr-analyzer-package-versions-plugin");
|
|
6
6
|
const package_1 = require("../plugins/package-version-plugins/package");
|
|
7
7
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
8
|
-
const
|
|
8
|
+
const flowr_cache_1 = require("../cache/flowr-cache");
|
|
9
9
|
const config_1 = require("../../config");
|
|
10
10
|
const r_version_1 = require("../../util/r-version");
|
|
11
|
+
const arrays_1 = require("../../util/collections/arrays");
|
|
12
|
+
const signature_db_1 = require("../sigdb/signature-db");
|
|
11
13
|
/**
|
|
12
14
|
* Manages the project's dependencies, their versions, and their interplay with {@link FlowrAnalyzerPackageVersionsPlugin}s.
|
|
13
15
|
*/
|
|
@@ -39,7 +41,7 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
39
41
|
return this.plugins.flatMap(p => p.loadedDatabases());
|
|
40
42
|
}
|
|
41
43
|
availableSignatureDatabases() {
|
|
42
|
-
return
|
|
44
|
+
return (0, arrays_1.uniqueArray)(this.loadedSignatureDatabases().map(d => d.scope));
|
|
43
45
|
}
|
|
44
46
|
hasSignatureDatabase() {
|
|
45
47
|
return (0, config_1.isSigDbEnabled)(this.ctx.config) && this.plugins.some(p => p.loadedDatabases().length > 0);
|
|
@@ -56,6 +58,9 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
56
58
|
}
|
|
57
59
|
return [...out];
|
|
58
60
|
}
|
|
61
|
+
signatures() {
|
|
62
|
+
return (0, signature_db_1.signatureDbOf)(this);
|
|
63
|
+
}
|
|
59
64
|
signatureSources() {
|
|
60
65
|
if (!(0, config_1.isSigDbEnabled)(this.ctx.config)) {
|
|
61
66
|
return [];
|
|
@@ -106,17 +111,7 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
receive(event) {
|
|
109
|
-
|
|
110
|
-
switch (type) {
|
|
111
|
-
case "full" /* InvalidationEventType.Full */:
|
|
112
|
-
this.reset();
|
|
113
|
-
break;
|
|
114
|
-
case "single-file-invalidate" /* InvalidationEventType.SingleFileInvalidate */:
|
|
115
|
-
// nothing to do
|
|
116
|
-
break;
|
|
117
|
-
default:
|
|
118
|
-
(0, assert_1.assertUnreachable)(type);
|
|
119
|
-
}
|
|
114
|
+
(0, flowr_cache_1.resetOnFullInvalidation)(this, event);
|
|
120
115
|
}
|
|
121
116
|
constructor(functionsContext, plugins) {
|
|
122
117
|
super(functionsContext.getAttachedContext(), flowr_analyzer_package_versions_plugin_1.FlowrAnalyzerPackageVersionsPlugin.defaultPlugin(), plugins);
|
|
@@ -208,7 +203,7 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
208
203
|
declaredPackageNames() {
|
|
209
204
|
this.ensureStaticsLoaded();
|
|
210
205
|
const declared = Object.values(this.ctx.meta.getDeclaredPackages());
|
|
211
|
-
return
|
|
206
|
+
return (0, arrays_1.uniqueArray)(declared.flatMap(group => group?.map(p => p.name) ?? []));
|
|
212
207
|
}
|
|
213
208
|
}
|
|
214
209
|
exports.FlowrAnalyzerDependenciesContext = FlowrAnalyzerDependenciesContext;
|
|
@@ -16,6 +16,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
16
16
|
const files_1 = require("../../util/files");
|
|
17
17
|
const glob_1 = require("../../util/glob");
|
|
18
18
|
const classify_project_kind_1 = require("./classify-project-kind");
|
|
19
|
+
const flowr_cache_1 = require("../cache/flowr-cache");
|
|
19
20
|
const fileLog = log_1.log.getSubLogger({ name: 'flowr-analyzer-files-context' });
|
|
20
21
|
function wrapFile(file, roles) {
|
|
21
22
|
if (typeof file === 'string') {
|
|
@@ -28,6 +29,13 @@ function wrapFile(file, roles) {
|
|
|
28
29
|
return file;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Whether the file system says the path is there. Where there is none, as in a browser, the stub standing
|
|
34
|
+
* in for `fs` answers every question with itself, so only a real `true` counts as an answer.
|
|
35
|
+
*/
|
|
36
|
+
function onDisk(path) {
|
|
37
|
+
return fs_1.default.existsSync(path) === true;
|
|
38
|
+
}
|
|
31
39
|
/**
|
|
32
40
|
* This is the analyzer file context to be modified by all plugins that affect the files.
|
|
33
41
|
* If you are interested in inspecting these files, refer to {@link ReadOnlyFlowrAnalyzerFilesContext}.
|
|
@@ -86,19 +94,9 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
86
94
|
const root = this.root();
|
|
87
95
|
return root === undefined ? filePath : (0, files_1.relativeTo)(root, filePath);
|
|
88
96
|
}
|
|
97
|
+
/* only the content of a known file changes the file set, so revisit once we add dedicated FileAdded / FileRemoved events */
|
|
89
98
|
receive(event) {
|
|
90
|
-
|
|
91
|
-
switch (type) {
|
|
92
|
-
case "full" /* InvalidationEventType.Full */:
|
|
93
|
-
this.reset();
|
|
94
|
-
break;
|
|
95
|
-
case "single-file-invalidate" /* InvalidationEventType.SingleFileInvalidate */:
|
|
96
|
-
// only the content of a known file changed, so the file set stays valid -> nothing to do.
|
|
97
|
-
// revisit once we add dedicated FileAdded / FileRemoved events.
|
|
98
|
-
break;
|
|
99
|
-
default:
|
|
100
|
-
(0, assert_1.assertUnreachable)(type);
|
|
101
|
-
}
|
|
99
|
+
(0, flowr_cache_1.resetOnFullInvalidation)(this, event);
|
|
102
100
|
}
|
|
103
101
|
/**
|
|
104
102
|
* Record that a file has been considered during dataflow analysis.
|
|
@@ -207,7 +205,7 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
207
205
|
return;
|
|
208
206
|
}
|
|
209
207
|
this.implicitSourceDirs.add(dir);
|
|
210
|
-
if (!
|
|
208
|
+
if (!onDisk(dir) || !fs_1.default.statSync(dir).isDirectory()) {
|
|
211
209
|
return;
|
|
212
210
|
}
|
|
213
211
|
const matchers = implicit.map(entry => (0, glob_1.globMatcher)(entry));
|
|
@@ -264,7 +262,7 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
264
262
|
return this.files.has(path);
|
|
265
263
|
}
|
|
266
264
|
hasFile(path) {
|
|
267
|
-
return this.hasCached(path) || (this.ctx.config.project.resolveUnknownPathsOnDisk &&
|
|
265
|
+
return this.hasCached(path) || (this.ctx.config.project.resolveUnknownPathsOnDisk && onDisk(path));
|
|
268
266
|
}
|
|
269
267
|
exists(p, ignoreCase) {
|
|
270
268
|
try {
|
|
@@ -290,13 +288,13 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
290
288
|
}
|
|
291
289
|
if (this.ctx.config.project.resolveUnknownPathsOnDisk) {
|
|
292
290
|
let files;
|
|
293
|
-
if (
|
|
291
|
+
if (onDisk(dir)) {
|
|
294
292
|
files = fs_1.default.readdirSync(dir);
|
|
295
293
|
}
|
|
296
294
|
else {
|
|
297
295
|
// try to find a dir in parent
|
|
298
296
|
const parentDir = path_1.default.dirname(dir);
|
|
299
|
-
if (
|
|
297
|
+
if (onDisk(parentDir)) {
|
|
300
298
|
const parentFiles = fs_1.default.readdirSync(parentDir);
|
|
301
299
|
const foundDir = parentFiles.find(f => f.toLowerCase() === path_1.default.basename(dir).toLowerCase());
|
|
302
300
|
if (foundDir) {
|
|
@@ -342,7 +340,7 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
342
340
|
}
|
|
343
341
|
if (this.ctx.config.project.resolveUnknownPathsOnDisk) {
|
|
344
342
|
fileLog.debug(`File ${path} not found in context, trying to load from disk.`);
|
|
345
|
-
if (
|
|
343
|
+
if (onDisk(path)) {
|
|
346
344
|
return this.addFile(new flowr_file_1.FlowrTextFile(path));
|
|
347
345
|
}
|
|
348
346
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowrAnalyzerMetaContext = exports.MetaPriority = void 0;
|
|
4
|
-
const
|
|
4
|
+
const flowr_cache_1 = require("../cache/flowr-cache");
|
|
5
5
|
/**
|
|
6
6
|
* How much a {@link ProjectMetaFields | contribution} is trusted, in case several sources disagree.
|
|
7
7
|
* A higher value wins; among equal values the first contribution stays.
|
|
@@ -36,17 +36,7 @@ class FlowrAnalyzerMetaContext {
|
|
|
36
36
|
this.fields.clear();
|
|
37
37
|
}
|
|
38
38
|
receive(event) {
|
|
39
|
-
|
|
40
|
-
switch (type) {
|
|
41
|
-
case "full" /* InvalidationEventType.Full */:
|
|
42
|
-
this.reset();
|
|
43
|
-
break;
|
|
44
|
-
case "single-file-invalidate" /* InvalidationEventType.SingleFileInvalidate */:
|
|
45
|
-
// nothing to do
|
|
46
|
-
break;
|
|
47
|
-
default:
|
|
48
|
-
(0, assert_1.assertUnreachable)(type);
|
|
49
|
-
}
|
|
39
|
+
(0, flowr_cache_1.resetOnFullInvalidation)(this, event);
|
|
50
40
|
}
|
|
51
41
|
/**
|
|
52
42
|
* Contribute what a source declares about the project; `undefined` fields are ignored, so a plugin can pass
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The dependency version space: for each dependency, the set of signature-database versions that survive the
|
|
3
|
-
* project's constraints (declared ranges, transitive requirements, the base-R/assumed-R bound, a date cutoff, and
|
|
4
|
-
* how the code actually calls the package), and the explosion of that space into concrete per-dependency version
|
|
5
|
-
* assignments. This is a source-agnostic resolver over {@link PackageSignatureSource} and the dependencies context;
|
|
6
|
-
* the `guess-dep-versions` query presents it, but it is usable on its own (e.g. for compatibility-matrix tooling).
|
|
7
|
-
*/
|
|
8
1
|
import { type Range } from 'semver';
|
|
9
2
|
import { type VersionString } from '../util/r-version';
|
|
10
3
|
import { type PackageSignatureSource } from './sigdb/reader';
|
|
@@ -204,7 +197,7 @@ export interface VersionSpaceOptions {
|
|
|
204
197
|
/** constraint sources to skip entirely: neither filtered on nor reported */
|
|
205
198
|
readonly disabled?: ReadonlySet<ConstraintSource>;
|
|
206
199
|
}
|
|
207
|
-
/** a target's sigdb package key, merged source and memoized signature resolver */
|
|
200
|
+
/** a target's sigdb package key, merged source, and memoized signature resolver */
|
|
208
201
|
interface PackageResolution {
|
|
209
202
|
readonly key: string;
|
|
210
203
|
readonly src: PackageSignatureSource | undefined;
|
|
@@ -219,7 +212,7 @@ interface PackageResolution {
|
|
|
219
212
|
/**
|
|
220
213
|
* The version space of one analysis: the surviving versions of each dependency and the transitive constraints
|
|
221
214
|
* refined to a fixpoint. Holding the shared inputs here keeps the passes to a handful of arguments and lets each
|
|
222
|
-
* package's sigdb key, source and decoded signatures be resolved once. The passes revisit the same versions
|
|
215
|
+
* package's sigdb key, source, and decoded signatures be resolved once. The passes revisit the same versions
|
|
223
216
|
* repeatedly, so that memoization is what makes the fixpoint affordable.
|
|
224
217
|
*/
|
|
225
218
|
export declare class VersionSpace {
|
|
@@ -231,7 +224,7 @@ export declare class VersionSpace {
|
|
|
231
224
|
readonly disabled: ReadonlySet<ConstraintSource>;
|
|
232
225
|
private readonly resolved;
|
|
233
226
|
constructor({ deps, usage, cutoff, rVersion, disabled }: VersionSpaceOptions);
|
|
234
|
-
/** the sigdb package, source and signature resolver of a target, resolved once */
|
|
227
|
+
/** the sigdb package, source, and signature resolver of a target, resolved once */
|
|
235
228
|
resolve(name: string): PackageResolution;
|
|
236
229
|
/** the versions of `name` surviving every constraint, see {@link survivingEntries} */
|
|
237
230
|
survivors(name: string, transitive: readonly TransitiveConstraint[], observe?: ConstraintObserver): SurvivingEntries;
|
|
@@ -25,12 +25,12 @@ exports.explodeDependencyVersions = explodeDependencyVersions;
|
|
|
25
25
|
* assignments. This is a source-agnostic resolver over {@link PackageSignatureSource} and the dependencies context;
|
|
26
26
|
* the `guess-dep-versions` query presents it, but it is usable on its own (e.g. for compatibility-matrix tooling).
|
|
27
27
|
*/
|
|
28
|
+
const match_args_1 = require("../dataflow/graph/match-args");
|
|
28
29
|
const semver_1 = require("semver");
|
|
29
30
|
const r_version_1 = require("../util/r-version");
|
|
30
31
|
const prefix_1 = require("../util/prefix");
|
|
31
32
|
const r_base_primitives_generated_1 = require("../data/r-base-primitives.generated");
|
|
32
33
|
const reader_1 = require("./sigdb/reader");
|
|
33
|
-
const signature_match_1 = require("./sigdb/signature-match");
|
|
34
34
|
const sigdb_version_1 = require("./sigdb/sigdb-version");
|
|
35
35
|
const identifier_1 = require("../dataflow/environments/identifier");
|
|
36
36
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
@@ -38,8 +38,9 @@ const graph_1 = require("../dataflow/graph/graph");
|
|
|
38
38
|
const df_helper_1 = require("../dataflow/graph/df-helper");
|
|
39
39
|
const r_base_packages_1 = require("../util/r-base-packages");
|
|
40
40
|
const undefined_symbol_util_1 = require("../linter/rules/undefined-symbol-util");
|
|
41
|
-
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
42
41
|
const built_in_s_seven_new_generic_1 = require("../dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic");
|
|
42
|
+
const r_string_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
43
|
+
const arrays_1 = require("../util/collections/arrays");
|
|
43
44
|
/** the pseudo-package standing for the analyzed project itself, never one of its own dependencies */
|
|
44
45
|
exports.ProjectPackage = 'current';
|
|
45
46
|
/** default safety cap on how many assignments {@link explodeDependencyVersions} yields */
|
|
@@ -92,7 +93,7 @@ function argStringLiteral(graph, arg) {
|
|
|
92
93
|
return undefined;
|
|
93
94
|
}
|
|
94
95
|
const node = graph.idMap?.get(id);
|
|
95
|
-
return
|
|
96
|
+
return r_string_1.RString.is(node) ? node.content.str : undefined;
|
|
96
97
|
}
|
|
97
98
|
/** class names used as a string literal in the code (`inherits(x, "zoo")`, `new("Foo")`, ...); only direct literals, not variables or `c(...)` */
|
|
98
99
|
function collectCodeClassUses(graph) {
|
|
@@ -309,7 +310,7 @@ function collectOrphanUsage(graph, deps, usage, isKnown, options = {}) {
|
|
|
309
310
|
}
|
|
310
311
|
// the exporters that lost, with the same calls recorded, so the guess can report what each of them would fit
|
|
311
312
|
const losers = providers.filter(p => p !== pkg);
|
|
312
|
-
alternatives.set(pkg,
|
|
313
|
+
alternatives.set(pkg, (0, arrays_1.uniqueArray)([...alternatives.get(pkg) ?? [], ...losers]));
|
|
313
314
|
for (const alt of losers) {
|
|
314
315
|
recordCallUsage(atKey(alternativeUsage, alt, () => new Map()), name, vertex.args, id);
|
|
315
316
|
}
|
|
@@ -347,7 +348,7 @@ function isCompatible(getFn, version, usage, tracked) {
|
|
|
347
348
|
}
|
|
348
349
|
for (const args of use.calls.values()) {
|
|
349
350
|
// R's matching: exact, pmatch prefix, or positional; `...` absorbs the rest
|
|
350
|
-
const bound =
|
|
351
|
+
const bound = match_args_1.MatchArgs.toSpec(args, decoded.signature);
|
|
351
352
|
let placed = 0;
|
|
352
353
|
for (const ids of bound.values()) {
|
|
353
354
|
placed += ids.length;
|
|
@@ -529,7 +530,7 @@ function makeSignatureFilter(src, pkg, getFn, timeline, usage) {
|
|
|
529
530
|
/**
|
|
530
531
|
* The version space of one analysis: the surviving versions of each dependency and the transitive constraints
|
|
531
532
|
* refined to a fixpoint. Holding the shared inputs here keeps the passes to a handful of arguments and lets each
|
|
532
|
-
* package's sigdb key, source and decoded signatures be resolved once. The passes revisit the same versions
|
|
533
|
+
* package's sigdb key, source, and decoded signatures be resolved once. The passes revisit the same versions
|
|
533
534
|
* repeatedly, so that memoization is what makes the fixpoint affordable.
|
|
534
535
|
*/
|
|
535
536
|
class VersionSpace {
|
|
@@ -548,7 +549,7 @@ class VersionSpace {
|
|
|
548
549
|
this.rVersion = rVersion;
|
|
549
550
|
this.disabled = disabled;
|
|
550
551
|
}
|
|
551
|
-
/** the sigdb package, source and signature resolver of a target, resolved once */
|
|
552
|
+
/** the sigdb package, source, and signature resolver of a target, resolved once */
|
|
552
553
|
resolve(name) {
|
|
553
554
|
let entry = this.resolved.get(name);
|
|
554
555
|
if (entry === undefined) {
|
|
@@ -727,7 +728,7 @@ function countOverForest(factors, tree) {
|
|
|
727
728
|
let total = 1;
|
|
728
729
|
for (let i = 0; i < factors.length; i++) {
|
|
729
730
|
if (!visited[i]) {
|
|
730
|
-
total *=
|
|
731
|
+
total *= (0, arrays_1.arraySum)(subtree(i, -1));
|
|
731
732
|
}
|
|
732
733
|
}
|
|
733
734
|
return total;
|
|
@@ -867,7 +868,7 @@ function orderedCandidatesOf(src, name, surviving, prefer, order) {
|
|
|
867
868
|
}
|
|
868
869
|
/** the default explosion targets: every declared and used dependency (excluding `current`, the analyzed package's own namespace) */
|
|
869
870
|
function defaultTargets(deps, usage) {
|
|
870
|
-
return
|
|
871
|
+
return (0, arrays_1.uniqueArray)([...deps.getDependencies().map(d => d.name), ...usage.keys()]).filter(name => name !== exports.ProjectPackage);
|
|
871
872
|
}
|
|
872
873
|
/**
|
|
873
874
|
* Whether the chosen versions can be loaded together, checking every requirement the chosen versions declare
|