@eagleoutice/flowr 2.14.1 → 2.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -87
- package/abstract-interpretation/absint-visitor.d.ts +91 -25
- package/abstract-interpretation/absint-visitor.js +235 -74
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/arguments.js +1 -1
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +107 -254
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +5 -5
- package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -1
- package/abstract-interpretation/data-frame/resolve-args.js +6 -4
- package/abstract-interpretation/data-frame/shape-inference.d.ts +4 -9
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -0
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -0
- package/abstract-interpretation/domains/partial-product-domain.js +1 -1
- package/abstract-interpretation/domains/set-range-domain.d.ts +3 -2
- package/abstract-interpretation/domains/set-range-domain.js +3 -2
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +3 -2
- package/abstract-interpretation/domains/set-upper-bound-domain.js +3 -2
- package/benchmark/calibration.d.ts +11 -6
- package/benchmark/calibration.js +19 -8
- package/benchmark/slicer.d.ts +7 -1
- package/benchmark/slicer.js +38 -34
- package/benchmark/stats/count-comments.d.ts +16 -0
- package/benchmark/stats/count-comments.js +30 -0
- package/benchmark/stats/print.js +2 -0
- package/benchmark/stats/size-of.d.ts +7 -3
- package/benchmark/stats/size-of.js +7 -3
- package/benchmark/stats/stats.d.ts +7 -0
- package/benchmark/summarizer/first-phase/process.js +2 -19
- package/benchmark/summarizer/second-phase/graph.js +13 -3
- package/benchmark/summarizer/second-phase/process.js +2 -0
- package/cli/repl/commands/repl-dataflow.js +70 -27
- package/cli/repl/core.d.ts +1 -1
- package/cli/repl/core.js +1 -1
- package/cli/repl/parser/slice-query-parser.js +2 -1
- package/cli/repl/server/connection.d.ts +4 -0
- package/cli/repl/server/connection.js +19 -16
- package/cli/repl/server/messages/message-analysis.d.ts +1 -1
- package/config.d.ts +6 -0
- package/config.js +8 -4
- package/control-flow/basic-cfg-guided-visitor.d.ts +7 -2
- package/control-flow/basic-cfg-guided-visitor.js +37 -24
- package/control-flow/cfg-dead-code.js +44 -33
- package/control-flow/cfg-properties.js +2 -2
- package/control-flow/cfg-simplification.js +6 -5
- package/control-flow/cfg-to-basic-blocks.js +11 -13
- package/control-flow/control-flow-graph.d.ts +179 -189
- package/control-flow/control-flow-graph.js +400 -263
- package/control-flow/dfg-cfg-guided-visitor.d.ts +21 -3
- package/control-flow/dfg-cfg-guided-visitor.js +17 -13
- package/control-flow/diff-cfg.js +6 -14
- package/control-flow/happens-before.js +5 -4
- package/control-flow/semantic-cfg-guided-visitor.d.ts +44 -101
- package/control-flow/semantic-cfg-guided-visitor.js +6 -26
- package/control-flow/simple-visitor.js +14 -15
- package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -1
- package/control-flow/useless-loop.js +18 -14
- package/core/steps/all/core/20-dataflow.d.ts +1 -3
- package/core/steps/pipeline/default-pipelines.d.ts +141 -157
- package/dataflow/cluster.js +7 -0
- package/dataflow/environments/apply-kill.d.ts +6 -0
- package/dataflow/environments/apply-kill.js +63 -31
- package/dataflow/environments/built-in-props.d.ts +5 -1
- package/dataflow/environments/built-in-props.js +4 -0
- package/dataflow/environments/built-in.d.ts +6 -3
- package/dataflow/environments/built-in.js +8 -5
- package/dataflow/environments/clone.d.ts +3 -3
- package/dataflow/environments/clone.js +5 -5
- package/dataflow/environments/default-builtin-config.d.ts +112 -7
- package/dataflow/environments/default-builtin-config.js +82 -34
- package/dataflow/environments/environment.d.ts +5 -5
- package/dataflow/environments/environment.js +5 -5
- package/dataflow/environments/identifier.d.ts +11 -1
- package/dataflow/environments/identifier.js +4 -1
- package/dataflow/environments/resolve-by-name.d.ts +7 -0
- package/dataflow/environments/resolve-by-name.js +12 -0
- package/dataflow/environments/resolve-helper.d.ts +3 -1
- package/dataflow/environments/resolve-helper.js +2 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +2 -2
- package/dataflow/eval/resolve/alias-tracking.js +2 -2
- package/dataflow/eval/resolve/match-arguments.js +7 -5
- package/dataflow/eval/resolve/node-value.d.ts +3 -1
- package/dataflow/eval/resolve/node-value.js +12 -0
- package/dataflow/eval/resolve/resolve-argument.js +5 -4
- package/dataflow/eval/resolve/resolve-operators.js +9 -6
- package/dataflow/eval/resolve/resolve-strings.js +2 -2
- package/dataflow/eval/resolve/resolve-working-directory.js +4 -3
- package/dataflow/eval/resolve/resolve.js +3 -2
- package/dataflow/eval/values/general.js +8 -5
- package/dataflow/extractor.d.ts +1 -4
- package/dataflow/extractor.js +11 -10
- package/dataflow/fn/exceptions-of-function.d.ts +3 -1
- package/dataflow/fn/strict-function.js +7 -5
- package/dataflow/graph/call-graph.js +2 -2
- package/dataflow/graph/df-helper.d.ts +8 -1
- package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +19 -2
- package/dataflow/graph/edge.d.ts +38 -2
- package/dataflow/graph/edge.js +32 -2
- package/dataflow/graph/graph.d.ts +4 -3
- package/dataflow/graph/graph.js +6 -2
- package/dataflow/graph/match-args.d.ts +69 -0
- package/dataflow/graph/match-args.js +167 -0
- package/dataflow/info.d.ts +14 -0
- package/dataflow/internal/control-flow.d.ts +102 -0
- package/dataflow/internal/control-flow.js +200 -0
- package/dataflow/internal/linker.d.ts +6 -31
- package/dataflow/internal/linker.js +24 -81
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +9 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +18 -37
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +11 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +18 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +8 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +11 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +27 -20
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +35 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +20 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +8 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +15 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +26 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +17 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +71 -33
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +6 -15
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +12 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +14 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +15 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +12 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +45 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +19 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +6 -2
- package/dataflow/internal/process/functions/call/common.js +5 -6
- package/dataflow/internal/process/functions/call/deferred.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +12 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +23 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +2 -0
- package/dataflow/internal/process/functions/call/nse.d.ts +1 -1
- package/dataflow/internal/process/functions/call/nse.js +6 -1
- package/dataflow/internal/process/functions/call/quoted.js +2 -2
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +19 -6
- package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/process-argument.js +12 -4
- package/dataflow/internal/process/functions/process-parameter.js +13 -0
- package/dataflow/internal/process/process-named-call.d.ts +2 -2
- package/dataflow/internal/process/process-named-call.js +9 -7
- package/documentation/data/server/doc-data-server-messages.js +4 -4
- package/documentation/doc-readme.js +45 -0
- package/documentation/doc-util/doc-cfg.d.ts +8 -7
- package/documentation/doc-util/doc-cfg.js +10 -10
- package/documentation/doc-util/doc-playground.d.ts +12 -0
- package/documentation/doc-util/doc-playground.js +21 -0
- package/documentation/doc-util/doc-query.d.ts +4 -1
- package/documentation/doc-util/doc-query.js +4 -2
- package/documentation/wiki-absint.d.ts +3 -4
- package/documentation/wiki-absint.js +12 -5
- package/documentation/wiki-analyzer.js +2 -2
- package/documentation/wiki-cfg.js +101 -106
- package/documentation/wiki-dataflow-graph.js +84 -53
- package/documentation/wiki-linter.js +15 -1
- package/documentation/wiki-linting-and-testing.js +1 -16
- package/documentation/wiki-mk/doc-maker.js +6 -4
- package/documentation/wiki-query.js +14 -4
- package/documentation/wiki-signature-database.js +28 -2
- package/linter/linter-fix.d.ts +16 -0
- package/linter/linter-fix.js +104 -0
- package/linter/linter-format.d.ts +18 -1
- package/linter/linter-format.js +31 -1
- package/linter/linter-output.js +46 -10
- package/linter/linter-rules.d.ts +40 -9
- package/linter/linter-rules.js +2 -0
- package/linter/rules/absolute-path.js +4 -2
- package/linter/rules/dataframe-access-validation.js +6 -7
- package/linter/rules/deprecated-functions.d.ts +107 -10
- package/linter/rules/deprecated-functions.js +309 -23
- package/linter/rules/file-path-validity.js +5 -4
- package/linter/rules/function-finder-util.d.ts +6 -0
- package/linter/rules/function-finder-util.js +21 -13
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +2 -2
- package/linter/rules/stop-with-call-arg.js +2 -2
- package/linter/rules/unclosed-connection.js +2 -2
- package/linter/rules/undefined-symbol-util.js +6 -4
- package/linter/rules/undefined-symbol.js +2 -2
- package/linter/rules/unused-definition.js +8 -4
- package/linter/rules/unused-import.d.ts +60 -0
- package/linter/rules/unused-import.js +179 -0
- package/package.json +2 -2
- package/project/attached-packages.js +2 -1
- package/project/cache/flowr-analyzer-cache.d.ts +2 -5
- package/project/cache/flowr-analyzer-cache.js +4 -7
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +9 -8
- package/project/cache/flowr-analyzer-controlflow-cache.js +17 -34
- package/project/cache/flowr-cache.d.ts +9 -0
- package/project/cache/flowr-cache.js +19 -0
- package/project/context/flowr-analyzer-context.d.ts +7 -3
- package/project/context/flowr-analyzer-context.js +15 -9
- package/project/context/flowr-analyzer-dependencies-context.d.ts +24 -3
- package/project/context/flowr-analyzer-dependencies-context.js +9 -14
- package/project/context/flowr-analyzer-files-context.js +15 -17
- package/project/context/flowr-analyzer-meta-context.js +2 -12
- package/project/dependency-version-space.d.ts +0 -7
- package/project/dependency-version-space.js +8 -7
- package/project/flowr-analyzer.d.ts +4 -6
- package/project/flowr-analyzer.js +4 -5
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -34
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +13 -13
- package/project/plugins/file-plugins/files/flowr-rda-file.js +131 -286
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +1 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +32 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +43 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +5 -8
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +4 -10
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +3 -10
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +1 -13
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +3 -6
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +2 -8
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +3 -4
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -6
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +3 -16
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +4 -12
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -16
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +2 -8
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +2 -6
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +1 -10
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +2 -5
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.js +2 -8
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +2 -1
- package/project/sigdb/build.d.ts +2 -2
- package/project/sigdb/decode.d.ts +0 -5
- package/project/sigdb/decode.js +0 -8
- package/project/sigdb/index-format.d.ts +4 -4
- package/project/sigdb/manifest.d.ts +2 -2
- package/project/sigdb/reader.d.ts +48 -13
- package/project/sigdb/reader.js +2 -1
- package/project/sigdb/schema.d.ts +3 -1
- package/project/sigdb/signature-db.d.ts +69 -0
- package/project/sigdb/signature-db.js +54 -0
- package/project/sigdb/signature-match.d.ts +10 -5
- package/project/sigdb/signature-match.js +13 -8
- package/queries/catalog/absint-query/absint-query-executor.js +1 -2
- package/queries/catalog/call-context-query/call-context-query-executor.js +2 -4
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +33 -6
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +8 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -35
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +13 -1
- package/queries/catalog/dependencies-query/function-info/library-functions.js +26 -22
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +9 -0
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +19 -0
- package/queries/catalog/dependencies-query/implicit-echo.d.ts +13 -0
- package/queries/catalog/dependencies-query/implicit-echo.js +133 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +1 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/signature-query/signature-query-executor.js +4 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +4 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +13 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +3 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +6 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +5 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +5 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +5 -3
- package/reconstruct/inline/source-inline-map.js +3 -3
- package/reconstruct/reconstruct.js +6 -4
- package/search/flowr-search-builder.d.ts +8 -8
- package/search/flowr-search-builder.js +4 -4
- package/search/flowr-search-filters.d.ts +2 -2
- package/search/flowr-search-filters.js +3 -2
- package/search/search-executor/search-enrichers.d.ts +6 -4
- package/search/search-executor/search-enrichers.js +44 -5
- package/slicing/criterion/filters/all-variables.js +2 -1
- package/slicing/criterion/parse.js +8 -6
- package/slicing/static/slice-call.js +2 -2
- package/util/arg-matching.d.ts +3 -0
- package/util/arg-matching.js +12 -1
- package/util/collections/arrays.d.ts +0 -4
- package/util/collections/arrays.js +4 -26
- package/util/diff-graph.d.ts +1 -1
- package/util/diff-graph.js +17 -3
- package/util/diff.d.ts +6 -0
- package/util/mermaid/ast.d.ts +1 -1
- package/util/mermaid/ast.js +5 -4
- package/util/mermaid/cfg.js +130 -24
- package/util/mermaid/dfg.js +31 -10
- package/util/mermaid/mermaid.js +2 -0
- package/util/objects.d.ts +9 -0
- package/util/objects.js +12 -0
- package/util/prefix.d.ts +1 -1
- package/util/text/playground-link.d.ts +131 -0
- package/util/text/playground-link.js +214 -0
- package/util/text/strings.js +7 -3
- package/util/version.js +1 -1
- package/control-flow/cfg-builder.d.ts +0 -30
- package/control-flow/cfg-builder.js +0 -79
- package/control-flow/extract-cfg.d.ts +0 -36
- package/control-flow/extract-cfg.js +0 -693
- package/project/cfg-kind.d.ts +0 -21
- package/project/cfg-kind.js +0 -26
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Playground = exports.PlaygroundMark = exports.PlaygroundBox = void 0;
|
|
4
|
+
const url_encoding_1 = require("./url-encoding");
|
|
5
|
+
const arrays_1 = require("../collections/arrays");
|
|
6
|
+
/** the parts of the page a mark can point at, rather than a place in the script */
|
|
7
|
+
var PlaygroundBox;
|
|
8
|
+
(function (PlaygroundBox) {
|
|
9
|
+
/** the program slice the page built for the criterion the cursor sits on */
|
|
10
|
+
PlaygroundBox["Slice"] = "slice";
|
|
11
|
+
/** flowR's own repl, which a mark of this name opens as it marks it */
|
|
12
|
+
PlaygroundBox["Repl"] = "repl";
|
|
13
|
+
/** what the dependency query found */
|
|
14
|
+
PlaygroundBox["Deps"] = "deps";
|
|
15
|
+
/** what the linter found */
|
|
16
|
+
PlaygroundBox["Lints"] = "lints";
|
|
17
|
+
})(PlaygroundBox || (exports.PlaygroundBox = PlaygroundBox = {}));
|
|
18
|
+
/** a mark that stands for a place in the script: a line, a range, a column, or a name on a line */
|
|
19
|
+
const CodeMarkPattern = /^\d+(:\d+|-\d+|@.+)?$/;
|
|
20
|
+
/** a mark that stands for what an analysis found: `lint:<rule>[@<line>]`, `dep:<kind>[@<line>]` */
|
|
21
|
+
const FoundMarkPattern = /^(lint|dep):[^@,]+(@\d+)?$/;
|
|
22
|
+
/** how many lines one range may stand for, so a hand-written link cannot ask for a million marks */
|
|
23
|
+
const MaxExpandedRange = 500;
|
|
24
|
+
/** the longest link the page still opens, and the longest a chat client hands on in one piece */
|
|
25
|
+
const MaxSharedLink = 4000;
|
|
26
|
+
/**
|
|
27
|
+
* The helper object associated with {@link PlaygroundMark}, which makes it easy to check a mark and to
|
|
28
|
+
* keep a list of them as short as a link should be.
|
|
29
|
+
*/
|
|
30
|
+
exports.PlaygroundMark = {
|
|
31
|
+
name: 'PlaygroundMark',
|
|
32
|
+
/**
|
|
33
|
+
* Checks whether a value has a valid mark syntax. This does not check whether the mark points at
|
|
34
|
+
* anything: a line past the end of the script is valid and simply marks nothing.
|
|
35
|
+
*/
|
|
36
|
+
isValid(mark) {
|
|
37
|
+
if (typeof mark !== 'string' || mark.includes(',')) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return Object.values(PlaygroundBox).includes(mark)
|
|
41
|
+
|| CodeMarkPattern.test(mark) || FoundMarkPattern.test(mark);
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* The same marks, as short as they go: without repetition, without what another mark already covers,
|
|
45
|
+
* and with runs of plain lines written as ranges. A link is read by people as well as by the page,
|
|
46
|
+
* so this shortens rather than packs.
|
|
47
|
+
*/
|
|
48
|
+
compress(marks) {
|
|
49
|
+
const kept = (0, arrays_1.uniqueArray)(marks.filter(exports.PlaygroundMark.isValid));
|
|
50
|
+
/* `lint:<rule>` stands for each of its findings, so the single ones beside it say nothing more */
|
|
51
|
+
const whole = kept.filter(mark => FoundMarkPattern.test(mark) && !mark.includes('@'));
|
|
52
|
+
const left = kept.filter(mark => !whole.some(all => mark.startsWith(`${all}@`)));
|
|
53
|
+
const lines = left.filter(mark => /^\d+$/.test(mark)).map(Number).sort((a, b) => a - b);
|
|
54
|
+
const ranges = [];
|
|
55
|
+
for (let i = 0; i < lines.length;) {
|
|
56
|
+
let end = i;
|
|
57
|
+
while (end + 1 < lines.length && lines[end + 1] === lines[end] + 1) {
|
|
58
|
+
end++;
|
|
59
|
+
}
|
|
60
|
+
ranges.push(end > i ? `${lines[i]}-${lines[end]}` : `${lines[i]}`);
|
|
61
|
+
i = end + 1;
|
|
62
|
+
}
|
|
63
|
+
return [...ranges, ...left.filter(mark => !/^\d+$/.test(mark))];
|
|
64
|
+
},
|
|
65
|
+
/** the inverse of {@link PlaygroundMark.compress}: every range back to the lines it stands for */
|
|
66
|
+
expand(marks) {
|
|
67
|
+
return marks.flatMap((mark) => {
|
|
68
|
+
const range = /^(\d+)-(\d+)$/.exec(mark);
|
|
69
|
+
if (range === null) {
|
|
70
|
+
return exports.PlaygroundMark.isValid(mark) ? [mark] : [];
|
|
71
|
+
}
|
|
72
|
+
const [from, to] = [Number(range[1]), Number(range[2])];
|
|
73
|
+
return from <= to && to - from < MaxExpandedRange
|
|
74
|
+
? Array.from({ length: to - from + 1 }, (_, i) => `${from + i}`)
|
|
75
|
+
: [];
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Everything about flowR's playground that is not the page itself: what a link to it carries, and how
|
|
81
|
+
* one is written. The page reads back exactly what {@link Playground.link} writes.
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* Playground.link({ code: 'x <- 1\nprint(x)', at: '2@x', marks: ['2@x'] });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
exports.Playground = {
|
|
88
|
+
name: 'Playground',
|
|
89
|
+
/** where the page these links point at is served from */
|
|
90
|
+
BaseRef: 'https://flowr-analysis.github.io/flowr/wiki/playground/',
|
|
91
|
+
/** what a link can point at */
|
|
92
|
+
Mark: exports.PlaygroundMark,
|
|
93
|
+
/** the boxes of the page a mark can point at */
|
|
94
|
+
Box: PlaygroundBox,
|
|
95
|
+
/**
|
|
96
|
+
* The link that opens the playground on exactly this: a script, what it points at, where its cursor
|
|
97
|
+
* sits, and how the page is laid out.
|
|
98
|
+
*/
|
|
99
|
+
link(parts) {
|
|
100
|
+
const { code, marks = [], collapsed = [], at, forward, dim, replOpen, wholeSlice, config = [], split, repl } = parts;
|
|
101
|
+
const base = parts.base ?? exports.Playground.BaseRef;
|
|
102
|
+
const fields = [];
|
|
103
|
+
if (code !== undefined && code.length > 0) {
|
|
104
|
+
fields.push(['c', (0, url_encoding_1.packForUrl)(code)]);
|
|
105
|
+
}
|
|
106
|
+
if (config.length > 0) {
|
|
107
|
+
fields.push(['k', config.join(';')]);
|
|
108
|
+
}
|
|
109
|
+
const kept = exports.PlaygroundMark.compress(marks);
|
|
110
|
+
if (kept.length > 0) {
|
|
111
|
+
fields.push(['h', kept.join(',')]);
|
|
112
|
+
}
|
|
113
|
+
const folded = (0, arrays_1.uniqueArray)(collapsed).filter(box => Object.values(PlaygroundBox).includes(box));
|
|
114
|
+
if (folded.length > 0) {
|
|
115
|
+
fields.push(['f', folded.join(',')]);
|
|
116
|
+
}
|
|
117
|
+
/* one field for everything about the layout, with the trailing empty parts dropped */
|
|
118
|
+
const view = [
|
|
119
|
+
split === undefined ? '' : String(split),
|
|
120
|
+
repl === undefined ? '' : String(repl),
|
|
121
|
+
`${forward ? '>' : ''}${dim ? 'd' : ''}${replOpen ? 'r' : ''}${wholeSlice ? 'a' : ''}`
|
|
122
|
+
];
|
|
123
|
+
while (view.length > 0 && view[view.length - 1].length === 0) {
|
|
124
|
+
view.pop();
|
|
125
|
+
}
|
|
126
|
+
if (view.length > 0) {
|
|
127
|
+
fields.push(['v', view.join(',')]);
|
|
128
|
+
}
|
|
129
|
+
const position = at === undefined ? undefined
|
|
130
|
+
: code === undefined ? (/^\d+:\d+$/.test(at) ? at : undefined) : exports.Playground.positionOf(code, at);
|
|
131
|
+
if (position !== undefined) {
|
|
132
|
+
fields.push(['p', position]);
|
|
133
|
+
}
|
|
134
|
+
const hash = exports.Playground.hash(fields);
|
|
135
|
+
return hash.length > 0 ? `${base}#${hash}` : base;
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* A fragment is not a query, so `,`, `:`, and the braces a configuration carries stand in it as they
|
|
139
|
+
* are and only what would end it, split it, or read back as something else has to be escaped. `<` and
|
|
140
|
+
* `>` go together: both are excluded from a URI, and a bare one of either ends the autolink a chat
|
|
141
|
+
* client or a markdown reader made of the address. A link is also made not to end on punctuation,
|
|
142
|
+
* because that is where a chat client stops reading it.
|
|
143
|
+
*/
|
|
144
|
+
hash(fields) {
|
|
145
|
+
const hash = fields
|
|
146
|
+
.filter(([, value]) => value.length > 0)
|
|
147
|
+
.map(([key, value]) => `${key}=${value.replace(/[%&#+<>\s]/g, character => encodeURIComponent(character))}`)
|
|
148
|
+
.join('&');
|
|
149
|
+
return hash.replace(/[.,:;"')\]]$/, character => encodeURIComponent(character));
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Where a criterion points in the given code, as the `<line>:<column>` the page opens the cursor on.
|
|
153
|
+
* `12@sum` is the name `sum` in line 12, `12:5` that column, `12` the first name on the line.
|
|
154
|
+
*/
|
|
155
|
+
positionOf(code, criterion) {
|
|
156
|
+
if (!CodeMarkPattern.test(criterion)) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
const cut = criterion.indexOf('@');
|
|
160
|
+
const [lineText, columnText] = (cut < 0 ? criterion : criterion.slice(0, cut)).split(':');
|
|
161
|
+
const name = cut < 0 ? undefined : criterion.slice(cut + 1);
|
|
162
|
+
const line = Number(lineText);
|
|
163
|
+
const text = code.split('\n')[line - 1];
|
|
164
|
+
if (!Number.isInteger(line) || line < 1 || text === undefined) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
if (columnText !== undefined) {
|
|
168
|
+
const column = Number(columnText);
|
|
169
|
+
return Number.isInteger(column) && column > 0 ? `${line}:${column}` : undefined;
|
|
170
|
+
}
|
|
171
|
+
const wanted = name ?? /[A-Za-z.][\w._]*/.exec(text)?.[0];
|
|
172
|
+
if (wanted === undefined) {
|
|
173
|
+
return `${line}:1`;
|
|
174
|
+
}
|
|
175
|
+
const at = exports.Playground.nameIndexIn(text, wanted);
|
|
176
|
+
return at === undefined ? undefined : `${line}:${at + 1}`;
|
|
177
|
+
},
|
|
178
|
+
/**
|
|
179
|
+
* The same script with what is nobody's business taken out: the directories a path names, addresses,
|
|
180
|
+
* and whatever a name like `token` or `password` was set to. This is what makes a script safe enough
|
|
181
|
+
* to travel in a bug report, and it is best-effort: it is not a guarantee that nothing private is left.
|
|
182
|
+
*/
|
|
183
|
+
sanitize(code) {
|
|
184
|
+
return code
|
|
185
|
+
/* a secret is whatever a name says it is, whether or not it looks like one */
|
|
186
|
+
.replace(/\b([\w.]*(?:token|secret|password|passwd|pwd|api[_.]?key|credential)[\w.]*)(\s*(?:<-|=|<<-)\s*)(["'])(?:\\.|(?!\3)[^\\])*\3/gi, (_, name, arrow, quote) => `${name}${arrow}${quote}<redacted>${quote}`)
|
|
187
|
+
/* a path says who ran the script and where; the file it names is what the report is about */
|
|
188
|
+
.replace(/(["'])((?:[A-Za-z]:[\\/]|~?\/)(?:\\.|(?!\1)[^\\])*)\1/g, (_, quote, path) => {
|
|
189
|
+
const name = path.split(/[\\/]/).filter(part => part.length > 0).pop() ?? '';
|
|
190
|
+
return `${quote}<path>/${name}${quote}`;
|
|
191
|
+
})
|
|
192
|
+
.replace(/[\w.+-]+@[\w-]+\.[\w.]+/g, '<email>');
|
|
193
|
+
},
|
|
194
|
+
/**
|
|
195
|
+
* The link a bug report carries, or `undefined` when the script is too long to travel in one. What
|
|
196
|
+
* {@link Playground.sanitize} takes out never enters the link.
|
|
197
|
+
*/
|
|
198
|
+
reportLink(code, parts = {}) {
|
|
199
|
+
const link = exports.Playground.link({ ...parts, code: exports.Playground.sanitize(code) });
|
|
200
|
+
return link.length > MaxSharedLink ? undefined : link;
|
|
201
|
+
},
|
|
202
|
+
/** where a name stands in a line, as a name rather than as a substring of a longer one */
|
|
203
|
+
nameIndexIn(text, name) {
|
|
204
|
+
for (const found of text.matchAll(new RegExp(name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'))) {
|
|
205
|
+
const before = text[found.index - 1];
|
|
206
|
+
const after = text[found.index + name.length];
|
|
207
|
+
if (!/[\w._]/.test(before ?? ' ') && !/[\w._]/.test(after ?? ' ')) {
|
|
208
|
+
return found.index;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
//# sourceMappingURL=playground-link.js.map
|
package/util/text/strings.js
CHANGED
|
@@ -113,9 +113,13 @@ function fileUrlToPath(s) {
|
|
|
113
113
|
* Check if the given path is an absolute path.
|
|
114
114
|
*/
|
|
115
115
|
function isAbsolutePath(p, regex) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
if (regex?.test(p) || p.startsWith('/') || p.startsWith('\\') || /[a-zA-Z]:[\\/]/.test(p)) {
|
|
117
|
+
return true; // the second is a UNC path, the third a Windows one
|
|
118
|
+
}
|
|
119
|
+
/* where there is no file system there is nothing to resolve against, and a browser is such a place:
|
|
120
|
+
without the check the stub answers every question with itself, and every path would look absolute */
|
|
121
|
+
const normalized = path_1.default.normalize(p + '/');
|
|
122
|
+
return typeof normalized === 'string' && normalized === path_1.default.normalize(path_1.default.resolve(p) + '/');
|
|
119
123
|
}
|
|
120
124
|
const CorrespondingClose = {
|
|
121
125
|
'(': ')',
|
package/util/version.js
CHANGED
|
@@ -42,7 +42,7 @@ const assert_1 = require("./assert");
|
|
|
42
42
|
const sigdb_download_1 = require("../project/sigdb/sigdb-download");
|
|
43
43
|
const doc_files_1 = require("../documentation/doc-util/doc-files");
|
|
44
44
|
// this is automatically replaced with the current version by release-it
|
|
45
|
-
const version = '2.14.
|
|
45
|
+
const version = '2.14.2';
|
|
46
46
|
// this is automatically replaced with the release date by release-it (regex-bumper, see package.json)
|
|
47
47
|
const versionDate = '2026-07-15T07:13:44Z';
|
|
48
48
|
/**
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An append-only builder for a {@link ControlFlowGraph}, used while folding the AST.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
|
-
import type { CfgEdge } from './control-flow-graph';
|
|
7
|
-
import { CfgVertex, ControlFlowGraph } from './control-flow-graph';
|
|
8
|
-
/**
|
|
9
|
-
* Records the vertices and edges of a control flow graph instead of building it, as the bottom-up fold would
|
|
10
|
-
* copy an eager graph once per nesting level. {@link CfgBuilder#mergeWith|mergeWith()} only references the other
|
|
11
|
-
* builder, {@link CfgBuilder#materialize|materialize()} replays everything once in recording order — the
|
|
12
|
-
* order an eager merge produced, which the vertex order of a function definition's children relies on.
|
|
13
|
-
*/
|
|
14
|
-
export declare class CfgBuilder {
|
|
15
|
-
private readonly operations;
|
|
16
|
-
addVertex(vertex: CfgVertex, rootVertex?: boolean): this;
|
|
17
|
-
addEdge(from: NodeId, to: NodeId, edge: CfgEdge): this;
|
|
18
|
-
/**
|
|
19
|
-
* Record that the other builder is part of this one, it must not be modified afterwards.
|
|
20
|
-
* @param other - the builder to include
|
|
21
|
-
* @param forceNested - should its vertices count as nested (e.g., within a function definition)
|
|
22
|
-
*/
|
|
23
|
-
mergeWith(other: CfgBuilder, forceNested?: boolean): this;
|
|
24
|
-
/** The last vertex recorded for the given id, searching the merged builders only if we hold none. */
|
|
25
|
-
getVertex(id: NodeId): CfgVertex | undefined;
|
|
26
|
-
/** The ids of all vertices that are not nested, in insertion order. */
|
|
27
|
-
rootIds(collected?: Set<NodeId>): ReadonlySet<NodeId>;
|
|
28
|
-
/** Replays all recorded operations into a {@link ControlFlowGraph}. */
|
|
29
|
-
materialize(graph?: ControlFlowGraph, nested?: boolean): ControlFlowGraph;
|
|
30
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CfgBuilder = void 0;
|
|
4
|
-
const control_flow_graph_1 = require("./control-flow-graph");
|
|
5
|
-
/**
|
|
6
|
-
* Records the vertices and edges of a control flow graph instead of building it, as the bottom-up fold would
|
|
7
|
-
* copy an eager graph once per nesting level. {@link CfgBuilder#mergeWith|mergeWith()} only references the other
|
|
8
|
-
* builder, {@link CfgBuilder#materialize|materialize()} replays everything once in recording order — the
|
|
9
|
-
* order an eager merge produced, which the vertex order of a function definition's children relies on.
|
|
10
|
-
*/
|
|
11
|
-
class CfgBuilder {
|
|
12
|
-
operations = [];
|
|
13
|
-
addVertex(vertex, rootVertex = true) {
|
|
14
|
-
this.operations.push({ kind: 0 /* BuilderOperationType.Vertex */, vertex, root: rootVertex });
|
|
15
|
-
return this;
|
|
16
|
-
}
|
|
17
|
-
addEdge(from, to, edge) {
|
|
18
|
-
this.operations.push({ kind: 1 /* BuilderOperationType.Edge */, from, to, edge });
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Record that the other builder is part of this one, it must not be modified afterwards.
|
|
23
|
-
* @param other - the builder to include
|
|
24
|
-
* @param forceNested - should its vertices count as nested (e.g., within a function definition)
|
|
25
|
-
*/
|
|
26
|
-
mergeWith(other, forceNested = false) {
|
|
27
|
-
this.operations.push({ kind: 2 /* BuilderOperationType.Merge */, other, nested: forceNested });
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
/** The last vertex recorded for the given id, searching the merged builders only if we hold none. */
|
|
31
|
-
getVertex(id) {
|
|
32
|
-
for (let i = this.operations.length - 1; i >= 0; i--) {
|
|
33
|
-
const operation = this.operations[i];
|
|
34
|
-
if (operation.kind === 0 /* BuilderOperationType.Vertex */) {
|
|
35
|
-
if (control_flow_graph_1.CfgVertex.getId(operation.vertex) === id) {
|
|
36
|
-
return operation.vertex;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else if (operation.kind === 2 /* BuilderOperationType.Merge */) {
|
|
40
|
-
const found = operation.other.getVertex(id);
|
|
41
|
-
if (found !== undefined) {
|
|
42
|
-
return found;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
/** The ids of all vertices that are not nested, in insertion order. */
|
|
49
|
-
rootIds(collected = new Set()) {
|
|
50
|
-
for (const operation of this.operations) {
|
|
51
|
-
if (operation.kind === 0 /* BuilderOperationType.Vertex */) {
|
|
52
|
-
if (operation.root) {
|
|
53
|
-
collected.add(control_flow_graph_1.CfgVertex.getId(operation.vertex));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else if (operation.kind === 2 /* BuilderOperationType.Merge */ && !operation.nested) {
|
|
57
|
-
operation.other.rootIds(collected);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return collected;
|
|
61
|
-
}
|
|
62
|
-
/** Replays all recorded operations into a {@link ControlFlowGraph}. */
|
|
63
|
-
materialize(graph = new control_flow_graph_1.ControlFlowGraph(), nested = false) {
|
|
64
|
-
for (const operation of this.operations) {
|
|
65
|
-
if (operation.kind === 0 /* BuilderOperationType.Vertex */) {
|
|
66
|
-
graph.addVertex(operation.vertex, operation.root && !nested);
|
|
67
|
-
}
|
|
68
|
-
else if (operation.kind === 1 /* BuilderOperationType.Edge */) {
|
|
69
|
-
graph.addEdge(operation.from, operation.to, operation.edge);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
operation.other.materialize(graph, nested || operation.nested);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return graph;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.CfgBuilder = CfgBuilder;
|
|
79
|
-
//# sourceMappingURL=cfg-builder.js.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type QuadSerializationConfiguration } from '../util/quads';
|
|
2
|
-
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
|
-
import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
-
import type { DataflowGraph } from '../dataflow/graph/graph';
|
|
5
|
-
import type { DataflowGraphVertexFunctionCall } from '../dataflow/graph/vertex';
|
|
6
|
-
import { CfgVertex, type ControlFlowInformation } from './control-flow-graph';
|
|
7
|
-
import { type CfgSimplificationPassName } from './cfg-simplification';
|
|
8
|
-
import type { ReadOnlyFlowrAnalyzerContext } from '../project/context/flowr-analyzer-context';
|
|
9
|
-
/**
|
|
10
|
-
* Given a normalized AST, this approximates the control flow graph of the program.
|
|
11
|
-
* This view is different from the computation of the dataflow graph and may differ,
|
|
12
|
-
* especially because it focuses on intra-procedural analysis.
|
|
13
|
-
* @param ast - the normalized AST
|
|
14
|
-
* @param ctx - the flowR context
|
|
15
|
-
* @param graph - additional dataflow facts to consider by the control flow extraction
|
|
16
|
-
* @param simplifications - a list of simplification passes to apply to the control flow graph
|
|
17
|
-
* @param ignoreFunctDefs - whether function definition vertices should be ignored
|
|
18
|
-
* @see {@link extractCfgQuick} - for a simplified version of this function
|
|
19
|
-
*/
|
|
20
|
-
export declare function extractCfg<Info = ParentInformation>(ast: NormalizedAst<Info & ParentInformation>, ctx: ReadOnlyFlowrAnalyzerContext, graph?: DataflowGraph, simplifications?: readonly CfgSimplificationPassName[], ignoreFunctDefs?: boolean): ControlFlowInformation;
|
|
21
|
-
/**
|
|
22
|
-
* A version of {@link extractCfg} that is much quicker and does not apply any simplifications or dataflow information.
|
|
23
|
-
*/
|
|
24
|
-
export declare function extractCfgQuick<Info = ParentInformation>(ast: NormalizedAst<Info>): ControlFlowInformation<CfgVertex>;
|
|
25
|
-
/**
|
|
26
|
-
* Extracts all function call vertices from the given control flow information and dataflow graph.
|
|
27
|
-
*/
|
|
28
|
-
export declare function getCallsInCfg(cfg: ControlFlowInformation, graph: DataflowGraph): Map<NodeId, Required<DataflowGraphVertexFunctionCall>>;
|
|
29
|
-
export declare const ResolvedCallSuffix: "-resolved-call-e";
|
|
30
|
-
/**
|
|
31
|
-
* Convert a cfg to RDF quads.
|
|
32
|
-
* @see {@link df2quads}
|
|
33
|
-
* @see {@link serialize2quads}
|
|
34
|
-
* @see {@link graph2quads}
|
|
35
|
-
*/
|
|
36
|
-
export declare function cfg2quads(cfg: ControlFlowInformation, config: QuadSerializationConfiguration): string;
|