@eagleoutice/flowr 2.12.3 → 2.13.1
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 +42 -95
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
- package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
- package/abstract-interpretation/data-frame/semantics.js +12 -16
- package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
- package/abstract-interpretation/domains/abstract-domain.js +146 -6
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
- package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
- package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
- package/abstract-interpretation/domains/interval-domain.js +111 -146
- package/abstract-interpretation/domains/lattice.d.ts +3 -3
- package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
- package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
- package/abstract-interpretation/domains/partial-product-domain.js +21 -54
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
- package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
- package/abstract-interpretation/domains/product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/product-domain.js +4 -4
- package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
- package/abstract-interpretation/domains/set-range-domain.js +141 -200
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
- package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
- package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
- package/abstract-interpretation/domains/singleton-domain.js +33 -72
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
- package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
- package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
- package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
- package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
- package/benchmark/slicer.d.ts +2 -2
- package/benchmark/slicer.js +6 -5
- package/cli/common/options.d.ts +20 -0
- package/cli/common/options.js +4 -0
- package/cli/common/scripts-info.d.ts +20 -0
- package/cli/flowr-main-options.d.ts +4 -0
- package/cli/flowr-main-options.js +5 -0
- package/cli/flowr.d.ts +5 -0
- package/cli/flowr.js +15 -7
- package/cli/repl/commands/repl-commands.d.ts +8 -0
- package/cli/repl/commands/repl-commands.js +16 -3
- package/cli/repl/commands/repl-query.js +50 -20
- package/cli/repl/commands/repl-signature.js +2 -2
- package/cli/repl/core.d.ts +14 -5
- package/cli/repl/core.js +32 -17
- package/cli/repl/parser/slice-query-parser.d.ts +69 -8
- package/cli/repl/parser/slice-query-parser.js +82 -13
- package/cli/repl/path-input.d.ts +6 -0
- package/cli/repl/path-input.js +41 -0
- package/cli/repl/print-version.js +3 -5
- package/cli/slicer-app.d.ts +4 -0
- package/cli/slicer-app.js +4 -2
- package/config.d.ts +56 -6
- package/config.js +134 -12
- package/control-flow/control-flow-graph.d.ts +3 -2
- package/control-flow/control-flow-graph.js +34 -14
- package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
- package/control-flow/semantic-cfg-guided-visitor.js +3 -0
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
- package/data/r-base-packages.generated.d.ts +1 -1
- package/data/r-base-packages.generated.js +3 -3
- package/data/sigdb/sigdb.remote.json +53 -53
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +3 -5
- package/dataflow/environments/default-builtin-config.js +2 -2
- package/dataflow/environments/environment.d.ts +9 -0
- package/dataflow/environments/environment.js +28 -7
- package/dataflow/environments/identifier.d.ts +1 -2
- package/dataflow/environments/identifier.js +1 -5
- package/dataflow/extractor.js +1 -2
- package/dataflow/graph/dataflowgraph-builder.js +42 -3
- package/dataflow/graph/df-helper.d.ts +15 -0
- package/dataflow/graph/df-helper.js +20 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
- package/documentation/data/faq/faqs.js +12 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-files.d.ts +2 -2
- package/documentation/doc-util/doc-files.js +4 -7
- package/documentation/doc-util/doc-query.d.ts +12 -9
- package/documentation/doc-util/doc-query.js +63 -28
- package/documentation/wiki-absint.js +1 -4
- package/documentation/wiki-analyzer.js +8 -3
- package/documentation/wiki-cfg.js +3 -2
- package/documentation/wiki-dataflow-graph.js +14 -4
- package/documentation/wiki-interface.js +30 -16
- package/documentation/wiki-mk/doc-maker.js +1 -1
- package/documentation/wiki-query.js +190 -30
- package/documentation/wiki-signature-database.d.ts +1 -1
- package/documentation/wiki-signature-database.js +53 -27
- package/linter/linter-output.d.ts +24 -0
- package/linter/linter-output.js +117 -0
- package/linter/linter-rules.d.ts +2 -4
- package/linter/rules/dataframe-access-validation.js +4 -4
- package/linter/rules/deprecated-functions.d.ts +2 -4
- package/linter/rules/deprecated-functions.js +58 -3
- package/linter/rules/undefined-symbol.js +18 -10
- package/linter/rules/unused-definition.js +24 -0
- package/package.json +5 -2
- package/project/context/flowr-analyzer-context.d.ts +61 -1
- package/project/context/flowr-analyzer-context.js +124 -3
- package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
- package/project/context/flowr-analyzer-dependencies-context.js +33 -3
- package/project/context/flowr-analyzer-files-context.d.ts +40 -0
- package/project/context/flowr-analyzer-files-context.js +171 -14
- package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
- package/project/context/flowr-analyzer-loading-order-context.js +20 -0
- package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
- package/project/context/flowr-analyzer-meta-context.js +64 -23
- package/project/context/flowr-file.d.ts +7 -0
- package/project/context/flowr-file.js +7 -0
- package/project/context/project-kind.d.ts +22 -0
- package/project/context/project-kind.js +27 -0
- package/project/dependency-version-space.d.ts +168 -0
- package/project/dependency-version-space.js +570 -0
- package/project/flowr-analyzer-builder.js +1 -1
- package/project/flowr-analyzer.d.ts +7 -0
- package/project/flowr-analyzer.js +9 -0
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
- package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
- package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
- package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
- package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
- package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
- package/project/plugins/flowr-analyzer-plugin.js +5 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
- package/project/plugins/package-version-plugins/package.d.ts +4 -1
- package/project/plugins/package-version-plugins/package.js +8 -5
- package/project/plugins/plugin-registry.d.ts +11 -3
- package/project/plugins/plugin-registry.js +24 -5
- package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
- package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
- package/project/sigdb/build.js +12 -2
- package/project/sigdb/decode.d.ts +7 -0
- package/project/sigdb/decode.js +35 -4
- package/project/sigdb/decompress.d.ts +2 -0
- package/project/sigdb/decompress.js +5 -0
- package/project/sigdb/manifest.d.ts +5 -0
- package/project/sigdb/manifest.js +37 -6
- package/project/sigdb/reader.d.ts +82 -2
- package/project/sigdb/reader.js +226 -14
- package/project/sigdb/schema.d.ts +31 -5
- package/project/sigdb/schema.js +7 -3
- package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
- package/project/sigdb/sigdb-version.js +119 -0
- package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
- package/queries/catalog/absint-query/absint-query-format.js +2 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
- package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
- package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
- package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
- package/queries/catalog/config-query/config-query-executor.js +17 -5
- package/queries/catalog/config-query/config-query-format.d.ts +19 -3
- package/queries/catalog/config-query/config-query-format.js +258 -98
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
- package/queries/catalog/dice-query/dice-query-executor.js +6 -9
- package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
- package/queries/catalog/dice-query/dice-query-format.js +10 -6
- package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
- package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
- package/queries/catalog/files-query/files-query-format.d.ts +2 -0
- package/queries/catalog/files-query/files-query-format.js +2 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +293 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +121 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +345 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
- package/queries/catalog/linter-query/linter-query-executor.js +11 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
- package/queries/catalog/linter-query/linter-query-format.js +44 -21
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +2 -0
- package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
- package/queries/catalog/project-query/project-query-executor.js +19 -62
- package/queries/catalog/project-query/project-query-format.d.ts +7 -18
- package/queries/catalog/project-query/project-query-format.js +3 -18
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
- package/queries/catalog/search-query/search-query-format.d.ts +1 -0
- package/queries/catalog/search-query/search-query-format.js +1 -0
- package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
- package/queries/catalog/signature-query/signature-query-executor.js +267 -57
- package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
- package/queries/catalog/signature-query/signature-query-format.js +41 -5
- package/queries/catalog/signature-query/signature-query-render.js +48 -6
- package/queries/catalog/slice-query-options.d.ts +49 -0
- package/queries/catalog/slice-query-options.js +50 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
- package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
- package/queries/query-print.js +3 -1
- package/queries/query.d.ts +62 -2
- package/queries/query.js +9 -2
- package/r-bridge/data/data.d.ts +16 -0
- package/r-bridge/data/data.js +20 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
- package/reconstruct/reconstruct.d.ts +18 -1
- package/reconstruct/reconstruct.js +42 -19
- package/slicing/criterion/parse.d.ts +4 -0
- package/slicing/criterion/parse.js +4 -0
- package/slicing/static/slice-call.js +17 -9
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +5 -4
- package/util/files.d.ts +19 -1
- package/util/files.js +45 -3
- package/util/glob.d.ts +19 -0
- package/util/glob.js +67 -0
- package/util/log.d.ts +12 -0
- package/util/log.js +17 -1
- package/util/logic.d.ts +6 -0
- package/util/logic.js +31 -1
- package/util/mermaid/dfg.js +17 -12
- package/util/mermaid/mermaid.js +2 -2
- package/util/objects.d.ts +5 -0
- package/util/objects.js +8 -0
- package/util/r-version.d.ts +9 -1
- package/util/r-version.js +27 -2
- package/util/schema.d.ts +18 -0
- package/util/schema.js +102 -4
- package/util/text/ansi.d.ts +4 -0
- package/util/text/ansi.js +27 -3
- package/util/text/strings.d.ts +9 -0
- package/util/text/strings.js +29 -0
- package/util/version.js +79 -6
- package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
- package/project/sigdb/version.js +0 -55
|
@@ -6,15 +6,13 @@ const set_1 = require("../../util/collections/set");
|
|
|
6
6
|
const logic_1 = require("../../util/logic");
|
|
7
7
|
const abstract_domain_1 = require("./abstract-domain");
|
|
8
8
|
const lattice_1 = require("./lattice");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.SetRangeTop = { min: new Set(), range: lattice_1.Top };
|
|
13
|
-
const DefaultLimit = { min: abstract_domain_1.DEFAULT_INFERENCE_LIMIT, range: abstract_domain_1.DEFAULT_INFERENCE_LIMIT };
|
|
9
|
+
const value_abstract_domain_1 = require("./value-abstract-domain");
|
|
10
|
+
/** The Top element of the set range domain with an empty set as must set and {@link Top} as may set */
|
|
11
|
+
exports.SetRangeTop = { must: new Set(), may: lattice_1.Top };
|
|
14
12
|
/**
|
|
15
|
-
* The set range abstract domain as range of possible value sets with a
|
|
13
|
+
* The set range abstract domain as range of possible value sets with a set of values that must be present and a set of values that may be present
|
|
16
14
|
* (similar to an interval-like structure with a lower bound and a difference to the upper bound).
|
|
17
|
-
* The Bottom element is defined as {@link Bottom} symbol and the Top element is defined as the range `[∅, Top]` where the
|
|
15
|
+
* The Bottom element is defined as {@link Bottom} symbol and the Top element is defined as the range `[∅, Top]` where the must set is the empty set and the may set is {@link Top}.
|
|
18
16
|
* @template T - Type of the values in the sets in the abstract domain
|
|
19
17
|
* @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value)
|
|
20
18
|
*/
|
|
@@ -22,19 +20,19 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
|
|
|
22
20
|
limit;
|
|
23
21
|
setType;
|
|
24
22
|
/**
|
|
25
|
-
* @param limit - A limit for the maximum number of elements to store in the
|
|
23
|
+
* @param limit - A limit for the maximum number of elements to store in the must set and may set before over-approximation
|
|
26
24
|
* @param newSet - An optional set constructor for the domain elements if the type `T` is not storable in a HashSet
|
|
27
25
|
*/
|
|
28
|
-
constructor(value, limit =
|
|
29
|
-
limit = typeof limit === 'number' ? {
|
|
26
|
+
constructor(value, limit = abstract_domain_1.DEFAULT_INFERENCE_LIMIT, setType = Set) {
|
|
27
|
+
limit = typeof limit === 'number' ? { must: limit, may: limit } : limit;
|
|
30
28
|
if (value !== lattice_1.Bottom) {
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
super({
|
|
29
|
+
const mustSet = new setType(value.must);
|
|
30
|
+
const maySet = value.may === lattice_1.Top ? lattice_1.Top : new setType(value.may);
|
|
31
|
+
const mustExceeds = mustSet.size > limit.must;
|
|
32
|
+
const mayExceeds = maySet === lattice_1.Top || maySet.size > limit.may || mustSet.size + maySet.size > limit.must + limit.may;
|
|
33
|
+
const must = mustExceeds ? new setType(mustSet.values().take(limit.must)) : mustSet;
|
|
34
|
+
const may = mayExceeds ? lattice_1.Top : mustSet.union(maySet).difference(must);
|
|
35
|
+
super({ must, may });
|
|
38
36
|
}
|
|
39
37
|
else {
|
|
40
38
|
super(value);
|
|
@@ -46,85 +44,65 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
|
|
|
46
44
|
return new SetRangeDomain(value, this.limit, this.setType);
|
|
47
45
|
}
|
|
48
46
|
/**
|
|
49
|
-
* The
|
|
47
|
+
* The set of values that must be present in the set.
|
|
50
48
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return lattice_1.Bottom;
|
|
54
|
-
}
|
|
55
|
-
return this.value.min;
|
|
49
|
+
get must() {
|
|
50
|
+
return (this.isValue() ? this.value.must : lattice_1.Bottom);
|
|
56
51
|
}
|
|
57
52
|
/**
|
|
58
|
-
* The
|
|
53
|
+
* The set of values that may be present in the set (can be {@link Top}).
|
|
59
54
|
*/
|
|
55
|
+
get may() {
|
|
56
|
+
return (this.isValue() ? this.value.may : lattice_1.Bottom);
|
|
57
|
+
}
|
|
58
|
+
lower() {
|
|
59
|
+
return this.must;
|
|
60
|
+
}
|
|
60
61
|
upper() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return
|
|
62
|
+
return this.isFinite() ? this.must.union(this.may) : this.may;
|
|
63
|
+
}
|
|
64
|
+
from(...values) {
|
|
65
|
+
if (values.length === 0) {
|
|
66
|
+
return this.bottom();
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
const sets = values.map(value => new Set(value));
|
|
69
|
+
const must = sets.reduce((result, set) => result.intersection(set));
|
|
70
|
+
const may = sets.reduce((result, set) => result.union(set)).difference(must);
|
|
71
|
+
return this.create({ must, may });
|
|
68
72
|
}
|
|
69
73
|
static top(limit, setType) {
|
|
70
|
-
return new
|
|
74
|
+
return new this(exports.SetRangeTop, limit, setType);
|
|
71
75
|
}
|
|
72
76
|
static bottom(limit, setType) {
|
|
73
|
-
return new
|
|
77
|
+
return new this(lattice_1.Bottom, limit, setType);
|
|
74
78
|
}
|
|
75
|
-
static
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
else if (concrete.size === 0) {
|
|
80
|
-
return SetRangeDomain.bottom(limit, setType);
|
|
79
|
+
static from(values, limit, setType) {
|
|
80
|
+
values = !Array.isArray(values) ? [values] : values.every(value => value instanceof Set || Array.isArray(value)) ? values : [values];
|
|
81
|
+
if (values.length === 0) {
|
|
82
|
+
return this.bottom();
|
|
81
83
|
}
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
84
|
+
const sets = values.map(value => new Set(value));
|
|
85
|
+
const must = sets.reduce((result, set) => result.intersection(set));
|
|
86
|
+
const may = sets.reduce((result, set) => result.union(set)).difference(must);
|
|
87
|
+
return new this({ must, may }, limit, setType);
|
|
85
88
|
}
|
|
86
89
|
top() {
|
|
87
|
-
return
|
|
90
|
+
return this.create(exports.SetRangeTop);
|
|
88
91
|
}
|
|
89
92
|
bottom() {
|
|
90
|
-
return
|
|
93
|
+
return this.create(lattice_1.Bottom);
|
|
91
94
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
else if (this.value === lattice_1.Bottom || other.value === lattice_1.Bottom || !(0, set_1.setEquals)(this.value.min, other.value.min)) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
else if (this.value.range === other.value.range) {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
return this.value.range !== lattice_1.Top && other.value.range !== lattice_1.Top && (0, set_1.setEquals)(this.value.range, other.value.range);
|
|
95
|
+
equalsValue(other) {
|
|
96
|
+
return (0, set_1.setEquals)(this.must, other.must) && (this.may === other.may || (this.may !== lattice_1.Top && other.may !== lattice_1.Top && (0, set_1.setEquals)(this.may, other.may)));
|
|
103
97
|
}
|
|
104
|
-
|
|
98
|
+
leqValue(other) {
|
|
105
99
|
const thisLower = this.lower(), thisUpper = this.upper();
|
|
106
100
|
const otherLower = other.lower(), otherUpper = other.upper();
|
|
107
|
-
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom || !otherLower.isSubsetOf(thisLower)) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
else if (otherUpper === lattice_1.Top) {
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
return thisUpper !== lattice_1.Top && thisUpper.isSubsetOf(otherUpper);
|
|
101
|
+
return otherLower.isSubsetOf(thisLower) && (otherUpper === lattice_1.Top || (thisUpper !== lattice_1.Top && thisUpper.isSubsetOf(otherUpper)));
|
|
117
102
|
}
|
|
118
|
-
|
|
119
|
-
other = other instanceof SetRangeDomain ? other : this.create(other);
|
|
103
|
+
joinValue(other) {
|
|
120
104
|
const thisLower = this.lower(), thisUpper = this.upper();
|
|
121
105
|
const otherLower = other.lower(), otherUpper = other.upper();
|
|
122
|
-
if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
|
|
123
|
-
return this.create(other.value);
|
|
124
|
-
}
|
|
125
|
-
else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
|
|
126
|
-
return this.create(this.value);
|
|
127
|
-
}
|
|
128
106
|
const joinLower = thisLower.intersection(otherLower);
|
|
129
107
|
let joinUpper;
|
|
130
108
|
if (thisUpper === lattice_1.Top || otherUpper === lattice_1.Top) {
|
|
@@ -133,15 +111,14 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
|
|
|
133
111
|
else {
|
|
134
112
|
joinUpper = thisUpper.union(otherUpper);
|
|
135
113
|
}
|
|
136
|
-
return this.create({
|
|
114
|
+
return this.create({
|
|
115
|
+
must: joinLower,
|
|
116
|
+
may: joinUpper === lattice_1.Top ? lattice_1.Top : joinUpper.difference(joinLower)
|
|
117
|
+
});
|
|
137
118
|
}
|
|
138
|
-
|
|
139
|
-
other = other instanceof SetRangeDomain ? other : this.create(other);
|
|
119
|
+
meetValue(other) {
|
|
140
120
|
const thisLower = this.lower(), thisUpper = this.upper();
|
|
141
121
|
const otherLower = other.lower(), otherUpper = other.upper();
|
|
142
|
-
if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom || otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
|
|
143
|
-
return this.bottom();
|
|
144
|
-
}
|
|
145
122
|
const meetLower = thisLower.union(otherLower);
|
|
146
123
|
let meetUpper;
|
|
147
124
|
if (thisUpper === lattice_1.Top) {
|
|
@@ -156,21 +133,18 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
|
|
|
156
133
|
if (meetUpper !== lattice_1.Top && !meetLower.isSubsetOf(meetUpper)) {
|
|
157
134
|
return this.bottom();
|
|
158
135
|
}
|
|
159
|
-
return this.create({
|
|
136
|
+
return this.create({
|
|
137
|
+
must: meetLower,
|
|
138
|
+
may: meetUpper === lattice_1.Top ? lattice_1.Top : meetUpper.difference(meetLower)
|
|
139
|
+
});
|
|
160
140
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Creates the union of this abstract value and another abstract value by creating the union of the minimum and maximum set, respectively.
|
|
163
|
-
*/
|
|
164
141
|
union(other) {
|
|
165
142
|
other = other instanceof SetRangeDomain ? other : this.create(other);
|
|
143
|
+
if (!this.isValue() || !other.isValue()) {
|
|
144
|
+
return this.bottom();
|
|
145
|
+
}
|
|
166
146
|
const thisLower = this.lower(), thisUpper = this.upper();
|
|
167
147
|
const otherLower = other.lower(), otherUpper = other.upper();
|
|
168
|
-
if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
|
|
169
|
-
return this.create(other.value);
|
|
170
|
-
}
|
|
171
|
-
else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
|
|
172
|
-
return this.create(this.value);
|
|
173
|
-
}
|
|
174
148
|
const unionLower = thisLower.union(otherLower);
|
|
175
149
|
let unionUpper;
|
|
176
150
|
if (thisUpper === lattice_1.Top || otherUpper === lattice_1.Top) {
|
|
@@ -179,18 +153,18 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
|
|
|
179
153
|
else {
|
|
180
154
|
unionUpper = thisUpper.union(otherUpper);
|
|
181
155
|
}
|
|
182
|
-
return this.create({
|
|
156
|
+
return this.create({
|
|
157
|
+
must: unionLower,
|
|
158
|
+
may: unionUpper === lattice_1.Top ? lattice_1.Top : unionUpper.difference(unionLower)
|
|
159
|
+
});
|
|
183
160
|
}
|
|
184
|
-
/**
|
|
185
|
-
* Creates the intersection of this abstract value and another abstract value by creating the intersection of the minimum and maximum set, respectively.
|
|
186
|
-
*/
|
|
187
161
|
intersect(other) {
|
|
188
162
|
other = other instanceof SetRangeDomain ? other : this.create(other);
|
|
189
|
-
|
|
190
|
-
const otherLower = other.lower(), otherUpper = other.upper();
|
|
191
|
-
if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom || otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
|
|
163
|
+
if (!this.isValue() || !other.isValue()) {
|
|
192
164
|
return this.bottom();
|
|
193
165
|
}
|
|
166
|
+
const thisLower = this.lower(), thisUpper = this.upper();
|
|
167
|
+
const otherLower = other.lower(), otherUpper = other.upper();
|
|
194
168
|
const intersectLower = thisLower.intersection(otherLower);
|
|
195
169
|
let intersectUpper;
|
|
196
170
|
if (thisUpper === lattice_1.Top) {
|
|
@@ -202,82 +176,66 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
|
|
|
202
176
|
else {
|
|
203
177
|
intersectUpper = thisUpper.intersection(otherUpper);
|
|
204
178
|
}
|
|
205
|
-
return this.create({
|
|
179
|
+
return this.create({
|
|
180
|
+
must: intersectLower,
|
|
181
|
+
may: intersectUpper === lattice_1.Top ? lattice_1.Top : intersectUpper.difference(intersectLower)
|
|
182
|
+
});
|
|
206
183
|
}
|
|
207
|
-
/**
|
|
208
|
-
* Subtracts another abstract value from the current abstract value by removing all elements of the other abstract value from the current abstract value.
|
|
209
|
-
*/
|
|
210
184
|
subtract(other) {
|
|
211
185
|
other = other instanceof SetRangeDomain ? other : this.create(other);
|
|
212
|
-
|
|
213
|
-
const otherLower = other.lower(), otherUpper = other.upper();
|
|
214
|
-
if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
|
|
186
|
+
if (!this.isValue() || !other.isValue()) {
|
|
215
187
|
return this.bottom();
|
|
216
188
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
let subLower;
|
|
189
|
+
const thisLower = this.lower(), thisUpper = this.upper();
|
|
190
|
+
const otherLower = other.lower(), otherUpper = other.upper();
|
|
191
|
+
let subtractLower;
|
|
221
192
|
if (otherUpper === lattice_1.Top) {
|
|
222
|
-
|
|
193
|
+
subtractLower = new Set();
|
|
223
194
|
}
|
|
224
195
|
else {
|
|
225
|
-
|
|
196
|
+
subtractLower = thisLower.difference(otherUpper);
|
|
226
197
|
}
|
|
227
|
-
let
|
|
198
|
+
let subtractUpper;
|
|
228
199
|
if (thisUpper === lattice_1.Top) {
|
|
229
|
-
|
|
200
|
+
subtractUpper = lattice_1.Top;
|
|
230
201
|
}
|
|
231
202
|
else if (otherUpper === lattice_1.Top) {
|
|
232
|
-
|
|
203
|
+
subtractUpper = thisUpper.difference(otherLower);
|
|
233
204
|
}
|
|
234
205
|
else {
|
|
235
|
-
|
|
206
|
+
subtractUpper = thisUpper.difference(otherUpper);
|
|
236
207
|
}
|
|
237
|
-
return this.create({
|
|
208
|
+
return this.create({
|
|
209
|
+
must: subtractLower,
|
|
210
|
+
may: subtractUpper === lattice_1.Top ? lattice_1.Top : subtractUpper.difference(subtractLower)
|
|
211
|
+
});
|
|
238
212
|
}
|
|
239
|
-
|
|
213
|
+
widenValue(other) {
|
|
240
214
|
const thisLower = this.lower(), thisUpper = this.upper();
|
|
241
215
|
const otherLower = other.lower(), otherUpper = other.upper();
|
|
242
|
-
if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
|
|
243
|
-
return this.create(other.value);
|
|
244
|
-
}
|
|
245
|
-
else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
|
|
246
|
-
return this.create(this.value);
|
|
247
|
-
}
|
|
248
216
|
let widenLower;
|
|
249
|
-
if (
|
|
250
|
-
widenLower =
|
|
217
|
+
if (thisLower.isSubsetOf(otherLower)) {
|
|
218
|
+
widenLower = thisLower;
|
|
251
219
|
}
|
|
252
220
|
else {
|
|
253
|
-
widenLower =
|
|
221
|
+
widenLower = new Set();
|
|
254
222
|
}
|
|
255
223
|
let widenUpper;
|
|
256
|
-
if (thisUpper
|
|
257
|
-
widenUpper =
|
|
224
|
+
if (thisUpper !== lattice_1.Top && otherUpper !== lattice_1.Top && otherUpper.isSubsetOf(thisUpper)) {
|
|
225
|
+
widenUpper = thisUpper;
|
|
258
226
|
}
|
|
259
227
|
else {
|
|
260
|
-
widenUpper =
|
|
228
|
+
widenUpper = lattice_1.Top;
|
|
261
229
|
}
|
|
262
|
-
return this.create({
|
|
230
|
+
return this.create({
|
|
231
|
+
must: widenLower,
|
|
232
|
+
may: widenUpper === lattice_1.Top ? lattice_1.Top : widenUpper.difference(widenLower)
|
|
233
|
+
});
|
|
263
234
|
}
|
|
264
|
-
|
|
235
|
+
narrowValue(other) {
|
|
265
236
|
const thisLower = this.lower(), thisUpper = this.upper();
|
|
266
237
|
const otherLower = other.lower(), otherUpper = other.upper();
|
|
267
|
-
if (
|
|
268
|
-
return this.bottom();
|
|
269
|
-
}
|
|
270
|
-
let meetUpper;
|
|
271
|
-
if (thisUpper === lattice_1.Top) {
|
|
272
|
-
meetUpper = otherUpper;
|
|
273
|
-
}
|
|
274
|
-
else if (otherUpper === lattice_1.Top) {
|
|
275
|
-
meetUpper = thisUpper;
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
meetUpper = thisUpper.intersection(otherUpper);
|
|
279
|
-
}
|
|
280
|
-
if (meetUpper !== lattice_1.Top && !thisLower.union(otherLower).isSubsetOf(meetUpper)) {
|
|
238
|
+
if (this.meetValue(other).isBottom()) {
|
|
281
239
|
return this.bottom();
|
|
282
240
|
}
|
|
283
241
|
let narrowLower;
|
|
@@ -294,103 +252,83 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
|
|
|
294
252
|
else {
|
|
295
253
|
narrowUpper = thisUpper;
|
|
296
254
|
}
|
|
297
|
-
return this.create({
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return new Set();
|
|
302
|
-
}
|
|
303
|
-
else if (this.value.range === lattice_1.Top || 2 ** (this.value.range.size) > limit) {
|
|
304
|
-
return lattice_1.Top;
|
|
305
|
-
}
|
|
306
|
-
const subsets = [new this.setType()];
|
|
307
|
-
for (const element of this.value.range) {
|
|
308
|
-
const newSubsets = subsets.map(subset => new this.setType([...subset, element]));
|
|
309
|
-
for (const subset of newSubsets) {
|
|
310
|
-
subsets.push(subset);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return new Set(subsets.map(subset => this.value === lattice_1.Bottom ? subset : this.value.min.union(subset)));
|
|
314
|
-
}
|
|
315
|
-
abstract(concrete) {
|
|
316
|
-
return SetRangeDomain.abstract(concrete, this.limit);
|
|
255
|
+
return this.create({
|
|
256
|
+
must: narrowLower,
|
|
257
|
+
may: narrowUpper === lattice_1.Top ? lattice_1.Top : narrowUpper.difference(narrowLower)
|
|
258
|
+
});
|
|
317
259
|
}
|
|
318
|
-
satisfies(set, comparator =
|
|
260
|
+
satisfies(set, comparator = value_abstract_domain_1.SetComparator.Equal) {
|
|
319
261
|
const lower = this.lower(), upper = this.upper();
|
|
320
262
|
if (lower === lattice_1.Bottom || upper === lattice_1.Bottom) {
|
|
321
263
|
return logic_1.Ternary.Never;
|
|
322
264
|
}
|
|
323
265
|
const value = new this.setType(set);
|
|
324
266
|
switch (comparator) {
|
|
325
|
-
case
|
|
267
|
+
case value_abstract_domain_1.SetComparator.Equal: {
|
|
326
268
|
if (lower.isSubsetOf(value) && (upper === lattice_1.Top || value.isSubsetOf(upper))) {
|
|
327
269
|
return upper !== lattice_1.Top && lower.size === upper.size ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
|
|
328
270
|
}
|
|
329
271
|
return logic_1.Ternary.Never;
|
|
330
272
|
}
|
|
331
|
-
case
|
|
273
|
+
case value_abstract_domain_1.SetComparator.SubsetOrEqual: {
|
|
332
274
|
if (upper === lattice_1.Top || value.isSubsetOf(upper)) {
|
|
333
275
|
return value.isSubsetOf(lower) ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
|
|
334
276
|
}
|
|
335
277
|
return logic_1.Ternary.Never;
|
|
336
278
|
}
|
|
337
|
-
case
|
|
279
|
+
case value_abstract_domain_1.SetComparator.Subset: {
|
|
338
280
|
if (upper === lattice_1.Top || (value.isSubsetOf(upper) && !(0, set_1.setEquals)(value, upper))) {
|
|
339
281
|
return value.isSubsetOf(lower) && !(0, set_1.setEquals)(value, lower) ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
|
|
340
282
|
}
|
|
341
283
|
return logic_1.Ternary.Never;
|
|
342
284
|
}
|
|
285
|
+
case value_abstract_domain_1.SetComparator.Intersect: {
|
|
286
|
+
if (this.isInfinite() || (this.isFinite() && [...set].some(value => this.may.has(value)))) {
|
|
287
|
+
return (this.isValue() && [...set].some(value => this.must.has(value))) ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
|
|
288
|
+
}
|
|
289
|
+
return logic_1.Ternary.Never;
|
|
290
|
+
}
|
|
291
|
+
case value_abstract_domain_1.SetComparator.NoIntersect: {
|
|
292
|
+
return logic_1.TernaryLogic.negate(this.satisfies(set, value_abstract_domain_1.SetComparator.Intersect));
|
|
293
|
+
}
|
|
343
294
|
default: {
|
|
344
295
|
(0, assert_1.assertUnreachable)(comparator);
|
|
345
296
|
}
|
|
346
297
|
}
|
|
347
298
|
}
|
|
348
299
|
/**
|
|
349
|
-
* Extends the
|
|
300
|
+
* Extends the must set of the current abstract value down to the empty set.
|
|
350
301
|
*/
|
|
351
302
|
widenDown() {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
return this.bottom();
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
return this.create({ min: new this.setType(), range: upper });
|
|
303
|
+
if (this.isValue()) {
|
|
304
|
+
return this.create({ must: new this.setType(), may: this.upper() });
|
|
358
305
|
}
|
|
306
|
+
return this.bottom();
|
|
359
307
|
}
|
|
360
308
|
/**
|
|
361
|
-
* Extends the
|
|
309
|
+
* Extends the may set of the current abstract value up to {@link Top}.
|
|
362
310
|
*/
|
|
363
311
|
widenUp() {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
return this.bottom();
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
return this.create({ min: lower, range: lattice_1.Top });
|
|
312
|
+
if (this.isValue()) {
|
|
313
|
+
return this.create({ must: this.must, may: lattice_1.Top });
|
|
370
314
|
}
|
|
315
|
+
return this.bottom();
|
|
371
316
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
const min = this.value.min.values().toArray();
|
|
377
|
-
const range = this.value.range === lattice_1.Top ? this.value.range.description : this.value.range.values().toArray();
|
|
378
|
-
return { min, range };
|
|
317
|
+
jsonify() {
|
|
318
|
+
const must = this.must.values().toArray();
|
|
319
|
+
const may = this.may === lattice_1.Top ? lattice_1.Top.description : this.may.values().toArray();
|
|
320
|
+
return { must, may };
|
|
379
321
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
322
|
+
stringify() {
|
|
323
|
+
const must = this.must.values().map(abstract_domain_1.AbstractDomain.toString).toArray().join(', ');
|
|
324
|
+
if (this.may === lattice_1.Top) {
|
|
325
|
+
return `[{${must}}, ${lattice_1.TopSymbol}]`;
|
|
383
326
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
return `[{${minString}}, ${lattice_1.TopSymbol}]`;
|
|
387
|
-
}
|
|
388
|
-
const minString = this.value.min.values().map(abstract_domain_1.AbstractDomain.toString).toArray().join(', ');
|
|
389
|
-
const rangeString = this.value.range.values().map(abstract_domain_1.AbstractDomain.toString).toArray().join(', ');
|
|
390
|
-
return `[{${minString}}, {${rangeString}}]`;
|
|
327
|
+
const may = this.may.values().map(abstract_domain_1.AbstractDomain.toString).toArray().join(', ');
|
|
328
|
+
return `[{${must}}, {${may}}]`;
|
|
391
329
|
}
|
|
392
330
|
isTop() {
|
|
393
|
-
return this.
|
|
331
|
+
return this.isValue() && this.must.size === 0 && this.may === lattice_1.Top;
|
|
394
332
|
}
|
|
395
333
|
isBottom() {
|
|
396
334
|
return this.value === lattice_1.Bottom;
|
|
@@ -399,7 +337,10 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
|
|
|
399
337
|
return this.value !== lattice_1.Bottom;
|
|
400
338
|
}
|
|
401
339
|
isFinite() {
|
|
402
|
-
return this.
|
|
340
|
+
return this.isValue() && this.may !== lattice_1.Top;
|
|
341
|
+
}
|
|
342
|
+
isInfinite() {
|
|
343
|
+
return this.isValue() && this.may === lattice_1.Top;
|
|
403
344
|
}
|
|
404
345
|
}
|
|
405
346
|
exports.SetRangeDomain = SetRangeDomain;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ternary } from '../../util/logic';
|
|
2
2
|
import { AbstractDomain } from './abstract-domain';
|
|
3
3
|
import { Bottom, Top } from './lattice';
|
|
4
|
-
import { type
|
|
4
|
+
import { type SetDomain, SetComparator } from './value-abstract-domain';
|
|
5
5
|
/** The type of the actual values of the set upper bound domain as set */
|
|
6
6
|
type SetUpperBoundValue<T> = ReadonlySet<T>;
|
|
7
7
|
/** The type of the Top element of the set upper bound domain as {@link Top} symbol */
|
|
@@ -16,39 +16,33 @@ type SetUpperBoundLift<T> = SetUpperBoundValue<T> | SetUpperBoundTop | SetUpperB
|
|
|
16
16
|
* @template T - Type of the values in the abstract domain
|
|
17
17
|
* @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value)
|
|
18
18
|
*/
|
|
19
|
-
export declare class SetUpperBoundDomain<T, Value extends SetUpperBoundLift<T> = SetUpperBoundLift<T>> extends AbstractDomain<
|
|
19
|
+
export declare class SetUpperBoundDomain<T, Value extends SetUpperBoundLift<T> = SetUpperBoundLift<T>> extends AbstractDomain<SetUpperBoundValue<T>, SetUpperBoundTop, SetUpperBoundBottom, Value> implements SetDomain<T> {
|
|
20
20
|
readonly limit: number;
|
|
21
|
-
|
|
21
|
+
protected readonly setType: typeof Set<T>;
|
|
22
22
|
/**
|
|
23
23
|
* @param limit - A limit for the maximum number of elements to store in the set
|
|
24
24
|
* @param newSet - An optional set constructor for the domain elements if the type `T` is not storable in a HashSet
|
|
25
25
|
*/
|
|
26
26
|
constructor(value: Value | T[], limit?: number, setType?: typeof Set<T>);
|
|
27
27
|
create(value: SetUpperBoundLift<T> | T[]): this;
|
|
28
|
+
from(...values: ReadonlySet<T>[] | T[][]): this;
|
|
28
29
|
static top<T>(limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T, SetUpperBoundTop>;
|
|
29
30
|
static bottom<T>(limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T, SetUpperBoundBottom>;
|
|
30
|
-
static
|
|
31
|
+
static from<T>(values: Set<T> | T[] | Set<T>[] | T[][], limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T>;
|
|
31
32
|
top(): this & SetUpperBoundDomain<T, SetUpperBoundTop>;
|
|
32
33
|
bottom(): this & SetUpperBoundDomain<T, SetUpperBoundBottom>;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* Subtracts another abstract value from the current abstract value by removing all elements of the other abstract value from the current abstract value.
|
|
41
|
-
*/
|
|
42
|
-
subtract(other: this | SetUpperBoundLift<T> | T[]): this;
|
|
43
|
-
widen(other: this): this;
|
|
44
|
-
narrow(other: this): this;
|
|
45
|
-
concretize(limit: number): ReadonlySet<ReadonlySet<T>> | typeof Top;
|
|
46
|
-
abstract(concrete: ReadonlySet<ReadonlySet<T>> | typeof Top): this;
|
|
34
|
+
protected equalsValue(this: SetUpperBoundDomain<T, SetUpperBoundValue<T>>, other: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): boolean;
|
|
35
|
+
protected leqValue(this: SetUpperBoundDomain<T, SetUpperBoundValue<T>>, other: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): boolean;
|
|
36
|
+
protected joinValue(this: this & SetUpperBoundDomain<T, SetUpperBoundValue<T>>, other: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): this;
|
|
37
|
+
protected meetValue(this: this & SetUpperBoundDomain<T, SetUpperBoundValue<T>>, other: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): this;
|
|
38
|
+
union(other: this | SetUpperBoundLift<T> | T[]): this;
|
|
39
|
+
intersect(other: this | SetUpperBoundLift<T> | T[]): this;
|
|
40
|
+
subtract(other: this | SetUpperBoundLift<T>): this;
|
|
47
41
|
satisfies(set: ReadonlySet<T> | T[], comparator?: SetComparator): Ternary;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
isTop(): this is SetUpperBoundDomain<T, SetUpperBoundTop>;
|
|
51
|
-
isBottom(): this is SetUpperBoundDomain<T, SetUpperBoundBottom>;
|
|
52
|
-
isValue(): this is SetUpperBoundDomain<T, SetUpperBoundValue<T>>;
|
|
42
|
+
protected jsonify(this: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): unknown;
|
|
43
|
+
protected stringify(this: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): string;
|
|
44
|
+
isTop(): this is this & SetUpperBoundDomain<T, SetUpperBoundTop>;
|
|
45
|
+
isBottom(): this is this & SetUpperBoundDomain<T, SetUpperBoundBottom>;
|
|
46
|
+
isValue(): this is this & SetUpperBoundDomain<T, SetUpperBoundValue<T>>;
|
|
53
47
|
}
|
|
54
48
|
export {};
|