@eagleoutice/flowr 2.14.1 → 2.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -87
- package/abstract-interpretation/absint-visitor.d.ts +132 -25
- package/abstract-interpretation/absint-visitor.js +459 -99
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/arguments.js +1 -1
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +107 -254
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +5 -5
- package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -1
- package/abstract-interpretation/data-frame/resolve-args.js +6 -4
- package/abstract-interpretation/data-frame/shape-inference.d.ts +4 -9
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -0
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -0
- package/abstract-interpretation/domains/partial-product-domain.js +1 -1
- package/abstract-interpretation/domains/set-range-domain.d.ts +3 -2
- package/abstract-interpretation/domains/set-range-domain.js +3 -2
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +3 -2
- package/abstract-interpretation/domains/set-upper-bound-domain.js +3 -2
- package/benchmark/calibration.d.ts +11 -6
- package/benchmark/calibration.js +19 -8
- package/benchmark/slicer.d.ts +7 -1
- package/benchmark/slicer.js +38 -34
- package/benchmark/stats/count-comments.d.ts +16 -0
- package/benchmark/stats/count-comments.js +30 -0
- package/benchmark/stats/print.js +2 -0
- package/benchmark/stats/size-of.d.ts +7 -3
- package/benchmark/stats/size-of.js +7 -3
- package/benchmark/stats/stats.d.ts +7 -0
- package/benchmark/summarizer/first-phase/process.js +2 -19
- package/benchmark/summarizer/second-phase/graph.js +13 -3
- package/benchmark/summarizer/second-phase/process.js +2 -0
- package/cli/repl/commands/repl-dataflow.js +70 -27
- package/cli/repl/core.d.ts +1 -1
- package/cli/repl/core.js +1 -1
- package/cli/repl/parser/slice-query-parser.js +2 -1
- package/cli/repl/server/connection.d.ts +4 -0
- package/cli/repl/server/connection.js +19 -16
- package/cli/repl/server/messages/message-analysis.d.ts +1 -1
- package/config.d.ts +21 -8
- package/config.js +12 -5
- package/control-flow/basic-cfg-guided-visitor.d.ts +7 -2
- package/control-flow/basic-cfg-guided-visitor.js +37 -24
- package/control-flow/cfg-dead-code.js +44 -33
- package/control-flow/cfg-properties.js +2 -2
- package/control-flow/cfg-simplification.js +6 -5
- package/control-flow/cfg-to-basic-blocks.js +11 -13
- package/control-flow/control-flow-graph.d.ts +179 -189
- package/control-flow/control-flow-graph.js +400 -263
- package/control-flow/dfg-cfg-guided-visitor.d.ts +21 -3
- package/control-flow/dfg-cfg-guided-visitor.js +17 -13
- package/control-flow/diff-cfg.js +6 -14
- package/control-flow/happens-before.js +5 -4
- package/control-flow/semantic-cfg-guided-visitor.d.ts +44 -101
- package/control-flow/semantic-cfg-guided-visitor.js +6 -3
- package/control-flow/simple-visitor.js +14 -15
- package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -1
- package/control-flow/useless-loop.js +18 -14
- package/core/steps/all/core/20-dataflow.d.ts +1 -3
- package/core/steps/pipeline/default-pipelines.d.ts +141 -157
- package/dataflow/cluster.js +7 -0
- package/dataflow/environments/apply-kill.d.ts +6 -0
- package/dataflow/environments/apply-kill.js +63 -31
- package/dataflow/environments/built-in-props.d.ts +5 -1
- package/dataflow/environments/built-in-props.js +4 -0
- package/dataflow/environments/built-in.d.ts +6 -3
- package/dataflow/environments/built-in.js +8 -5
- package/dataflow/environments/clone.d.ts +3 -3
- package/dataflow/environments/clone.js +5 -5
- package/dataflow/environments/default-builtin-config.d.ts +114 -3
- package/dataflow/environments/default-builtin-config.js +137 -35
- package/dataflow/environments/environment.d.ts +5 -5
- package/dataflow/environments/environment.js +5 -5
- package/dataflow/environments/identifier.d.ts +11 -1
- package/dataflow/environments/identifier.js +4 -1
- package/dataflow/environments/resolve-by-name.d.ts +7 -0
- package/dataflow/environments/resolve-by-name.js +12 -0
- package/dataflow/environments/resolve-helper.d.ts +3 -1
- package/dataflow/environments/resolve-helper.js +2 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +3 -3
- package/dataflow/eval/resolve/alias-tracking.js +3 -3
- package/dataflow/eval/resolve/match-arguments.js +7 -5
- package/dataflow/eval/resolve/node-value.d.ts +3 -1
- package/dataflow/eval/resolve/node-value.js +12 -0
- package/dataflow/eval/resolve/resolve-argument.js +5 -4
- package/dataflow/eval/resolve/resolve-operators.js +9 -6
- package/dataflow/eval/resolve/resolve-strings.js +2 -2
- package/dataflow/eval/resolve/resolve-working-directory.js +4 -3
- package/dataflow/eval/resolve/resolve.js +3 -2
- package/dataflow/eval/values/general.js +8 -5
- package/dataflow/extractor.d.ts +1 -4
- package/dataflow/extractor.js +11 -10
- package/dataflow/fn/exceptions-of-function.d.ts +3 -1
- package/dataflow/fn/strict-function.js +7 -5
- package/dataflow/graph/call-graph.js +2 -2
- package/dataflow/graph/df-helper.d.ts +8 -1
- package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +19 -2
- package/dataflow/graph/edge.d.ts +38 -2
- package/dataflow/graph/edge.js +32 -2
- package/dataflow/graph/graph.d.ts +4 -3
- package/dataflow/graph/graph.js +6 -2
- package/dataflow/graph/match-args.d.ts +69 -0
- package/dataflow/graph/match-args.js +167 -0
- package/dataflow/info.d.ts +15 -6
- package/dataflow/info.js +0 -17
- package/dataflow/internal/control-flow.d.ts +114 -0
- package/dataflow/internal/control-flow.js +224 -0
- package/dataflow/internal/linker.d.ts +6 -31
- package/dataflow/internal/linker.js +24 -81
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +9 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +18 -37
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +11 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +18 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +18 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +12 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +38 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +36 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +20 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +9 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +15 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +11 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +26 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +17 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +71 -33
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +6 -15
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +13 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +14 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +15 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +12 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +50 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +20 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +6 -2
- package/dataflow/internal/process/functions/call/common.js +5 -6
- package/dataflow/internal/process/functions/call/deferred.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +12 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +41 -15
- package/dataflow/internal/process/functions/call/named-call-handling.js +2 -0
- package/dataflow/internal/process/functions/call/nse.d.ts +1 -1
- package/dataflow/internal/process/functions/call/nse.js +6 -1
- package/dataflow/internal/process/functions/call/quoted.js +2 -2
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +19 -6
- package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/process-argument.js +12 -4
- package/dataflow/internal/process/functions/process-parameter.js +13 -0
- package/dataflow/internal/process/process-named-call.d.ts +2 -2
- package/dataflow/internal/process/process-named-call.js +9 -7
- package/documentation/data/server/doc-data-server-messages.js +4 -4
- package/documentation/doc-readme.js +33 -0
- package/documentation/doc-util/doc-cfg.d.ts +8 -7
- package/documentation/doc-util/doc-cfg.js +10 -10
- package/documentation/doc-util/doc-playground.d.ts +12 -0
- package/documentation/doc-util/doc-playground.js +21 -0
- package/documentation/doc-util/doc-query.d.ts +4 -1
- package/documentation/doc-util/doc-query.js +4 -2
- package/documentation/wiki-absint.d.ts +3 -4
- package/documentation/wiki-absint.js +17 -5
- package/documentation/wiki-analyzer.js +2 -2
- package/documentation/wiki-cfg.js +101 -106
- package/documentation/wiki-dataflow-graph.js +84 -53
- package/documentation/wiki-interface.js +1 -0
- package/documentation/wiki-linter.js +15 -1
- package/documentation/wiki-linting-and-testing.js +1 -16
- package/documentation/wiki-mk/doc-maker.js +6 -4
- package/documentation/wiki-query.js +14 -4
- package/documentation/wiki-signature-database.js +28 -2
- package/linter/linter-fix.d.ts +16 -0
- package/linter/linter-fix.js +104 -0
- package/linter/linter-format.d.ts +18 -1
- package/linter/linter-format.js +31 -1
- package/linter/linter-output.js +46 -10
- package/linter/linter-rules.d.ts +40 -9
- package/linter/linter-rules.js +2 -0
- package/linter/rules/absolute-path.js +4 -2
- package/linter/rules/dataframe-access-validation.js +6 -7
- package/linter/rules/deprecated-functions.d.ts +107 -10
- package/linter/rules/deprecated-functions.js +311 -23
- package/linter/rules/file-path-validity.js +5 -4
- package/linter/rules/function-finder-util.d.ts +6 -0
- package/linter/rules/function-finder-util.js +21 -13
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +2 -2
- package/linter/rules/stop-with-call-arg.js +2 -2
- package/linter/rules/unclosed-connection.js +2 -2
- package/linter/rules/undefined-symbol-util.js +6 -4
- package/linter/rules/undefined-symbol.js +2 -2
- package/linter/rules/unused-definition.js +8 -4
- package/linter/rules/unused-import.d.ts +60 -0
- package/linter/rules/unused-import.js +179 -0
- package/package.json +2 -2
- package/project/attached-packages.js +2 -1
- package/project/cache/flowr-analyzer-cache.d.ts +2 -5
- package/project/cache/flowr-analyzer-cache.js +4 -7
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +9 -8
- package/project/cache/flowr-analyzer-controlflow-cache.js +17 -34
- package/project/cache/flowr-cache.d.ts +9 -0
- package/project/cache/flowr-cache.js +19 -0
- package/project/context/flowr-analyzer-context.d.ts +7 -3
- package/project/context/flowr-analyzer-context.js +15 -9
- package/project/context/flowr-analyzer-dependencies-context.d.ts +24 -3
- package/project/context/flowr-analyzer-dependencies-context.js +9 -14
- package/project/context/flowr-analyzer-files-context.js +15 -17
- package/project/context/flowr-analyzer-meta-context.js +2 -12
- package/project/dependency-version-space.d.ts +1 -7
- package/project/dependency-version-space.js +9 -8
- package/project/flowr-analyzer-builder.d.ts +4 -4
- package/project/flowr-analyzer.d.ts +4 -6
- package/project/flowr-analyzer.js +4 -5
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -34
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +13 -13
- package/project/plugins/file-plugins/files/flowr-rda-file.js +131 -286
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +1 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +32 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +43 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +5 -8
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +4 -10
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +3 -10
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +1 -13
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +3 -6
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +3 -4
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -6
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -16
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +2 -8
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +2 -6
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +1 -10
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.js +2 -8
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +2 -1
- package/project/sigdb/build.d.ts +2 -2
- package/project/sigdb/decode.d.ts +0 -5
- package/project/sigdb/decode.js +0 -8
- package/project/sigdb/index-format.d.ts +4 -4
- package/project/sigdb/manifest.d.ts +2 -2
- package/project/sigdb/reader.d.ts +54 -13
- package/project/sigdb/reader.js +4 -3
- package/project/sigdb/schema.d.ts +3 -1
- package/project/sigdb/signature-db.d.ts +69 -0
- package/project/sigdb/signature-db.js +54 -0
- package/project/sigdb/signature-match.d.ts +10 -5
- package/project/sigdb/signature-match.js +13 -8
- package/queries/catalog/absint-query/absint-query-executor.js +1 -2
- package/queries/catalog/call-context-query/call-context-query-executor.js +2 -4
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +33 -6
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +8 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -35
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +13 -1
- package/queries/catalog/dependencies-query/function-info/library-functions.js +26 -22
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +9 -0
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +19 -0
- package/queries/catalog/dependencies-query/implicit-echo.d.ts +13 -0
- package/queries/catalog/dependencies-query/implicit-echo.js +133 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +1 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/signature-query/signature-query-executor.js +4 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +4 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +13 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +8 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +8 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +3 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +6 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +5 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +5 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +5 -3
- package/reconstruct/inline/source-inline-map.js +3 -3
- package/reconstruct/reconstruct.js +6 -4
- package/search/flowr-search-builder.d.ts +8 -8
- package/search/flowr-search-builder.js +4 -4
- package/search/flowr-search-filters.d.ts +2 -2
- package/search/flowr-search-filters.js +3 -2
- package/search/search-executor/search-enrichers.d.ts +6 -0
- package/search/search-executor/search-enrichers.js +44 -5
- package/slicing/criterion/filters/all-variables.js +2 -1
- package/slicing/criterion/parse.js +8 -6
- package/slicing/static/slice-call.js +2 -2
- package/util/arg-matching.d.ts +3 -0
- package/util/arg-matching.js +12 -1
- package/util/collections/arrays.d.ts +0 -4
- package/util/collections/arrays.js +4 -26
- package/util/diff-graph.d.ts +1 -1
- package/util/diff-graph.js +17 -3
- package/util/diff.d.ts +6 -0
- package/util/mermaid/ast.d.ts +1 -1
- package/util/mermaid/ast.js +5 -4
- package/util/mermaid/cfg.js +130 -24
- package/util/mermaid/dfg.js +31 -10
- package/util/mermaid/mermaid.js +2 -0
- package/util/objects.d.ts +24 -4
- package/util/objects.js +12 -0
- package/util/prefix.d.ts +1 -1
- package/util/text/playground-link.d.ts +131 -0
- package/util/text/playground-link.js +214 -0
- package/util/text/strings.js +7 -3
- package/util/version.js +1 -1
- package/control-flow/cfg-builder.d.ts +0 -30
- package/control-flow/cfg-builder.js +0 -79
- package/control-flow/extract-cfg.d.ts +0 -36
- package/control-flow/extract-cfg.js +0 -693
- package/project/cfg-kind.d.ts +0 -21
- package/project/cfg-kind.js +0 -26
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
+
import type { DataflowGraph } from '../dataflow/graph/graph';
|
|
3
|
+
import type { ControlDependency, DataflowInformation } from '../dataflow/info';
|
|
4
|
+
import { type QuadSerializationConfiguration } from '../util/quads';
|
|
2
5
|
import type { MergeableRecord } from '../util/objects';
|
|
3
6
|
import { RFalse, RTrue } from '../r-bridge/lang-4.x/convert-values';
|
|
7
|
+
import type { AstIdMap } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
8
|
/**
|
|
5
9
|
* The type of a vertex in the {@link ControlFlowGraph}.
|
|
6
10
|
* Please use the helper object (e.g. {@link CfgVertex#getType|getType()}) to work with vertices instead of directly accessing the properties.
|
|
7
11
|
*/
|
|
8
12
|
export declare enum CfgVertexType {
|
|
9
|
-
/**
|
|
10
|
-
* The explicit exit-nodes to ensure the hammock property.
|
|
11
|
-
* @see {@link CfgVertex.makeMarker|CfgVertex.makeMarker()} - for a helper function to create end marker vertices
|
|
12
|
-
*/
|
|
13
|
-
Marker = 0,
|
|
14
13
|
/**
|
|
15
14
|
* something like an if, assignment, ... even though in the classical sense of R they are still expressions
|
|
16
15
|
* @see {@link CfgVertex.makeStatement|CfgVertex.makeStatement()} - for a helper function to create statement vertices
|
|
@@ -28,32 +27,30 @@ export declare enum CfgVertexType {
|
|
|
28
27
|
Block = 3
|
|
29
28
|
}
|
|
30
29
|
export declare const enum CfgEdgeType {
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/** a
|
|
34
|
-
|
|
30
|
+
/** the target simply runs after the source */
|
|
31
|
+
Flow = 0,
|
|
32
|
+
/** the target runs after the source, but only under a {@link ControlDependency} */
|
|
33
|
+
Control = 1
|
|
35
34
|
}
|
|
36
35
|
/**
|
|
37
|
-
* A vertex in the {@link ControlFlowGraph}
|
|
36
|
+
* A vertex in the {@link ControlFlowGraph}.
|
|
38
37
|
* - `type`: the type of the vertex, either a statement or an expression
|
|
39
|
-
* - `id`: the id of the vertex, which
|
|
38
|
+
* - `id`: the id of the vertex, which directly relates to the AST node and to the vertex of the same id in the {@link DataflowGraph}
|
|
40
39
|
* - `children`: child nodes attached to this one
|
|
41
40
|
* - `callTargets`: if the vertex calls a function, this links all targets of this call
|
|
41
|
+
*
|
|
42
|
+
* The control flow is modeled in post-order: a construct's own vertex is where its operands join again,
|
|
43
|
+
* which is why there are no separate marker vertices to close an `if` or a loop.
|
|
42
44
|
*/
|
|
43
|
-
type
|
|
44
|
-
/**
|
|
45
|
-
* @see {@link CfgBaseVertexWithMarker}
|
|
46
|
-
*/
|
|
47
|
-
export type CfgStatementVertex = [CfgVertexType.Statement, ...a: unknown[]] & CfgBaseVertexWithMarker;
|
|
45
|
+
type CfgBaseVertex = [type: CfgVertexType, id: NodeId, children?: NodeId[], callTargets?: Set<NodeId>];
|
|
48
46
|
/**
|
|
49
|
-
* @see {@link
|
|
47
|
+
* @see {@link CfgBaseVertex}
|
|
50
48
|
*/
|
|
51
|
-
export type
|
|
49
|
+
export type CfgStatementVertex = [CfgVertexType.Statement, ...a: unknown[]] & CfgBaseVertex;
|
|
52
50
|
/**
|
|
53
|
-
*
|
|
54
|
-
* @see {@link CfgBaseVertexWithMarker}
|
|
51
|
+
* @see {@link CfgBaseVertex}
|
|
55
52
|
*/
|
|
56
|
-
export type
|
|
53
|
+
export type CfgExpressionVertex = [CfgVertexType.Expression, ...a: unknown[]] & CfgBaseVertex;
|
|
57
54
|
/**
|
|
58
55
|
* A basic block vertex in the {@link ControlFlowGraph}.
|
|
59
56
|
* Contains the vertices that are part of this block, only connected by FDs, vertices should never occur in multiple bbs.
|
|
@@ -63,99 +60,45 @@ export type CfgBasicBlockVertex = [CfgVertexType.Block, ...a: unknown[]] & [type
|
|
|
63
60
|
* A vertex in the {@link ControlFlowGraph}.
|
|
64
61
|
* Please use the helper object (e.g. {@link CfgVertex#getType|getType()}) to work with vertices instead of directly accessing the properties.
|
|
65
62
|
*/
|
|
66
|
-
export type CfgVertex = CfgStatementVertex | CfgExpressionVertex | CfgBasicBlockVertex
|
|
63
|
+
export type CfgVertex = CfgStatementVertex | CfgExpressionVertex | CfgBasicBlockVertex;
|
|
67
64
|
/**
|
|
68
|
-
* Helper object for {@link CfgVertex} - a vertex in the {@link ControlFlowGraph}
|
|
65
|
+
* Helper object for {@link CfgVertex} - a vertex in the {@link ControlFlowGraph}.
|
|
69
66
|
*/
|
|
70
67
|
export declare const CfgVertex: {
|
|
71
68
|
readonly name: "CfgVertex";
|
|
72
69
|
/**
|
|
73
|
-
* Create a new expression vertex with the given id, children, call targets
|
|
70
|
+
* Create a new expression vertex with the given id, children, and call targets.
|
|
74
71
|
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
75
72
|
* @param children - child nodes attached to this one
|
|
76
73
|
* @param callTargets - if the vertex calls a function, this links all targets of this call
|
|
77
|
-
* @param mid - the ids of the mid-markers attached to this vertex, which should directly relate to the AST nodes of the mid markers
|
|
78
|
-
* @param end - the ids of the end-markers attached to this vertex, which should directly relate to the AST nodes of the end markers
|
|
79
74
|
* @see {@link CfgVertex#isExpression|isExpression()} - for a way to check whether a vertex is an expression vertex
|
|
80
75
|
*/
|
|
81
|
-
readonly makeExpression: (this: void, id: NodeId, { children,
|
|
76
|
+
readonly makeExpression: (this: void, id: NodeId, { children, callTargets }?: {
|
|
82
77
|
children?: NodeId[];
|
|
83
78
|
callTargets?: Set<NodeId>;
|
|
84
|
-
mid?: NodeId[];
|
|
85
|
-
end?: NodeId[];
|
|
86
79
|
}) => CfgExpressionVertex;
|
|
87
80
|
/**
|
|
88
|
-
*
|
|
81
|
+
* Create a new statement vertex with the given id, children, and call targets.
|
|
89
82
|
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
90
83
|
* @param children - child nodes attached to this one
|
|
91
84
|
* @param callTargets - if the vertex calls a function, this links all targets of this call
|
|
92
|
-
* @param mid - the ids of the mid-markers attached to this vertex, which should directly relate to the AST nodes of the mid markers
|
|
93
|
-
* @see {@link CfgVertex#makeExpression|makeExpression()} - for a way to create expression vertices with a custom end marker
|
|
94
|
-
* @see {@link CfgVertex#makeExitMarker|makeExitMarker()} - for a helper function to create end marker vertices with a canonical id#
|
|
95
|
-
* @see {@link CfgVertex#toExitId|toExitId()} - for a way to convert the given id to a canonical end marker id
|
|
96
|
-
*/
|
|
97
|
-
readonly makeExpressionWithEnd: (this: void, id: NodeId, { children, mid, callTargets }?: {
|
|
98
|
-
children?: NodeId[];
|
|
99
|
-
callTargets?: Set<NodeId>;
|
|
100
|
-
mid?: NodeId[];
|
|
101
|
-
}) => CfgExpressionVertex;
|
|
102
|
-
/**
|
|
103
|
-
* A convenience function to create a new statement vertex with a canonical end marker ({@link CfgVertex#toExitId|toExitId()}) based on the given id and the given id as root id for the end marker.
|
|
104
|
-
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
105
|
-
* @param children - child nodes attached to this one
|
|
106
|
-
* @param callTargets - if the vertex calls a function, this links all targets of this call
|
|
107
|
-
* @param mid - the ids of the mid-markers attached to this vertex, which should directly relate to the AST nodes of the mid markers
|
|
108
|
-
* @see {@link CfgVertex#makeExpression|makeExpression()} - for a way to create expression vertices with a custom end marker
|
|
109
|
-
* @see {@link CfgVertex#makeExitMarker|makeExitMarker()} - for a helper function to create end marker vertices with a canonical id#
|
|
110
|
-
* @see {@link CfgVertex#toExitId|toExitId()} - for a way to convert the given id to a canonical end marker id
|
|
111
|
-
*/
|
|
112
|
-
readonly makeStatementWithEnd: (this: void, id: NodeId, { children, mid, callTargets }?: {
|
|
113
|
-
children?: NodeId[];
|
|
114
|
-
callTargets?: Set<NodeId>;
|
|
115
|
-
mid?: NodeId[];
|
|
116
|
-
}) => CfgStatementVertex;
|
|
117
|
-
/**
|
|
118
|
-
* Create a new statement vertex with the given id, children, call targets, and markers.
|
|
119
|
-
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
120
|
-
* @param children - child nodes attached to this one
|
|
121
|
-
* @param callTargets - if the vertex calls a function, this links all targets of this call
|
|
122
|
-
* @param mid - the ids of the mid-markers attached to this vertex, which should directly relate to the AST nodes of the mid markers
|
|
123
|
-
* @param end - the ids of the end-markers attached to this vertex, which should directly relate to the AST nodes of the end markers
|
|
124
85
|
* @see {@link CfgVertex#isStatement|isStatement()} - for a way to check whether a vertex is a statement vertex
|
|
125
86
|
*/
|
|
126
|
-
readonly makeStatement: (this: void, id: NodeId, { children,
|
|
87
|
+
readonly makeStatement: (this: void, id: NodeId, { children, callTargets }?: {
|
|
127
88
|
children?: NodeId[];
|
|
128
89
|
callTargets?: Set<NodeId>;
|
|
129
|
-
mid?: NodeId[];
|
|
130
|
-
end?: NodeId[];
|
|
131
90
|
}) => CfgStatementVertex;
|
|
132
91
|
/**
|
|
133
92
|
* A convenience function to create a new vertex which is either a statement or an expression.
|
|
134
93
|
*/
|
|
135
|
-
readonly makeExprOrStm: (this: void, id: NodeId, type: CfgVertexType.Expression | CfgVertexType.Statement, { children,
|
|
94
|
+
readonly makeExprOrStm: (this: void, id: NodeId, type: CfgVertexType.Expression | CfgVertexType.Statement, { children, callTargets }?: {
|
|
136
95
|
children?: NodeId[];
|
|
137
96
|
callTargets?: Set<NodeId>;
|
|
138
|
-
mid?: NodeId[];
|
|
139
|
-
end?: NodeId[];
|
|
140
97
|
}) => CfgExpressionVertex | CfgStatementVertex;
|
|
141
98
|
/**
|
|
142
|
-
* Create a new
|
|
143
|
-
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
144
|
-
* @param rootId - the id of the AST node this end marker corresponds to
|
|
145
|
-
* @see {@link CfgVertex#isMarker|isMarker()} - for a way to check whether a vertex is an end marker vertex
|
|
146
|
-
* @see {@link CfgVertex#getRootId|getRootId()} - for a way to get the root id of an end marker vertex
|
|
147
|
-
* @see {@link CfgVertex#makeExitMarker|makeExitMarker()} - for a helper function to create end marker vertices with a canonical id
|
|
148
|
-
*/
|
|
149
|
-
readonly makeMarker: (this: void, id: NodeId, rootId: NodeId) => CfgMarkerVertex;
|
|
150
|
-
/**
|
|
151
|
-
* A convenience function to create a new marker vertex with a canonical id ({@link CfgVertex#toExitId|toExitId()}) based on the given id and the given id as root id.
|
|
152
|
-
* @see {@link CfgVertex#makeMarker|makeMarker()} - for a way to create end marker vertices with a custom id
|
|
153
|
-
*/
|
|
154
|
-
readonly makeExitMarker: (this: void, id: NodeId) => CfgMarkerVertex;
|
|
155
|
-
/**
|
|
156
|
-
* Create a new basic block vertex with the given id, elements, children, and call targets.
|
|
99
|
+
* Create a new basic block vertex with the given id and elements.
|
|
157
100
|
* @param id - the id of the vertex, which should directly relate to the AST node
|
|
158
|
-
* @param elems - the vertices that are part of this block, only connected by FDs
|
|
101
|
+
* @param elems - the vertices that are part of this block in the order they run, only connected by FDs; a vertex should never occur in multiple blocks
|
|
159
102
|
* @see {@link CfgVertex#isBlock|isBlock()} - for a way to check whether a vertex is a basic block vertex
|
|
160
103
|
*/
|
|
161
104
|
readonly makeBlock: (this: void, id: NodeId, elems: readonly Exclude<CfgVertex, CfgBasicBlockVertex>[]) => CfgBasicBlockVertex;
|
|
@@ -171,12 +114,6 @@ export declare const CfgVertex: {
|
|
|
171
114
|
* @see {@link CfgVertex#getType|getType()} - for a way to get the type of a vertex instead of checking against a given type
|
|
172
115
|
*/
|
|
173
116
|
readonly isStatement: (this: void, vertex: CfgVertex | undefined) => vertex is CfgStatementVertex;
|
|
174
|
-
/**
|
|
175
|
-
* Check whether the given vertex is an end marker vertex.
|
|
176
|
-
* @see {@link CfgVertex#makeMarker|makeMarker()} - for a way to create end marker vertices
|
|
177
|
-
* @see {@link CfgVertex#getType|getType()} - for a way to get the type of a vertex instead of checking against a given type
|
|
178
|
-
*/
|
|
179
|
-
readonly isMarker: (this: void, vertex: CfgVertex | undefined) => vertex is CfgMarkerVertex;
|
|
180
117
|
/**
|
|
181
118
|
* Check whether the given vertex is a basic block vertex.
|
|
182
119
|
* @see {@link CfgVertex#makeBlock|makeBlock()} - for a way to create basic block vertices
|
|
@@ -187,10 +124,10 @@ export declare const CfgVertex: {
|
|
|
187
124
|
* Get the type of the given vertex.
|
|
188
125
|
* @example
|
|
189
126
|
* ```ts
|
|
190
|
-
* const vertex: CfgVertex = CfgVertex.
|
|
127
|
+
* const vertex: CfgVertex = CfgVertex.makeExpression('node-1')
|
|
191
128
|
* console.log(CfgVertex.getType(vertex)); // Output: CfgVertexType.Expression
|
|
192
129
|
* ```
|
|
193
|
-
* @see {@link CfgVertex#isExpression|isExpression()}, {@link CfgVertex#isStatement|isStatement()}, {@link CfgVertex#
|
|
130
|
+
* @see {@link CfgVertex#isExpression|isExpression()}, {@link CfgVertex#isStatement|isStatement()}, {@link CfgVertex#isBlock|isBlock()} - for ways to check the type of a vertex against a specific type
|
|
194
131
|
* @see {@link CfgVertex#getId|getId()} - for a way to get the id of a vertex
|
|
195
132
|
* @see {@link CfgVertex#typeToString|typeToString()} - for a way to convert the type of a vertex to a string for easier debugging and visualization
|
|
196
133
|
*/
|
|
@@ -202,31 +139,19 @@ export declare const CfgVertex: {
|
|
|
202
139
|
*/
|
|
203
140
|
readonly typeToString: (this: void, type: CfgVertexType) => string;
|
|
204
141
|
/**
|
|
205
|
-
* Get the id of the given vertex, which
|
|
142
|
+
* Get the id of the given vertex, which directly relates to the AST node.
|
|
206
143
|
* @example
|
|
207
144
|
* ```ts
|
|
208
|
-
* const vertex: CfgVertex = CfgVertex.
|
|
145
|
+
* const vertex: CfgVertex = CfgVertex.makeExpression('node-1')
|
|
209
146
|
* console.log(CfgVertex.getId(vertex)); // Output: 'node-1'
|
|
210
147
|
* ```
|
|
211
148
|
* @see {@link CfgVertex#getType|getType()} - for a way to get the type of a vertex
|
|
212
|
-
* @see {@link CfgVertex#getRootId|getRootId()} - for a way to get the root id of a vertex
|
|
213
149
|
*/
|
|
214
150
|
readonly getId: <T extends CfgVertex | undefined>(this: void, vertex: T) => T extends undefined ? NodeId | undefined : NodeId;
|
|
215
151
|
/**
|
|
216
152
|
* Check whether two vertices are equal, i.e., they have the same type, id, and if they are basic block vertices, they also have the same elements in the same order.
|
|
217
153
|
*/
|
|
218
154
|
readonly equal: (this: void, a: CfgVertex, b: CfgVertex) => boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Get the root id of a vertex, i.e., the id of the AST node it corresponds to.
|
|
221
|
-
* For normal vertices, this is the same as the id of the vertex itself, for end marker vertices, this is the root id stored in the vertex.
|
|
222
|
-
* @see {@link CfgVertex#unpackRoot|unpackRoot()} - for a way to unpack the root id of a marker vertex
|
|
223
|
-
*/
|
|
224
|
-
readonly getRootId: (this: void, vertex: CfgVertex) => NodeId;
|
|
225
|
-
/**
|
|
226
|
-
* Unpack the root id of a marker vertex, i.e., get the root id stored in the vertex or derive it from the canonical id if it is not explicitly stored.
|
|
227
|
-
* @see {@link CfgVertex#getRootId|getRootId()} - for a way to get the root id of a vertex, which uses this function for marker vertices
|
|
228
|
-
*/
|
|
229
|
-
readonly unpackRootId: (this: void, vertex: CfgMarkerVertex) => NodeId;
|
|
230
155
|
/**
|
|
231
156
|
* Get the elements of a basic block vertex, i.e., the vertices that are part of this block, only connected by FDs, vertices should never occur in multiple bbs.
|
|
232
157
|
* @see {@link CfgVertex#isBlock|isBlock()} - for a way to check whether a vertex is a basic block vertex before trying to get the elements
|
|
@@ -240,72 +165,27 @@ export declare const CfgVertex: {
|
|
|
240
165
|
* @see {@link CfgVertex#getBasicBlockElements|getBasicBlockElements()} - for a way to get the elements of a basic block vertex
|
|
241
166
|
*/
|
|
242
167
|
readonly setBasicBlockElements: (this: void, vertex: CfgBasicBlockVertex, elems: readonly Exclude<CfgVertex, CfgBasicBlockVertex>[]) => void;
|
|
243
|
-
/**
|
|
244
|
-
* Get the ids of the mid-markers attached to this vertex, which should directly relate to the AST nodes of the mid markers.
|
|
245
|
-
* @see {@link CfgVertex#getMid|getMid()} - for a way to get the ids of the mid-markers attached to this vertex
|
|
246
|
-
* @see {@link CfgVertex#setEnd|setEnd()} - for a way to set the ids of the end-markers attached to this vertex
|
|
247
|
-
*/
|
|
248
|
-
readonly getEnd: (this: void, vertex: CfgVertex | undefined) => NodeId[] | undefined;
|
|
249
|
-
/**
|
|
250
|
-
* **Sets in-place**
|
|
251
|
-
* Set the ids of the end-markers attached to this vertex, which should directly relate to the AST nodes of the end markers.
|
|
252
|
-
* @see {@link CfgVertex#getEnd|getEnd()} - for a way to get the ids of the end-markers attached to this vertex
|
|
253
|
-
*/
|
|
254
|
-
readonly setEnd: (this: void, vertex: CfgStatementVertex | CfgExpressionVertex, endMarkers: NodeId[] | undefined) => void;
|
|
255
|
-
/**
|
|
256
|
-
* Get the ids of the mid-markers attached to this vertex, which should directly relate to the AST nodes of the mid markers.
|
|
257
|
-
*/
|
|
258
|
-
readonly getMid: (this: void, vertex: CfgVertex) => NodeId[] | undefined;
|
|
259
|
-
/**
|
|
260
|
-
* **Sets in-place**
|
|
261
|
-
* Set the ids of the mid-markers attached to this vertex, which should directly relate to the AST nodes of the mid markers.
|
|
262
|
-
* @see {@link CfgVertex#getMid|getMid()} - for a way to get the ids of the mid-markers attached to this vertex
|
|
263
|
-
* @see {@link CfgVertex#setEnd|setEnd()} - for a way to set the ids of the end-markers attached to this vertex
|
|
264
|
-
*/
|
|
265
|
-
readonly setMid: (this: void, vertex: CfgStatementVertex | CfgExpressionVertex, midMarkers: NodeId[] | undefined) => void;
|
|
266
168
|
/**
|
|
267
169
|
* Converts the given id to a, canonical, basic block lift (i.e., it adds 'bb-' as a prefix).
|
|
268
170
|
*/
|
|
269
171
|
readonly toBasicBlockId: <Id extends NodeId>(this: void, id: Id) => `bb-${Id}`;
|
|
270
172
|
/**
|
|
271
|
-
*
|
|
272
|
-
* @see {@link CfgVertex#fromExitId|fromExitId()} - for a way to convert the given id from a canonical end marker lift to the original id (i.e., it removes '-end' as a suffix if it is present)
|
|
273
|
-
*/
|
|
274
|
-
readonly toExitId: <Id extends NodeId>(this: void, id: Id) => `${Id}-e`;
|
|
275
|
-
/**
|
|
276
|
-
* Converts the given id from a canonical end marker lift to the original id (i.e., it removes '-end' as a suffix if it is present).
|
|
277
|
-
* @see {@link CfgVertex#toExitId|toExitId()} - for a way to convert the given id to a canonical end marker lift (i.e., it adds '-end' as a suffix)
|
|
278
|
-
*/
|
|
279
|
-
readonly fromExitId: (this: void, exitId: NodeId) => NodeId;
|
|
280
|
-
/**
|
|
281
|
-
* Get the call targets of a statement or expression vertex, which links all targets of this call.
|
|
173
|
+
* The functions a call may dispatch to, taken from the `calls` edges the dataflow analysis resolved.
|
|
282
174
|
*/
|
|
283
175
|
readonly getCallTargets: (this: void, vertex: CfgVertex | undefined) => Set<NodeId> | undefined;
|
|
284
|
-
/**
|
|
285
|
-
* **Sets in-place**
|
|
286
|
-
* Set the call targets of a statement or expression vertex, which links all targets of this call.
|
|
287
|
-
* @see {@link CfgVertex#getCallTargets|getCallTargets()} - for a way to get the call targets of a statement or expression vertex
|
|
288
|
-
* @see {@link CfgVertex#mapCallTargets|mapCallTargets()} - for a way to map the call targets of a statement or expression vertex to new call targets
|
|
289
|
-
*/
|
|
290
|
-
readonly setCallTargets: (this: void, vertex: CfgStatementVertex | CfgExpressionVertex, callTargets: Set<NodeId>) => void;
|
|
291
|
-
/**
|
|
292
|
-
* Map the call targets of a statement or expression vertex, which links all targets of this call, to new call targets using the given mapping function.
|
|
293
|
-
* @see {@link CfgVertex#getCallTargets|getCallTargets()} - for a way to get the call targets of a statement or expression vertex
|
|
294
|
-
* @see {@link CfgVertex#setCallTargets|setCallTargets()} - for a way to set the call targets of a statement or expression vertex to new call targets
|
|
295
|
-
*/
|
|
296
|
-
readonly mapCallTargets: (this: void, vertex: CfgStatementVertex | CfgExpressionVertex, mapFn: (targets: Set<NodeId> | undefined) => Set<NodeId>) => void;
|
|
297
176
|
/**
|
|
298
177
|
* Get the children of a statement or expression vertex, i.e., the child nodes attached to this one.
|
|
299
178
|
*/
|
|
300
179
|
readonly getChildren: (this: void, vertex: CfgVertex | undefined) => NodeId[] | undefined;
|
|
301
180
|
};
|
|
302
|
-
type
|
|
303
|
-
|
|
181
|
+
type CfgFlowEdge = CfgEdgeType.Flow;
|
|
182
|
+
/** a control edge *is* the {@link ControlDependency} it stands for, so nothing about the branch is lost */
|
|
183
|
+
type CfgControlEdge = ControlDependency;
|
|
304
184
|
/**
|
|
305
185
|
* An edge in the {@link ControlFlowGraph}.
|
|
306
186
|
* @see {@link CfgEdge} - for helper functions to work with edges.
|
|
307
187
|
*/
|
|
308
|
-
export type CfgEdge =
|
|
188
|
+
export type CfgEdge = CfgFlowEdge | CfgControlEdge;
|
|
309
189
|
/**
|
|
310
190
|
* Helper object for {@link CfgEdge} - an edge in the {@link ControlFlowGraph}.
|
|
311
191
|
*/
|
|
@@ -314,35 +194,34 @@ export declare const CfgEdge: {
|
|
|
314
194
|
/**
|
|
315
195
|
* Check whether the given edge is a flow dependency edge.
|
|
316
196
|
*/
|
|
317
|
-
readonly isFlowDependency: (this: void, edge: CfgEdge | undefined) => edge is
|
|
197
|
+
readonly isFlowDependency: (this: void, edge: CfgEdge | undefined) => edge is CfgFlowEdge;
|
|
318
198
|
/**
|
|
319
199
|
* Check whether the given edge is a control dependency edge.
|
|
320
200
|
*/
|
|
321
|
-
readonly isControlDependency: (this: void, edge: CfgEdge | undefined) => edge is
|
|
201
|
+
readonly isControlDependency: (this: void, edge: CfgEdge | undefined) => edge is CfgControlEdge;
|
|
322
202
|
/**
|
|
323
203
|
* Create a flow dependency edge.
|
|
324
204
|
*/
|
|
325
|
-
readonly makeFd: (this: void) =>
|
|
205
|
+
readonly makeFd: (this: void) => CfgFlowEdge;
|
|
326
206
|
/**
|
|
327
|
-
* Create a control dependency edge
|
|
328
|
-
* @param
|
|
329
|
-
* @
|
|
330
|
-
* @see {@link CfgEdge#
|
|
331
|
-
* @see {@link CfgEdge#makeCdFalse|makeCdFalse()} - for a version of this function that assumes the control dependency is negated (e.g., else-branch)
|
|
207
|
+
* Create a control dependency edge from the given control dependency, which is what the edge is.
|
|
208
|
+
* @param cd - the decision the edge follows, i.e. the vertex that causes it and the outcome it takes
|
|
209
|
+
* @see {@link CfgEdge#makeCdTrue|makeCdTrue()} - to build one for a true condition from the causing id alone
|
|
210
|
+
* @see {@link CfgEdge#makeCdFalse|makeCdFalse()} - to build one for a negated condition (e.g., else-branch)
|
|
332
211
|
*/
|
|
333
|
-
readonly makeCd: (this: void,
|
|
212
|
+
readonly makeCd: (this: void, cd: CfgControlEdge) => CfgControlEdge;
|
|
334
213
|
/**
|
|
335
214
|
* Create a control dependency edge with the given cause and a true condition.
|
|
336
215
|
* @param controlId - the id of the vertex that causes the control dependency
|
|
337
216
|
* @see {@link CfgEdge#makeCd|makeCd()} - for a version of this function that allows to specify the condition as well
|
|
338
217
|
*/
|
|
339
|
-
readonly makeCdTrue: (this: void, controlId: NodeId) =>
|
|
218
|
+
readonly makeCdTrue: (this: void, controlId: NodeId) => CfgControlEdge;
|
|
340
219
|
/**
|
|
341
220
|
* Create a control dependency edge with the given cause and a negated condition (e.g., else-branch).
|
|
342
221
|
* @param controlId - the id of the vertex that causes the control dependency
|
|
343
222
|
* @see {@link CfgEdge#makeCd|makeCd()} - for a version of this function that allows to specify the condition as well
|
|
344
223
|
*/
|
|
345
|
-
readonly makeCdFalse: (this: void, controlId: NodeId) =>
|
|
224
|
+
readonly makeCdFalse: (this: void, controlId: NodeId) => CfgControlEdge;
|
|
346
225
|
/**
|
|
347
226
|
* Get the cause of a control dependency edge, i.e., the id of the vertex that causes the control dependency.
|
|
348
227
|
* If the edge is not a control dependency edge, this returns undefined.
|
|
@@ -354,7 +233,7 @@ export declare const CfgEdge: {
|
|
|
354
233
|
/**
|
|
355
234
|
* Get the cause of a control dependency edge, i.e., the id of the vertex that causes the control dependency.
|
|
356
235
|
*/
|
|
357
|
-
readonly unpackCause: (this: void, edge:
|
|
236
|
+
readonly unpackCause: (this: void, edge: CfgControlEdge) => NodeId;
|
|
358
237
|
/**
|
|
359
238
|
* Get whether the control dependency edge is satisfied with a true condition or is it negated (e.g., else-branch).
|
|
360
239
|
* If the edge is not a control dependency edge, this returns undefined.
|
|
@@ -366,7 +245,7 @@ export declare const CfgEdge: {
|
|
|
366
245
|
/**
|
|
367
246
|
* Get whether the control dependency edge is satisfied with a true condition or is it negated (e.g., else-branch).
|
|
368
247
|
*/
|
|
369
|
-
readonly unpackWhen: (this: void, edge:
|
|
248
|
+
readonly unpackWhen: (this: void, edge: CfgControlEdge) => typeof RTrue | typeof RFalse;
|
|
370
249
|
/**
|
|
371
250
|
* Check whether two edges are equal.
|
|
372
251
|
*/
|
|
@@ -409,30 +288,29 @@ export interface ReadOnlyControlFlowGraph {
|
|
|
409
288
|
/**
|
|
410
289
|
* Provide a view of all vertices in the graph.
|
|
411
290
|
* @param includeBasicBlockElements - if true, the elements of basic block elements are included in the result, otherwise only the basic blocks themselves are included
|
|
412
|
-
* @see {@link ReadOnlyControlFlowGraph#
|
|
291
|
+
* @see {@link ReadOnlyControlFlowGraph#rootIds|rootIds()} - for a way to get the root vertices of the graph.
|
|
413
292
|
* @see {@link ReadOnlyControlFlowGraph#getVertex|getVertex()} - for a way to get a specific vertex by its id.
|
|
414
293
|
* @see {@link ReadOnlyControlFlowGraph#edges|edges()} - for a way to get all edges in the graph.
|
|
415
294
|
*/
|
|
416
295
|
readonly vertices: (includeBasicBlockElements: boolean) => ReadonlyMap<NodeId, CfgVertex>;
|
|
417
296
|
/**
|
|
418
297
|
* Get all edges in the graph, independent of their sources and targets.
|
|
298
|
+
* Edges are in flow order: an edge from `a` to `b` means that `b` is evaluated after `a`.
|
|
419
299
|
* If you are only interested in the edges of a specific node, please use {@link ReadOnlyControlFlowGraph#outgoingEdges|outgoingEdges()} or {@link ReadOnlyControlFlowGraph#ingoingEdges|ingoingEdges()}.
|
|
420
300
|
*
|
|
421
301
|
* This is the pendant of {@link DataflowGraph#edges|edges()} on a {@link DataflowGraph}.
|
|
422
302
|
*/
|
|
423
303
|
readonly edges: () => ReadonlyMap<NodeId, ReadonlyMap<NodeId, CfgEdge>>;
|
|
424
304
|
/**
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
* @see {@link ReadOnlyControlFlowGraph#ingoingEdges|ingoingEdges()} - for a way to get all ingoing edges of a vertex.
|
|
305
|
+
* The edges leaving the given vertex, i.e. what may be evaluated after it.
|
|
306
|
+
* @see {@link ReadOnlyControlFlowGraph#ingoingEdges|ingoingEdges()} - for what may be evaluated before it
|
|
307
|
+
* @see {@link ReadOnlyControlFlowGraph#successors|successors()} - if you only need the ids
|
|
429
308
|
*/
|
|
430
309
|
readonly outgoingEdges: (id: NodeId) => ReadonlyMap<NodeId, CfgEdge> | undefined;
|
|
431
310
|
/**
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
* @see {@link ReadOnlyControlFlowGraph#outgoingEdges|outgoingEdges()} - for a way to get all outgoing edges of a vertex.
|
|
311
|
+
* The edges leading into the given vertex, i.e. what may be evaluated before it.
|
|
312
|
+
* @see {@link ReadOnlyControlFlowGraph#outgoingEdges|outgoingEdges()} - for what may be evaluated after it
|
|
313
|
+
* @see {@link ReadOnlyControlFlowGraph#predecessors|predecessors()} - if you only need the ids
|
|
436
314
|
*/
|
|
437
315
|
readonly ingoingEdges: (id: NodeId) => ReadonlyMap<NodeId, CfgEdge> | undefined;
|
|
438
316
|
/**
|
|
@@ -460,36 +338,126 @@ export interface ReadOnlyControlFlowGraph {
|
|
|
460
338
|
* This can be used for optimizations.
|
|
461
339
|
*/
|
|
462
340
|
readonly mayHaveBasicBlocks: () => boolean;
|
|
341
|
+
/**
|
|
342
|
+
* The vertices control flow may reach directly from `id`, i.e. what may be evaluated next.
|
|
343
|
+
*
|
|
344
|
+
* Prefer this over walking the edges by hand: a graph that is a view on another structure
|
|
345
|
+
* (see {@link ControlFlowGraph}) may answer it without projecting itself at all.
|
|
346
|
+
* @see {@link ReadOnlyControlFlowGraph#predecessors|predecessors()} - for the other direction
|
|
347
|
+
*/
|
|
348
|
+
readonly successors: (id: NodeId) => Iterable<NodeId>;
|
|
349
|
+
/**
|
|
350
|
+
* The vertices control flow may come from to reach `id`, i.e. what may have been evaluated before.
|
|
351
|
+
* @see {@link ReadOnlyControlFlowGraph#successors|successors()} - for the other direction
|
|
352
|
+
*/
|
|
353
|
+
readonly predecessors: (id: NodeId) => Iterable<NodeId>;
|
|
354
|
+
/**
|
|
355
|
+
* The dataflow graph this control flow graph is a view of, `undefined` once it holds a copy of its own.
|
|
356
|
+
* It knows the ast as well, so a traversal needs nothing but the control flow to reach either.
|
|
357
|
+
*/
|
|
358
|
+
readonly dataflow: () => DataflowGraph | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* The vertices nested within the given one, which for a function definition is the body it holds.
|
|
361
|
+
* Nothing flows into such a region, so this is the only way a traversal can step into it.
|
|
362
|
+
*/
|
|
363
|
+
readonly childrenOf: (id: NodeId) => readonly NodeId[] | undefined;
|
|
364
|
+
/**
|
|
365
|
+
* The constructs whose outcome this vertex decides, e.g. the `if` a condition belongs to.
|
|
366
|
+
*
|
|
367
|
+
* Since a construct is reached only once its parts have run, standing on the condition is the moment
|
|
368
|
+
* to ask what that condition is for.
|
|
369
|
+
* @example
|
|
370
|
+
* ```r
|
|
371
|
+
* if(u) a else b # decides(u) names the if, so `u` is known to be its condition
|
|
372
|
+
* ```
|
|
373
|
+
* @see {@link ReadOnlyControlFlowGraph#entryOf|entryOf()} - for the way back, from the construct to its condition
|
|
374
|
+
*/
|
|
375
|
+
readonly decides: (id: NodeId) => readonly NodeId[];
|
|
376
|
+
/**
|
|
377
|
+
* The vertex a construct is over at, i.e. where its branches join and control flow continues past it.
|
|
378
|
+
*
|
|
379
|
+
* The control flow is modeled in post-order: everything a construct is made of is evaluated before the
|
|
380
|
+
* construct itself, so an `if` is over on the `if` vertex, a loop on its loop vertex, and `2 * 3` on the
|
|
381
|
+
* `*` vertex. There is no separate marker to look for — reaching the vertex *is* the construct ending.
|
|
382
|
+
* @see {@link ReadOnlyControlFlowGraph#entryOf|entryOf()} - for where it begins instead
|
|
383
|
+
*/
|
|
384
|
+
readonly exitOf: (id: NodeId) => NodeId;
|
|
385
|
+
/**
|
|
386
|
+
* The vertex control flow enters the construct rooted at `id` at, i.e. the first thing it evaluates.
|
|
387
|
+
* For `if(u) a else b` that is the condition, for `2 * 3` the left operand, and for a leaf the leaf itself.
|
|
388
|
+
*
|
|
389
|
+
* `undefined` if the construct is not part of the control flow at all.
|
|
390
|
+
* @param id - the construct to look at
|
|
391
|
+
* @param idMap - the AST the graph belongs to; a graph that knows its own (a view on a dataflow graph) may omit it
|
|
392
|
+
* @see {@link ReadOnlyControlFlowGraph#exitOf|exitOf()} - for where it is over
|
|
393
|
+
*/
|
|
394
|
+
readonly entryOf: (id: NodeId, idMap?: AstIdMap) => NodeId | undefined;
|
|
463
395
|
}
|
|
396
|
+
/** Shared empty result so navigating a vertex without neighbors allocates nothing. */
|
|
397
|
+
export declare const NoNeighbors: readonly NodeId[];
|
|
464
398
|
/**
|
|
465
399
|
* This class represents the control flow graph of an R program.
|
|
466
|
-
* The control flow may be hierarchical when confronted with function definitions (see {@link CfgVertex} and {@link
|
|
400
|
+
* The control flow may be hierarchical when confronted with function definitions (see {@link CfgVertex} and {@link ControlFlowGraph#rootIds|rootIds()}).
|
|
401
|
+
*
|
|
402
|
+
* Edges are in flow order: an edge from `a` to `b` means that `b` is evaluated after `a`.
|
|
403
|
+
* Reading them backwards (what leads into a vertex) goes through a reverse index built on the first such read.
|
|
467
404
|
*
|
|
468
405
|
* There are two very simple visitors to traverse a CFG:
|
|
469
|
-
* - {@link visitCfgInOrder} visits
|
|
470
|
-
* - {@link visitCfgInReverseOrder} visits
|
|
406
|
+
* - {@link visitCfgInOrder} visits it in the order the program runs
|
|
407
|
+
* - {@link visitCfgInReverseOrder} visits it in the opposite order
|
|
471
408
|
*
|
|
472
409
|
* If you want to prohibit modification, please refer to the {@link ReadOnlyControlFlowGraph} interface.
|
|
473
410
|
*/
|
|
474
411
|
export declare class ControlFlowGraph<Vertex extends CfgVertex = CfgVertex> implements ReadOnlyControlFlowGraph {
|
|
475
|
-
|
|
412
|
+
/**
|
|
413
|
+
* The dataflow graph this control flow graph is a view on, if it is one.
|
|
414
|
+
* Reads are answered from it directly; the state below is only filled in when the graph is modified
|
|
415
|
+
* (see {@link ControlFlowGraph#materialize|materialize()}).
|
|
416
|
+
*/
|
|
417
|
+
private readonly dfg?;
|
|
418
|
+
/** whether the state below has been filled in from {@link ControlFlowGraph#dfg|dfg} already */
|
|
419
|
+
private projected;
|
|
420
|
+
/** the root ids of a view, which stay the same as long as it is one */
|
|
421
|
+
private rootCache?;
|
|
422
|
+
protected readonly roots: Set<NodeId>;
|
|
476
423
|
/** Nesting-Independent vertex information, mapping the id to the vertex */
|
|
477
|
-
|
|
424
|
+
protected readonly vtxInfos: Map<NodeId, Vertex>;
|
|
478
425
|
/** the basic block children map contains a mapping of ids to all vertices that are nested in basic blocks, mapping them to the Id of the block they appear in */
|
|
479
|
-
|
|
480
|
-
/** basic block agnostic edges */
|
|
481
|
-
|
|
426
|
+
protected readonly bbChildren: Map<NodeId, NodeId>;
|
|
427
|
+
/** basic block agnostic edges, in flow order: `edgeInfos[a][b]` means that `b` is evaluated after `a` */
|
|
428
|
+
protected readonly edgeInfos: Map<NodeId, Map<NodeId, CfgEdge>>;
|
|
482
429
|
/** reverse edges for bidirectional mapping, derived from `edgeInfos` on the first ingoing lookup */
|
|
483
|
-
|
|
430
|
+
protected revEdgeInfos: Map<NodeId, Map<NodeId, CfgEdge>> | undefined;
|
|
484
431
|
/** used as an optimization to avoid unnecessary lookups */
|
|
485
|
-
|
|
432
|
+
protected _mayBB: boolean;
|
|
433
|
+
/**
|
|
434
|
+
* A control flow graph either owns its vertices and edges, or is a view on the {@link DataflowGraph} that
|
|
435
|
+
* carries them: the dataflow extraction records the control flow while it walks the program, so every
|
|
436
|
+
* vertex of that graph is a vertex here and its {@link EdgeType.FlowEdge|flow} and
|
|
437
|
+
* {@link EdgeType.ControlEdge|control} dependency edges are the edges here.
|
|
438
|
+
* @param dfg - the dataflow graph to view, or nothing to build a graph of your own
|
|
439
|
+
*/
|
|
440
|
+
constructor(dfg?: DataflowGraph);
|
|
441
|
+
/**
|
|
442
|
+
* Fill the state of this graph from the dataflow graph it views.
|
|
443
|
+
* Reading a view does not need this — the reads below are answered from the dataflow graph — but
|
|
444
|
+
* modifying one does, and so does asking for every vertex or edge at once.
|
|
445
|
+
*/
|
|
446
|
+
protected materialize(): void;
|
|
447
|
+
/**
|
|
448
|
+
* Serializing a graph hands out its vertices and edges, never the dataflow graph a view reads them from,
|
|
449
|
+
* so a view and a graph of its own serialize alike.
|
|
450
|
+
*/
|
|
451
|
+
toJSON(): unknown;
|
|
452
|
+
/** Whether this graph still answers from the dataflow graph it views instead of a copy of it. */
|
|
453
|
+
private get isView();
|
|
486
454
|
/**
|
|
487
455
|
* Add a new vertex to the control flow graph.
|
|
488
456
|
* @see {@link ControlFlowGraph#addEdge|addEdge()} - to add an edge
|
|
489
457
|
*/
|
|
490
458
|
addVertex(vertex: Vertex, rootVertex?: boolean): this;
|
|
491
459
|
/**
|
|
492
|
-
* Add a new edge to the control flow graph
|
|
460
|
+
* Add a new edge to the control flow graph, in flow order: `to` is evaluated after `from`.
|
|
493
461
|
* @see {@link ControlFlowGraph#addVertex|addVertex()} - to add vertices
|
|
494
462
|
* @see {@link ControlFlowGraph#addEdges|addEdges()} - to add multiple edges at once
|
|
495
463
|
*/
|
|
@@ -511,6 +479,13 @@ export declare class ControlFlowGraph<Vertex extends CfgVertex = CfgVertex> impl
|
|
|
511
479
|
getVertex(id: NodeId, includeBlocks?: boolean): CfgVertex | undefined;
|
|
512
480
|
hasVertex(id: NodeId, includeBlocks?: boolean): boolean;
|
|
513
481
|
mayHaveBasicBlocks(): boolean;
|
|
482
|
+
dataflow(): DataflowGraph | undefined;
|
|
483
|
+
childrenOf(id: NodeId): readonly NodeId[] | undefined;
|
|
484
|
+
decides(id: NodeId): readonly NodeId[];
|
|
485
|
+
exitOf(id: NodeId): NodeId;
|
|
486
|
+
entryOf(id: NodeId, idMap?: AstIdMap | undefined): NodeId | undefined;
|
|
487
|
+
successors(id: NodeId): Iterable<NodeId>;
|
|
488
|
+
predecessors(id: NodeId): Iterable<NodeId>;
|
|
514
489
|
/**
|
|
515
490
|
* This removes the vertex and all edges to and from it.
|
|
516
491
|
* @param id - the id of the vertex to remove
|
|
@@ -558,4 +533,19 @@ export interface ControlFlowInformation<Vertex extends CfgVertex = CfgVertex> ex
|
|
|
558
533
|
* Create an empty control flow information object.
|
|
559
534
|
*/
|
|
560
535
|
export declare function emptyControlFlowInformation(): ControlFlowInformation;
|
|
536
|
+
/**
|
|
537
|
+
* The control flow of the program the given dataflow analysis describes.
|
|
538
|
+
* @see {@link ControlFlowGraph} - for the projection this is built on
|
|
539
|
+
*/
|
|
540
|
+
/**
|
|
541
|
+
*
|
|
542
|
+
*/
|
|
543
|
+
export declare function extractCfg(dataflow: DataflowInformation): ControlFlowInformation;
|
|
544
|
+
/**
|
|
545
|
+
* Convert a cfg to RDF quads.
|
|
546
|
+
* @see {@link df2quads}
|
|
547
|
+
* @see {@link serialize2quads}
|
|
548
|
+
* @see {@link graph2quads}
|
|
549
|
+
*/
|
|
550
|
+
export declare function cfg2quads(cfg: ControlFlowInformation, config: QuadSerializationConfiguration): string;
|
|
561
551
|
export {};
|