@eagleoutice/flowr 2.14.1 → 2.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -87
- package/abstract-interpretation/absint-visitor.d.ts +132 -25
- package/abstract-interpretation/absint-visitor.js +459 -99
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/arguments.js +1 -1
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +107 -254
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +5 -5
- package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -1
- package/abstract-interpretation/data-frame/resolve-args.js +6 -4
- package/abstract-interpretation/data-frame/shape-inference.d.ts +4 -9
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -0
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -0
- package/abstract-interpretation/domains/partial-product-domain.js +1 -1
- package/abstract-interpretation/domains/set-range-domain.d.ts +3 -2
- package/abstract-interpretation/domains/set-range-domain.js +3 -2
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +3 -2
- package/abstract-interpretation/domains/set-upper-bound-domain.js +3 -2
- package/benchmark/calibration.d.ts +11 -6
- package/benchmark/calibration.js +19 -8
- package/benchmark/slicer.d.ts +7 -1
- package/benchmark/slicer.js +38 -34
- package/benchmark/stats/count-comments.d.ts +16 -0
- package/benchmark/stats/count-comments.js +30 -0
- package/benchmark/stats/print.js +2 -0
- package/benchmark/stats/size-of.d.ts +7 -3
- package/benchmark/stats/size-of.js +7 -3
- package/benchmark/stats/stats.d.ts +7 -0
- package/benchmark/summarizer/first-phase/process.js +2 -19
- package/benchmark/summarizer/second-phase/graph.js +13 -3
- package/benchmark/summarizer/second-phase/process.js +2 -0
- package/cli/repl/commands/repl-dataflow.js +70 -27
- package/cli/repl/core.d.ts +1 -1
- package/cli/repl/core.js +1 -1
- package/cli/repl/parser/slice-query-parser.js +2 -1
- package/cli/repl/server/connection.d.ts +4 -0
- package/cli/repl/server/connection.js +19 -16
- package/cli/repl/server/messages/message-analysis.d.ts +1 -1
- package/config.d.ts +21 -8
- package/config.js +12 -5
- package/control-flow/basic-cfg-guided-visitor.d.ts +7 -2
- package/control-flow/basic-cfg-guided-visitor.js +37 -24
- package/control-flow/cfg-dead-code.js +44 -33
- package/control-flow/cfg-properties.js +2 -2
- package/control-flow/cfg-simplification.js +6 -5
- package/control-flow/cfg-to-basic-blocks.js +11 -13
- package/control-flow/control-flow-graph.d.ts +179 -189
- package/control-flow/control-flow-graph.js +400 -263
- package/control-flow/dfg-cfg-guided-visitor.d.ts +21 -3
- package/control-flow/dfg-cfg-guided-visitor.js +17 -13
- package/control-flow/diff-cfg.js +6 -14
- package/control-flow/happens-before.js +5 -4
- package/control-flow/semantic-cfg-guided-visitor.d.ts +44 -101
- package/control-flow/semantic-cfg-guided-visitor.js +6 -3
- package/control-flow/simple-visitor.js +14 -15
- package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -1
- package/control-flow/useless-loop.js +18 -14
- package/core/steps/all/core/20-dataflow.d.ts +1 -3
- package/core/steps/pipeline/default-pipelines.d.ts +141 -157
- package/dataflow/cluster.js +7 -0
- package/dataflow/environments/apply-kill.d.ts +6 -0
- package/dataflow/environments/apply-kill.js +63 -31
- package/dataflow/environments/built-in-props.d.ts +5 -1
- package/dataflow/environments/built-in-props.js +4 -0
- package/dataflow/environments/built-in.d.ts +6 -3
- package/dataflow/environments/built-in.js +8 -5
- package/dataflow/environments/clone.d.ts +3 -3
- package/dataflow/environments/clone.js +5 -5
- package/dataflow/environments/default-builtin-config.d.ts +114 -3
- package/dataflow/environments/default-builtin-config.js +137 -35
- package/dataflow/environments/environment.d.ts +5 -5
- package/dataflow/environments/environment.js +5 -5
- package/dataflow/environments/identifier.d.ts +11 -1
- package/dataflow/environments/identifier.js +4 -1
- package/dataflow/environments/resolve-by-name.d.ts +7 -0
- package/dataflow/environments/resolve-by-name.js +12 -0
- package/dataflow/environments/resolve-helper.d.ts +3 -1
- package/dataflow/environments/resolve-helper.js +2 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +3 -3
- package/dataflow/eval/resolve/alias-tracking.js +3 -3
- package/dataflow/eval/resolve/match-arguments.js +7 -5
- package/dataflow/eval/resolve/node-value.d.ts +3 -1
- package/dataflow/eval/resolve/node-value.js +12 -0
- package/dataflow/eval/resolve/resolve-argument.js +5 -4
- package/dataflow/eval/resolve/resolve-operators.js +9 -6
- package/dataflow/eval/resolve/resolve-strings.js +2 -2
- package/dataflow/eval/resolve/resolve-working-directory.js +4 -3
- package/dataflow/eval/resolve/resolve.js +3 -2
- package/dataflow/eval/values/general.js +8 -5
- package/dataflow/extractor.d.ts +1 -4
- package/dataflow/extractor.js +11 -10
- package/dataflow/fn/exceptions-of-function.d.ts +3 -1
- package/dataflow/fn/strict-function.js +7 -5
- package/dataflow/graph/call-graph.js +2 -2
- package/dataflow/graph/df-helper.d.ts +8 -1
- package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +19 -2
- package/dataflow/graph/edge.d.ts +38 -2
- package/dataflow/graph/edge.js +32 -2
- package/dataflow/graph/graph.d.ts +4 -3
- package/dataflow/graph/graph.js +6 -2
- package/dataflow/graph/match-args.d.ts +69 -0
- package/dataflow/graph/match-args.js +167 -0
- package/dataflow/info.d.ts +15 -6
- package/dataflow/info.js +0 -17
- package/dataflow/internal/control-flow.d.ts +114 -0
- package/dataflow/internal/control-flow.js +224 -0
- package/dataflow/internal/linker.d.ts +6 -31
- package/dataflow/internal/linker.js +24 -81
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +9 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +18 -37
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +11 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +18 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +18 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +12 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +38 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +36 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +20 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +9 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +15 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +11 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +26 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +17 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +71 -33
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +6 -15
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +13 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +14 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +15 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +12 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +50 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +20 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +6 -2
- package/dataflow/internal/process/functions/call/common.js +5 -6
- package/dataflow/internal/process/functions/call/deferred.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +12 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +41 -15
- package/dataflow/internal/process/functions/call/named-call-handling.js +2 -0
- package/dataflow/internal/process/functions/call/nse.d.ts +1 -1
- package/dataflow/internal/process/functions/call/nse.js +6 -1
- package/dataflow/internal/process/functions/call/quoted.js +2 -2
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +19 -6
- package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/process-argument.js +12 -4
- package/dataflow/internal/process/functions/process-parameter.js +13 -0
- package/dataflow/internal/process/process-named-call.d.ts +2 -2
- package/dataflow/internal/process/process-named-call.js +9 -7
- package/documentation/data/server/doc-data-server-messages.js +4 -4
- package/documentation/doc-readme.js +33 -0
- package/documentation/doc-util/doc-cfg.d.ts +8 -7
- package/documentation/doc-util/doc-cfg.js +10 -10
- package/documentation/doc-util/doc-playground.d.ts +12 -0
- package/documentation/doc-util/doc-playground.js +21 -0
- package/documentation/doc-util/doc-query.d.ts +4 -1
- package/documentation/doc-util/doc-query.js +4 -2
- package/documentation/wiki-absint.d.ts +3 -4
- package/documentation/wiki-absint.js +17 -5
- package/documentation/wiki-analyzer.js +2 -2
- package/documentation/wiki-cfg.js +101 -106
- package/documentation/wiki-dataflow-graph.js +84 -53
- package/documentation/wiki-interface.js +1 -0
- package/documentation/wiki-linter.js +15 -1
- package/documentation/wiki-linting-and-testing.js +1 -16
- package/documentation/wiki-mk/doc-maker.js +6 -4
- package/documentation/wiki-query.js +14 -4
- package/documentation/wiki-signature-database.js +28 -2
- package/linter/linter-fix.d.ts +16 -0
- package/linter/linter-fix.js +104 -0
- package/linter/linter-format.d.ts +18 -1
- package/linter/linter-format.js +31 -1
- package/linter/linter-output.js +46 -10
- package/linter/linter-rules.d.ts +40 -9
- package/linter/linter-rules.js +2 -0
- package/linter/rules/absolute-path.js +4 -2
- package/linter/rules/dataframe-access-validation.js +6 -7
- package/linter/rules/deprecated-functions.d.ts +107 -10
- package/linter/rules/deprecated-functions.js +311 -23
- package/linter/rules/file-path-validity.js +5 -4
- package/linter/rules/function-finder-util.d.ts +6 -0
- package/linter/rules/function-finder-util.js +21 -13
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +2 -2
- package/linter/rules/stop-with-call-arg.js +2 -2
- package/linter/rules/unclosed-connection.js +2 -2
- package/linter/rules/undefined-symbol-util.js +6 -4
- package/linter/rules/undefined-symbol.js +2 -2
- package/linter/rules/unused-definition.js +8 -4
- package/linter/rules/unused-import.d.ts +60 -0
- package/linter/rules/unused-import.js +179 -0
- package/package.json +2 -2
- package/project/attached-packages.js +2 -1
- package/project/cache/flowr-analyzer-cache.d.ts +2 -5
- package/project/cache/flowr-analyzer-cache.js +4 -7
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +9 -8
- package/project/cache/flowr-analyzer-controlflow-cache.js +17 -34
- package/project/cache/flowr-cache.d.ts +9 -0
- package/project/cache/flowr-cache.js +19 -0
- package/project/context/flowr-analyzer-context.d.ts +7 -3
- package/project/context/flowr-analyzer-context.js +15 -9
- package/project/context/flowr-analyzer-dependencies-context.d.ts +24 -3
- package/project/context/flowr-analyzer-dependencies-context.js +9 -14
- package/project/context/flowr-analyzer-files-context.js +15 -17
- package/project/context/flowr-analyzer-meta-context.js +2 -12
- package/project/dependency-version-space.d.ts +1 -7
- package/project/dependency-version-space.js +9 -8
- package/project/flowr-analyzer-builder.d.ts +4 -4
- package/project/flowr-analyzer.d.ts +4 -6
- package/project/flowr-analyzer.js +4 -5
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -34
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +13 -13
- package/project/plugins/file-plugins/files/flowr-rda-file.js +131 -286
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +1 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +32 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +43 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +5 -8
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +4 -10
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +3 -10
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +1 -13
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +3 -6
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +3 -4
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -6
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -16
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +2 -8
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +2 -6
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +1 -10
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.js +2 -8
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +2 -1
- package/project/sigdb/build.d.ts +2 -2
- package/project/sigdb/decode.d.ts +0 -5
- package/project/sigdb/decode.js +0 -8
- package/project/sigdb/index-format.d.ts +4 -4
- package/project/sigdb/manifest.d.ts +2 -2
- package/project/sigdb/reader.d.ts +54 -13
- package/project/sigdb/reader.js +4 -3
- package/project/sigdb/schema.d.ts +3 -1
- package/project/sigdb/signature-db.d.ts +69 -0
- package/project/sigdb/signature-db.js +54 -0
- package/project/sigdb/signature-match.d.ts +10 -5
- package/project/sigdb/signature-match.js +13 -8
- package/queries/catalog/absint-query/absint-query-executor.js +1 -2
- package/queries/catalog/call-context-query/call-context-query-executor.js +2 -4
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +33 -6
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +8 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -35
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +13 -1
- package/queries/catalog/dependencies-query/function-info/library-functions.js +26 -22
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +9 -0
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +19 -0
- package/queries/catalog/dependencies-query/implicit-echo.d.ts +13 -0
- package/queries/catalog/dependencies-query/implicit-echo.js +133 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +1 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/signature-query/signature-query-executor.js +4 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +4 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +13 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +8 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +8 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +3 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +6 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +5 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +5 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +5 -3
- package/reconstruct/inline/source-inline-map.js +3 -3
- package/reconstruct/reconstruct.js +6 -4
- package/search/flowr-search-builder.d.ts +8 -8
- package/search/flowr-search-builder.js +4 -4
- package/search/flowr-search-filters.d.ts +2 -2
- package/search/flowr-search-filters.js +3 -2
- package/search/search-executor/search-enrichers.d.ts +6 -0
- package/search/search-executor/search-enrichers.js +44 -5
- package/slicing/criterion/filters/all-variables.js +2 -1
- package/slicing/criterion/parse.js +8 -6
- package/slicing/static/slice-call.js +2 -2
- package/util/arg-matching.d.ts +3 -0
- package/util/arg-matching.js +12 -1
- package/util/collections/arrays.d.ts +0 -4
- package/util/collections/arrays.js +4 -26
- package/util/diff-graph.d.ts +1 -1
- package/util/diff-graph.js +17 -3
- package/util/diff.d.ts +6 -0
- package/util/mermaid/ast.d.ts +1 -1
- package/util/mermaid/ast.js +5 -4
- package/util/mermaid/cfg.js +130 -24
- package/util/mermaid/dfg.js +31 -10
- package/util/mermaid/mermaid.js +2 -0
- package/util/objects.d.ts +24 -4
- package/util/objects.js +12 -0
- package/util/prefix.d.ts +1 -1
- package/util/text/playground-link.d.ts +131 -0
- package/util/text/playground-link.js +214 -0
- package/util/text/strings.js +7 -3
- package/util/version.js +1 -1
- package/control-flow/cfg-builder.d.ts +0 -30
- package/control-flow/cfg-builder.js +0 -79
- package/control-flow/extract-cfg.d.ts +0 -36
- package/control-flow/extract-cfg.js +0 -693
- package/project/cfg-kind.d.ts +0 -21
- package/project/cfg-kind.js +0 -26
package/dataflow/graph/graph.js
CHANGED
|
@@ -449,7 +449,7 @@ class DataflowGraph {
|
|
|
449
449
|
}
|
|
450
450
|
return this;
|
|
451
451
|
}
|
|
452
|
-
addEdge(fromId, toId, type) {
|
|
452
|
+
addEdge(fromId, toId, type, data) {
|
|
453
453
|
if (fromId === toId) {
|
|
454
454
|
return this;
|
|
455
455
|
}
|
|
@@ -459,9 +459,13 @@ class DataflowGraph {
|
|
|
459
459
|
if (existing !== undefined) {
|
|
460
460
|
/* the reverse index holds this very object, so a widened type is already visible through it */
|
|
461
461
|
existing.types |= type;
|
|
462
|
+
if (data !== undefined) {
|
|
463
|
+
Object.assign(existing, data);
|
|
464
|
+
}
|
|
462
465
|
return this;
|
|
463
466
|
}
|
|
464
|
-
|
|
467
|
+
/* the spread would build the object through a slower path, and this runs for every edge of every graph */
|
|
468
|
+
const added = (data === undefined ? { types: type } : { types: type, cd: data.cd });
|
|
465
469
|
if (fromEdges === undefined) {
|
|
466
470
|
this.edgeInformation.set(fromId, new Map([[toId, added]]));
|
|
467
471
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type PotentiallyEmptyRArgument, type RFunctionCall } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
2
|
+
import type { RArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-argument';
|
|
3
|
+
import type { RParameter } from '../../r-bridge/lang-4.x/ast/model/nodes/r-parameter';
|
|
4
|
+
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
|
+
import type { NoInfo } from '../../r-bridge/lang-4.x/ast/model/model';
|
|
6
|
+
import { type DataflowGraph, FunctionArgument } from './graph';
|
|
7
|
+
import type { SigParameter } from '../../project/sigdb/decode';
|
|
8
|
+
import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
9
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
10
|
+
/**
|
|
11
|
+
* R's argument matching, as {@link matchArgumentsToParameters} implements it. Pick by what you hold:
|
|
12
|
+
*
|
|
13
|
+
* - {@link MatchArgs.toNames|toNames} - AST arguments and the formal names
|
|
14
|
+
* - {@link MatchArgs.toSpec|toSpec} - graph arguments and the formals (a spec or a database signature)
|
|
15
|
+
* - {@link MatchArgs.onCallAndLink|onCallAndLink} - as `toSpec`, and **adds the argument edges to the graph**
|
|
16
|
+
* - {@link MatchArgs.toDefinition|toDefinition} - only the call, the formals are looked up for you
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* MatchArgs.toNames(call.arguments, ['x', 'value']).get('value');
|
|
20
|
+
* MatchArgs.toSpec(args, { file: 'fileId', '...': '...' }).get('fileId');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const MatchArgs: {
|
|
24
|
+
readonly name: "MatchArgs";
|
|
25
|
+
/**
|
|
26
|
+
* Binds a call's AST `args` to the formal `paramNames`. An empty argument (`f(1, ,3)`) takes its formal but
|
|
27
|
+
* never appears here. Arguments falling to `...` share that key, so only the last survives; use
|
|
28
|
+
* {@link MatchArgs.toSpec} to keep them all.
|
|
29
|
+
* @param args - The arguments as they stand in the normalized AST.
|
|
30
|
+
* @param paramNames - The formals of the called function, in order.
|
|
31
|
+
* @returns Per formal name the argument bound to it.
|
|
32
|
+
*/
|
|
33
|
+
readonly toNames: <Info = object>(this: void, args: readonly PotentiallyEmptyRArgument<Info>[], paramNames: readonly string[]) => ReadonlyMap<string, RArgument<Info>>;
|
|
34
|
+
/**
|
|
35
|
+
* Binds a call's graph `args` against the formals, reading nothing from the graph, so it also serves a
|
|
36
|
+
* function whose parameters are not in the AST at all. Name `'...'` in a specification unless the function
|
|
37
|
+
* really has none, as that is what collects arguments finding no formal of their own.
|
|
38
|
+
* @param args - The arguments as the graph holds them, see {@link convertFnArguments}.
|
|
39
|
+
* @param params - Formal name to the target it stands for, or a signature whose names are the targets.
|
|
40
|
+
* @returns Per target the ids bound to it.
|
|
41
|
+
*/
|
|
42
|
+
readonly toSpec: <Targets extends NodeId = string>(this: void, args: readonly FunctionArgument[], params: Record<string, Targets> | readonly SigParameter[]) => Map<Targets, NodeId[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Binds a call's graph `args` to the `params` of the definition it calls **and mutates `graph`**, adding an
|
|
45
|
+
* {@link EdgeType.DefinesOnCall} and a {@link EdgeType.DefinedByOnCall} edge per bound pair. It is the only
|
|
46
|
+
* member here that writes anything.
|
|
47
|
+
* @param args - The arguments as the graph holds them.
|
|
48
|
+
* @param params - The parameters of the called definition, in order.
|
|
49
|
+
* @param graph - The graph the edges are added to.
|
|
50
|
+
* @returns The argument id to parameter id mapping the edges were drawn for.
|
|
51
|
+
*/
|
|
52
|
+
readonly onCallAndLink: (this: void, args: readonly FunctionArgument[], params: readonly RParameter<ParentInformation>[], graph: DataflowGraph) => Map<NodeId, NodeId>;
|
|
53
|
+
/**
|
|
54
|
+
* Binds a call's arguments to the formals of whatever it calls, looking the formals up itself. It takes them
|
|
55
|
+
* from the {@link RFunctionDefinition} the call resolves to in user code, and from the database signature at
|
|
56
|
+
* the version the analysis assumes otherwise (see {@link SignatureDb}). `undefined` when it resolves to
|
|
57
|
+
* neither, so fall back to a hardcoded list then.
|
|
58
|
+
*
|
|
59
|
+
* `graph` is what says which definition a name reaches here, because scoping, shadowing and control flow
|
|
60
|
+
* decide that and a name alone cannot. It therefore needs a finished graph rather than one under
|
|
61
|
+
* construction. Cost is one {@link Dataflow.origin} lookup plus, for a package call, decoding that one
|
|
62
|
+
* function.
|
|
63
|
+
* @param call - The call whose arguments are to be bound.
|
|
64
|
+
* @param graph - The finished graph the call was analyzed into.
|
|
65
|
+
* @param ctx - The analyzer context the database and the assumed versions come from.
|
|
66
|
+
* @returns Per formal name the argument bound to it, `undefined` if the formals could not be found.
|
|
67
|
+
*/
|
|
68
|
+
readonly toDefinition: <Info>(this: void, call: RFunctionCall<Info & ParentInformation>, graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext) => ReadonlyMap<string, RArgument<Info & ParentInformation>> | undefined;
|
|
69
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MatchArgs = void 0;
|
|
4
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
5
|
+
const graph_1 = require("./graph");
|
|
6
|
+
const edge_1 = require("./edge");
|
|
7
|
+
const logger_1 = require("../logger");
|
|
8
|
+
const arg_matching_1 = require("../../util/arg-matching");
|
|
9
|
+
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
10
|
+
const signature_db_1 = require("../../project/sigdb/signature-db");
|
|
11
|
+
const df_helper_1 = require("./df-helper");
|
|
12
|
+
const identifier_1 = require("../environments/identifier");
|
|
13
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
14
|
+
/** the argument names in the shape {@link matchArgumentsToParameters} takes, unnamed arguments as `undefined` */
|
|
15
|
+
function graphArgumentNames(args) {
|
|
16
|
+
return args.map(a => graph_1.FunctionArgument.isNamed(a) ? a.name : undefined);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* R's argument matching, as {@link matchArgumentsToParameters} implements it. Pick by what you hold:
|
|
20
|
+
*
|
|
21
|
+
* - {@link MatchArgs.toNames|toNames} - AST arguments and the formal names
|
|
22
|
+
* - {@link MatchArgs.toSpec|toSpec} - graph arguments and the formals (a spec or a database signature)
|
|
23
|
+
* - {@link MatchArgs.onCallAndLink|onCallAndLink} - as `toSpec`, and **adds the argument edges to the graph**
|
|
24
|
+
* - {@link MatchArgs.toDefinition|toDefinition} - only the call, the formals are looked up for you
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* MatchArgs.toNames(call.arguments, ['x', 'value']).get('value');
|
|
28
|
+
* MatchArgs.toSpec(args, { file: 'fileId', '...': '...' }).get('fileId');
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
exports.MatchArgs = {
|
|
32
|
+
name: 'MatchArgs',
|
|
33
|
+
/**
|
|
34
|
+
* Binds a call's AST `args` to the formal `paramNames`. An empty argument (`f(1, ,3)`) takes its formal but
|
|
35
|
+
* never appears here. Arguments falling to `...` share that key, so only the last survives; use
|
|
36
|
+
* {@link MatchArgs.toSpec} to keep them all.
|
|
37
|
+
* @param args - The arguments as they stand in the normalized AST.
|
|
38
|
+
* @param paramNames - The formals of the called function, in order.
|
|
39
|
+
* @returns Per formal name the argument bound to it.
|
|
40
|
+
*/
|
|
41
|
+
toNames(args, paramNames) {
|
|
42
|
+
const matched = (0, arg_matching_1.matchArgumentsToParameters)(args.map(a => a === r_function_call_1.EmptyArgument ? undefined : a.name?.content), paramNames);
|
|
43
|
+
const bound = new Map();
|
|
44
|
+
for (let i = 0; i < args.length; i++) {
|
|
45
|
+
const arg = args[i], param = matched[i];
|
|
46
|
+
if (arg !== r_function_call_1.EmptyArgument && param !== undefined) {
|
|
47
|
+
bound.set(paramNames[param], arg);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return bound;
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Binds a call's graph `args` against the formals, reading nothing from the graph, so it also serves a
|
|
54
|
+
* function whose parameters are not in the AST at all. Name `'...'` in a specification unless the function
|
|
55
|
+
* really has none, as that is what collects arguments finding no formal of their own.
|
|
56
|
+
* @param args - The arguments as the graph holds them, see {@link convertFnArguments}.
|
|
57
|
+
* @param params - Formal name to the target it stands for, or a signature whose names are the targets.
|
|
58
|
+
* @returns Per target the ids bound to it.
|
|
59
|
+
*/
|
|
60
|
+
toSpec(args, params) {
|
|
61
|
+
let spec = params;
|
|
62
|
+
if (Array.isArray(params)) {
|
|
63
|
+
spec = {};
|
|
64
|
+
for (const p of params) {
|
|
65
|
+
spec[p.name] = p.name;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const paramNames = Object.keys(spec);
|
|
69
|
+
const matched = (0, arg_matching_1.matchArgumentsToParameters)(graphArgumentNames(args), paramNames);
|
|
70
|
+
const maps = new Map();
|
|
71
|
+
for (let i = 0; i < args.length; i++) {
|
|
72
|
+
const arg = args[i], param = matched[i];
|
|
73
|
+
if (arg === r_function_call_1.EmptyArgument || param === undefined) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const target = spec[paramNames[param]];
|
|
77
|
+
const known = maps.get(target);
|
|
78
|
+
if (known) {
|
|
79
|
+
known.push(arg.nodeId);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
maps.set(target, [arg.nodeId]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return maps;
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Binds a call's graph `args` to the `params` of the definition it calls **and mutates `graph`**, adding an
|
|
89
|
+
* {@link EdgeType.DefinesOnCall} and a {@link EdgeType.DefinedByOnCall} edge per bound pair. It is the only
|
|
90
|
+
* member here that writes anything.
|
|
91
|
+
* @param args - The arguments as the graph holds them.
|
|
92
|
+
* @param params - The parameters of the called definition, in order.
|
|
93
|
+
* @param graph - The graph the edges are added to.
|
|
94
|
+
* @returns The argument id to parameter id mapping the edges were drawn for.
|
|
95
|
+
*/
|
|
96
|
+
onCallAndLink(args, params, graph) {
|
|
97
|
+
const matched = (0, arg_matching_1.matchArgumentsToParameters)(graphArgumentNames(args), params.map(p => p?.special ? arg_matching_1.DotsParameterName : p?.name?.content));
|
|
98
|
+
const maps = new Map();
|
|
99
|
+
for (let i = 0; i < args.length; i++) {
|
|
100
|
+
const arg = args[i];
|
|
101
|
+
if (arg === r_function_call_1.EmptyArgument) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const param = matched[i];
|
|
105
|
+
const pid = param === undefined ? undefined : params[param].name?.info.id;
|
|
106
|
+
const aid = arg.nodeId;
|
|
107
|
+
if (pid === undefined) {
|
|
108
|
+
logger_1.dataflowLogger.warn(`skipping argument ${i} (id: ${aid}) as there is no corresponding parameter - R should block that`);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
graph.addEdge(aid, pid, edge_1.EdgeType.DefinesOnCall);
|
|
112
|
+
graph.addEdge(pid, aid, edge_1.EdgeType.DefinedByOnCall);
|
|
113
|
+
maps.set(aid, pid);
|
|
114
|
+
}
|
|
115
|
+
return maps;
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* Binds a call's arguments to the formals of whatever it calls, looking the formals up itself. It takes them
|
|
119
|
+
* from the {@link RFunctionDefinition} the call resolves to in user code, and from the database signature at
|
|
120
|
+
* the version the analysis assumes otherwise (see {@link SignatureDb}). `undefined` when it resolves to
|
|
121
|
+
* neither, so fall back to a hardcoded list then.
|
|
122
|
+
*
|
|
123
|
+
* `graph` is what says which definition a name reaches here, because scoping, shadowing and control flow
|
|
124
|
+
* decide that and a name alone cannot. It therefore needs a finished graph rather than one under
|
|
125
|
+
* construction. Cost is one {@link Dataflow.origin} lookup plus, for a package call, decoding that one
|
|
126
|
+
* function.
|
|
127
|
+
* @param call - The call whose arguments are to be bound.
|
|
128
|
+
* @param graph - The finished graph the call was analyzed into.
|
|
129
|
+
* @param ctx - The analyzer context the database and the assumed versions come from.
|
|
130
|
+
* @returns Per formal name the argument bound to it, `undefined` if the formals could not be found.
|
|
131
|
+
*/
|
|
132
|
+
toDefinition(call, graph, ctx) {
|
|
133
|
+
const names = formalsOf(call, graph, ctx);
|
|
134
|
+
return names === undefined ? undefined : exports.MatchArgs.toNames(call.arguments, names);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* The formals {@link MatchArgs.toDefinition} binds against. User code is tried first because its parameters are
|
|
139
|
+
* already in the AST, so the common case never touches the signature database.
|
|
140
|
+
*/
|
|
141
|
+
function formalsOf(call, graph, ctx) {
|
|
142
|
+
const origins = df_helper_1.Dataflow.origin(graph, call.info.id);
|
|
143
|
+
if (origins === undefined) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
for (const origin of origins) {
|
|
147
|
+
if (origin.type === 2 /* OriginType.FunctionCallOrigin */ && !node_id_1.NodeId.isBuiltIn(origin.id)) {
|
|
148
|
+
const definition = graph.idMap?.get(origin.id);
|
|
149
|
+
if (r_function_definition_1.RFunctionDefinition.is(definition)) {
|
|
150
|
+
return definition.parameters.map(p => p.special ? arg_matching_1.DotsParameterName : p.name.content);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
let db;
|
|
155
|
+
for (const origin of origins) {
|
|
156
|
+
if (origin.type !== 3 /* OriginType.BuiltInFunctionOrigin */) {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
db ??= (0, signature_db_1.signatureDbOf)(ctx.deps);
|
|
160
|
+
const found = db.parametersOf(identifier_1.Identifier.toQualified([origin], origin.fn.name) ?? origin.fn.name);
|
|
161
|
+
if (found !== undefined && found.length > 0) {
|
|
162
|
+
return found;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=match-args.js.map
|
package/dataflow/info.d.ts
CHANGED
|
@@ -83,7 +83,7 @@ export declare function doesExitPointPropagateCalls(type: ExitPointType): boolea
|
|
|
83
83
|
* This may be as innocent as the last expression or explicit with a `return`/`break`/`next`.
|
|
84
84
|
* @see {@link ExitPointType} - for the different types of exit points
|
|
85
85
|
* @see {@link addNonDefaultExitPoints} - to easily modify lists of exit points
|
|
86
|
-
* @see {@link alwaysExits} - to check whether a
|
|
86
|
+
* @see {@link ControlFlow#alwaysExits|ControlFlow.alwaysExits()} - to check whether a subtree always jumps away
|
|
87
87
|
* @see {@link filterOutLoopExitPoints} - to remove loop exit points from a list
|
|
88
88
|
*/
|
|
89
89
|
export interface ExitPoint {
|
|
@@ -133,6 +133,20 @@ export type KillReference =
|
|
|
133
133
|
export interface DataflowCfgInformation {
|
|
134
134
|
/** The entry node into the subgraph */
|
|
135
135
|
entryPoint: NodeId;
|
|
136
|
+
/**
|
|
137
|
+
* The node control flow enters this subtree at.
|
|
138
|
+
* Control flow is modeled in post-order (operands are evaluated before the operator that consumes them),
|
|
139
|
+
* so for compound constructs this is not the {@link DataflowCfgInformation#entryPoint|entryPoint}
|
|
140
|
+
* (which names the value-producing node) but the first node that is actually evaluated.
|
|
141
|
+
* Left `undefined` whenever both coincide, which is the case for all leaves.
|
|
142
|
+
*/
|
|
143
|
+
cfgEntry?: NodeId;
|
|
144
|
+
/**
|
|
145
|
+
* The node control flow leaves this subtree at, joining the branches of the construct if it has any.
|
|
146
|
+
* Left `undefined` whenever the {@link DataflowCfgInformation#exitPoints|exitPoints} already name it,
|
|
147
|
+
* which is the case whenever the construct has a single point of exit.
|
|
148
|
+
*/
|
|
149
|
+
cfgExit?: NodeId;
|
|
136
150
|
/**
|
|
137
151
|
* All already identified exit points (active 'return'/'break'/'next'-likes) of the respective structure.
|
|
138
152
|
* This also tracks (local knowledge of) exceptions thrown within the structure.
|
|
@@ -209,11 +223,6 @@ export declare function happensInEveryBranch(cds: readonly ControlDependency[] |
|
|
|
209
223
|
* @see {@link happensInEveryBranch} - for the array-based version
|
|
210
224
|
*/
|
|
211
225
|
export declare function happensInEveryBranchSet(cds: ReadonlySet<ControlDependency> | undefined): boolean;
|
|
212
|
-
/**
|
|
213
|
-
* Checks whether the given dataflow information always exits (i.e., if there is a non-default exit point in every branch).
|
|
214
|
-
* @see {@link ExitPoint} - for the different types of exit points
|
|
215
|
-
*/
|
|
216
|
-
export declare function alwaysExits(data: DataflowInformation): boolean;
|
|
217
226
|
/**
|
|
218
227
|
* Filters out exit points which end their cascade within a loop.
|
|
219
228
|
*/
|
package/dataflow/info.js
CHANGED
|
@@ -9,7 +9,6 @@ exports.addNonDefaultExitPoints = addNonDefaultExitPoints;
|
|
|
9
9
|
exports.overwriteExitPoints = overwriteExitPoints;
|
|
10
10
|
exports.happensInEveryBranch = happensInEveryBranch;
|
|
11
11
|
exports.happensInEveryBranchSet = happensInEveryBranchSet;
|
|
12
|
-
exports.alwaysExits = alwaysExits;
|
|
13
12
|
exports.filterOutLoopExitPoints = filterOutLoopExitPoints;
|
|
14
13
|
exports.diffControlDependency = diffControlDependency;
|
|
15
14
|
exports.diffControlDependencies = diffControlDependencies;
|
|
@@ -172,22 +171,6 @@ function coversSet(cds) {
|
|
|
172
171
|
function happensInEveryBranchSet(cds) {
|
|
173
172
|
return cds === undefined || (cds.size !== 0 && coversSet(cds));
|
|
174
173
|
}
|
|
175
|
-
/**
|
|
176
|
-
* Checks whether the given dataflow information always exits (i.e., if there is a non-default exit point in every branch).
|
|
177
|
-
* @see {@link ExitPoint} - for the different types of exit points
|
|
178
|
-
*/
|
|
179
|
-
function alwaysExits(data) {
|
|
180
|
-
let cds = [];
|
|
181
|
-
for (const e of data.exitPoints) {
|
|
182
|
-
if (e.type !== 0 /* ExitPointType.Default */) {
|
|
183
|
-
if (e.cds === undefined) {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
cds = cds.concat(e.cds);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return happensInEveryBranch(cds);
|
|
190
|
-
}
|
|
191
174
|
/**
|
|
192
175
|
* Filters out exit points which end their cascade within a loop.
|
|
193
176
|
*/
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
+
import type { DataflowGraph } from '../graph/graph';
|
|
3
|
+
import type { DataflowCfgInformation } from '../info';
|
|
4
|
+
import { ControlDependency, ExitPointType } from '../info';
|
|
5
|
+
/**
|
|
6
|
+
* Records the control flow of a program in the {@link DataflowGraph} while the dataflow analysis walks it.
|
|
7
|
+
* The {@link ControlFlowGraph} is a view on what is recorded here.
|
|
8
|
+
*
|
|
9
|
+
* The control flow is modeled in post-order: everything a construct is made of runs before the construct
|
|
10
|
+
* itself, so its own vertex is where its parts join again and where it is left.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ControlFlow: {
|
|
13
|
+
readonly name: "ControlFlow";
|
|
14
|
+
/**
|
|
15
|
+
* The node control flow enters the given subtree at.
|
|
16
|
+
* @example
|
|
17
|
+
* ```r
|
|
18
|
+
* x + 1 # the `+` is entered at `x`
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
readonly entryOf: (this: void, info: DataflowCfgInformation) => NodeId;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the node runs as a statement of the program instead of as part of a larger expression.
|
|
24
|
+
* Assignments count as statements wherever they stand.
|
|
25
|
+
* @example
|
|
26
|
+
* ```r
|
|
27
|
+
* print(x + 1) # the call is a statement, `x + 1` and `x` are expressions
|
|
28
|
+
* ```
|
|
29
|
+
* @see {@link ControlFlow#isExpression|isExpression()} - for the other kind
|
|
30
|
+
*/
|
|
31
|
+
readonly isStatement: (this: void, graph: DataflowGraph, id: NodeId) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the node runs as part of a larger expression instead of as a statement of its own.
|
|
34
|
+
* @example
|
|
35
|
+
* ```r
|
|
36
|
+
* print(x + 1) # `x + 1` and `x` are expressions, the call is a statement
|
|
37
|
+
* ```
|
|
38
|
+
* @see {@link ControlFlow#isStatement|isStatement()} - for the other kind
|
|
39
|
+
*/
|
|
40
|
+
readonly isExpression: (this: void, graph: DataflowGraph, id: NodeId) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the subtree always jumps away instead of being left normally, i.e. whether a non-default exit
|
|
43
|
+
* point happens in every branch.
|
|
44
|
+
* @example
|
|
45
|
+
* ```r
|
|
46
|
+
* { break } # always exits
|
|
47
|
+
* { if(u) break } # only maybe
|
|
48
|
+
* ```
|
|
49
|
+
* @see {@link ControlFlow#canComplete|canComplete()} - for whether it can be left normally at all
|
|
50
|
+
*/
|
|
51
|
+
readonly alwaysExits: (this: void, info: DataflowCfgInformation) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the subtree can be left normally instead of always jumping away.
|
|
54
|
+
* @example
|
|
55
|
+
* ```r
|
|
56
|
+
* { 1 } # can complete
|
|
57
|
+
* { break } # cannot
|
|
58
|
+
* ```
|
|
59
|
+
* @see {@link ControlFlow#alwaysExits|alwaysExits()} - for whether it always jumps away
|
|
60
|
+
*/
|
|
61
|
+
readonly canComplete: (this: void, info: DataflowCfgInformation) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whatever `from` completes at continues with `next`.
|
|
64
|
+
* @example
|
|
65
|
+
* ```r
|
|
66
|
+
* f(); g() # the call to `g` continues what `f` completes
|
|
67
|
+
* ```
|
|
68
|
+
* @see {@link ControlFlow#branchesTo|branchesTo()} - if it only continues under a condition
|
|
69
|
+
*/
|
|
70
|
+
readonly continuesWith: (this: void, graph: DataflowGraph, from: DataflowCfgInformation, next: NodeId) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Whatever `from` completes at continues with `target`, but only under the given control dependency.
|
|
73
|
+
* Hand over the very dependency the vertices behind the branch carry, so both say the same thing.
|
|
74
|
+
* @example
|
|
75
|
+
* ```r
|
|
76
|
+
* if(u) a else b # `a` is reached when `u` holds, `b` when it does not
|
|
77
|
+
* ```
|
|
78
|
+
* @see {@link ControlFlow#continuesWith|continuesWith()} - if it always continues
|
|
79
|
+
*/
|
|
80
|
+
readonly branchesTo: (this: void, graph: DataflowGraph, from: DataflowCfgInformation, target: NodeId, cd: ControlDependency) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Every jump of the given kind within `from` lands on `target`.
|
|
83
|
+
* @example
|
|
84
|
+
* ```r
|
|
85
|
+
* while(u) { break } # the `break` lands on the loop it leaves
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
readonly jumpsTo: (this: void, graph: DataflowGraph, from: DataflowCfgInformation, kind: ExitPointType, target: NodeId) => void;
|
|
89
|
+
/**
|
|
90
|
+
* The parts run one after the other and the last one continues with `last`, if it is given.
|
|
91
|
+
* Parts that are `undefined` are skipped, which keeps optional arguments cheap to handle.
|
|
92
|
+
* @example
|
|
93
|
+
* ```r
|
|
94
|
+
* f(a, b) # `a`, then `b`, then the call
|
|
95
|
+
* ```
|
|
96
|
+
* @returns the node control flow enters the sequence at, or `last` if there is nothing to enter
|
|
97
|
+
*/
|
|
98
|
+
readonly inSequence: (this: void, graph: DataflowGraph, parts: readonly (DataflowCfgInformation | undefined)[], last?: NodeId) => NodeId | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* The parts before `from` run in sequence, the ones after it are alternatives of which at most one runs.
|
|
101
|
+
* Whichever one it is, control joins on `joinsAt`.
|
|
102
|
+
* @example
|
|
103
|
+
* ```r
|
|
104
|
+
* switch(k, a = 1, b = 2) # `k`, then one arm, then the switch
|
|
105
|
+
* ```
|
|
106
|
+
* @param graph - the graph to record in
|
|
107
|
+
* @param parts - the arguments of the call, in the order they run
|
|
108
|
+
* @param from - the index the alternatives start at
|
|
109
|
+
* @param joinsAt - the call the alternatives belong to
|
|
110
|
+
* @param hasDefault - whether one alternative runs when none of the others matched
|
|
111
|
+
* @returns the node control flow enters the call at
|
|
112
|
+
*/
|
|
113
|
+
readonly picksOneOf: (this: void, graph: DataflowGraph, parts: readonly (DataflowCfgInformation | undefined)[], from: number, joinsAt: NodeId, hasDefault: boolean) => NodeId | undefined;
|
|
114
|
+
};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ControlFlow = void 0;
|
|
4
|
+
const edge_1 = require("../graph/edge");
|
|
5
|
+
const info_1 = require("../info");
|
|
6
|
+
const r_binary_op_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
|
|
7
|
+
/**
|
|
8
|
+
* Records the control flow of a program in the {@link DataflowGraph} while the dataflow analysis walks it.
|
|
9
|
+
* The {@link ControlFlowGraph} is a view on what is recorded here.
|
|
10
|
+
*
|
|
11
|
+
* The control flow is modeled in post-order: everything a construct is made of runs before the construct
|
|
12
|
+
* itself, so its own vertex is where its parts join again and where it is left.
|
|
13
|
+
*/
|
|
14
|
+
exports.ControlFlow = {
|
|
15
|
+
name: 'ControlFlow',
|
|
16
|
+
/**
|
|
17
|
+
* The node control flow enters the given subtree at.
|
|
18
|
+
* @example
|
|
19
|
+
* ```r
|
|
20
|
+
* x + 1 # the `+` is entered at `x`
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
entryOf(info) {
|
|
24
|
+
return info.cfgEntry ?? info.entryPoint;
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Whether the node runs as a statement of the program instead of as part of a larger expression.
|
|
28
|
+
* Assignments count as statements wherever they stand.
|
|
29
|
+
* @example
|
|
30
|
+
* ```r
|
|
31
|
+
* print(x + 1) # the call is a statement, `x + 1` and `x` are expressions
|
|
32
|
+
* ```
|
|
33
|
+
* @see {@link ControlFlow#isExpression|isExpression()} - for the other kind
|
|
34
|
+
*/
|
|
35
|
+
isStatement(graph, id) {
|
|
36
|
+
const node = graph.idMap?.get(id);
|
|
37
|
+
if (node === undefined) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return node.info.role === "el-c" /* RoleInParent.ExpressionListChild */
|
|
41
|
+
|| (r_binary_op_1.RBinaryOp.is(node) && node.flavor === 'assignment');
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Whether the node runs as part of a larger expression instead of as a statement of its own.
|
|
45
|
+
* @example
|
|
46
|
+
* ```r
|
|
47
|
+
* print(x + 1) # `x + 1` and `x` are expressions, the call is a statement
|
|
48
|
+
* ```
|
|
49
|
+
* @see {@link ControlFlow#isStatement|isStatement()} - for the other kind
|
|
50
|
+
*/
|
|
51
|
+
isExpression(graph, id) {
|
|
52
|
+
return graph.idMap?.get(id) !== undefined && !exports.ControlFlow.isStatement(graph, id);
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Whether the subtree always jumps away instead of being left normally, i.e. whether a non-default exit
|
|
56
|
+
* point happens in every branch.
|
|
57
|
+
* @example
|
|
58
|
+
* ```r
|
|
59
|
+
* { break } # always exits
|
|
60
|
+
* { if(u) break } # only maybe
|
|
61
|
+
* ```
|
|
62
|
+
* @see {@link ControlFlow#canComplete|canComplete()} - for whether it can be left normally at all
|
|
63
|
+
*/
|
|
64
|
+
alwaysExits(info) {
|
|
65
|
+
let cds = [];
|
|
66
|
+
for (const exit of info.exitPoints) {
|
|
67
|
+
if (exit.type !== 0 /* ExitPointType.Default */) {
|
|
68
|
+
if (exit.cds === undefined) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
cds = cds.concat(exit.cds);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return info_1.ControlDependency.happensInEveryBranch(cds);
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Whether the subtree can be left normally instead of always jumping away.
|
|
78
|
+
* @example
|
|
79
|
+
* ```r
|
|
80
|
+
* { 1 } # can complete
|
|
81
|
+
* { break } # cannot
|
|
82
|
+
* ```
|
|
83
|
+
* @see {@link ControlFlow#alwaysExits|alwaysExits()} - for whether it always jumps away
|
|
84
|
+
*/
|
|
85
|
+
canComplete(info) {
|
|
86
|
+
if (info.cfgExit !== undefined) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
for (const exit of info.exitPoints) {
|
|
90
|
+
if (exit.type === 0 /* ExitPointType.Default */) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* Whatever `from` completes at continues with `next`.
|
|
98
|
+
* @example
|
|
99
|
+
* ```r
|
|
100
|
+
* f(); g() # the call to `g` continues what `f` completes
|
|
101
|
+
* ```
|
|
102
|
+
* @see {@link ControlFlow#branchesTo|branchesTo()} - if it only continues under a condition
|
|
103
|
+
*/
|
|
104
|
+
continuesWith(graph, from, next) {
|
|
105
|
+
if (from.cfgExit !== undefined) {
|
|
106
|
+
graph.addEdge(from.cfgExit, next, edge_1.EdgeType.FlowEdge);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
for (const exit of from.exitPoints) {
|
|
110
|
+
if (exit.type === 0 /* ExitPointType.Default */) {
|
|
111
|
+
graph.addEdge(exit.nodeId, next, edge_1.EdgeType.FlowEdge);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* Whatever `from` completes at continues with `target`, but only under the given control dependency.
|
|
117
|
+
* Hand over the very dependency the vertices behind the branch carry, so both say the same thing.
|
|
118
|
+
* @example
|
|
119
|
+
* ```r
|
|
120
|
+
* if(u) a else b # `a` is reached when `u` holds, `b` when it does not
|
|
121
|
+
* ```
|
|
122
|
+
* @see {@link ControlFlow#continuesWith|continuesWith()} - if it always continues
|
|
123
|
+
*/
|
|
124
|
+
branchesTo(graph, from, target, cd) {
|
|
125
|
+
if (from.cfgExit !== undefined) {
|
|
126
|
+
graph.addEdge(from.cfgExit, target, edge_1.EdgeType.ControlEdge, { cd });
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
for (const exit of from.exitPoints) {
|
|
130
|
+
if (exit.type === 0 /* ExitPointType.Default */) {
|
|
131
|
+
graph.addEdge(exit.nodeId, target, edge_1.EdgeType.ControlEdge, { cd });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Every jump of the given kind within `from` lands on `target`.
|
|
137
|
+
* @example
|
|
138
|
+
* ```r
|
|
139
|
+
* while(u) { break } # the `break` lands on the loop it leaves
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
jumpsTo(graph, from, kind, target) {
|
|
143
|
+
for (const exit of from.exitPoints) {
|
|
144
|
+
if (exit.type === kind) {
|
|
145
|
+
graph.addEdge(exit.nodeId, target, edge_1.EdgeType.FlowEdge);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* The parts run one after the other and the last one continues with `last`, if it is given.
|
|
151
|
+
* Parts that are `undefined` are skipped, which keeps optional arguments cheap to handle.
|
|
152
|
+
* @example
|
|
153
|
+
* ```r
|
|
154
|
+
* f(a, b) # `a`, then `b`, then the call
|
|
155
|
+
* ```
|
|
156
|
+
* @returns the node control flow enters the sequence at, or `last` if there is nothing to enter
|
|
157
|
+
*/
|
|
158
|
+
inSequence(graph, parts, last) {
|
|
159
|
+
let entry = undefined;
|
|
160
|
+
let previous = undefined;
|
|
161
|
+
for (const part of parts) {
|
|
162
|
+
if (part === undefined) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (previous === undefined) {
|
|
166
|
+
entry = exports.ControlFlow.entryOf(part);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
exports.ControlFlow.continuesWith(graph, previous, exports.ControlFlow.entryOf(part));
|
|
170
|
+
}
|
|
171
|
+
previous = part;
|
|
172
|
+
}
|
|
173
|
+
if (previous !== undefined && last !== undefined) {
|
|
174
|
+
exports.ControlFlow.continuesWith(graph, previous, last);
|
|
175
|
+
}
|
|
176
|
+
return entry ?? last;
|
|
177
|
+
},
|
|
178
|
+
/**
|
|
179
|
+
* The parts before `from` run in sequence, the ones after it are alternatives of which at most one runs.
|
|
180
|
+
* Whichever one it is, control joins on `joinsAt`.
|
|
181
|
+
* @example
|
|
182
|
+
* ```r
|
|
183
|
+
* switch(k, a = 1, b = 2) # `k`, then one arm, then the switch
|
|
184
|
+
* ```
|
|
185
|
+
* @param graph - the graph to record in
|
|
186
|
+
* @param parts - the arguments of the call, in the order they run
|
|
187
|
+
* @param from - the index the alternatives start at
|
|
188
|
+
* @param joinsAt - the call the alternatives belong to
|
|
189
|
+
* @param hasDefault - whether one alternative runs when none of the others matched
|
|
190
|
+
* @returns the node control flow enters the call at
|
|
191
|
+
*/
|
|
192
|
+
picksOneOf(graph, parts, from, joinsAt, hasDefault) {
|
|
193
|
+
let entry = undefined;
|
|
194
|
+
let selector = undefined;
|
|
195
|
+
for (let i = 0; i < from; i++) {
|
|
196
|
+
const part = parts[i];
|
|
197
|
+
if (part === undefined) {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (selector === undefined) {
|
|
201
|
+
entry = exports.ControlFlow.entryOf(part);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
exports.ControlFlow.continuesWith(graph, selector, exports.ControlFlow.entryOf(part));
|
|
205
|
+
}
|
|
206
|
+
selector = part;
|
|
207
|
+
}
|
|
208
|
+
for (let i = from; i < parts.length; i++) {
|
|
209
|
+
const alternative = parts[i];
|
|
210
|
+
if (alternative === undefined) {
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (selector !== undefined) {
|
|
214
|
+
exports.ControlFlow.branchesTo(graph, selector, exports.ControlFlow.entryOf(alternative), { id: joinsAt, when: true });
|
|
215
|
+
}
|
|
216
|
+
exports.ControlFlow.continuesWith(graph, alternative, joinsAt);
|
|
217
|
+
}
|
|
218
|
+
if (selector !== undefined && !hasDefault) {
|
|
219
|
+
exports.ControlFlow.branchesTo(graph, selector, joinsAt, { id: joinsAt, when: false });
|
|
220
|
+
}
|
|
221
|
+
return entry ?? joinsAt;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
//# sourceMappingURL=control-flow.js.map
|