@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
|
@@ -8,6 +8,7 @@ exports.writeManifest = writeManifest;
|
|
|
8
8
|
exports.readManifestFile = readManifestFile;
|
|
9
9
|
exports.readManifestDate = readManifestDate;
|
|
10
10
|
exports.defaultSigDbPath = defaultSigDbPath;
|
|
11
|
+
exports.clearDefaultSigDbPathsMemo = clearDefaultSigDbPathsMemo;
|
|
11
12
|
exports.defaultSigDbPaths = defaultSigDbPaths;
|
|
12
13
|
/**
|
|
13
14
|
* The sharded-database manifest format (shard/dictionary descriptors that route a set of shard files as one
|
|
@@ -58,21 +59,24 @@ function readManifestDate(manifestFile) {
|
|
|
58
59
|
}
|
|
59
60
|
/** richest first: a container shipping the full set uses it, else the slim `current`, else the `base` floor */
|
|
60
61
|
const SigDbScopeOrder = ['full', 'current', 'base'];
|
|
61
|
-
/** layouts a bundled sigdb may sit in, relative to a search root -- the root itself (e.g. a `$FLOWR_SIGDB_DIR` data mount), then the dev `src`, build `dist
|
|
62
|
+
/** layouts a bundled sigdb may sit in, relative to a search root -- the root itself (e.g. a `$FLOWR_SIGDB_DIR` data mount), then the dev `src`, build `dist`, and data-dir layouts */
|
|
62
63
|
const SigDbSubDirs = ['', 'data/sigdb', 'src/data/sigdb', 'dist/src/data/sigdb'];
|
|
63
64
|
/** a `<scope>.manifest.json`, in any of the codecs we can read */
|
|
64
65
|
const ManifestFilePattern = new RegExp(`\\.manifest\\.json${codec_1.CompressedExtPattern}$`);
|
|
65
66
|
/** a `<name>.sigs.ndjson` bundle, in any of the codecs we can read */
|
|
66
67
|
const BundleFilePattern = new RegExp(`${schema_1.SigDbExt.replace(/\./g, '\\.')}${codec_1.CompressedExtPattern}$`);
|
|
67
|
-
function sigDbBundleDirs() {
|
|
68
|
+
function sigDbBundleDirs(watched) {
|
|
68
69
|
if (typeof fs_1.default?.readdirSync !== 'function') {
|
|
69
70
|
return [];
|
|
70
71
|
}
|
|
71
72
|
try {
|
|
72
73
|
const bundles = path_1.default.join((0, decompress_1.sigDbCacheDir)(undefined, false), 'bundles');
|
|
73
|
-
|
|
74
|
+
const mtimeMs = fs_1.default.statSync(bundles).mtimeMs;
|
|
75
|
+
const dirs = fs_1.default.readdirSync(bundles, { withFileTypes: true })
|
|
74
76
|
.filter(e => e.isDirectory())
|
|
75
77
|
.map(e => path_1.default.join(bundles, e.name));
|
|
78
|
+
watched?.push([bundles, mtimeMs]); // a bundle directory appearing here has to be picked up too
|
|
79
|
+
return dirs;
|
|
76
80
|
}
|
|
77
81
|
catch {
|
|
78
82
|
return [];
|
|
@@ -95,7 +99,7 @@ function sigDbSearchRoots(extra) {
|
|
|
95
99
|
}
|
|
96
100
|
/**
|
|
97
101
|
* Location of a bundled sigdb **manifest**, found by walking up from several roots (this module,
|
|
98
|
-
* `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`) and data-mount
|
|
102
|
+
* `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`), and data-mount
|
|
99
103
|
* layouts. With no `scope` it returns the richest available (`full` > `current` > `base`), so a
|
|
100
104
|
* container that ships the full set uses it automatically while a plain npm install falls back to the
|
|
101
105
|
* bundled `base`. Node only (needs `fs`); pass `searchRoots` to override where it looks.
|
|
@@ -139,6 +143,31 @@ function defaultSigDbPath(scope, searchRoots) {
|
|
|
139
143
|
}
|
|
140
144
|
return undefined;
|
|
141
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Memo for {@link defaultSigDbPaths}, keyed by the resolved search roots. The scan costs ~70 `readdirSync` calls
|
|
148
|
+
* to answer with a handful of paths and an analyzer asks for it once on construction, so a per-analyzer run
|
|
149
|
+
* repeats it for nothing. Kept honest by remembering the modification time of every directory the scan read: a
|
|
150
|
+
* bundle dropped next to the shipped ones bumps that directory and the next call rescans.
|
|
151
|
+
*/
|
|
152
|
+
const defaultSigDbPathsMemo = new Map();
|
|
153
|
+
/** Forget what {@link defaultSigDbPaths} discovered, so the next call scans the filesystem again. */
|
|
154
|
+
function clearDefaultSigDbPathsMemo() {
|
|
155
|
+
defaultSigDbPathsMemo.clear();
|
|
156
|
+
}
|
|
157
|
+
/** Whether every directory the memoized scan read still carries the modification time it had back then */
|
|
158
|
+
function memoizedScanStillCurrent(watched) {
|
|
159
|
+
for (const [dir, mtimeMs] of watched) {
|
|
160
|
+
try {
|
|
161
|
+
if (fs_1.default.statSync(dir).mtimeMs !== mtimeMs) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return false; // the directory went away
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
142
171
|
/**
|
|
143
172
|
* Every distinct sigdb bundle discoverable in the search dirs (see {@link defaultSigDbPath}) -- not just the
|
|
144
173
|
* richest scope. So dropping an extra bundle next to the shipped default (a downloaded full-history
|
|
@@ -150,6 +179,14 @@ function defaultSigDbPaths(searchRoots) {
|
|
|
150
179
|
if (typeof fs_1.default?.readdirSync !== 'function') {
|
|
151
180
|
return [];
|
|
152
181
|
}
|
|
182
|
+
const roots = sigDbSearchRoots(searchRoots);
|
|
183
|
+
const memoKey = roots.join('\0');
|
|
184
|
+
const memoized = defaultSigDbPathsMemo.get(memoKey);
|
|
185
|
+
if (memoized !== undefined && memoizedScanStillCurrent(memoized.watched)) {
|
|
186
|
+
return [...memoized.paths];
|
|
187
|
+
}
|
|
188
|
+
/** every directory the scan below read, with its modification time taken _before_ the read so a concurrent write invalidates rather than sticks */
|
|
189
|
+
const watched = [];
|
|
153
190
|
const manifests = new Map(); // `<name>.manifest.json` (ignoring compression ext) -> first-found path
|
|
154
191
|
const standalones = new Map(); // `<name>.sigs.ndjson` (ignoring compression ext) -> first-found path
|
|
155
192
|
const foundIn = new Map(); // where a key was first found, to only compare codecs within one directory
|
|
@@ -166,14 +203,16 @@ function defaultSigDbPaths(searchRoots) {
|
|
|
166
203
|
};
|
|
167
204
|
const scanDir = (base) => {
|
|
168
205
|
for (const sub of SigDbSubDirs) {
|
|
206
|
+
const dir = path_1.default.join(base, sub);
|
|
169
207
|
let entries;
|
|
170
208
|
try {
|
|
171
|
-
|
|
209
|
+
const mtimeMs = fs_1.default.statSync(dir).mtimeMs;
|
|
210
|
+
entries = fs_1.default.readdirSync(dir);
|
|
211
|
+
watched.push([dir, mtimeMs]);
|
|
172
212
|
}
|
|
173
213
|
catch {
|
|
174
214
|
continue; // directory does not exist on this root
|
|
175
215
|
}
|
|
176
|
-
const dir = path_1.default.join(base, sub);
|
|
177
216
|
for (const file of entries) {
|
|
178
217
|
if (ManifestFilePattern.test(file)) {
|
|
179
218
|
keep(manifests, (0, codec_1.stripCompressedExt)(file), path_1.default.join(dir, file), dir);
|
|
@@ -184,7 +223,7 @@ function defaultSigDbPaths(searchRoots) {
|
|
|
184
223
|
}
|
|
185
224
|
}
|
|
186
225
|
};
|
|
187
|
-
for (const root of
|
|
226
|
+
for (const root of roots) {
|
|
188
227
|
for (let dir = root, i = 0; i < 10; i++) {
|
|
189
228
|
scanDir(dir);
|
|
190
229
|
const parent = path_1.default.dirname(dir);
|
|
@@ -194,7 +233,7 @@ function defaultSigDbPaths(searchRoots) {
|
|
|
194
233
|
dir = parent;
|
|
195
234
|
}
|
|
196
235
|
}
|
|
197
|
-
for (const bundle of sigDbBundleDirs()) {
|
|
236
|
+
for (const bundle of sigDbBundleDirs(watched)) {
|
|
198
237
|
scanDir(bundle);
|
|
199
238
|
}
|
|
200
239
|
// a standalone bundle is a `.sigs.ndjson` that is not a shard of a discovered manifest (`<manifest>.<shard>...`)
|
|
@@ -210,6 +249,8 @@ function defaultSigDbPaths(searchRoots) {
|
|
|
210
249
|
const orderedManifests = [...manifests.entries()]
|
|
211
250
|
.sort((a, b) => scopeRank(a[0]) - scopeRank(b[0]) || a[0].localeCompare(b[0])).map(([, p]) => p);
|
|
212
251
|
const bundles = standalones.entries().filter(([name]) => !isShard(name)).map(([, p]) => p);
|
|
213
|
-
|
|
252
|
+
const paths = [...orderedManifests, ...bundles];
|
|
253
|
+
defaultSigDbPathsMemo.set(memoKey, { paths, watched });
|
|
254
|
+
return [...paths];
|
|
214
255
|
}
|
|
215
256
|
//# sourceMappingURL=manifest.js.map
|
|
@@ -10,6 +10,11 @@ export declare function readSignatureDb(file: string): Promise<SigDb>;
|
|
|
10
10
|
* The read interface every package-signature source implements, so a single {@link SigDatabase} and a
|
|
11
11
|
* sharded {@link SigDatabaseSet} are interchangeable. Queries are synchronous; any decompression/caching
|
|
12
12
|
* happens once during `open`.
|
|
13
|
+
*
|
|
14
|
+
* Where a query takes an optional `version` and none is given, it answers for the newest version the database
|
|
15
|
+
* holds for that package. That is not the version flowR assumed for the project, and nothing here reads the
|
|
16
|
+
* configuration, the `DESCRIPTION`, or a lockfile. A caller wanting the assumed version resolves it and passes
|
|
17
|
+
* it, as {@link FlowrAnalyzerDependenciesContext} does before falling back to the versionless call.
|
|
13
18
|
*/
|
|
14
19
|
export interface PackageSignatureSource {
|
|
15
20
|
/** whether the source can resolve the package at all */
|
|
@@ -18,28 +23,53 @@ export interface PackageSignatureSource {
|
|
|
18
23
|
hasVersion(pkg: string, version: string): boolean;
|
|
19
24
|
/** whether a version is a current CRAN release (i.e. not in the package's `noncran`/removed set) */
|
|
20
25
|
isCranVersion(pkg: string, version: string): boolean;
|
|
21
|
-
/** the export view of a package version (defaults to its latest) */
|
|
22
|
-
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
23
26
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* by a reverse index over every package's latest version, built once and cached.
|
|
27
|
+
* The export view of a package version.
|
|
28
|
+
* @param pkg - The package to look up.
|
|
29
|
+
* @param version - The version to answer for, the database's newest if omitted.
|
|
28
30
|
*/
|
|
31
|
+
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
29
32
|
/**
|
|
30
33
|
* The packages exporting `name`, ordered by downloads (descending, ties by name). Answered without building
|
|
31
|
-
* a reverse index
|
|
32
|
-
* it are decoded.
|
|
34
|
+
* a reverse index, as a name the database never stores is rejected outright and only the blobs that may
|
|
35
|
+
* hold it are decoded.
|
|
36
|
+
* @param name - The exported name to search for.
|
|
33
37
|
*/
|
|
34
38
|
packagesExporting(name: string): readonly string[];
|
|
39
|
+
/**
|
|
40
|
+
* The package that OWNS the class `className`, either as an S3 class (a same-named constructor plus a
|
|
41
|
+
* registered method, see {@link LibraryExports.s3Classes}) or as an S4 class (exported via `exportClasses`,
|
|
42
|
+
* see {@link LibraryExports.s4Classes}). S3 ownership wins a tie, and `undefined` means no package owns it.
|
|
43
|
+
* @param className - The class to find the owner of.
|
|
44
|
+
* @param version - The version *every candidate package* is inspected at, each one's newest if omitted.
|
|
45
|
+
* Only the versionless form reuses the cached reverse index, the other scans package by package.
|
|
46
|
+
*/
|
|
35
47
|
classOwner(className: string, version?: string): string | undefined;
|
|
36
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Rich per-function view (signatures and call graphs) of a package version.
|
|
50
|
+
* @param pkg - The package to decode.
|
|
51
|
+
* @param version - The version to answer for, the database's newest if omitted.
|
|
52
|
+
*/
|
|
37
53
|
functions(pkg: string, version?: string): DecodedFunction[] | undefined;
|
|
38
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* The rich view of a single function by name, decoding only it, unlike {@link functions}.
|
|
56
|
+
* @param pkg - The package the function belongs to.
|
|
57
|
+
* @param name - The function to decode.
|
|
58
|
+
* @param version - The version to answer for, the database's newest if omitted.
|
|
59
|
+
*/
|
|
39
60
|
functionByName(pkg: string, name: string, version?: string): DecodedFunction | undefined;
|
|
40
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* The transitive callees of a function within one package version, expanding the stored local call graphs.
|
|
63
|
+
* @param pkg - The package the function belongs to.
|
|
64
|
+
* @param name - The function whose callees are expanded.
|
|
65
|
+
* @param version - The version to answer for, the database's newest if omitted.
|
|
66
|
+
*/
|
|
41
67
|
transitiveCallees(pkg: string, name: string, version?: string): string[] | undefined;
|
|
42
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Declared dependencies (Depends, Imports, ...) of a package version, with version qualifiers.
|
|
70
|
+
* @param pkg - The package to read the dependencies of.
|
|
71
|
+
* @param version - The version to answer for, the database's newest if omitted.
|
|
72
|
+
*/
|
|
43
73
|
dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
|
|
44
74
|
/** every package name this source can resolve */
|
|
45
75
|
packageNames(): string[];
|
|
@@ -49,7 +79,12 @@ export interface PackageSignatureSource {
|
|
|
49
79
|
downloads(pkg: string): number;
|
|
50
80
|
/** for a base package, the R versions it was part of core (ascending); `undefined` otherwise */
|
|
51
81
|
coreVersions(pkg: string): RVersion[] | undefined;
|
|
52
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* The release date of a package version, `undefined` if unknown.
|
|
84
|
+
* @param pkg - The package to date.
|
|
85
|
+
* @param version - The version to answer for. Omitted, this defaults to the newest release *by recorded
|
|
86
|
+
* date*, unlike the queries above, which take the package's recorded latest.
|
|
87
|
+
*/
|
|
53
88
|
releaseDate(pkg: string, version?: string): Date | undefined;
|
|
54
89
|
/** every known release of a package (version + date), ascending by R-version order */
|
|
55
90
|
releaseDates(pkg: string): VersionRelease[];
|
package/project/sigdb/reader.js
CHANGED
|
@@ -29,6 +29,7 @@ const decompress_1 = require("./decompress");
|
|
|
29
29
|
const codec_1 = require("./codec");
|
|
30
30
|
const hash_1 = require("./hash");
|
|
31
31
|
const manifest_1 = require("./manifest");
|
|
32
|
+
const arrays_1 = require("../../util/collections/arrays");
|
|
32
33
|
/** apply one `d` line (`["d", start, payload]`, new newline-blob or legacy `string[]` form) to the dictionary in place */
|
|
33
34
|
function applyDictLine(json, strings) {
|
|
34
35
|
const [, start, payload] = JSON.parse(json);
|
|
@@ -214,7 +215,7 @@ class MergedSignatureSource {
|
|
|
214
215
|
return this.pick(pkg, version)?.dependencies(pkg, version);
|
|
215
216
|
}
|
|
216
217
|
packageNames() {
|
|
217
|
-
return
|
|
218
|
+
return (0, arrays_1.uniqueArray)(this.sources.flatMap(s => s.packageNames()));
|
|
218
219
|
}
|
|
219
220
|
isBaseR(pkg) {
|
|
220
221
|
return this.sources.some(s => s.has(pkg) && s.isBaseR(pkg));
|
|
@@ -469,7 +470,7 @@ class SigDatabase {
|
|
|
469
470
|
return [];
|
|
470
471
|
}
|
|
471
472
|
const found = [];
|
|
472
|
-
for (const pkg
|
|
473
|
+
for (const pkg in this.index.pkgs) {
|
|
473
474
|
if (this.mayOffer(pkg, name) && this.lookup(pkg)?.exported.includes(name)) {
|
|
474
475
|
found.push(pkg);
|
|
475
476
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms
|
|
3
|
-
* data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
|
|
2
|
+
* On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms,
|
|
3
|
+
* and data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
|
|
4
4
|
* operates on these lives in `./sigdb` (which re-exports this module, so `./sigdb` stays the single entry point).
|
|
5
5
|
*/
|
|
6
6
|
/** The definition location of the binding, with a file path usually relative to the package project root. */
|
|
@@ -127,6 +127,8 @@ export type PkgBlobTuple = [Sig[], number[][], SigFn[], Record<string, number[]>
|
|
|
127
127
|
* the package shipped with core R, so the set of versions is exactly the R versions it was part of core.
|
|
128
128
|
*/
|
|
129
129
|
export type SigDbPkgMeta = [latest: string, archived: number, downloads: number, core?: number];
|
|
130
|
+
/** Every package the database knows, mapped from its name to its {@link SigDbPkgMeta}. */
|
|
131
|
+
export type SigDbPkgMetaIndex = Record<string, SigDbPkgMeta>;
|
|
130
132
|
/**
|
|
131
133
|
* Temporal tier of a bundle's packages:
|
|
132
134
|
* - `current` -- only each package's latest version.
|
|
@@ -169,7 +171,7 @@ export interface SigDb {
|
|
|
169
171
|
/** package name to its index into {@link SigDb.blobs} */
|
|
170
172
|
pkgs: Record<string, number>;
|
|
171
173
|
/** package name to its {@link SigDbPkgMeta} */
|
|
172
|
-
meta:
|
|
174
|
+
meta: SigDbPkgMetaIndex;
|
|
173
175
|
}
|
|
174
176
|
export interface SigParamInfo {
|
|
175
177
|
readonly name: string;
|
package/project/sigdb/schema.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms
|
|
4
|
-
* data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
|
|
3
|
+
* On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms,
|
|
4
|
+
* and data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
|
|
5
5
|
* operates on these lives in `./sigdb` (which re-exports this module, so `./sigdb` stays the single entry point).
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Identifier } from '../../dataflow/environments/identifier';
|
|
2
|
+
import type { DecodedFunction } from './decode';
|
|
3
|
+
import type { PackageSignatureSource } from './reader';
|
|
4
|
+
import type { LibraryExports } from './schema';
|
|
5
|
+
import type { ReadOnlyFlowrAnalyzerDependenciesContext } from '../context/flowr-analyzer-dependencies-context';
|
|
6
|
+
/**
|
|
7
|
+
* The signature database as the analyzed project sees it.
|
|
8
|
+
*
|
|
9
|
+
* A {@link PackageSignatureSource} answers for a version you name, and falls back to whatever it holds as newest
|
|
10
|
+
* when you name none. This adds the step above that, taking the version from what flowR resolved for the project,
|
|
11
|
+
* which is where `solver.sigdb.versionOverrides`, `solver.sigdb.versionSelection` and
|
|
12
|
+
* `solver.sigdb.assumedRVersion` have already been applied. So a query without a version is answered for the
|
|
13
|
+
* version the analysis actually assumes, not for the newest the database happens to carry.
|
|
14
|
+
*
|
|
15
|
+
* Obtain one from {@link ReadOnlyFlowrAnalyzerDependenciesContext.signatures}, and reach for
|
|
16
|
+
* {@link SignatureDb.sources|sources} only for what this does not cover.
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const db = analyzer.inspectContext().deps.signatures();
|
|
20
|
+
* db.versionOf('dplyr'); // the version the analysis assumes
|
|
21
|
+
* db.parametersOf(Identifier.make('lead', 'dplyr')); // its formals, for MatchArgs
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface SignatureDb {
|
|
25
|
+
/** Whether any signature source is loaded at all, i.e. whether anything below can answer. */
|
|
26
|
+
available(this: void): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The version the analysis assumes for `pkg`, `undefined` if flowR could not pin one down. This is what every
|
|
29
|
+
* lookup here uses when no version is given.
|
|
30
|
+
*/
|
|
31
|
+
versionOf(this: void, pkg: string): string | undefined;
|
|
32
|
+
/** Whether the database can resolve `pkg` at all, at any version. */
|
|
33
|
+
has(this: void, pkg: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The export view of a package.
|
|
36
|
+
* @param pkg - The package to look up.
|
|
37
|
+
* @param version - The version to answer for, {@link versionOf} if omitted.
|
|
38
|
+
*/
|
|
39
|
+
exportsOf(this: void, pkg: string, version?: string): LibraryExports | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* The database entry for a *qualified* call, i.e. a `pkg::fn` {@link Identifier}. Decodes only that one
|
|
42
|
+
* function rather than the whole package.
|
|
43
|
+
* @param id - The qualified identifier of the function.
|
|
44
|
+
* @param version - The version to answer for, {@link versionOf} of its package if omitted.
|
|
45
|
+
*/
|
|
46
|
+
functionOf(this: void, id: Identifier, version?: string): DecodedFunction | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The formal parameter names of a qualified call, ready to hand to {@link MatchArgs.toNames}.
|
|
49
|
+
* @param id - The qualified identifier of the function.
|
|
50
|
+
* @param version - The version to answer for, {@link versionOf} of its package if omitted.
|
|
51
|
+
*/
|
|
52
|
+
parametersOf(this: void, id: Identifier, version?: string): readonly string[] | undefined;
|
|
53
|
+
/** The packages exporting `name`, ordered by downloads, see {@link PackageSignatureSource.packagesExporting}. */
|
|
54
|
+
packagesExporting(this: void, name: string): readonly string[];
|
|
55
|
+
/** Every loaded source as one, for the questions this interface does not ask. */
|
|
56
|
+
sources(this: void): PackageSignatureSource;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Builds the {@link SignatureDb} that {@link ReadOnlyFlowrAnalyzerDependenciesContext.signatures} hands out.
|
|
60
|
+
*
|
|
61
|
+
* Call this only where you hold a dependencies context but no analyzer, e.g. inside a plugin or a query
|
|
62
|
+
* executor. Everywhere else go through `analyzer.inspectContext().deps.signatures()`. It exists so the version
|
|
63
|
+
* resolution lives in one place instead of every caller pairing a {@link PackageSignatureSource} with a
|
|
64
|
+
* `getDependency(...)?.resolvedVersion` of its own.
|
|
65
|
+
*
|
|
66
|
+
* The result keeps no state, so it stays correct when a database is mounted or a version is re-resolved later.
|
|
67
|
+
* @param deps - The dependencies context the versions and the sources come from.
|
|
68
|
+
*/
|
|
69
|
+
export declare function signatureDbOf(deps: ReadOnlyFlowrAnalyzerDependenciesContext): SignatureDb;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signatureDbOf = signatureDbOf;
|
|
4
|
+
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
5
|
+
const reader_1 = require("./reader");
|
|
6
|
+
const log_1 = require("../../util/log");
|
|
7
|
+
const signatureDbLog = log_1.log.getSubLogger({ name: 'signature-db' });
|
|
8
|
+
/**
|
|
9
|
+
* Builds the {@link SignatureDb} that {@link ReadOnlyFlowrAnalyzerDependenciesContext.signatures} hands out.
|
|
10
|
+
*
|
|
11
|
+
* Call this only where you hold a dependencies context but no analyzer, e.g. inside a plugin or a query
|
|
12
|
+
* executor. Everywhere else go through `analyzer.inspectContext().deps.signatures()`. It exists so the version
|
|
13
|
+
* resolution lives in one place instead of every caller pairing a {@link PackageSignatureSource} with a
|
|
14
|
+
* `getDependency(...)?.resolvedVersion` of its own.
|
|
15
|
+
*
|
|
16
|
+
* The result keeps no state, so it stays correct when a database is mounted or a version is re-resolved later.
|
|
17
|
+
* @param deps - The dependencies context the versions and the sources come from.
|
|
18
|
+
*/
|
|
19
|
+
function signatureDbOf(deps) {
|
|
20
|
+
const merged = () => new reader_1.MergedSignatureSource(deps.signatureSources());
|
|
21
|
+
const versionOf = (pkg) => deps.getDependency(pkg)?.resolvedVersion;
|
|
22
|
+
const answerFor = (pkg, version, ask) => {
|
|
23
|
+
const src = merged();
|
|
24
|
+
const assumed = version ?? versionOf(pkg);
|
|
25
|
+
const found = ask(src, assumed);
|
|
26
|
+
if (found !== undefined || assumed === undefined) {
|
|
27
|
+
return found;
|
|
28
|
+
}
|
|
29
|
+
const any = ask(src, undefined);
|
|
30
|
+
if (any !== undefined) {
|
|
31
|
+
signatureDbLog.debug(`no signature for ${pkg} ${assumed}, answering from the newest version the database holds`);
|
|
32
|
+
}
|
|
33
|
+
return any;
|
|
34
|
+
};
|
|
35
|
+
const functionOf = (id, version) => {
|
|
36
|
+
const pkg = identifier_1.Identifier.getNamespace(id);
|
|
37
|
+
if (pkg === undefined) {
|
|
38
|
+
return undefined; // without a package there is nothing to look the function up in
|
|
39
|
+
}
|
|
40
|
+
const name = identifier_1.Identifier.getName(id);
|
|
41
|
+
return answerFor(pkg, version, (src, v) => src.functionByName(pkg, name, v));
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
available: () => deps.signatureSources().length > 0,
|
|
45
|
+
versionOf,
|
|
46
|
+
has: pkg => merged().has(pkg),
|
|
47
|
+
exportsOf: (pkg, version) => answerFor(pkg, version, (src, v) => src.lookup(pkg, v)),
|
|
48
|
+
packagesExporting: name => deps.packagesExporting(name),
|
|
49
|
+
sources: () => merged(),
|
|
50
|
+
functionOf,
|
|
51
|
+
parametersOf: (id, version) => functionOf(id, version)?.signature.map(p => p.name)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=signature-db.js.map
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import type { FunctionArgument } from '../../dataflow/graph/graph';
|
|
2
2
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
3
|
import type { SigParameter } from './decode';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* The {@link MatchArgs.toSpec} parameter spec of a *known* signature, where every formal maps to itself.
|
|
6
|
+
* @useInstead {@link MatchArgs.toSpec}
|
|
7
|
+
*/
|
|
5
8
|
export declare function signatureParameterSpec(signature: readonly SigParameter[]): Record<string, string>;
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `matchArgumentsToSignature(ggplotCall.args, ggplotSignature).get('data')`.
|
|
10
|
+
* Matches a call's `args` against a *known* signature, returning per parameter name the id(s) bound to it.
|
|
11
|
+
* @useInstead {@link MatchArgs.toSpec}
|
|
10
12
|
*/
|
|
11
13
|
export declare function matchArgumentsToSignature(args: readonly FunctionArgument[], signature: readonly SigParameter[]): Map<string, NodeId[]>;
|
|
12
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The id(s) a *known* signature binds to a single `parameter`, `undefined` if nothing is.
|
|
16
|
+
* @useInstead {@link MatchArgs.toSpec}
|
|
17
|
+
*/
|
|
13
18
|
export declare function argumentForParameter(args: readonly FunctionArgument[], signature: readonly SigParameter[], parameter: string): NodeId[] | undefined;
|
|
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.signatureParameterSpec = signatureParameterSpec;
|
|
4
4
|
exports.matchArgumentsToSignature = matchArgumentsToSignature;
|
|
5
5
|
exports.argumentForParameter = argumentForParameter;
|
|
6
|
-
const
|
|
7
|
-
/**
|
|
6
|
+
const match_args_1 = require("../../dataflow/graph/match-args");
|
|
7
|
+
/**
|
|
8
|
+
* The {@link MatchArgs.toSpec} parameter spec of a *known* signature, where every formal maps to itself.
|
|
9
|
+
* @useInstead {@link MatchArgs.toSpec}
|
|
10
|
+
*/
|
|
8
11
|
function signatureParameterSpec(signature) {
|
|
9
12
|
const spec = {};
|
|
10
13
|
for (const p of signature) {
|
|
@@ -13,15 +16,17 @@ function signatureParameterSpec(signature) {
|
|
|
13
16
|
return spec;
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* `matchArgumentsToSignature(ggplotCall.args, ggplotSignature).get('data')`.
|
|
19
|
+
* Matches a call's `args` against a *known* signature, returning per parameter name the id(s) bound to it.
|
|
20
|
+
* @useInstead {@link MatchArgs.toSpec}
|
|
19
21
|
*/
|
|
20
22
|
function matchArgumentsToSignature(args, signature) {
|
|
21
|
-
return
|
|
23
|
+
return match_args_1.MatchArgs.toSpec(args, signature);
|
|
22
24
|
}
|
|
23
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The id(s) a *known* signature binds to a single `parameter`, `undefined` if nothing is.
|
|
27
|
+
* @useInstead {@link MatchArgs.toSpec}
|
|
28
|
+
*/
|
|
24
29
|
function argumentForParameter(args, signature, parameter) {
|
|
25
|
-
return
|
|
30
|
+
return match_args_1.MatchArgs.toSpec(args, signature).get(parameter);
|
|
26
31
|
}
|
|
27
32
|
//# sourceMappingURL=signature-match.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeAbsintQuery = executeAbsintQuery;
|
|
4
|
-
const cfg_kind_1 = require("../../../project/cfg-kind");
|
|
5
4
|
const parse_1 = require("../../../slicing/criterion/parse");
|
|
6
5
|
const log_1 = require("../../../util/log");
|
|
7
6
|
const absint_query_format_1 = require("./absint-query-format");
|
|
@@ -19,7 +18,7 @@ async function executeAbsintQuery({ analyzer }, queries) {
|
|
|
19
18
|
const inference = absint_query_format_1.AbsintQueryInferences[queries[0].inference];
|
|
20
19
|
const ast = await analyzer.normalize();
|
|
21
20
|
const dfg = (await analyzer.dataflow()).graph;
|
|
22
|
-
const cfg = await analyzer.controlflow(undefined
|
|
21
|
+
const cfg = await analyzer.controlflow(undefined);
|
|
23
22
|
const start = Date.now();
|
|
24
23
|
const visitor = inference({ controlFlow: cfg, dfg, normalizedAst: ast, ctx: analyzer.inspectContext() });
|
|
25
24
|
visitor.start();
|
|
@@ -8,8 +8,6 @@ const edge_1 = require("../../../dataflow/graph/edge");
|
|
|
8
8
|
const two_layer_collector_1 = require("../../two-layer-collector");
|
|
9
9
|
const objects_1 = require("../../../util/objects");
|
|
10
10
|
const identify_link_to_last_call_relation_1 = require("./identify-link-to-last-call-relation");
|
|
11
|
-
const cfg_kind_1 = require("../../../project/cfg-kind");
|
|
12
|
-
const extract_cfg_1 = require("../../../control-flow/extract-cfg");
|
|
13
11
|
const identify_link_to_relation_1 = require("./identify-link-to-relation");
|
|
14
12
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
15
13
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
@@ -237,9 +235,9 @@ async function executeCallContextQueries({ analyzer }, queries) {
|
|
|
237
235
|
const sigDbReady = primeSigDbForNamespaceFilter(promotedQueries, deps);
|
|
238
236
|
let cfg = undefined;
|
|
239
237
|
if (requiresCfg) {
|
|
240
|
-
cfg = await analyzer.controlflow(undefined
|
|
238
|
+
cfg = await analyzer.controlflow(undefined);
|
|
241
239
|
}
|
|
242
|
-
const calls = cfg ?
|
|
240
|
+
const calls = cfg ? new Map(dataflow.graph.verticesOfType(vertex_1.VertexType.FunctionCall)) : undefined;
|
|
243
241
|
const queriesWhichWantAliases = promotedQueries.filter(q => q.includeAliases);
|
|
244
242
|
/* index exact-name queries so each vertex costs one map lookup instead of a predicate check per query */
|
|
245
243
|
const nonAliasByName = new Map();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
2
|
import { type DataflowGraph } from '../../../dataflow/graph/graph';
|
|
3
3
|
import { type DataflowGraphVertexFunctionCall } from '../../../dataflow/graph/vertex';
|
|
4
|
-
import { RType } from '../../../r-bridge/lang-4.x/ast/model/type';
|
|
4
|
+
import type { RType } from '../../../r-bridge/lang-4.x/ast/model/type';
|
|
5
5
|
import type { RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
6
6
|
import type { LinkToLastCall } from './call-context-query-format';
|
|
7
7
|
import type { PromotedLinkTo } from './call-context-query-executor';
|
|
@@ -8,14 +8,15 @@ exports.identifyLinkToLastCallRelationSync = identifyLinkToLastCallRelationSync;
|
|
|
8
8
|
const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
9
9
|
const graph_1 = require("../../../dataflow/graph/graph");
|
|
10
10
|
const simple_visitor_1 = require("../../../control-flow/simple-visitor");
|
|
11
|
+
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
11
12
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
12
13
|
const edge_1 = require("../../../dataflow/graph/edge");
|
|
13
14
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
14
15
|
const assert_1 = require("../../../util/assert");
|
|
15
|
-
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
16
16
|
const cascade_action_1 = require("./cascade-action");
|
|
17
|
-
const
|
|
17
|
+
const control_flow_graph_1 = require("../../../control-flow/control-flow-graph");
|
|
18
18
|
const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
|
|
19
|
+
const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
19
20
|
var CallTargets;
|
|
20
21
|
(function (CallTargets) {
|
|
21
22
|
/** call targets a function that is not defined locally in the script (e.g., the call targets a library function) */
|
|
@@ -112,7 +113,7 @@ function getValueOfArgument(graph, call, argument, additionalAllowedTypes) {
|
|
|
112
113
|
return undefined;
|
|
113
114
|
}
|
|
114
115
|
let valueNode = graph.idMap?.get(refAtIndex);
|
|
115
|
-
if (
|
|
116
|
+
if (r_argument_1.RArgument.is(valueNode)) {
|
|
116
117
|
valueNode = valueNode.value;
|
|
117
118
|
}
|
|
118
119
|
if (valueNode) {
|
|
@@ -130,7 +131,7 @@ function getValueOfArgument(graph, call, argument, additionalAllowedTypes) {
|
|
|
130
131
|
*/
|
|
131
132
|
async function identifyLinkToLastCallRelation(from, analyzer, l, knownCalls) {
|
|
132
133
|
const graph = (await analyzer.dataflow()).graph;
|
|
133
|
-
const cfg = (await analyzer.controlflow([]
|
|
134
|
+
const cfg = (await analyzer.controlflow([])).graph;
|
|
134
135
|
return identifyLinkToLastCallRelationSync(from, cfg, graph, l, knownCalls);
|
|
135
136
|
}
|
|
136
137
|
/**
|
|
@@ -174,15 +175,32 @@ function identifyLinkToLastCallRelationSync(from, cfg, graph, { callName, cascad
|
|
|
174
175
|
const v = graph.getVertex(node);
|
|
175
176
|
return vertex_1.FunctionCallVertex.is(v) ? v : undefined;
|
|
176
177
|
};
|
|
178
|
+
/* function bodies the walk steps into, collected while walking and drained afterwards */
|
|
179
|
+
const searchFrom = [];
|
|
180
|
+
/*
|
|
181
|
+
* A call made while evaluating the arguments of `from` is part of that call, not something that happened
|
|
182
|
+
* before it, so what `from` is made of is skipped.
|
|
183
|
+
*/
|
|
184
|
+
const within = model_1.RNode.collectAllIds(graph.idMap?.get(from));
|
|
177
185
|
(0, simple_visitor_1.visitCfgInReverseOrder)(cfg, [from], node => {
|
|
178
|
-
|
|
179
|
-
if (node === from) {
|
|
186
|
+
if (within.has(node)) {
|
|
180
187
|
return;
|
|
181
188
|
}
|
|
182
189
|
const vertex = getVertex(node);
|
|
183
190
|
if (vertex === undefined) {
|
|
184
191
|
return;
|
|
185
192
|
}
|
|
193
|
+
/*
|
|
194
|
+
* A call runs whatever it dispatches to, so the last call before it may sit in that function's body.
|
|
195
|
+
* The control flow itself stays intra-procedural, which is why the step happens along the call targets:
|
|
196
|
+
* a function that is never called is never entered this way.
|
|
197
|
+
*/
|
|
198
|
+
for (const target of control_flow_graph_1.CfgVertex.getCallTargets(cfg.getVertex(node)) ?? []) {
|
|
199
|
+
const definition = graph.getVertex(target);
|
|
200
|
+
if (vertex_1.FunctionDefinitionVertex.is(definition)) {
|
|
201
|
+
searchFrom.push(...definition.exitPoints.map(e => e.nodeId));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
186
204
|
if (cNameCheck(vertex)) {
|
|
187
205
|
const act = cascadeIf ? cascadeIf(vertex, from, graph) : cascade_action_1.CascadeAction.Stop;
|
|
188
206
|
if (act === cascade_action_1.CascadeAction.Skip) {
|
|
@@ -195,6 +213,15 @@ function identifyLinkToLastCallRelationSync(from, cfg, graph, { callName, cascad
|
|
|
195
213
|
return act === cascade_action_1.CascadeAction.Stop;
|
|
196
214
|
}
|
|
197
215
|
});
|
|
216
|
+
while (searchFrom.length > 0) {
|
|
217
|
+
(0, simple_visitor_1.visitCfgInReverseOrder)(cfg, searchFrom.splice(0), node => {
|
|
218
|
+
const vertex = getVertex(node);
|
|
219
|
+
if (vertex !== undefined && cNameCheck(vertex) && satisfiesCallTargets(vertex, graph, CallTargets.MustIncludeGlobal) !== 'no') {
|
|
220
|
+
found.push(node);
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
198
225
|
return found;
|
|
199
226
|
}
|
|
200
227
|
//# sourceMappingURL=identify-link-to-last-call-relation.js.map
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeControlFlowQuery = executeControlFlowQuery;
|
|
4
4
|
const log_1 = require("../../../util/log");
|
|
5
|
-
const cfg_kind_1 = require("../../../project/cfg-kind");
|
|
6
5
|
/**
|
|
7
6
|
* Executes the control flow query with the given simplification passes.
|
|
8
7
|
*/
|
|
@@ -12,7 +11,7 @@ async function executeControlFlowQuery({ analyzer }, queries) {
|
|
|
12
11
|
}
|
|
13
12
|
const query = queries[0];
|
|
14
13
|
const start = Date.now();
|
|
15
|
-
const controlFlow = await analyzer.controlflow(query.config?.simplificationPasses
|
|
14
|
+
const controlFlow = await analyzer.controlflow(query.config?.simplificationPasses);
|
|
16
15
|
return {
|
|
17
16
|
'.meta': {
|
|
18
17
|
timing: Date.now() - start
|