@eagleoutice/flowr 2.6.2 → 2.7.0
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.d.ts +1 -1
- package/abstract-interpretation/data-frame/absint-visitor.js +6 -6
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +4 -7
- package/abstract-interpretation/data-frame/dataframe-domain.js +5 -11
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +3 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +3 -2
- package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +3 -1
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +3 -2
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +7 -7
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +28 -24
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +3 -1
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +3 -2
- package/abstract-interpretation/data-frame/semantics.js +54 -41
- package/abstract-interpretation/data-frame/shape-inference.d.ts +3 -3
- package/abstract-interpretation/data-frame/shape-inference.js +3 -3
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -0
- package/abstract-interpretation/domains/abstract-domain.js +3 -2
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +2 -2
- package/abstract-interpretation/domains/interval-domain.js +3 -6
- package/abstract-interpretation/domains/lattice.d.ts +2 -0
- package/abstract-interpretation/domains/lattice.js +3 -1
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -1
- package/abstract-interpretation/domains/positive-interval-domain.js +1 -1
- package/abstract-interpretation/domains/satisfiable-domain.d.ts +2 -2
- package/abstract-interpretation/domains/satisfiable-domain.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +98 -0
- package/abstract-interpretation/domains/set-range-domain.js +400 -0
- package/abstract-interpretation/domains/set-upper-bound-domain.js +2 -2
- package/abstract-interpretation/domains/singleton-domain.js +2 -2
- package/abstract-interpretation/normalized-ast-fold.d.ts +1 -1
- package/benchmark/slicer.d.ts +3 -1
- package/benchmark/slicer.js +50 -27
- package/benchmark/stats/print.js +8 -5
- package/benchmark/stats/stats.d.ts +3 -2
- package/benchmark/summarizer/data.d.ts +11 -8
- package/benchmark/summarizer/first-phase/process.js +12 -9
- package/benchmark/summarizer/second-phase/graph.d.ts +3 -1
- package/benchmark/summarizer/second-phase/graph.js +3 -1
- package/benchmark/summarizer/second-phase/process.js +24 -18
- 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 +14 -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 +16 -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 +4 -2
- package/core/steps/all/static-slicing/00-slice.js +3 -2
- 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 +94 -95
- package/core/steps/pipeline/default-pipelines.js +8 -8
- package/dataflow/cluster.js +2 -2
- package/dataflow/environments/append.d.ts +5 -0
- package/dataflow/environments/append.js +6 -20
- package/dataflow/environments/built-in.d.ts +2 -1
- package/dataflow/environments/clone.d.ts +1 -2
- package/dataflow/environments/clone.js +3 -17
- package/dataflow/environments/define.d.ts +7 -3
- package/dataflow/environments/define.js +9 -56
- package/dataflow/environments/diff.js +3 -3
- package/dataflow/environments/environment.d.ts +48 -28
- package/dataflow/environments/environment.js +187 -62
- package/dataflow/environments/overwrite.d.ts +1 -5
- package/dataflow/environments/overwrite.js +2 -61
- package/dataflow/environments/reference-to-maybe.d.ts +13 -0
- package/dataflow/environments/reference-to-maybe.js +54 -0
- package/dataflow/environments/resolve-by-name.d.ts +6 -1
- package/dataflow/environments/resolve-by-name.js +56 -4
- package/dataflow/environments/scoping.d.ts +8 -4
- package/dataflow/environments/scoping.js +13 -9
- package/dataflow/eval/resolve/alias-tracking.d.ts +10 -4
- package/dataflow/eval/resolve/alias-tracking.js +15 -13
- package/dataflow/eval/resolve/resolve-argument.d.ts +2 -1
- package/dataflow/eval/resolve/resolve-argument.js +10 -10
- package/dataflow/eval/resolve/resolve.d.ts +13 -11
- package/dataflow/eval/resolve/resolve.js +16 -15
- 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 -28
- package/dataflow/fn/higher-order-function.d.ts +2 -1
- package/dataflow/fn/higher-order-function.js +4 -4
- package/dataflow/graph/dataflowgraph-builder.d.ts +9 -5
- package/dataflow/graph/dataflowgraph-builder.js +21 -11
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/graph.d.ts +13 -11
- package/dataflow/graph/graph.js +40 -24
- package/dataflow/graph/invert-dfg.d.ts +3 -2
- package/dataflow/graph/invert-dfg.js +3 -3
- package/dataflow/graph/resolve-graph.d.ts +2 -1
- package/dataflow/graph/resolve-graph.js +2 -2
- package/dataflow/graph/unknown-replacement.d.ts +4 -2
- package/dataflow/graph/unknown-replacement.js +4 -2
- package/dataflow/graph/vertex.d.ts +3 -3
- package/dataflow/graph/vertex.js +3 -3
- package/dataflow/info.d.ts +8 -1
- package/dataflow/info.js +21 -0
- package/dataflow/internal/linker.js +10 -11
- 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/argument/unpack-argument.d.ts +7 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +12 -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 +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +10 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -4
- 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 +10 -14
- 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 +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +8 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.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 +4 -4
- 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 +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +6 -4
- 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 +5 -5
- package/dataflow/internal/process/functions/call/common.d.ts +1 -1
- package/dataflow/internal/process/functions/call/common.js +6 -7
- 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 +4 -4
- package/dataflow/internal/process/functions/call/named-call-handling.js +4 -4
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +1 -1
- package/dataflow/internal/process/functions/process-argument.js +1 -1
- package/dataflow/internal/process/functions/process-parameter.js +4 -4
- package/dataflow/internal/process/process-symbol.js +1 -1
- package/dataflow/internal/process/process-value.d.ts +1 -1
- package/dataflow/internal/process/process-value.js +7 -7
- 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 +7 -16
- 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 +15 -14
- 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 +14 -10
- 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 +109 -62
- 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 +425 -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} +146 -177
- 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 +21 -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 +134 -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 +15 -19
- package/linter/rules/absolute-path.d.ts +1 -2
- package/linter/rules/absolute-path.js +5 -5
- package/linter/rules/dataframe-access-validation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.js +13 -9
- 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 +3 -7
- package/linter/rules/function-finder-util.js +1 -1
- 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 +4 -3
- package/linter/rules/seeded-randomness.js +38 -18
- 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 +5 -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 +37 -5
- package/project/context/flowr-analyzer-context.js +51 -4
- package/project/context/flowr-analyzer-environment-context.d.ts +47 -0
- package/project/context/flowr-analyzer-environment-context.js +50 -0
- 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 +5 -6
- 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/control-flow-query/control-flow-query-format.js +3 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +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 +5 -5
- 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.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +2 -2
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +6 -6
- package/queries/catalog/df-shape-query/df-shape-query-format.js +8 -7
- 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 +4 -4
- 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 +3 -3
- 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 +2 -2
- 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/slicing/static/slice-call.d.ts +3 -2
- package/slicing/static/slice-call.js +4 -4
- package/slicing/static/static-slicer.d.ts +3 -1
- package/slicing/static/static-slicer.js +6 -7
- package/statistics/features/supported/assignments/assignments.js +1 -1
- package/statistics/features/supported/control-flow/control-flow.js +2 -2
- 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 +2 -2
- package/statistics/features/supported/variables/variables.js +3 -2
- package/statistics/statistics.js +3 -2
- package/util/assert.d.ts +4 -0
- package/util/assert.js +4 -0
- package/util/containers.js +1 -1
- 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/mermaid/dfg.d.ts +1 -0
- package/util/mermaid/dfg.js +3 -3
- package/util/simple-df/dfg-view.d.ts +2 -1
- package/util/simple-df/dfg-view.js +2 -2
- package/util/version.js +1 -1
- package/dataflow/environments/remove.d.ts +0 -12
- package/dataflow/environments/remove.js +0 -52
- 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
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cloneEnvironmentInformation = cloneEnvironmentInformation;
|
|
4
|
-
const environment_1 = require("./environment");
|
|
5
|
-
function cloneEnvironment(environment, recurseParents) {
|
|
6
|
-
if (environment === undefined) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
else if (environment.builtInEnv) {
|
|
10
|
-
return environment; // do not clone the built-in environment
|
|
11
|
-
}
|
|
12
|
-
/* make sure the clone has the same id */
|
|
13
|
-
const clone = new environment_1.Environment(recurseParents ? cloneEnvironment(environment.parent, recurseParents) : environment.parent, environment.builtInEnv);
|
|
14
|
-
clone.memory = new Map(JSON.parse(JSON.stringify([...environment.memory])));
|
|
15
|
-
return clone;
|
|
16
|
-
}
|
|
17
4
|
/**
|
|
18
5
|
* Produce a clone of the given environment information.
|
|
19
6
|
* @param environment - The environment information to clone.
|
|
20
|
-
* @param builtInEnvironment - The built-in environment
|
|
21
7
|
* @param recurseParents - Whether to clone the parent environments as well.
|
|
22
8
|
*/
|
|
23
|
-
function cloneEnvironmentInformation(
|
|
9
|
+
function cloneEnvironmentInformation({ current, level }, recurseParents = true) {
|
|
24
10
|
return {
|
|
25
|
-
current:
|
|
26
|
-
level
|
|
11
|
+
current: current.clone(recurseParents),
|
|
12
|
+
level
|
|
27
13
|
};
|
|
28
14
|
}
|
|
29
15
|
//# sourceMappingURL=clone.js.map
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { REnvironmentInformation } from './environment';
|
|
2
|
-
import type { IdentifierDefinition, InGraphIdentifierDefinition } from './identifier';
|
|
2
|
+
import type { Identifier, IdentifierDefinition, InGraphIdentifierDefinition } from './identifier';
|
|
3
3
|
import type { FlowrConfigOptions } from '../../config';
|
|
4
4
|
/**
|
|
5
5
|
* assumes: existing is not undefined, the overwrite has indices
|
|
6
6
|
*/
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function mergeDefinitionsForPointer(existing: readonly IdentifierDefinition[], definition: InGraphIdentifierDefinition): InGraphIdentifierDefinition[];
|
|
8
8
|
/**
|
|
9
9
|
* Insert the given `definition` --- defined within the given scope --- into the passed along `environments` will take care of propagation.
|
|
10
10
|
* Does not modify the passed along `environments` in-place! It returns the new reference.
|
|
11
|
+
* @see {@link Environment#define} - for details on how (local) definitions are handled.
|
|
12
|
+
* @see {@link Environment#defineSuper} - for details on how (super) definitions are handled.
|
|
11
13
|
*/
|
|
12
|
-
export declare function define(definition: IdentifierDefinition
|
|
14
|
+
export declare function define(definition: IdentifierDefinition & {
|
|
15
|
+
name: Identifier;
|
|
16
|
+
}, superAssign: boolean | undefined, { level, current }: REnvironmentInformation, config: FlowrConfigOptions): REnvironmentInformation;
|
|
@@ -1,39 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.mergeDefinitionsForPointer = mergeDefinitionsForPointer;
|
|
4
4
|
exports.define = define;
|
|
5
5
|
const assert_1 = require("../../util/assert");
|
|
6
|
-
const clone_1 = require("./clone");
|
|
7
6
|
const vertex_1 = require("../graph/vertex");
|
|
8
|
-
function defInEnv(newEnvironments, name, definition, config) {
|
|
9
|
-
const existing = newEnvironments.memory.get(name);
|
|
10
|
-
// When there are defined indices, merge the definitions
|
|
11
|
-
const inGraphDefinition = definition;
|
|
12
|
-
if (config.solver.pointerTracking &&
|
|
13
|
-
existing !== undefined &&
|
|
14
|
-
inGraphDefinition.controlDependencies === undefined) {
|
|
15
|
-
if (inGraphDefinition.indicesCollection !== undefined) {
|
|
16
|
-
newEnvironments.memory.set(name, mergeDefinitions(existing, inGraphDefinition));
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
else if (existing?.flatMap(i => i.indicesCollection ?? []).length > 0) {
|
|
20
|
-
// When indices couldn't be resolved, but indices where defined before, just add the definition
|
|
21
|
-
existing.push(definition);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
// check if it is maybe or not
|
|
26
|
-
if (existing === undefined || definition.controlDependencies === undefined) {
|
|
27
|
-
newEnvironments.memory.set(name, [definition]);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
existing.push(definition);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
7
|
/**
|
|
34
8
|
* assumes: existing is not undefined, the overwrite has indices
|
|
35
9
|
*/
|
|
36
|
-
function
|
|
10
|
+
function mergeDefinitionsForPointer(existing, definition) {
|
|
37
11
|
// When new definition is not a single index, e.g., a list redefinition, then reset existing definition
|
|
38
12
|
if (definition.indicesCollection?.some(indices => indices.isContainer)) {
|
|
39
13
|
return [definition];
|
|
@@ -119,34 +93,13 @@ function overwriteContainerIndices(existingIndices, overwriteIndex) {
|
|
|
119
93
|
/**
|
|
120
94
|
* Insert the given `definition` --- defined within the given scope --- into the passed along `environments` will take care of propagation.
|
|
121
95
|
* Does not modify the passed along `environments` in-place! It returns the new reference.
|
|
96
|
+
* @see {@link Environment#define} - for details on how (local) definitions are handled.
|
|
97
|
+
* @see {@link Environment#defineSuper} - for details on how (super) definitions are handled.
|
|
122
98
|
*/
|
|
123
|
-
function define(definition, superAssign,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
newEnvironment = (0, clone_1.cloneEnvironmentInformation)(environment, true);
|
|
129
|
-
let current = newEnvironment.current;
|
|
130
|
-
let last = undefined;
|
|
131
|
-
let found = false;
|
|
132
|
-
do {
|
|
133
|
-
if (current.memory.has(name)) {
|
|
134
|
-
current.memory.set(name, [definition]);
|
|
135
|
-
found = true;
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
last = current;
|
|
139
|
-
current = current.parent;
|
|
140
|
-
} while (!current.builtInEnv);
|
|
141
|
-
if (!found) {
|
|
142
|
-
(0, assert_1.guard)(last !== undefined, () => `Could not find global scope for ${name}`);
|
|
143
|
-
last.memory.set(name, [definition]);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
newEnvironment = (0, clone_1.cloneEnvironmentInformation)(environment, false);
|
|
148
|
-
defInEnv(newEnvironment.current, name, definition, config);
|
|
149
|
-
}
|
|
150
|
-
return newEnvironment;
|
|
99
|
+
function define(definition, superAssign, { level, current }, config) {
|
|
100
|
+
return {
|
|
101
|
+
level,
|
|
102
|
+
current: superAssign ? current.defineSuper(definition) : current.define(definition, config),
|
|
103
|
+
};
|
|
151
104
|
}
|
|
152
105
|
//# sourceMappingURL=define.js.map
|
|
@@ -33,8 +33,8 @@ function diffMemory(a, b, info) {
|
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
35
|
// we sort both value arrays by their id so that we have no problems with differently ordered arrays (which have no impact)
|
|
36
|
-
const sorted =
|
|
37
|
-
const sorted2 =
|
|
36
|
+
const sorted = value.slice().sort((a, b) => String(a.nodeId).localeCompare(String(b.nodeId)));
|
|
37
|
+
const sorted2 = value2.slice().sort((a, b) => String(a.nodeId).localeCompare(String(b.nodeId)));
|
|
38
38
|
for (let i = 0; i < value.length; ++i) {
|
|
39
39
|
const aVal = sorted[i];
|
|
40
40
|
const bVal = sorted2[i];
|
|
@@ -69,7 +69,7 @@ function diffEnvironment(a, b, info, depth) {
|
|
|
69
69
|
}
|
|
70
70
|
if (a.memory.size !== b.memory.size) {
|
|
71
71
|
info.report.addComment(`${info.position}[at level: ${depth}] Different number of definitions in environment. ${info.leftname}: ${a.memory.size} vs. ${info.rightname}: ${b.memory.size}`);
|
|
72
|
-
(0, diff_1.setDifference)(new Set(
|
|
72
|
+
(0, diff_1.setDifference)(new Set(a.memory.keys()), new Set(b.memory.keys()), {
|
|
73
73
|
...info,
|
|
74
74
|
position: `${info.position}[at level: ${depth}] Key comparison. `
|
|
75
75
|
});
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provides an environment structure similar to R.
|
|
3
|
-
* This allows the dataflow to hold current definition locations for variables, based on the current scope.
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import type { IdentifierReference } from './identifier';
|
|
7
|
-
import type { DataflowGraph } from '../graph/graph';
|
|
8
|
-
import type { ControlDependency } from '../info';
|
|
9
1
|
import type { BuiltInMemory } from './built-in';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
export declare function makeAllMaybe(references: readonly IdentifierReference[] | undefined, graph: DataflowGraph, environments: REnvironmentInformation, includeDefs: boolean, defaultCd?: ControlDependency | undefined): IdentifierReference[];
|
|
2
|
+
import type { Identifier, IdentifierDefinition } from './identifier';
|
|
3
|
+
import type { ControlDependency } from '../info';
|
|
4
|
+
import type { FlowrConfigOptions } from '../../config';
|
|
5
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
18
6
|
/** A single entry/scope within an {@link REnvironmentInformation} */
|
|
19
7
|
export interface IEnvironment {
|
|
20
8
|
/** Unique and internally generated identifier -- will not be used for comparison but helps with debugging for tracking identities */
|
|
@@ -28,6 +16,12 @@ export interface IEnvironment {
|
|
|
28
16
|
*/
|
|
29
17
|
builtInEnv?: true | undefined;
|
|
30
18
|
}
|
|
19
|
+
type Jsonified = {
|
|
20
|
+
id: NodeId;
|
|
21
|
+
parent: Jsonified | undefined;
|
|
22
|
+
builtInEnv?: true;
|
|
23
|
+
memory: BuiltInMemory;
|
|
24
|
+
};
|
|
31
25
|
/**
|
|
32
26
|
* Please use this function only if you do not know the object type.
|
|
33
27
|
* Otherwise, rely on {@link IEnvironment#builtInEnv}
|
|
@@ -36,14 +30,43 @@ export declare function isDefaultBuiltInEnvironment(obj: unknown): boolean;
|
|
|
36
30
|
/** @see REnvironmentInformation */
|
|
37
31
|
export declare class Environment implements IEnvironment {
|
|
38
32
|
readonly id: number;
|
|
39
|
-
parent:
|
|
33
|
+
parent: Environment;
|
|
40
34
|
memory: BuiltInMemory;
|
|
35
|
+
cache?: BuiltInMemory;
|
|
41
36
|
builtInEnv?: true;
|
|
42
|
-
constructor(parent:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
constructor(parent: Environment, isBuiltInDefault?: true | undefined);
|
|
38
|
+
/**
|
|
39
|
+
* Create a deep clone of this environment.
|
|
40
|
+
* @param recurseParents - Whether to also clone parent environments
|
|
41
|
+
*/
|
|
42
|
+
clone(recurseParents: boolean): Environment;
|
|
43
|
+
/**
|
|
44
|
+
* Define a new identifier definition within this environment.
|
|
45
|
+
* @param definition - The definition to add.
|
|
46
|
+
* @param config - The flowr configuration options.
|
|
47
|
+
*/
|
|
48
|
+
define(definition: IdentifierDefinition & {
|
|
49
|
+
name: Identifier;
|
|
50
|
+
}, { solver: { pointerTracking } }: FlowrConfigOptions): Environment;
|
|
51
|
+
defineSuper(definition: IdentifierDefinition & {
|
|
52
|
+
name: Identifier;
|
|
53
|
+
}): Environment;
|
|
54
|
+
/**
|
|
55
|
+
* Assumes, that all definitions within other replace those within this environment (given the same name).
|
|
56
|
+
* <b>But</b> if all definitions within other are maybe, then they are appended to the current definitions (updating them to be `maybe` from now on as well), similar to {@link appendEnvironment}.
|
|
57
|
+
* This always recurses parents.
|
|
58
|
+
*/
|
|
59
|
+
overwrite(other: Environment | undefined, applyCds?: readonly ControlDependency[]): Environment;
|
|
60
|
+
/**
|
|
61
|
+
* Adds all writes of `other` to this environment (i.e., the operations of `other` *might* happen).
|
|
62
|
+
* This always recurses parents.
|
|
63
|
+
*/
|
|
64
|
+
append(other: Environment | undefined): Environment;
|
|
65
|
+
remove(name: Identifier): this;
|
|
66
|
+
removeAll(names: readonly {
|
|
67
|
+
name: Identifier;
|
|
68
|
+
}[]): Environment;
|
|
69
|
+
toJSON(): Jsonified;
|
|
47
70
|
}
|
|
48
71
|
/**
|
|
49
72
|
* An environment describes a ({@link IEnvironment#parent|scoped}) mapping of names to their definitions ({@link BuiltIns}).
|
|
@@ -55,7 +78,7 @@ export interface WorkingDirectoryReference {
|
|
|
55
78
|
* but statically determining all attached environments is theoretically impossible --- consider attachments by user input).
|
|
56
79
|
*
|
|
57
80
|
* One important environment is the {@link BuiltIns|BuiltInEnvironment} which contains the default definitions for R's built-in functions and constants.
|
|
58
|
-
*
|
|
81
|
+
* This environment is created and provided by the {@link FlowrAnalyzerEnvironmentContext}.
|
|
59
82
|
* During serialization, you may want to rely on the {@link builtInEnvJsonReplacer} to avoid the huge built-in environment.
|
|
60
83
|
* @see {@link define} - to define a new {@link IdentifierDefinition|identifier definition} within an environment
|
|
61
84
|
* @see {@link resolveByName} - to resolve an {@link Identifier|identifier/name} to its {@link IdentifierDefinition|definitions} within an environment
|
|
@@ -67,15 +90,12 @@ export interface WorkingDirectoryReference {
|
|
|
67
90
|
*/
|
|
68
91
|
export interface REnvironmentInformation {
|
|
69
92
|
/** The currently active environment (the stack is represented by the currently active {@link IEnvironment#parent}). Environments are maintained within the dataflow graph. */
|
|
70
|
-
readonly current:
|
|
93
|
+
readonly current: Environment;
|
|
71
94
|
/** nesting level of the environment, will be `0` for the global/root environment */
|
|
72
95
|
readonly level: number;
|
|
73
96
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Initialize a new {@link REnvironmentInformation|environment} with the built-ins.
|
|
76
|
-
*/
|
|
77
|
-
export declare function initializeCleanEnvironments(memory?: BuiltInMemory, fullBuiltIns?: boolean): REnvironmentInformation;
|
|
78
97
|
/**
|
|
79
98
|
* Helps to serialize an environment, but replaces the built-in environment with a placeholder.
|
|
80
99
|
*/
|
|
81
100
|
export declare function builtInEnvJsonReplacer(k: unknown, v: unknown): unknown;
|
|
101
|
+
export {};
|
|
@@ -1,61 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Environment = void 0;
|
|
4
|
-
exports.makeReferenceMaybe = makeReferenceMaybe;
|
|
5
|
-
exports.makeAllMaybe = makeAllMaybe;
|
|
6
4
|
exports.isDefaultBuiltInEnvironment = isDefaultBuiltInEnvironment;
|
|
7
|
-
exports.initializeCleanEnvironments = initializeCleanEnvironments;
|
|
8
5
|
exports.builtInEnvJsonReplacer = builtInEnvJsonReplacer;
|
|
9
|
-
const identifier_1 = require("./identifier");
|
|
10
|
-
const resolve_by_name_1 = require("./resolve-by-name");
|
|
11
|
-
const json_1 = require("../../util/json");
|
|
12
|
-
const built_in_config_1 = require("./built-in-config");
|
|
13
|
-
/**
|
|
14
|
-
* Marks the reference as maybe (i.e., as controlled by a set of {@link IdentifierReference#controlDependencies|control dependencies}).
|
|
15
|
-
*/
|
|
16
|
-
function makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd = undefined) {
|
|
17
|
-
if (includeDefs) {
|
|
18
|
-
const definitions = ref.name ? (0, resolve_by_name_1.resolveByName)(ref.name, environments, ref.type) : undefined;
|
|
19
|
-
for (const definition of definitions ?? []) {
|
|
20
|
-
if (definition.type !== identifier_1.ReferenceType.BuiltInFunction && definition.type !== identifier_1.ReferenceType.BuiltInConstant) {
|
|
21
|
-
if (definition.controlDependencies) {
|
|
22
|
-
if (defaultCd && !definition.controlDependencies.find(c => c.id === defaultCd.id && c.when === defaultCd.when)) {
|
|
23
|
-
definition.controlDependencies.push(defaultCd);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
definition.controlDependencies = defaultCd ? [defaultCd] : [];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
const node = graph.getVertex(ref.nodeId, true);
|
|
33
|
-
if (node) {
|
|
34
|
-
if (node.cds) {
|
|
35
|
-
if (defaultCd && !node.cds.find(c => c.id === defaultCd.id && c.when === defaultCd.when)) {
|
|
36
|
-
node.cds.push(defaultCd);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
node.cds = defaultCd ? [defaultCd] : [];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (ref.controlDependencies) {
|
|
44
|
-
if (defaultCd && !ref.controlDependencies.find(c => c.id === defaultCd.id && c.when === defaultCd.when)) {
|
|
45
|
-
return { ...ref, controlDependencies: (ref.controlDependencies ?? []).concat(defaultCd ? [defaultCd] : []) };
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
return { ...ref, controlDependencies: ref.controlDependencies ?? (defaultCd ? [defaultCd] : []) };
|
|
50
|
-
}
|
|
51
|
-
return ref;
|
|
52
|
-
}
|
|
53
6
|
/**
|
|
54
|
-
*
|
|
7
|
+
* Provides an environment structure similar to R.
|
|
8
|
+
* This allows the dataflow to hold current definition locations for variables, based on the current scope.
|
|
9
|
+
* @module
|
|
55
10
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
11
|
+
const json_1 = require("../../util/json");
|
|
12
|
+
const assert_1 = require("../../util/assert");
|
|
13
|
+
const info_1 = require("../info");
|
|
14
|
+
const define_1 = require("./define");
|
|
15
|
+
const append_1 = require("./append");
|
|
59
16
|
/**
|
|
60
17
|
* Please use this function only if you do not know the object type.
|
|
61
18
|
* Otherwise, rely on {@link IEnvironment#builtInEnv}
|
|
@@ -69,6 +26,7 @@ class Environment {
|
|
|
69
26
|
id;
|
|
70
27
|
parent;
|
|
71
28
|
memory;
|
|
29
|
+
cache;
|
|
72
30
|
builtInEnv;
|
|
73
31
|
constructor(parent, isBuiltInDefault = undefined) {
|
|
74
32
|
this.id = isBuiltInDefault ? 0 : environmentIdCounter++;
|
|
@@ -79,19 +37,186 @@ class Environment {
|
|
|
79
37
|
this.builtInEnv = isBuiltInDefault;
|
|
80
38
|
}
|
|
81
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a deep clone of this environment.
|
|
42
|
+
* @param recurseParents - Whether to also clone parent environments
|
|
43
|
+
*/
|
|
44
|
+
clone(recurseParents) {
|
|
45
|
+
if (this.builtInEnv) {
|
|
46
|
+
return this; // do not clone the built-in environment
|
|
47
|
+
}
|
|
48
|
+
const parent = recurseParents ? this.parent.clone(recurseParents) : this.parent;
|
|
49
|
+
const clone = new Environment(parent, this.builtInEnv);
|
|
50
|
+
clone.memory = new Map(this.memory.entries()
|
|
51
|
+
.map(([k, v]) => [k,
|
|
52
|
+
v.map(s => ({
|
|
53
|
+
...s,
|
|
54
|
+
controlDependencies: s.controlDependencies?.slice()
|
|
55
|
+
}))
|
|
56
|
+
]));
|
|
57
|
+
return clone;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Define a new identifier definition within this environment.
|
|
61
|
+
* @param definition - The definition to add.
|
|
62
|
+
* @param config - The flowr configuration options.
|
|
63
|
+
*/
|
|
64
|
+
define(definition, { solver: { pointerTracking } }) {
|
|
65
|
+
const { name } = definition;
|
|
66
|
+
const newEnvironment = this.clone(false);
|
|
67
|
+
// When there are defined indices, merge the definitions
|
|
68
|
+
if (definition.controlDependencies === undefined && !pointerTracking) {
|
|
69
|
+
newEnvironment.memory.set(name, [definition]);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const existing = newEnvironment.memory.get(name);
|
|
73
|
+
const inGraphDefinition = definition;
|
|
74
|
+
if (pointerTracking &&
|
|
75
|
+
existing !== undefined &&
|
|
76
|
+
inGraphDefinition.controlDependencies === undefined) {
|
|
77
|
+
if (inGraphDefinition.indicesCollection !== undefined) {
|
|
78
|
+
const defs = (0, define_1.mergeDefinitionsForPointer)(existing, inGraphDefinition);
|
|
79
|
+
newEnvironment.memory.set(name, defs);
|
|
80
|
+
}
|
|
81
|
+
else if (existing?.flatMap(i => i.indicesCollection ?? []).length > 0) {
|
|
82
|
+
// When indices couldn't be resolved, but indices where defined before, just add the definition
|
|
83
|
+
existing.push(definition);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (existing === undefined || definition.controlDependencies === undefined) {
|
|
87
|
+
newEnvironment.memory.set(name, [definition]);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
existing.push(definition);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return newEnvironment;
|
|
94
|
+
}
|
|
95
|
+
defineSuper(definition) {
|
|
96
|
+
const { name } = definition;
|
|
97
|
+
const newEnvironment = this.clone(true);
|
|
98
|
+
let current = newEnvironment;
|
|
99
|
+
let last = undefined;
|
|
100
|
+
let found = false;
|
|
101
|
+
do {
|
|
102
|
+
if (current.memory.has(name)) {
|
|
103
|
+
current.memory.set(name, [definition]);
|
|
104
|
+
found = true;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
last = current;
|
|
108
|
+
current = current.parent;
|
|
109
|
+
} while (!current.builtInEnv);
|
|
110
|
+
if (!found) {
|
|
111
|
+
(0, assert_1.guard)(last !== undefined, () => `Could not find global scope for ${name}`);
|
|
112
|
+
last.memory.set(name, [definition]);
|
|
113
|
+
}
|
|
114
|
+
return newEnvironment;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Assumes, that all definitions within other replace those within this environment (given the same name).
|
|
118
|
+
* <b>But</b> if all definitions within other are maybe, then they are appended to the current definitions (updating them to be `maybe` from now on as well), similar to {@link appendEnvironment}.
|
|
119
|
+
* This always recurses parents.
|
|
120
|
+
*/
|
|
121
|
+
overwrite(other, applyCds) {
|
|
122
|
+
if (!other || this.builtInEnv) {
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
const map = new Map(this.memory);
|
|
126
|
+
for (const [key, values] of other.memory) {
|
|
127
|
+
const hasMaybe = applyCds === undefined ? values.length === 0 || values.some(v => v.controlDependencies !== undefined) : true;
|
|
128
|
+
if (hasMaybe) {
|
|
129
|
+
const old = map.get(key);
|
|
130
|
+
// we need to make a copy to avoid side effects for old reference in other environments
|
|
131
|
+
const updatedOld = old?.slice() ?? [];
|
|
132
|
+
for (const v of values) {
|
|
133
|
+
const index = updatedOld.findIndex(o => o.nodeId === v.nodeId && o.definedAt === v.definedAt);
|
|
134
|
+
if (index >= 0) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (applyCds === undefined) {
|
|
138
|
+
updatedOld.push(v);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
updatedOld.push({
|
|
142
|
+
...v,
|
|
143
|
+
controlDependencies: v.controlDependencies ? applyCds.concat(v.controlDependencies) : applyCds.slice()
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
map.set(key, updatedOld);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
map.set(key, values);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const out = new Environment(this.parent.overwrite(other.parent, applyCds));
|
|
154
|
+
out.memory = map;
|
|
155
|
+
return out;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Adds all writes of `other` to this environment (i.e., the operations of `other` *might* happen).
|
|
159
|
+
* This always recurses parents.
|
|
160
|
+
*/
|
|
161
|
+
append(other) {
|
|
162
|
+
if (!other || this.builtInEnv) {
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
165
|
+
const map = new Map(this.memory);
|
|
166
|
+
for (const [key, value] of other.memory) {
|
|
167
|
+
const old = map.get(key);
|
|
168
|
+
if (old) {
|
|
169
|
+
map.set(key, (0, append_1.uniqueMergeValuesInDefinitions)(old, value));
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
map.set(key, value);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const out = new Environment(this.parent.append(other.parent));
|
|
176
|
+
out.memory = map;
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
remove(name) {
|
|
180
|
+
if (this.builtInEnv) {
|
|
181
|
+
return this;
|
|
182
|
+
}
|
|
183
|
+
const definition = this.memory.get(name);
|
|
184
|
+
let cont = true;
|
|
185
|
+
if (definition !== undefined) {
|
|
186
|
+
this.memory.delete(name);
|
|
187
|
+
this.cache?.delete(name);
|
|
188
|
+
cont = !definition.every(d => (0, info_1.happensInEveryBranch)(d.controlDependencies));
|
|
189
|
+
}
|
|
190
|
+
if (cont) {
|
|
191
|
+
this.parent.remove(name);
|
|
192
|
+
}
|
|
193
|
+
return this;
|
|
194
|
+
}
|
|
195
|
+
removeAll(names) {
|
|
196
|
+
if (this.builtInEnv || names.length === 0) {
|
|
197
|
+
return this;
|
|
198
|
+
}
|
|
199
|
+
const newEnv = this.clone(true);
|
|
200
|
+
// we should optimize this later
|
|
201
|
+
for (const { name } of names) {
|
|
202
|
+
newEnv.remove(name);
|
|
203
|
+
}
|
|
204
|
+
return newEnv;
|
|
205
|
+
}
|
|
206
|
+
toJSON() {
|
|
207
|
+
return this.builtInEnv ? {
|
|
208
|
+
id: this.id,
|
|
209
|
+
parent: this.parent,
|
|
210
|
+
builtInEnv: this.builtInEnv,
|
|
211
|
+
memory: this.memory,
|
|
212
|
+
} : {
|
|
213
|
+
id: this.id,
|
|
214
|
+
parent: this.parent,
|
|
215
|
+
memory: this.memory,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
82
218
|
}
|
|
83
219
|
exports.Environment = Environment;
|
|
84
|
-
/**
|
|
85
|
-
* Initialize a new {@link REnvironmentInformation|environment} with the built-ins.
|
|
86
|
-
*/
|
|
87
|
-
function initializeCleanEnvironments(memory, fullBuiltIns = true) {
|
|
88
|
-
const builtInEnv = new Environment(undefined, true);
|
|
89
|
-
builtInEnv.memory = memory ?? (fullBuiltIns ? (0, built_in_config_1.getDefaultBuiltInDefinitions)().builtInMemory : (0, built_in_config_1.getDefaultBuiltInDefinitions)().emptyBuiltInMemory);
|
|
90
|
-
return {
|
|
91
|
-
current: new Environment(builtInEnv),
|
|
92
|
-
level: 0
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
220
|
/**
|
|
96
221
|
* Helps to serialize an environment, but replaces the built-in environment with a placeholder.
|
|
97
222
|
*/
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type REnvironmentInformation } from './environment';
|
|
2
2
|
import type { ControlDependency } from '../info';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare function overwriteIEnvironmentWith(base: IEnvironment | undefined, next: IEnvironment | undefined, includeParent?: boolean, applyCds?: readonly ControlDependency[]): IEnvironment;
|
|
7
3
|
export declare function overwriteEnvironment(base: REnvironmentInformation, next: REnvironmentInformation | undefined, applyCds?: readonly ControlDependency[]): REnvironmentInformation;
|
|
8
4
|
export declare function overwriteEnvironment(base: REnvironmentInformation | undefined, next: REnvironmentInformation, applyCds?: readonly ControlDependency[]): REnvironmentInformation;
|
|
9
5
|
export declare function overwriteEnvironment(base: undefined, next: undefined, applyCds?: readonly ControlDependency[]): undefined;
|
|
@@ -1,70 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.overwriteIEnvironmentWith = overwriteIEnvironmentWith;
|
|
4
3
|
exports.overwriteEnvironment = overwriteEnvironment;
|
|
5
4
|
const assert_1 = require("../../util/assert");
|
|
6
|
-
const environment_1 = require("./environment");
|
|
7
|
-
const log_1 = require("../../util/log");
|
|
8
|
-
function anyIsMaybeOrEmpty(values) {
|
|
9
|
-
if (values.length === 0) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
for (const val of values) {
|
|
13
|
-
if (val.controlDependencies !== undefined) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
function overwriteIEnvironmentWith(base, next, includeParent = true, applyCds) {
|
|
23
|
-
(0, assert_1.guard)(base !== undefined && next !== undefined, 'can not overwrite environments with undefined');
|
|
24
|
-
const map = new Map(base.memory);
|
|
25
|
-
for (const [key, values] of next.memory) {
|
|
26
|
-
if (values.length > 1_000_000) {
|
|
27
|
-
log_1.log.warn(`Overwriting environment with ${values.length} definitions for ${key}`);
|
|
28
|
-
}
|
|
29
|
-
const hasMaybe = applyCds !== undefined ? true : anyIsMaybeOrEmpty(values);
|
|
30
|
-
if (hasMaybe) {
|
|
31
|
-
const old = map.get(key);
|
|
32
|
-
// we need to make a copy to avoid side effects for old reference in other environments
|
|
33
|
-
const updatedOld = [...old ?? []];
|
|
34
|
-
for (const v of values) {
|
|
35
|
-
const index = updatedOld.findIndex(o => o.nodeId === v.nodeId && o.definedAt === v.definedAt);
|
|
36
|
-
if (index < 0) {
|
|
37
|
-
if (applyCds !== undefined) {
|
|
38
|
-
updatedOld.push({
|
|
39
|
-
...v,
|
|
40
|
-
controlDependencies: applyCds.concat(v.controlDependencies ?? [])
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
updatedOld.push(v);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
map.set(key, updatedOld);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
map.set(key, values);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
let parent;
|
|
55
|
-
if (includeParent) {
|
|
56
|
-
parent = base.parent.builtInEnv ? base.parent : overwriteIEnvironmentWith(base.parent, next.parent, includeParent, applyCds);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
parent = base.parent;
|
|
60
|
-
}
|
|
61
|
-
const out = new environment_1.Environment(parent);
|
|
62
|
-
out.memory = map;
|
|
63
|
-
return out;
|
|
64
|
-
}
|
|
65
5
|
/**
|
|
66
6
|
* Assumes, that all definitions within next replace those within base (given the same name).
|
|
67
7
|
* <b>But</b> if all definitions within next are maybe, then they are appended to the base definitions (updating them to be `maybe` from now on as well), similar to {@link appendEnvironment}.
|
|
8
|
+
* @see {@link Environment.overwrite} - for details on how definitions are handled.
|
|
68
9
|
*/
|
|
69
10
|
function overwriteEnvironment(base, next, applyCds) {
|
|
70
11
|
if (base === undefined) {
|
|
@@ -75,7 +16,7 @@ function overwriteEnvironment(base, next, applyCds) {
|
|
|
75
16
|
}
|
|
76
17
|
(0, assert_1.guard)(next.level === base.level, `cannot overwrite environments with differently nested local scopes, base ${base.level} vs. next ${next.level}. This should not happen.`);
|
|
77
18
|
return {
|
|
78
|
-
current:
|
|
19
|
+
current: base.current.overwrite(next.current, applyCds),
|
|
79
20
|
level: base.level
|
|
80
21
|
};
|
|
81
22
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IdentifierReference } from './identifier';
|
|
2
|
+
import type { DataflowGraph } from '../graph/graph';
|
|
3
|
+
import type { ControlDependency } from '../info';
|
|
4
|
+
import type { REnvironmentInformation } from './environment';
|
|
5
|
+
/**
|
|
6
|
+
* Marks the reference as maybe (i.e., as controlled by a set of {@link IdentifierReference#controlDependencies|control dependencies}).
|
|
7
|
+
*/
|
|
8
|
+
export declare function makeReferenceMaybe(ref: IdentifierReference, graph: DataflowGraph, environments: REnvironmentInformation, includeDefs: boolean, defaultCd?: ControlDependency | undefined): IdentifierReference;
|
|
9
|
+
/**
|
|
10
|
+
* Marks all references as maybe (i.e., as controlled by a set of {@link IdentifierReference#controlDependencies|control dependencies}).
|
|
11
|
+
* @see {@link makeReferenceMaybe}
|
|
12
|
+
*/
|
|
13
|
+
export declare function makeAllMaybe(references: readonly IdentifierReference[] | undefined, graph: DataflowGraph, environments: REnvironmentInformation, includeDefs: boolean, defaultCd?: ControlDependency | undefined): IdentifierReference[];
|