@eagleoutice/flowr 2.6.2 → 2.6.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 +36 -34
- package/abstract-interpretation/data-frame/absint-visitor.js +3 -3
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +7 -7
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +20 -16
- package/abstract-interpretation/data-frame/semantics.js +8 -0
- package/abstract-interpretation/data-frame/shape-inference.d.ts +3 -3
- package/abstract-interpretation/data-frame/shape-inference.js +3 -3
- package/abstract-interpretation/normalized-ast-fold.d.ts +1 -1
- package/benchmark/slicer.d.ts +1 -0
- package/benchmark/slicer.js +13 -12
- package/benchmark/summarizer/first-phase/process.js +1 -1
- package/benchmark/summarizer/second-phase/graph.d.ts +3 -1
- package/benchmark/summarizer/second-phase/graph.js +3 -1
- package/cli/export-quads-app.js +1 -1
- package/cli/repl/commands/repl-dataflow.js +2 -1
- package/cli/repl/commands/repl-parse.js +16 -4
- package/cli/repl/commands/repl-query.js +1 -1
- package/cli/repl/core.js +16 -13
- package/cli/repl/server/connection.js +2 -1
- package/cli/script-core/statistics-helper-core.js +2 -1
- package/cli/slicer-app.js +3 -4
- package/cli/wiki.d.ts +4 -0
- package/cli/wiki.js +165 -0
- package/config.d.ts +4 -0
- package/config.js +6 -0
- package/control-flow/cfg-dead-code.js +13 -3
- package/control-flow/cfg-simplification.d.ts +5 -2
- package/control-flow/cfg-simplification.js +3 -0
- package/control-flow/extract-cfg.d.ts +9 -3
- package/control-flow/extract-cfg.js +44 -4
- package/control-flow/semantic-cfg-guided-visitor.d.ts +2 -2
- package/control-flow/simple-visitor.js +2 -2
- package/control-flow/useless-loop.d.ts +3 -3
- package/control-flow/useless-loop.js +14 -5
- package/core/pipeline-executor.d.ts +3 -6
- package/core/pipeline-executor.js +4 -7
- package/core/print/normalize-printer.d.ts +1 -1
- package/core/print/normalize-printer.js +2 -2
- package/core/steps/all/core/00-parse.d.ts +1 -1
- package/core/steps/all/core/00-parse.js +1 -1
- package/core/steps/all/core/10-normalize.d.ts +3 -9
- package/core/steps/all/core/10-normalize.js +1 -16
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -3
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -3
- package/core/steps/all/core/20-dataflow.d.ts +3 -4
- package/core/steps/all/core/20-dataflow.js +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +1 -2
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +8 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +4 -1
- package/core/steps/pipeline/default-pipelines.d.ts +55 -56
- package/core/steps/pipeline/default-pipelines.js +8 -8
- package/dataflow/environments/clone.d.ts +0 -1
- package/dataflow/environments/clone.js +12 -2
- package/dataflow/environments/diff.js +2 -2
- package/dataflow/environments/overwrite.d.ts +1 -5
- package/dataflow/environments/overwrite.js +3 -19
- package/dataflow/environments/scoping.d.ts +6 -2
- package/dataflow/environments/scoping.js +6 -2
- package/dataflow/eval/resolve/resolve-argument.js +2 -2
- package/dataflow/eval/values/string/string-constants.d.ts +9 -3
- package/dataflow/eval/values/string/string-constants.js +9 -3
- package/dataflow/extractor.d.ts +2 -3
- package/dataflow/extractor.js +25 -22
- package/dataflow/graph/graph.d.ts +3 -9
- package/dataflow/graph/graph.js +0 -13
- package/dataflow/graph/unknown-replacement.d.ts +4 -2
- package/dataflow/graph/unknown-replacement.js +4 -2
- package/dataflow/info.d.ts +7 -0
- package/dataflow/info.js +21 -0
- package/dataflow/internal/linker.js +7 -4
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -2
- package/dataflow/internal/process/functions/call/argument/make-argument.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +6 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +15 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +78 -75
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
- package/dataflow/internal/process/functions/call/common.d.ts +1 -1
- package/dataflow/internal/process/functions/call/common.js +4 -4
- package/dataflow/internal/process/functions/call/default-call-handling.d.ts +3 -1
- package/dataflow/internal/process/functions/call/default-call-handling.js +3 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +3 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +4 -4
- package/dataflow/internal/process/functions/process-parameter.js +4 -4
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
- package/dataflow/processor.d.ts +6 -11
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +0 -2
- package/documentation/data/faq/faqs.js +27 -18
- package/documentation/data/faq/recommended-configs.d.ts +36 -0
- package/documentation/data/faq/recommended-configs.js +40 -0
- package/documentation/data/faq/wiki-faq-store.d.ts +1 -0
- package/documentation/data/faq/wiki-faq-store.js +10 -2
- package/documentation/data/server/doc-data-server-messages.js +1 -1
- package/documentation/doc-capabilities.d.ts +9 -0
- package/documentation/{print-capabilities-markdown.js → doc-capabilities.js} +18 -21
- package/documentation/doc-readme.d.ts +9 -0
- package/documentation/{print-readme.js → doc-readme.js} +31 -35
- package/documentation/doc-util/doc-benchmarks.d.ts +6 -4
- package/documentation/doc-util/doc-benchmarks.js +6 -4
- package/documentation/doc-util/doc-cfg.js +5 -8
- package/documentation/doc-util/doc-dfg.d.ts +7 -7
- package/documentation/doc-util/doc-dfg.js +13 -13
- package/documentation/doc-util/doc-escape.d.ts +6 -0
- package/documentation/doc-util/doc-escape.js +11 -0
- package/documentation/doc-util/doc-general.d.ts +22 -2
- package/documentation/doc-util/doc-general.js +22 -2
- package/documentation/doc-util/doc-normalized-ast.d.ts +10 -5
- package/documentation/doc-util/doc-normalized-ast.js +12 -9
- package/documentation/doc-util/doc-query.d.ts +12 -4
- package/documentation/doc-util/doc-query.js +18 -11
- package/documentation/doc-util/doc-search.d.ts +0 -30
- package/documentation/doc-util/doc-search.js +2 -73
- package/documentation/doc-util/doc-server-message.d.ts +5 -5
- package/documentation/doc-util/doc-server-message.js +4 -4
- package/documentation/doc-util/doc-types.d.ts +69 -32
- package/documentation/doc-util/doc-types.js +108 -61
- package/documentation/index.d.ts +9 -9
- package/documentation/index.js +9 -9
- package/documentation/issue-linting-rule.d.ts +9 -0
- package/documentation/{print-linter-issue.js → issue-linting-rule.js} +20 -23
- package/documentation/wiki-analyzer.d.ts +9 -0
- package/documentation/wiki-analyzer.js +412 -0
- package/documentation/wiki-cfg.d.ts +9 -0
- package/documentation/{print-cfg-wiki.js → wiki-cfg.js} +144 -160
- package/documentation/wiki-core.d.ts +14 -0
- package/documentation/{print-core-wiki.js → wiki-core.js} +164 -175
- package/documentation/wiki-dataflow-graph.d.ts +9 -0
- package/documentation/{print-dataflow-graph-wiki.js → wiki-dataflow-graph.js} +142 -172
- package/documentation/wiki-engine.d.ts +9 -0
- package/documentation/{print-engines-wiki.js → wiki-engine.js} +27 -42
- package/documentation/wiki-faq.d.ts +8 -0
- package/documentation/wiki-faq.js +22 -0
- package/documentation/wiki-interface.d.ts +9 -0
- package/documentation/{print-interface-wiki.js → wiki-interface.js} +59 -56
- package/documentation/wiki-linter.d.ts +9 -0
- package/documentation/{print-linter-wiki.js → wiki-linter.js} +52 -48
- package/documentation/wiki-linting-and-testing.d.ts +9 -0
- package/documentation/{print-linting-and-testing-wiki.js → wiki-linting-and-testing.js} +25 -32
- package/documentation/wiki-mk/doc-context.d.ts +186 -0
- package/documentation/wiki-mk/doc-context.js +84 -0
- package/documentation/wiki-mk/doc-maker.d.ts +95 -0
- package/documentation/wiki-mk/doc-maker.js +133 -0
- package/documentation/wiki-normalized-ast.d.ts +9 -0
- package/documentation/{print-normalized-ast-wiki.js → wiki-normalized-ast.js} +64 -47
- package/documentation/wiki-onboarding.d.ts +8 -0
- package/documentation/{print-onboarding-wiki.js → wiki-onboarding.js} +18 -15
- package/documentation/wiki-query.d.ts +9 -0
- package/documentation/{print-query-wiki.js → wiki-query.js} +62 -47
- package/documentation/wiki-search.d.ts +9 -0
- package/documentation/wiki-search.js +61 -0
- package/linter/linter-executor.js +3 -2
- package/linter/linter-format.d.ts +2 -2
- package/linter/linter-rules.d.ts +13 -17
- package/linter/rules/absolute-path.d.ts +1 -2
- package/linter/rules/absolute-path.js +2 -2
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +12 -8
- package/linter/rules/dead-code.d.ts +1 -1
- package/linter/rules/deprecated-functions.d.ts +1 -5
- package/linter/rules/file-path-validity.d.ts +1 -1
- package/linter/rules/file-path-validity.js +4 -4
- package/linter/rules/function-finder-util.d.ts +1 -5
- package/linter/rules/naming-convention.d.ts +2 -2
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/network-functions.js +1 -1
- package/linter/rules/seeded-randomness.d.ts +3 -2
- package/linter/rules/seeded-randomness.js +33 -13
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/useless-loop.d.ts +2 -2
- package/linter/rules/useless-loop.js +2 -2
- package/package.json +6 -17
- package/project/cache/flowr-analyzer-cache.d.ts +7 -10
- package/project/cache/flowr-analyzer-cache.js +17 -38
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +34 -0
- package/project/cache/flowr-analyzer-controlflow-cache.js +79 -0
- package/project/context/flowr-analyzer-context.d.ts +30 -5
- package/project/context/flowr-analyzer-context.js +48 -4
- package/project/context/flowr-analyzer-files-context.d.ts +63 -13
- package/project/context/flowr-analyzer-files-context.js +110 -39
- package/project/context/flowr-file.d.ts +32 -10
- package/project/context/flowr-file.js +30 -9
- package/project/flowr-analyzer-builder.d.ts +22 -28
- package/project/flowr-analyzer-builder.js +32 -70
- package/project/flowr-analyzer.d.ts +55 -14
- package/project/flowr-analyzer.js +53 -8
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +7 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +13 -5
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +3 -3
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +11 -5
- package/project/plugins/file-plugins/flowr-description-file.d.ts +3 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +33 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +33 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +33 -0
- package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.d.ts +20 -0
- package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.js +42 -0
- package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.d.ts +59 -0
- package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.js +132 -0
- package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
- package/project/plugins/file-plugins/notebooks/notebook.js +2 -0
- package/project/plugins/flowr-analyzer-plugin-defaults.d.ts +5 -0
- package/project/plugins/flowr-analyzer-plugin-defaults.js +23 -0
- package/project/plugins/flowr-analyzer-plugin.d.ts +2 -0
- package/project/plugins/flowr-analyzer-plugin.js +2 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/plugin-registry.d.ts +34 -0
- package/project/plugins/plugin-registry.js +62 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +4 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +5 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +25 -18
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
- package/queries/catalog/df-shape-query/df-shape-query-format.js +6 -5
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.js +13 -2
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -1
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-executor.js +3 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.js +13 -1
- package/queries/query.d.ts +26 -18
- package/queries/query.js +21 -1
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/model/collect.js +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +29 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +15 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +5 -7
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +24 -11
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/type.js +2 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +9 -8
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +11 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.d.ts +4 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +20 -11
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +5 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +3 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +14 -5
- package/r-bridge/parser.d.ts +15 -5
- package/r-bridge/parser.js +27 -13
- package/r-bridge/retriever.d.ts +9 -15
- package/r-bridge/retriever.js +14 -5
- package/r-bridge/shell.d.ts +1 -1
- package/r-bridge/shell.js +1 -1
- package/reconstruct/auto-select/auto-select-defaults.d.ts +0 -1
- package/reconstruct/auto-select/magic-comments.js +1 -1
- package/reconstruct/reconstruct.d.ts +17 -9
- package/reconstruct/reconstruct.js +19 -8
- package/search/flowr-search.d.ts +12 -0
- package/search/search-executor/search-enrichers.d.ts +9 -2
- package/search/search-executor/search-enrichers.js +1 -3
- package/search/search-executor/search-generators.d.ts +1 -1
- package/search/search-executor/search-generators.js +9 -4
- package/slicing/criterion/collect-all.d.ts +3 -2
- package/slicing/criterion/collect-all.js +1 -1
- package/slicing/criterion/parse.js +4 -4
- package/statistics/features/supported/assignments/assignments.js +1 -1
- package/statistics/features/supported/control-flow/control-flow.js +1 -1
- package/statistics/features/supported/data-access/data-access.js +1 -1
- package/statistics/features/supported/defined-functions/defined-functions.js +1 -1
- package/statistics/features/supported/expression-list/statistics-expression-list.js +1 -1
- package/statistics/features/supported/loops/loops.js +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +1 -1
- package/statistics/features/supported/variables/variables.js +1 -1
- package/statistics/statistics.js +3 -2
- package/util/assert.d.ts +4 -0
- package/util/assert.js +4 -0
- package/util/files.d.ts +1 -1
- package/util/files.js +1 -1
- package/util/mermaid/ast.d.ts +4 -3
- package/util/mermaid/ast.js +36 -8
- package/util/mermaid/cfg.js +1 -1
- package/util/version.js +1 -1
- package/documentation/print-analyzer-wiki.d.ts +0 -1
- package/documentation/print-analyzer-wiki.js +0 -141
- package/documentation/print-capabilities-markdown.d.ts +0 -1
- package/documentation/print-cfg-wiki.d.ts +0 -1
- package/documentation/print-core-wiki.d.ts +0 -5
- package/documentation/print-dataflow-graph-wiki.d.ts +0 -1
- package/documentation/print-engines-wiki.d.ts +0 -1
- package/documentation/print-faq-wiki.d.ts +0 -1
- package/documentation/print-faq-wiki.js +0 -18
- package/documentation/print-interface-wiki.d.ts +0 -1
- package/documentation/print-linter-issue.d.ts +0 -1
- package/documentation/print-linter-wiki.d.ts +0 -1
- package/documentation/print-linting-and-testing-wiki.d.ts +0 -1
- package/documentation/print-normalized-ast-wiki.d.ts +0 -1
- package/documentation/print-onboarding-wiki.d.ts +0 -1
- package/documentation/print-query-wiki.d.ts +0 -1
- package/documentation/print-readme.d.ts +0 -1
- package/documentation/print-search-wiki.d.ts +0 -1
- package/documentation/print-search-wiki.js +0 -74
- package/util/formats/adapter-format.d.ts +0 -6
- package/util/formats/adapter-format.js +0 -3
- package/util/formats/adapter.d.ts +0 -27
- package/util/formats/adapter.js +0 -58
- package/util/formats/adapters/r-adapter.d.ts +0 -4
- package/util/formats/adapters/r-adapter.js +0 -7
- package/util/formats/adapters/rmd-adapter.d.ts +0 -35
- package/util/formats/adapters/rmd-adapter.js +0 -100
|
@@ -7,7 +7,8 @@ exports.collectStrings = collectStrings;
|
|
|
7
7
|
const general_1 = require("../general");
|
|
8
8
|
const r_value_1 = require("../r-value");
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Lift a raw string or R string value into a ValueString.
|
|
11
|
+
* @see {@link liftString} - for lifting a Lift<RStringValue>
|
|
11
12
|
*/
|
|
12
13
|
function stringFrom(str) {
|
|
13
14
|
return {
|
|
@@ -19,7 +20,8 @@ function stringFrom(str) {
|
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Lift a Lift<RStringValue> into a ValueString.
|
|
24
|
+
* @see {@link stringFrom} - for lifting a raw string or R string value.
|
|
23
25
|
*/
|
|
24
26
|
function liftString(str) {
|
|
25
27
|
return {
|
|
@@ -28,7 +30,11 @@ function liftString(str) {
|
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
|
-
*
|
|
33
|
+
* Collect strings from an array of ValueString.
|
|
34
|
+
* If any value is not a string, or is Bottom/Top, undefined is returned.
|
|
35
|
+
* @param a - The array of Value to collect strings from.
|
|
36
|
+
* @param withQuotes - Whether to include the quotes in the returned strings.
|
|
37
|
+
* @returns - An array of strings, or undefined if any value is not a string.
|
|
32
38
|
*/
|
|
33
39
|
function collectStrings(a, withQuotes = false) {
|
|
34
40
|
if ((0, general_1.bottomTopGuard)(a)) {
|
package/dataflow/extractor.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { DataflowInformation } from './info';
|
|
2
2
|
import { type DataflowProcessors } from './processor';
|
|
3
3
|
import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
-
import type { RParseRequests } from '../r-bridge/retriever';
|
|
5
4
|
import type { KnownParserType, Parser } from '../r-bridge/parser';
|
|
6
5
|
import type { ControlFlowInformation } from '../control-flow/control-flow-graph';
|
|
7
|
-
import type {
|
|
6
|
+
import type { FlowrAnalyzerContext } from '../project/context/flowr-analyzer-context';
|
|
8
7
|
/**
|
|
9
8
|
* The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
|
|
10
9
|
* Maps every {@link RType} in the normalized AST to a processor.
|
|
@@ -16,6 +15,6 @@ export declare const processors: DataflowProcessors<ParentInformation>;
|
|
|
16
15
|
* (e.g., in the event of a `source` call).
|
|
17
16
|
* For the actual, canonical fold entry point, see {@link processDataflowFor}.
|
|
18
17
|
*/
|
|
19
|
-
export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>,
|
|
18
|
+
export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, completeAst: NormalizedAst<OtherInfo & ParentInformation>, ctx: FlowrAnalyzerContext): DataflowInformation & {
|
|
20
19
|
cfgQuick: ControlFlowInformation | undefined;
|
|
21
20
|
};
|
package/dataflow/extractor.js
CHANGED
|
@@ -21,6 +21,7 @@ const edge_1 = require("./graph/edge");
|
|
|
21
21
|
const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
22
22
|
const built_in_function_definition_1 = require("./internal/process/functions/call/built-in/built-in-function-definition");
|
|
23
23
|
const built_in_config_1 = require("./environments/built-in-config");
|
|
24
|
+
const flowr_file_1 = require("../project/context/flowr-file");
|
|
24
25
|
/**
|
|
25
26
|
* The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
|
|
26
27
|
* Maps every {@link RType} in the normalized AST to a processor.
|
|
@@ -60,13 +61,24 @@ exports.processors = {
|
|
|
60
61
|
};
|
|
61
62
|
function resolveLinkToSideEffects(ast, graph) {
|
|
62
63
|
let cf = undefined;
|
|
64
|
+
let knownCalls;
|
|
65
|
+
const handled = new Set();
|
|
63
66
|
for (const s of graph.unknownSideEffects) {
|
|
64
67
|
if (typeof s !== 'object') {
|
|
65
68
|
continue;
|
|
66
69
|
}
|
|
67
|
-
cf
|
|
70
|
+
if (cf === undefined) {
|
|
71
|
+
cf = (0, extract_cfg_1.extractCfgQuick)(ast);
|
|
72
|
+
if (graph.unknownSideEffects.size > 20) {
|
|
73
|
+
knownCalls = (0, extract_cfg_1.getCallsInCfg)(cf, graph);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else if (handled.has(s.id)) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
handled.add(s.id);
|
|
68
80
|
/* this has to change whenever we add a new link to relations because we currently offer no abstraction for the type */
|
|
69
|
-
const potentials = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(s.id, cf
|
|
81
|
+
const potentials = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(s.id, cf.graph, graph, s.linkTo, knownCalls);
|
|
70
82
|
for (const pot of potentials) {
|
|
71
83
|
graph.addEdge(s.id, pot, edge_1.EdgeType.Reads);
|
|
72
84
|
}
|
|
@@ -82,36 +94,27 @@ function resolveLinkToSideEffects(ast, graph) {
|
|
|
82
94
|
* (e.g., in the event of a `source` call).
|
|
83
95
|
* For the actual, canonical fold entry point, see {@link processDataflowFor}.
|
|
84
96
|
*/
|
|
85
|
-
function produceDataFlowGraph(parser,
|
|
86
|
-
|
|
87
|
-
const multifile = Array.isArray(request);
|
|
88
|
-
if (multifile) {
|
|
89
|
-
firstRequest = request[0];
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
firstRequest = request;
|
|
93
|
-
}
|
|
94
|
-
const builtInsConfig = config.semantics.environment.overwriteBuiltIns;
|
|
97
|
+
function produceDataFlowGraph(parser, completeAst, ctx) {
|
|
98
|
+
const builtInsConfig = ctx.config.semantics.environment.overwriteBuiltIns;
|
|
95
99
|
const builtIns = (0, built_in_config_1.getBuiltInDefinitions)(builtInsConfig.definitions, builtInsConfig.loadDefaults);
|
|
96
100
|
const env = (0, environment_1.initializeCleanEnvironments)(builtIns.builtInMemory);
|
|
101
|
+
// we freeze the files here to avoid endless modifications during processing
|
|
102
|
+
const files = completeAst.ast.files.slice();
|
|
103
|
+
ctx.files.addConsideredFile(files[0].filePath ? files[0].filePath : flowr_file_1.FlowrFile.INLINE_PATH);
|
|
97
104
|
const dfData = {
|
|
98
105
|
parser,
|
|
99
106
|
completeAst,
|
|
100
107
|
environment: env,
|
|
101
108
|
builtInEnvironment: env.current.parent,
|
|
102
109
|
processors: exports.processors,
|
|
103
|
-
currentRequest: firstRequest,
|
|
104
110
|
controlDependencies: undefined,
|
|
105
|
-
referenceChain: [
|
|
106
|
-
|
|
111
|
+
referenceChain: [files[0].filePath],
|
|
112
|
+
ctx
|
|
107
113
|
};
|
|
108
|
-
let df = (0, processor_1.processDataflowFor)(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
/* source requests register automatically */
|
|
113
|
-
df = (0, built_in_source_1.standaloneSourceFile)(request[i], dfData, `root-${i}`, df);
|
|
114
|
-
}
|
|
114
|
+
let df = (0, processor_1.processDataflowFor)(files[0].root, dfData);
|
|
115
|
+
for (let i = 1; i < files.length; i++) {
|
|
116
|
+
/* source requests register automatically */
|
|
117
|
+
df = (0, built_in_source_1.standaloneSourceFile)(i, files[i], dfData, df);
|
|
115
118
|
}
|
|
116
119
|
// finally, resolve linkages
|
|
117
120
|
(0, built_in_function_definition_1.updateNestedFunctionCalls)(df.graph, df.environment);
|
|
@@ -71,15 +71,14 @@ export interface DataflowGraphJson {
|
|
|
71
71
|
readonly rootVertices: NodeId[];
|
|
72
72
|
readonly vertexInformation: [NodeId, DataflowGraphVertexInfo][];
|
|
73
73
|
readonly edgeInformation: [NodeId, [NodeId, DataflowGraphEdge][]][];
|
|
74
|
-
readonly sourced?: (string | '<inline>')[];
|
|
75
74
|
}
|
|
76
75
|
/**
|
|
77
76
|
* An unknown side effect describes something that we cannot handle correctly (in all cases).
|
|
78
|
-
* For example, `
|
|
77
|
+
* For example, `load` will be marked as an unknown side effect as we have no idea of how it will affect the program.
|
|
79
78
|
* Linked side effects are used whenever we know that a call may be affected by another one in a way that we cannot
|
|
80
79
|
* grasp from the dataflow perspective (e.g., an indirect dependency based on the currently active graphic device).
|
|
81
80
|
*/
|
|
82
|
-
export type
|
|
81
|
+
export type UnknownSideEffect = NodeId | {
|
|
83
82
|
id: NodeId;
|
|
84
83
|
linkTo: LinkTo<RegExp>;
|
|
85
84
|
};
|
|
@@ -101,8 +100,6 @@ export type UnknownSidEffect = NodeId | {
|
|
|
101
100
|
export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = DataflowGraphVertexInfo, Edge extends DataflowGraphEdge = DataflowGraphEdge> {
|
|
102
101
|
private static DEFAULT_ENVIRONMENT;
|
|
103
102
|
private _idMap;
|
|
104
|
-
/** all file paths included in this dfg */
|
|
105
|
-
private _sourced;
|
|
106
103
|
private readonly _unknownSideEffects;
|
|
107
104
|
constructor(idMap: AstIdMap | undefined);
|
|
108
105
|
/** Contains the vertices of the root level graph (i.e., included those vertices from the complete graph, that are nested within function definitions) */
|
|
@@ -138,13 +135,10 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
138
135
|
getLinked(nodeId: NodeId): NodeId[] | undefined;
|
|
139
136
|
/** Retrieves the id-map to the normalized AST attached to the dataflow graph */
|
|
140
137
|
get idMap(): AstIdMap | undefined;
|
|
141
|
-
get sourced(): (string | '<inline>')[];
|
|
142
|
-
/** Mark this file as being part of the dfg */
|
|
143
|
-
addFile(source: string | '<inline>'): void;
|
|
144
138
|
/**
|
|
145
139
|
* Retrieves the set of vertices which have side effects that we do not know anything about.
|
|
146
140
|
*/
|
|
147
|
-
get unknownSideEffects(): Set<
|
|
141
|
+
get unknownSideEffects(): Set<UnknownSideEffect>;
|
|
148
142
|
/** Allows setting the id-map explicitly (which should only be used when, e.g., you plan to compare two dataflow graphs on the same AST-basis) */
|
|
149
143
|
setIdMap(idMap: AstIdMap): void;
|
|
150
144
|
/**
|
package/dataflow/graph/graph.js
CHANGED
|
@@ -53,8 +53,6 @@ function getReferenceOfArgument(arg) {
|
|
|
53
53
|
class DataflowGraph {
|
|
54
54
|
static DEFAULT_ENVIRONMENT = undefined;
|
|
55
55
|
_idMap;
|
|
56
|
-
/** all file paths included in this dfg */
|
|
57
|
-
_sourced = [];
|
|
58
56
|
/*
|
|
59
57
|
* Set of vertices which have sideEffects that we do not know anything about.
|
|
60
58
|
* As a (temporary) solution until we have FD edges, a side effect may also store known target links
|
|
@@ -127,13 +125,6 @@ class DataflowGraph {
|
|
|
127
125
|
get idMap() {
|
|
128
126
|
return this._idMap;
|
|
129
127
|
}
|
|
130
|
-
get sourced() {
|
|
131
|
-
return this._sourced;
|
|
132
|
-
}
|
|
133
|
-
/** Mark this file as being part of the dfg */
|
|
134
|
-
addFile(source) {
|
|
135
|
-
this._sourced.push(source);
|
|
136
|
-
}
|
|
137
128
|
/**
|
|
138
129
|
* Retrieves the set of vertices which have side effects that we do not know anything about.
|
|
139
130
|
*/
|
|
@@ -248,7 +239,6 @@ class DataflowGraph {
|
|
|
248
239
|
this.rootVertices.add(root);
|
|
249
240
|
}
|
|
250
241
|
}
|
|
251
|
-
this._sourced = this._sourced.concat(otherGraph.sourced);
|
|
252
242
|
for (const unknown of otherGraph.unknownSideEffects) {
|
|
253
243
|
this._unknownSideEffects.add(unknown);
|
|
254
244
|
}
|
|
@@ -348,9 +338,6 @@ class DataflowGraph {
|
|
|
348
338
|
}
|
|
349
339
|
}
|
|
350
340
|
graph.edgeInformation = new Map(data.edgeInformation.map(([id, edges]) => [id, new Map(edges)]));
|
|
351
|
-
if (data.sourced) {
|
|
352
|
-
graph._sourced = data.sourced;
|
|
353
|
-
}
|
|
354
341
|
return graph;
|
|
355
342
|
}
|
|
356
343
|
}
|
|
@@ -8,10 +8,12 @@ export type ReplacementOperatorHandlerArgs = {
|
|
|
8
8
|
};
|
|
9
9
|
export type ReplacementOperatorHandler = (args: ReplacementOperatorHandlerArgs) => void;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Register a new (global) handler for replacement operators.
|
|
12
|
+
* @see {@link handleReplacementOperator}
|
|
12
13
|
*/
|
|
13
14
|
export declare function onReplacementOperator(handler: ReplacementOperatorHandler): void;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Handle a replacement operator by calling all registered handlers.
|
|
17
|
+
* @see {@link onReplacementOperator}
|
|
16
18
|
*/
|
|
17
19
|
export declare function handleReplacementOperator(args: ReplacementOperatorHandlerArgs): void;
|
|
@@ -4,13 +4,15 @@ exports.onReplacementOperator = onReplacementOperator;
|
|
|
4
4
|
exports.handleReplacementOperator = handleReplacementOperator;
|
|
5
5
|
const handlers = [];
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Register a new (global) handler for replacement operators.
|
|
8
|
+
* @see {@link handleReplacementOperator}
|
|
8
9
|
*/
|
|
9
10
|
function onReplacementOperator(handler) {
|
|
10
11
|
handlers.push(handler);
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* Handle a replacement operator by calling all registered handlers.
|
|
15
|
+
* @see {@link onReplacementOperator}
|
|
14
16
|
*/
|
|
15
17
|
function handleReplacementOperator(args) {
|
|
16
18
|
handlers.forEach(handler => handler(args));
|
package/dataflow/info.d.ts
CHANGED
|
@@ -106,8 +106,15 @@ export declare function initializeCleanDataflowInformation<T>(entryPoint: NodeId
|
|
|
106
106
|
/**
|
|
107
107
|
* Checks whether the given control dependencies are exhaustive (i.e. if for every control dependency on a boolean,
|
|
108
108
|
* the list contains a dependency on the `true` and on the `false` case).
|
|
109
|
+
* @see {@link happensInEveryBranchSet} - for the set-based version
|
|
109
110
|
*/
|
|
110
111
|
export declare function happensInEveryBranch(controlDependencies: readonly ControlDependency[] | undefined): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Checks whether the given control dependencies are exhaustive (i.e. if for every control dependency on a boolean,
|
|
114
|
+
* the list contains a dependency on the `true` and on the `false` case).
|
|
115
|
+
* @see {@link happensInEveryBranch} - for the array-based version
|
|
116
|
+
*/
|
|
117
|
+
export declare function happensInEveryBranchSet(controlDependencies: ReadonlySet<ControlDependency> | undefined): boolean;
|
|
111
118
|
/**
|
|
112
119
|
* Checks whether the given dataflow information always exits (i.e., if there is a non-default exit point in every branch).
|
|
113
120
|
* @see {@link ExitPoint} - for the different types of exit points
|
package/dataflow/info.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addNonDefaultExitPoints = addNonDefaultExitPoints;
|
|
4
4
|
exports.initializeCleanDataflowInformation = initializeCleanDataflowInformation;
|
|
5
5
|
exports.happensInEveryBranch = happensInEveryBranch;
|
|
6
|
+
exports.happensInEveryBranchSet = happensInEveryBranchSet;
|
|
6
7
|
exports.alwaysExits = alwaysExits;
|
|
7
8
|
exports.filterOutLoopExitPoints = filterOutLoopExitPoints;
|
|
8
9
|
exports.diffControlDependency = diffControlDependency;
|
|
@@ -33,6 +34,7 @@ function initializeCleanDataflowInformation(entryPoint, data) {
|
|
|
33
34
|
/**
|
|
34
35
|
* Checks whether the given control dependencies are exhaustive (i.e. if for every control dependency on a boolean,
|
|
35
36
|
* the list contains a dependency on the `true` and on the `false` case).
|
|
37
|
+
* @see {@link happensInEveryBranchSet} - for the set-based version
|
|
36
38
|
*/
|
|
37
39
|
function happensInEveryBranch(controlDependencies) {
|
|
38
40
|
if (controlDependencies === undefined) {
|
|
@@ -43,6 +45,9 @@ function happensInEveryBranch(controlDependencies) {
|
|
|
43
45
|
/* this happens only when we have no idea and require more analysis */
|
|
44
46
|
return false;
|
|
45
47
|
}
|
|
48
|
+
return coversSet(controlDependencies);
|
|
49
|
+
}
|
|
50
|
+
function coversSet(controlDependencies) {
|
|
46
51
|
const trues = [];
|
|
47
52
|
const falseSet = new Set();
|
|
48
53
|
for (const { id, when } of controlDependencies) {
|
|
@@ -55,6 +60,22 @@ function happensInEveryBranch(controlDependencies) {
|
|
|
55
60
|
}
|
|
56
61
|
return trues.every(id => falseSet.has(id));
|
|
57
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks whether the given control dependencies are exhaustive (i.e. if for every control dependency on a boolean,
|
|
65
|
+
* the list contains a dependency on the `true` and on the `false` case).
|
|
66
|
+
* @see {@link happensInEveryBranch} - for the array-based version
|
|
67
|
+
*/
|
|
68
|
+
function happensInEveryBranchSet(controlDependencies) {
|
|
69
|
+
if (controlDependencies === undefined) {
|
|
70
|
+
/* the cds are unconstrained */
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
else if (controlDependencies.size === 0) {
|
|
74
|
+
/* this happens only when we have no idea and require more analysis */
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return coversSet(controlDependencies);
|
|
78
|
+
}
|
|
58
79
|
/**
|
|
59
80
|
* Checks whether the given dataflow information always exits (i.e., if there is a non-default exit point in every branch).
|
|
60
81
|
* @see {@link ExitPoint} - for the different types of exit points
|
|
@@ -241,7 +241,7 @@ function getAllFunctionCallTargets(call, graph, environment) {
|
|
|
241
241
|
* Finds all linked function definitions starting from the given set of read ids.
|
|
242
242
|
*/
|
|
243
243
|
function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGraph) {
|
|
244
|
-
let potential =
|
|
244
|
+
let potential = functionDefinitionReadIds.values().toArray();
|
|
245
245
|
const visited = new Set();
|
|
246
246
|
const result = new Set();
|
|
247
247
|
const builtIns = new Set();
|
|
@@ -257,8 +257,9 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
|
|
|
257
257
|
continue;
|
|
258
258
|
}
|
|
259
259
|
visited.add(currentId);
|
|
260
|
-
const outgoingEdges =
|
|
261
|
-
const returnEdges = outgoingEdges
|
|
260
|
+
const outgoingEdges = currentInfo[1].entries().toArray();
|
|
261
|
+
const returnEdges = outgoingEdges
|
|
262
|
+
.filter(([_, e]) => (0, edge_1.edgeIncludesType)(e.types, edge_1.EdgeType.Returns));
|
|
262
263
|
if (returnEdges.length > 0) {
|
|
263
264
|
// only traverse return edges and do not follow `calls` etc. as this indicates that we have a function call which returns a result, and not the function calls itself
|
|
264
265
|
potential = potential.concat(returnEdges.map(([target]) => target).filter(id => !visited.has(id)));
|
|
@@ -270,7 +271,9 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
|
|
|
270
271
|
result.add(currentInfo[0]);
|
|
271
272
|
}
|
|
272
273
|
// trace all joined reads
|
|
273
|
-
potential = potential.concat(followEdges
|
|
274
|
+
potential = potential.concat(followEdges
|
|
275
|
+
.map(([target]) => target)
|
|
276
|
+
.filter(id => !visited.has(id)));
|
|
274
277
|
}
|
|
275
278
|
return [result, builtIns];
|
|
276
279
|
}
|
|
@@ -3,10 +3,10 @@ import type { AstIdMap, ParentInformation } from '../../../../../../r-bridge/lan
|
|
|
3
3
|
import { EmptyArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
4
4
|
import type { RUnnamedArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Converts a normalized node into an unnamed argument (wraps it with an argument node).
|
|
7
7
|
*/
|
|
8
8
|
export declare function toUnnamedArgument<OtherInfo>(node: RNode<OtherInfo & ParentInformation> | undefined, idMap: AstIdMap<OtherInfo>): RUnnamedArgument<OtherInfo & ParentInformation> | typeof EmptyArgument;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Wraps the given nodes as unnamed arguments where necessary.
|
|
11
11
|
*/
|
|
12
12
|
export declare function wrapArgumentsUnnamed<OtherInfo>(nodes: readonly (RNode<OtherInfo & ParentInformation> | typeof EmptyArgument | undefined)[], idMap: AstIdMap<OtherInfo>): ("<>" | import("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument").RArgument<OtherInfo & ParentInformation>)[];
|
|
@@ -7,7 +7,7 @@ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model
|
|
|
7
7
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
8
8
|
const voidRange = (0, range_1.rangeFrom)(-1, -1, -1, -1);
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Converts a normalized node into an unnamed argument (wraps it with an argument node).
|
|
11
11
|
*/
|
|
12
12
|
function toUnnamedArgument(node, idMap) {
|
|
13
13
|
if (node === undefined) {
|
|
@@ -16,7 +16,6 @@ function toUnnamedArgument(node, idMap) {
|
|
|
16
16
|
const arg = {
|
|
17
17
|
type: type_1.RType.Argument,
|
|
18
18
|
lexeme: node.lexeme ?? '',
|
|
19
|
-
// is this correct?
|
|
20
19
|
location: node.location ?? voidRange,
|
|
21
20
|
info: {
|
|
22
21
|
...node.info,
|
|
@@ -29,7 +28,7 @@ function toUnnamedArgument(node, idMap) {
|
|
|
29
28
|
return arg;
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
31
|
+
* Wraps the given nodes as unnamed arguments where necessary.
|
|
33
32
|
*/
|
|
34
33
|
function wrapArgumentsUnnamed(nodes, idMap) {
|
|
35
34
|
return nodes.map(n => n === r_function_call_1.EmptyArgument || n?.type === type_1.RType.Argument ? n : toUnnamedArgument(n, idMap));
|
|
@@ -20,6 +20,6 @@ export declare function processAccess<OtherInfo>(name: RSymbol<OtherInfo & Paren
|
|
|
20
20
|
treatIndicesAsString: boolean;
|
|
21
21
|
} & ForceArguments): DataflowInformation;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Converts symbol arguments to string arguments within the specified range.
|
|
24
24
|
*/
|
|
25
25
|
export declare function symbolArgumentsToStrings<OtherInfo>(args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], firstIndexInclusive?: number, lastIndexInclusive?: number): RFunctionArgument<OtherInfo & ParentInformation>[];
|
|
@@ -114,16 +114,16 @@ function processNumberBasedAccess(data, name, args, rootId, config, head) {
|
|
|
114
114
|
if (head.value && outInfo.definitionRootNodes.length > 0) {
|
|
115
115
|
(0, built_in_assignment_1.markAsAssignment)(fnCall.information, { type: identifier_1.ReferenceType.Variable, name: head.value.lexeme ?? '', nodeId: head.value.info.id, definedAt: rootId, controlDependencies: [] }, outInfo.definitionRootNodes, rootId, data);
|
|
116
116
|
}
|
|
117
|
-
if (data.
|
|
117
|
+
if (data.ctx.config.solver.pointerTracking) {
|
|
118
118
|
referenceAccessedIndices(args, data, fnCall, rootId, true);
|
|
119
119
|
}
|
|
120
120
|
return fnCall;
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
123
|
+
* Converts symbol arguments to string arguments within the specified range.
|
|
124
124
|
*/
|
|
125
125
|
function symbolArgumentsToStrings(args, firstIndexInclusive = 1, lastIndexInclusive = args.length - 1) {
|
|
126
|
-
const newArgs =
|
|
126
|
+
const newArgs = args.slice();
|
|
127
127
|
// if the argument is a symbol, we convert it to a string for this perspective
|
|
128
128
|
for (let i = firstIndexInclusive; i <= lastIndexInclusive; i++) {
|
|
129
129
|
const arg = newArgs[i];
|
|
@@ -159,7 +159,7 @@ function processStringBasedAccess(args, data, name, rootId, config) {
|
|
|
159
159
|
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: newArgs, rootId, data, forceArgs: config.forceArgs,
|
|
160
160
|
origin: 'builtin:access'
|
|
161
161
|
});
|
|
162
|
-
if (data.
|
|
162
|
+
if (data.ctx.config.solver.pointerTracking) {
|
|
163
163
|
referenceAccessedIndices(newArgs, data, fnCall, rootId, false);
|
|
164
164
|
}
|
|
165
165
|
return fnCall;
|
|
@@ -60,7 +60,7 @@ function processApply(name, args, rootId, data, config) {
|
|
|
60
60
|
else if (val.type === type_1.RType.Symbol) {
|
|
61
61
|
functionId = val.info.id;
|
|
62
62
|
if (resolveValue) {
|
|
63
|
-
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.
|
|
63
|
+
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables }));
|
|
64
64
|
if (resolved?.elements.length === 1 && resolved.elements[0].type === 'string') {
|
|
65
65
|
functionName = (0, r_value_1.isValue)(resolved.elements[0].value) ? resolved.elements[0].value.str : undefined;
|
|
66
66
|
}
|
|
@@ -112,7 +112,7 @@ args, rootId, data, config) {
|
|
|
112
112
|
}
|
|
113
113
|
else {
|
|
114
114
|
// try to resolve the variable first
|
|
115
|
-
const n = (0, alias_tracking_1.resolveIdToValue)(target.info.id, { environment: data.environment, resolve: data.
|
|
115
|
+
const n = (0, alias_tracking_1.resolveIdToValue)(target.info.id, { environment: data.environment, resolve: data.ctx.config.solver.variables, idMap: data.completeAst.idMap, full: true });
|
|
116
116
|
if (n.type === 'set' && n.elements.length === 1 && n.elements[0].type === 'string') {
|
|
117
117
|
const val = n.elements[0].value;
|
|
118
118
|
if ((0, r_value_1.isValue)(val)) {
|
|
@@ -259,7 +259,7 @@ function checkTargetReferenceType(source, sourceInfo) {
|
|
|
259
259
|
* @param assignmentConfig - configuration for the assignment processing
|
|
260
260
|
*/
|
|
261
261
|
function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignment, data, assignmentConfig) {
|
|
262
|
-
if (data.
|
|
262
|
+
if (data.ctx.config.solver.pointerTracking) {
|
|
263
263
|
let indicesCollection = undefined;
|
|
264
264
|
if (sourceIds.length === 1) {
|
|
265
265
|
// support for tracking indices.
|
|
@@ -288,7 +288,7 @@ function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignme
|
|
|
288
288
|
}
|
|
289
289
|
nodeToDefine.indicesCollection ??= indicesCollection;
|
|
290
290
|
}
|
|
291
|
-
information.environment = (0, define_1.define)(nodeToDefine, assignmentConfig?.superAssignment, information.environment, data.
|
|
291
|
+
information.environment = (0, define_1.define)(nodeToDefine, assignmentConfig?.superAssignment, information.environment, data.ctx.config);
|
|
292
292
|
information.graph.setDefinitionOfVertex(nodeToDefine);
|
|
293
293
|
if (!assignmentConfig?.quoteSource) {
|
|
294
294
|
for (const sourceId of sourceIds) {
|
|
@@ -343,7 +343,7 @@ function processAssignmentToSymbol(config) {
|
|
|
343
343
|
unknownReferences: [],
|
|
344
344
|
entryPoint: rootId,
|
|
345
345
|
in: readTargets,
|
|
346
|
-
out:
|
|
346
|
+
out: writeNodes.concat(readFromSourceWritten),
|
|
347
347
|
};
|
|
348
348
|
}
|
|
349
349
|
//# sourceMappingURL=built-in-assignment.js.map
|
|
@@ -33,12 +33,12 @@ function processEvalCall(name, args, rootId, data, config) {
|
|
|
33
33
|
if (config.includeFunctionCall) {
|
|
34
34
|
information.graph.addEdge(rootId, args[0].value.info.id, edge_1.EdgeType.Returns);
|
|
35
35
|
}
|
|
36
|
-
if (!data.
|
|
36
|
+
if (!data.ctx.config.solver.evalStrings) {
|
|
37
37
|
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Skipping eval call ${JSON.stringify(evalArgument)} (disabled in config file)`);
|
|
38
38
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
39
39
|
return information;
|
|
40
40
|
}
|
|
41
|
-
const code = resolveEvalToCode(evalArgument.value, data.environment, data.completeAst.idMap, data.
|
|
41
|
+
const code = resolveEvalToCode(evalArgument.value, data.environment, data.completeAst.idMap, data.ctx.config);
|
|
42
42
|
if (code) {
|
|
43
43
|
const idGenerator = (0, decorate_1.sourcedDeterministicCountingIdGenerator)(name.lexeme + '::' + rootId, name.location);
|
|
44
44
|
data = {
|
|
@@ -60,10 +60,10 @@ function processEvalCall(name, args, rootId, data, config) {
|
|
|
60
60
|
graph: result.reduce((acc, r) => acc.mergeWith(r.graph), information.graph),
|
|
61
61
|
environment: result.reduce((acc, r) => (0, append_1.appendEnvironment)(acc, r.environment), information.environment),
|
|
62
62
|
entryPoint: rootId,
|
|
63
|
-
out:
|
|
64
|
-
in:
|
|
65
|
-
unknownReferences:
|
|
66
|
-
exitPoints:
|
|
63
|
+
out: information.out.concat(result.flatMap(r => r.out)),
|
|
64
|
+
in: information.in.concat(result.flatMap(r => r.in)),
|
|
65
|
+
unknownReferences: information.unknownReferences.concat(result.flatMap(r => r.unknownReferences)),
|
|
66
|
+
exitPoints: information.exitPoints.concat(result.flatMap(r => r.exitPoints)),
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Non-constant argument ${JSON.stringify(args)} for eval is currently not supported, skipping`);
|
|
@@ -153,7 +153,7 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
153
153
|
controlDependencies: data.controlDependencies
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
-
const ingoing =
|
|
156
|
+
const ingoing = remainingRead.values().toArray().flat();
|
|
157
157
|
const rootNode = data.completeAst.idMap.get(rootId);
|
|
158
158
|
const withGroup = rootNode?.grouping;
|
|
159
159
|
if (withGroup) {
|
|
@@ -37,7 +37,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
37
37
|
const headGraph = variable.graph.mergeWith(vector.graph);
|
|
38
38
|
const writtenVariable = variable.unknownReferences.concat(variable.in);
|
|
39
39
|
for (const write of writtenVariable) {
|
|
40
|
-
headEnvironments = (0, define_1.define)({ ...write, definedAt: name.info.id, type: identifier_1.ReferenceType.Variable }, false, headEnvironments, data.
|
|
40
|
+
headEnvironments = (0, define_1.define)({ ...write, definedAt: name.info.id, type: identifier_1.ReferenceType.Variable }, false, headEnvironments, data.ctx.config);
|
|
41
41
|
}
|
|
42
42
|
data = { ...data, controlDependencies: [...data.controlDependencies ?? [], { id: name.info.id, when: true }], environment: headEnvironments };
|
|
43
43
|
const body = (0, processor_1.processDataflowFor)(bodyArg, data);
|
|
@@ -42,7 +42,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
42
42
|
(0, assert_1.guard)(param !== r_function_call_1.EmptyArgument, () => `Empty argument in function definition ${name.content}, ${JSON.stringify(args)}`);
|
|
43
43
|
const processed = (0, processor_1.processDataflowFor)(param, data);
|
|
44
44
|
subgraph.mergeWith(processed.graph);
|
|
45
|
-
const read =
|
|
45
|
+
const read = processed.in.concat(processed.unknownReferences);
|
|
46
46
|
(0, linker_1.linkInputs)(read, data.environment, readInParameters, subgraph, false);
|
|
47
47
|
data = { ...data, environment: (0, overwrite_1.overwriteEnvironment)(data.environment, processed.environment) };
|
|
48
48
|
}
|
|
@@ -5,6 +5,6 @@ import type { RFunctionArgument } from '../../../../../../r-bridge/lang-4.x/ast/
|
|
|
5
5
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
6
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Processes a built-in 'get' function call.
|
|
9
9
|
*/
|
|
10
10
|
export declare function processGet<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
|
|
@@ -9,7 +9,7 @@ const retriever_1 = require("../../../../../../r-bridge/retriever");
|
|
|
9
9
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
10
10
|
const edge_1 = require("../../../../../graph/edge");
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Processes a built-in 'get' function call.
|
|
13
13
|
*/
|
|
14
14
|
function processGet(name, args, rootId, data) {
|
|
15
15
|
if (args.length !== 1) {
|
|
@@ -37,7 +37,7 @@ function processIfThenElse(name, args, rootId, data) {
|
|
|
37
37
|
let then;
|
|
38
38
|
let makeThenMaybe = false;
|
|
39
39
|
// we should defer this to the abstract interpretation
|
|
40
|
-
const values = (0, alias_tracking_1.resolveIdToValue)(condArg?.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.
|
|
40
|
+
const values = (0, alias_tracking_1.resolveIdToValue)(condArg?.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables });
|
|
41
41
|
const conditionIsAlwaysFalse = (0, general_1.valueSetGuard)(values)?.elements.every(d => d.type === 'logical' && d.value === false) ?? false;
|
|
42
42
|
const conditionIsAlwaysTrue = (0, general_1.valueSetGuard)(values)?.elements.every(d => d.type === 'logical' && d.value === true) ?? false;
|
|
43
43
|
if (!conditionIsAlwaysFalse) {
|
|
@@ -16,7 +16,7 @@ const containers_1 = require("../../../../../../util/containers");
|
|
|
16
16
|
*/
|
|
17
17
|
function processList(name, args, rootId, data) {
|
|
18
18
|
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'builtin:list' });
|
|
19
|
-
if (!data.
|
|
19
|
+
if (!data.ctx.config.solver.pointerTracking) {
|
|
20
20
|
return fnCall.information;
|
|
21
21
|
}
|
|
22
22
|
const listArgs = [];
|
|
@@ -67,7 +67,7 @@ function processList(name, args, rootId, data) {
|
|
|
67
67
|
}
|
|
68
68
|
listArgs.push(newIndex);
|
|
69
69
|
}
|
|
70
|
-
if ((0, config_1.isOverPointerAnalysisThreshold)(data.
|
|
70
|
+
if ((0, config_1.isOverPointerAnalysisThreshold)(data.ctx.config, listArgs.length)) {
|
|
71
71
|
return fnCall.information;
|
|
72
72
|
}
|
|
73
73
|
const indices = {
|
|
@@ -38,19 +38,19 @@ function processPipe(name, args, rootId, data) {
|
|
|
38
38
|
information.graph.addEdge(functionCallNode.id, argId, edge_1.EdgeType.Argument | edge_1.EdgeType.Reads);
|
|
39
39
|
}
|
|
40
40
|
const firstArgument = processedArguments[0];
|
|
41
|
-
const uniqueIn =
|
|
41
|
+
const uniqueIn = information.in.slice();
|
|
42
42
|
for (const ing of (firstArgument?.in ?? [])) {
|
|
43
43
|
if (!uniqueIn.find(e => e.nodeId === ing.nodeId)) {
|
|
44
44
|
uniqueIn.push(ing);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
const uniqueOut =
|
|
47
|
+
const uniqueOut = information.out.slice();
|
|
48
48
|
for (const outg of (firstArgument?.out ?? [])) {
|
|
49
49
|
if (!uniqueOut.find(e => e.nodeId === outg.nodeId)) {
|
|
50
50
|
uniqueOut.push(outg);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
const uniqueUnknownReferences =
|
|
53
|
+
const uniqueUnknownReferences = information.unknownReferences.slice();
|
|
54
54
|
for (const unknown of (firstArgument?.unknownReferences ?? [])) {
|
|
55
55
|
if (!uniqueUnknownReferences.find(e => e.nodeId === unknown.nodeId)) {
|
|
56
56
|
uniqueUnknownReferences.push(unknown);
|
|
@@ -5,6 +5,11 @@ import { type RFunctionArgument } from '../../../../../../r-bridge/lang-4.x/ast/
|
|
|
5
5
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
6
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Process a built-in repeat loop function call like `repeat { ... }`.
|
|
9
|
+
* @param name - The name of the function being called.
|
|
10
|
+
* @param args - The arguments passed to the function.
|
|
11
|
+
* @param rootId - The root node ID for the current processing context.
|
|
12
|
+
* @param data - Additional dataflow processor information.
|
|
13
|
+
* @returns - The resulting dataflow information after processing the repeat loop.
|
|
9
14
|
*/
|
|
10
15
|
export declare function processRepeatLoop<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
|