@eagleoutice/flowr 2.14.3 → 2.15.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 +76 -63
- package/abstract-interpretation/absint-inference.d.ts +347 -0
- package/abstract-interpretation/{absint-visitor.js → absint-inference.js} +327 -97
- package/abstract-interpretation/abstract-semantics.d.ts +246 -0
- package/abstract-interpretation/abstract-semantics.js +3 -0
- package/abstract-interpretation/data-frame/{mappers/arguments.d.ts → arguments.d.ts} +18 -16
- package/abstract-interpretation/data-frame/{mappers/arguments.js → arguments.js} +20 -21
- package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +52 -0
- package/abstract-interpretation/data-frame/dataframe-semantics.js +1656 -0
- package/abstract-interpretation/data-frame/resolve-args.js +4 -4
- package/abstract-interpretation/data-frame/semantics.d.ts +15 -21
- package/abstract-interpretation/data-frame/semantics.js +27 -29
- package/abstract-interpretation/data-frame/shape-inference.d.ts +28 -24
- package/abstract-interpretation/data-frame/shape-inference.js +14 -79
- package/abstract-interpretation/domains/interval-domain.d.ts +5 -1
- package/abstract-interpretation/domains/interval-domain.js +25 -33
- package/abstract-interpretation/domains/multi-value-state-domain.d.ts +6 -3
- package/abstract-interpretation/domains/multi-value-state-domain.js +24 -4
- package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -6
- package/abstract-interpretation/domains/partial-product-domain.js +26 -43
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -6
- package/abstract-interpretation/domains/positive-interval-domain.js +3 -29
- package/abstract-interpretation/domains/product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.d.ts +6 -0
- package/abstract-interpretation/domains/set-range-domain.js +29 -62
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +9 -2
- package/abstract-interpretation/domains/state-abstract-domain.js +26 -37
- package/abstract-interpretation/domains/{state-domain-like.d.ts → state-domain.d.ts} +10 -6
- package/abstract-interpretation/domains/{state-domain-like.js → state-domain.js} +1 -1
- package/abstract-interpretation/value-semantics.d.ts +113 -0
- package/abstract-interpretation/value-semantics.js +115 -0
- package/benchmark/slicer.js +12 -6
- package/benchmark/stats/feature-counts.d.ts +2 -1
- package/benchmark/stats/feature-counts.js +25 -1
- package/benchmark/stats/stats.d.ts +4 -0
- package/benchmark/summarizer/second-phase/graph.js +7 -0
- package/cli/repl/commands/repl-parse.js +11 -22
- package/cli/repl/parser/slice-query-parser.d.ts +2 -0
- package/cli/repl/parser/slice-query-parser.js +1 -0
- package/config.d.ts +30 -205
- package/config.js +37 -3
- package/control-flow/cfg-properties.d.ts +5 -0
- package/control-flow/cfg-properties.js +25 -7
- package/control-flow/control-flow-graph.d.ts +11 -37
- package/control-flow/control-flow-graph.js +33 -77
- package/control-flow/semantic-cfg-guided-visitor.d.ts +63 -320
- package/control-flow/semantic-cfg-guided-visitor.js +65 -320
- package/dataflow/environments/built-in-config.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in-props.d.ts +192 -82
- package/dataflow/environments/built-in-props.js +336 -106
- package/dataflow/environments/built-in.d.ts +21 -9
- package/dataflow/environments/built-in.js +43 -12
- package/dataflow/environments/default-builtin-config.d.ts +3219 -328
- package/dataflow/environments/default-builtin-config.js +804 -1031
- package/dataflow/environments/environment.d.ts +26 -49
- package/dataflow/environments/environment.js +34 -47
- package/dataflow/environments/group-generics.d.ts +36 -0
- package/dataflow/environments/group-generics.js +58 -0
- package/dataflow/environments/identifier.d.ts +106 -6
- package/dataflow/environments/identifier.js +19 -1
- package/dataflow/environments/query-fn-props.d.ts +16 -8
- package/dataflow/environments/query-fn-props.js +45 -21
- package/dataflow/environments/resolve-by-name.js +9 -2
- package/dataflow/environments/scoping.d.ts +5 -0
- package/dataflow/environments/scoping.js +11 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +20 -2
- package/dataflow/eval/resolve/resolve-numbers.d.ts +182 -7
- package/dataflow/eval/resolve/resolve-numbers.js +44 -9
- package/dataflow/eval/resolve/resolve-strings.d.ts +79 -2
- package/dataflow/eval/resolve/resolve-strings.js +16 -7
- package/dataflow/eval/resolve/resolve.d.ts +5 -22
- package/dataflow/eval/resolve/resolve.js +24 -34
- package/dataflow/eval/values/general.d.ts +7 -1
- package/dataflow/eval/values/general.js +17 -3
- package/dataflow/eval/values/string/string-constants.d.ts +16 -15
- package/dataflow/eval/values/string/string-constants.js +59 -27
- package/dataflow/extractor.d.ts +2 -1
- package/dataflow/extractor.js +16 -4
- package/dataflow/fn/argument-roles.d.ts +35 -0
- package/dataflow/fn/argument-roles.js +252 -0
- package/dataflow/fn/class-declaration.d.ts +148 -0
- package/dataflow/fn/class-declaration.js +317 -0
- package/dataflow/fn/condition-handlers.d.ts +5 -0
- package/dataflow/fn/condition-handlers.js +13 -0
- package/dataflow/fn/exceptions-of-function.d.ts +21 -7
- package/dataflow/fn/exceptions-of-function.js +74 -43
- package/dataflow/fn/frame-reflection.d.ts +46 -0
- package/dataflow/fn/frame-reflection.js +169 -0
- package/dataflow/fn/function-props.d.ts +32 -0
- package/dataflow/fn/function-props.js +160 -0
- package/dataflow/fn/higher-order-function.d.ts +23 -5
- package/dataflow/fn/higher-order-function.js +64 -18
- package/dataflow/fn/strict-function.d.ts +24 -2
- package/dataflow/fn/strict-function.js +49 -19
- package/dataflow/graph/call-graph.js +10 -2
- package/dataflow/graph/df-helper.d.ts +1 -12
- package/dataflow/graph/df-helper.js +2 -19
- package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/graph.d.ts +39 -188
- package/dataflow/graph/graph.js +46 -163
- package/dataflow/graph/match-args.d.ts +34 -2
- package/dataflow/graph/match-args.js +45 -12
- package/dataflow/graph/vertex.d.ts +8 -0
- package/dataflow/info.d.ts +7 -5
- package/dataflow/info.js +1 -5
- package/dataflow/internal/control-flow.js +20 -17
- package/dataflow/internal/linker.d.ts +8 -37
- package/dataflow/internal/linker.js +22 -55
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +8 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +43 -50
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.d.ts +23 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.js +24 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +0 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +73 -27
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +131 -92
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +17 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +187 -99
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +0 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +31 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +101 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +23 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +22 -1
- package/dataflow/internal/process/functions/call/common.d.ts +4 -6
- package/dataflow/internal/process/functions/call/common.js +2 -2
- package/dataflow/internal/process/functions/call/deferred.d.ts +1 -1
- package/dataflow/internal/process/functions/call/deferred.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +5 -3
- package/dataflow/internal/process/functions/call/known-call-handling.js +6 -4
- package/dataflow/internal/process/functions/call/named-call-handling.js +19 -13
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -2
- package/dataflow/internal/process/functions/call/quoted.js +144 -28
- package/dataflow/origin/dfg-get-origin.js +23 -10
- package/dataflow/processor.d.ts +2 -1
- package/dataflow/processor.js +6 -0
- package/documentation/data/interface/doc-writing-code.js +2 -0
- package/documentation/doc-util/doc-search.js +1 -1
- package/documentation/wiki-absint.d.ts +11 -14
- package/documentation/wiki-absint.js +73 -59
- package/documentation/wiki-core.js +64 -24
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-query.js +82 -264
- package/documentation/wiki-signature-database.js +23 -6
- package/gas.d.ts +91 -47
- package/gas.js +97 -13
- package/index.d.ts +31 -0
- package/index.js +52 -0
- package/linter/linter-rules.d.ts +87 -23
- package/linter/linter-rules.js +3 -1
- package/linter/rules/absolute-path.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +10 -8
- package/linter/rules/dead-code.d.ts +1 -1
- package/linter/rules/deprecated-functions.js +14 -5
- package/linter/rules/file-path-validity.d.ts +1 -1
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +13 -2
- package/linter/rules/network-functions.d.ts +10 -5
- package/linter/rules/network-functions.js +48 -36
- package/linter/rules/no-leaked-credentials.d.ts +1 -1
- package/linter/rules/problematic-inputs.d.ts +1 -1
- package/linter/rules/problematic-inputs.js +1 -1
- package/linter/rules/seeded-randomness.d.ts +3 -2
- package/linter/rules/seeded-randomness.js +7 -3
- package/linter/rules/software-has-license.d.ts +1 -1
- package/linter/rules/software-has-tests.d.ts +1 -1
- package/linter/rules/stop-with-call-arg.d.ts +1 -1
- package/linter/rules/syntactically-valid.d.ts +1 -1
- package/linter/rules/unclosed-connection.d.ts +3 -3
- package/linter/rules/unclosed-connection.js +3 -4
- package/linter/rules/undefined-symbol.d.ts +1 -1
- package/linter/rules/unescaped-arguments.d.ts +161 -0
- package/linter/rules/unescaped-arguments.js +293 -0
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/unused-definition.js +51 -6
- package/linter/rules/unused-import.d.ts +1 -1
- package/linter/rules/useless-loop.d.ts +1 -1
- package/package.json +3 -198
- package/project/context/flowr-analyzer-environment-context.d.ts +12 -1
- package/project/context/flowr-analyzer-environment-context.js +33 -1
- package/project/context/flowr-analyzer-files-context.d.ts +24 -1
- package/project/context/flowr-analyzer-files-context.js +42 -21
- package/project/context/flowr-analyzer-functions-context.d.ts +8 -0
- package/project/context/flowr-analyzer-functions-context.js +2 -0
- package/project/context/flowr-analyzer-gas-context.d.ts +9 -1
- package/project/context/flowr-analyzer-gas-context.js +21 -0
- package/project/context/flowr-file.d.ts +16 -1
- package/project/context/flowr-file.js +26 -2
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +19 -20
- package/project/plugins/file-plugins/files/flowr-description-file.js +55 -41
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +9 -4
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +11 -3
- package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +6 -9
- package/project/plugins/file-plugins/files/flowr-manifest-files.js +5 -21
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +11 -12
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +48 -61
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +3 -12
- package/project/plugins/file-plugins/files/flowr-news-file.js +2 -19
- package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +145 -0
- package/project/plugins/file-plugins/files/flowr-rd-file.js +676 -0
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +122 -422
- package/project/plugins/file-plugins/files/flowr-rda-file.js +517 -1005
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +8 -2
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +10 -1
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +7 -2
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +9 -1
- package/project/plugins/file-plugins/files/flowr-sysdata-file.d.ts +17 -0
- package/project/plugins/file-plugins/files/flowr-sysdata-file.js +40 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -1
- package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.d.ts +58 -0
- package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.js +95 -0
- package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.d.ts +23 -0
- package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +33 -72
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +17 -15
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +20 -37
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +29 -53
- package/project/plugins/package-version-plugins/package.js +2 -1
- package/project/plugins/plugin-registry.d.ts +3 -1
- package/project/plugins/plugin-registry.js +11 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +20 -4
- package/project/sigdb/build.d.ts +9 -15
- package/project/sigdb/build.js +63 -42
- package/project/sigdb/decode.d.ts +10 -4
- package/project/sigdb/decode.js +60 -21
- package/project/sigdb/memory-source.d.ts +4 -0
- package/project/sigdb/memory-source.js +8 -0
- package/project/sigdb/reader.d.ts +50 -100
- package/project/sigdb/reader.js +84 -105
- package/project/sigdb/schema.d.ts +102 -26
- package/project/sigdb/schema.js +14 -6
- package/project/sigdb/signature-db.d.ts +4 -0
- package/project/sigdb/signature-db.js +8 -1
- package/queries/base-query-format.d.ts +7 -0
- package/queries/base-query-format.js +29 -0
- package/queries/catalog/absint-query/absint-query-executor.js +8 -6
- package/queries/catalog/absint-query/absint-query-format.d.ts +20 -9
- package/queries/catalog/absint-query/absint-query-format.js +32 -19
- package/queries/catalog/call-context-query/call-context-query-executor.js +3 -3
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-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.js +33 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +2 -2
- package/queries/catalog/dependencies-query/function-info/derived-functions.js +14 -4
- package/queries/catalog/dependencies-query/function-info/read-functions.js +7 -121
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +2 -2
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +4 -46
- package/queries/catalog/dependencies-query/function-info/write-functions.js +3 -76
- package/queries/catalog/dependencies-query/implicit-echo.js +2 -2
- package/queries/catalog/dependencies-query/link-devices.d.ts +2 -2
- package/queries/catalog/dependencies-query/link-devices.js +6 -7
- package/queries/catalog/dice-query/dice-query-executor.js +1 -1
- package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
- package/queries/catalog/does-call-query/does-call-query-executor.js +4 -0
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -1
- package/queries/catalog/files-query/files-query-format.d.ts +1 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +1 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -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/input-sources-query/input-source-functions.d.ts +1 -1
- package/queries/catalog/input-sources-query/input-source-functions.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -17
- package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -27
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +3 -8
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -11
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +4 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +60 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +35 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +63 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -6
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +3 -8
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -11
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +3 -8
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -12
- package/queries/catalog/linter-query/linter-query-format.d.ts +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-format.d.ts +1 -1
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +3 -8
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -14
- 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/signature-query/signature-query-executor.d.ts +9 -9
- package/queries/catalog/signature-query/signature-query-executor.js +104 -95
- package/queries/catalog/signature-query/signature-query-format.d.ts +34 -8
- package/queries/catalog/signature-query/signature-query-format.js +16 -4
- package/queries/catalog/signature-query/signature-query-render.js +24 -4
- package/queries/catalog/slice-query-options.d.ts +14 -0
- package/queries/catalog/slice-query-options.js +15 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +2 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.js +7 -5
- package/queries/query-function-filter.d.ts +8 -3
- package/queries/query-function-filter.js +16 -6
- package/queries/query.d.ts +38 -38
- package/queries/query.js +30 -4
- package/r-bridge/lang-4.x/ast/model/model.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/model.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +17 -9
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +35 -27
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -22
- package/reconstruct/reconstruct.d.ts +9 -20
- package/reconstruct/reconstruct.js +66 -28
- package/search/flowr-search-filters.d.ts +7 -6
- package/search/flowr-search-filters.js +6 -4
- package/search/search-executor/search-enrichers.d.ts +10 -10
- package/search/search-executor/search-enrichers.js +32 -3
- package/search/search-executor/search-transformer.js +15 -23
- package/slicing/criterion/parse.js +2 -12
- package/slicing/static/slice-call.js +1 -8
- package/slicing/static/static-slicer.js +1 -1
- package/util/collections/bimap.js +14 -6
- package/util/objects.js +16 -17
- package/util/r-value.d.ts +5 -4
- package/util/record.d.ts +38 -3
- package/util/record.js +48 -1
- package/util/simple-df/dfg-ascii.js +1 -1
- package/util/text/name-rank.js +8 -2
- package/util/text/strings.d.ts +5 -0
- package/util/text/strings.js +10 -0
- package/util/version.js +2 -2
- package/abstract-interpretation/absint-visitor.d.ts +0 -223
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +0 -19
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +0 -151
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +0 -287
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +0 -1096
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +0 -15
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +0 -207
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +0 -6
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +0 -25
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +0 -31
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +0 -56
|
@@ -13,14 +13,24 @@ const nse_1 = require("./nse");
|
|
|
13
13
|
const deferred_1 = require("./deferred");
|
|
14
14
|
const vertex_2 = require("../../../../graph/vertex");
|
|
15
15
|
const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
16
|
+
const retriever_1 = require("../../../../../r-bridge/retriever");
|
|
17
|
+
const happens_before_1 = require("../../../../../control-flow/happens-before");
|
|
18
|
+
const logic_1 = require("../../../../../util/logic");
|
|
16
19
|
/** Calls capturing a language object. */
|
|
17
20
|
const CapturingProcessors = [built_in_proc_name_1.BuiltInProcName.Quote];
|
|
21
|
+
/** Calls whose result is a language object although they read their arguments like any other call. */
|
|
22
|
+
const CapturingCalls = new Set(['expression']);
|
|
18
23
|
/** Calls capturing an expression as a promise, forced at some later read of the variable they bind. */
|
|
19
24
|
const DelayingCalls = new Set(['delayedAssign']);
|
|
20
25
|
/** Calls evaluating one. */
|
|
21
26
|
const EvaluatingProcessors = [built_in_proc_name_1.BuiltInProcName.Eval];
|
|
22
|
-
/**
|
|
23
|
-
const
|
|
27
|
+
/** Calls evaluating their own unevaluated argument, in a frame of their own. */
|
|
28
|
+
const EvaluatingElsewhereCalls = new Set(['evalq']);
|
|
29
|
+
/**
|
|
30
|
+
* How a value reaches its use: `DefinedByOnCall` is the hop from a parameter to its argument, and an argument
|
|
31
|
+
* counts because a call handing back one of them, a container included, must not hide the capture inside.
|
|
32
|
+
*/
|
|
33
|
+
const ValueFlow = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall | edge_1.EdgeType.Returns | edge_1.EdgeType.Argument;
|
|
24
34
|
function hasOrigin(vertex, of) {
|
|
25
35
|
return vertex.origin !== 'unnamed' && vertex.origin.some(o => of.includes(o));
|
|
26
36
|
}
|
|
@@ -35,10 +45,19 @@ function hasOrigin(vertex, of) {
|
|
|
35
45
|
*/
|
|
36
46
|
exports.Quoted = {
|
|
37
47
|
name: 'Quoted',
|
|
38
|
-
/** The
|
|
48
|
+
/** The expressions a capturing call holds on to. */
|
|
39
49
|
capturedBy(graph, id) {
|
|
40
50
|
const vertex = graph.getVertex(id);
|
|
41
|
-
|
|
51
|
+
if (!vertex_1.FunctionCallVertex.is(vertex)) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
else if (hasOrigin(vertex, CapturingProcessors)) {
|
|
55
|
+
return capturedArgumentsOf(graph, id, true);
|
|
56
|
+
}
|
|
57
|
+
else if (CapturingCalls.has(identifier_1.Identifier.getName(vertex.name))) {
|
|
58
|
+
return capturedArgumentsOf(graph, id, false);
|
|
59
|
+
}
|
|
60
|
+
return [];
|
|
42
61
|
},
|
|
43
62
|
/** Every expression the value at `id` may hold, with the call that captured it. Several is normal. */
|
|
44
63
|
sourcesOf(graph, id) {
|
|
@@ -48,8 +67,10 @@ exports.Quoted = {
|
|
|
48
67
|
while (pending.length > 0) {
|
|
49
68
|
const current = pending.pop();
|
|
50
69
|
const captured = exports.Quoted.capturedBy(graph, current);
|
|
51
|
-
if (captured
|
|
52
|
-
|
|
70
|
+
if (captured.length > 0) {
|
|
71
|
+
for (const expr of captured) {
|
|
72
|
+
found.push({ expr, at: current });
|
|
73
|
+
}
|
|
53
74
|
continue;
|
|
54
75
|
}
|
|
55
76
|
for (const [target, edge] of graph.outgoingEdges(current) ?? graph_1.NoEdges) {
|
|
@@ -70,6 +91,7 @@ exports.Quoted = {
|
|
|
70
91
|
*/
|
|
71
92
|
finalize(graph, idMap, controlFlow) {
|
|
72
93
|
let names = undefined;
|
|
94
|
+
let bindings = undefined;
|
|
73
95
|
let cfg = null;
|
|
74
96
|
const cfgOnce = () => (cfg === null ? (cfg = controlFlow()) : cfg);
|
|
75
97
|
const masking = [];
|
|
@@ -79,18 +101,22 @@ exports.Quoted = {
|
|
|
79
101
|
masking.push(masks);
|
|
80
102
|
}
|
|
81
103
|
if (DelayingCalls.has(identifier_1.Identifier.getName(vertex.name))) {
|
|
82
|
-
const promise =
|
|
104
|
+
const promise = capturedArgumentsOf(graph, id, true)[0];
|
|
83
105
|
const binding = promise === undefined ? undefined : boundBy(graph, id);
|
|
84
106
|
if (promise !== undefined) {
|
|
85
107
|
names ??= deferred_1.Deferred.indexOf(graph, idMap);
|
|
86
108
|
const flow = binding === undefined ? undefined : cfgOnce();
|
|
87
109
|
const sites = flow === undefined || binding === undefined ? undefined : deferred_1.Deferred.forcedAt(graph, binding, flow);
|
|
88
110
|
deferred_1.Deferred.link(graph, promise, names, idMap, flow !== undefined && sites?.length && binding !== undefined ? { cfg: flow, sites, binding } : undefined);
|
|
111
|
+
if (binding !== undefined) {
|
|
112
|
+
linkForcesToPromise(graph, binding, promise);
|
|
113
|
+
}
|
|
89
114
|
}
|
|
90
115
|
}
|
|
91
|
-
else if (
|
|
116
|
+
else if (hasOrigin(vertex, EvaluatingProcessors) || EvaluatingElsewhereCalls.has(identifier_1.Identifier.getName(vertex.name))) {
|
|
92
117
|
names ??= deferred_1.Deferred.indexOf(graph, idMap);
|
|
93
|
-
|
|
118
|
+
bindings ??= bindingsOf(graph, idMap);
|
|
119
|
+
resolveEvaluation(graph, vertex, idMap, names, bindings, cfgOnce());
|
|
94
120
|
}
|
|
95
121
|
else {
|
|
96
122
|
for (const escaped of escapingArguments(graph, id)) {
|
|
@@ -112,37 +138,127 @@ function boundBy(graph, id) {
|
|
|
112
138
|
}
|
|
113
139
|
return undefined;
|
|
114
140
|
}
|
|
115
|
-
/**
|
|
116
|
-
function
|
|
141
|
+
/** Every read of the delayed name takes the promised expression's value, so all of them get the link, not just whichever forces it first. */
|
|
142
|
+
function linkForcesToPromise(graph, binding, promise) {
|
|
143
|
+
for (const [reader, edge] of graph.ingoingEdges(binding) ?? graph_1.NoEdges) {
|
|
144
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) && reader !== promise) {
|
|
145
|
+
graph.addEdge(reader, promise, edge_1.EdgeType.Reads);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The arguments a call captures: the ones it marked as unevaluated, or, for a call that reads its arguments
|
|
151
|
+
* and still hands back the language object they form, all of them.
|
|
152
|
+
*/
|
|
153
|
+
function capturedArgumentsOf(graph, id, marked) {
|
|
154
|
+
const captured = [];
|
|
117
155
|
for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
|
|
118
|
-
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Argument) && edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation)) {
|
|
119
|
-
|
|
156
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Argument) && (!marked || edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation))) {
|
|
157
|
+
captured.push(target);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return captured;
|
|
161
|
+
}
|
|
162
|
+
/** Every name a definition binds, the string-named ones an `assign` creates included. */
|
|
163
|
+
function bindingsOf(graph, idMap) {
|
|
164
|
+
const bindings = new Map();
|
|
165
|
+
for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
|
|
166
|
+
const name = node_id_1.NodeId.recoverName(id, idMap);
|
|
167
|
+
if (name === undefined) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const key = identifier_1.Identifier.getName((0, retriever_1.removeRQuotes)(name));
|
|
171
|
+
const known = bindings.get(key);
|
|
172
|
+
if (known !== undefined) {
|
|
173
|
+
known.push(id);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
bindings.set(key, [id]);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return bindings;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Where the evaluation happens: the call itself, or, for one inside a closure, every call of that closure (those
|
|
183
|
+
* are the points whose bindings the evaluation sees). `undefined` if a nesting closure is never seen called.
|
|
184
|
+
*/
|
|
185
|
+
function evaluationSites(graph, id) {
|
|
186
|
+
const sites = [];
|
|
187
|
+
let nested = false;
|
|
188
|
+
for (const [definition, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)) {
|
|
189
|
+
if (!vertex.subflow.graph.has(id)) {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
nested = true;
|
|
193
|
+
for (const [caller, edge] of graph.ingoingEdges(definition) ?? graph_1.NoEdges) {
|
|
194
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls)) {
|
|
195
|
+
sites.push(caller);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (!nested) {
|
|
200
|
+
return [id];
|
|
201
|
+
}
|
|
202
|
+
return sites.length > 0 ? sites : undefined;
|
|
203
|
+
}
|
|
204
|
+
/** Whether some point the evaluation may run at can be reached with `definition` in effect. */
|
|
205
|
+
function mayReach(sites, definition, cfg) {
|
|
206
|
+
return cfg === undefined || sites === undefined || sites.some(site => (0, happens_before_1.happensBefore)(cfg, definition, site) !== logic_1.Ternary.Never);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The names the frames we know do not bind: a capture forced inside a closure may see bindings the caller made
|
|
210
|
+
* after the closure was written, so every reachable definition of the name stays a candidate.
|
|
211
|
+
*/
|
|
212
|
+
function linkAgainstAnyBinding(graph, open, bindings, sites, cfg) {
|
|
213
|
+
for (const reference of open) {
|
|
214
|
+
if (reference.name === undefined) {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
for (const definition of bindings.get(identifier_1.Identifier.getName(reference.name)) ?? []) {
|
|
218
|
+
if (definition !== reference.nodeId && mayReach(sites, definition, cfg)) {
|
|
219
|
+
graph.addEdge(reference.nodeId, definition, edge_1.EdgeType.Reads);
|
|
220
|
+
}
|
|
120
221
|
}
|
|
121
222
|
}
|
|
122
|
-
return undefined;
|
|
123
223
|
}
|
|
124
224
|
/** Links a capture handed to an evaluating call, in that call's scope. */
|
|
125
|
-
function resolveEvaluation(graph, call,
|
|
225
|
+
function resolveEvaluation(graph, call, idMap, names, bindings, cfg) {
|
|
126
226
|
const id = call.id;
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
const
|
|
227
|
+
const own = EvaluatingElsewhereCalls.has(identifier_1.Identifier.getName(call.name));
|
|
228
|
+
const sources = own ? capturedArgumentsOf(graph, id, true).map(expr => ({ expr, at: id })) : sourcesHandedTo(graph, call, idMap);
|
|
229
|
+
const environment = call.environment;
|
|
230
|
+
/* a frame of its own says nothing about the bindings here, so every one of them stays possible */
|
|
231
|
+
const elsewhere = own || environment === undefined || evaluatesElsewhere(idMap.get(id));
|
|
232
|
+
const sites = sources.length > 0 ? evaluationSites(graph, id) : undefined;
|
|
130
233
|
for (const { expr, at } of sources) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
234
|
+
if (elsewhere) {
|
|
235
|
+
const forces = cfg === undefined || sites === undefined ? undefined : { cfg, sites, binding: id };
|
|
236
|
+
deferred_1.Deferred.link(graph, expr, { definitions: bindings, uses: names.uses }, idMap, forces);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
const open = (0, linker_1.linkExpressionIn)(graph, expr, environment, idMap);
|
|
240
|
+
/* R falls through to the enclosing scope for names the evaluating frame does not bind */
|
|
241
|
+
const enclosing = open.length > 0 ? graph.getVertex(at)?.environment : undefined;
|
|
242
|
+
const unbound = enclosing === undefined ? open : (0, linker_1.linkInputs)(open, enclosing, [], graph, false);
|
|
243
|
+
linkAgainstAnyBinding(graph, unbound, bindings, sites, cfg);
|
|
244
|
+
deferred_1.Deferred.publish(graph, expr, names, idMap, id, cfg);
|
|
136
245
|
}
|
|
137
246
|
graph.addEdge(id, expr, edge_1.EdgeType.Returns);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
247
|
+
if (!elsewhere) {
|
|
248
|
+
/* the capture said "not evaluated here", and being handed to `eval` settles that it is */
|
|
249
|
+
nse_1.Nse.unmark(graph, at);
|
|
250
|
+
}
|
|
141
251
|
}
|
|
142
|
-
if (sources.length > 0) {
|
|
252
|
+
if (sources.length > 0 && !elsewhere) {
|
|
143
253
|
forgetUnknownSideEffect(graph, id);
|
|
144
254
|
}
|
|
145
255
|
}
|
|
256
|
+
/** The captures the first argument of an evaluating call may carry. */
|
|
257
|
+
function sourcesHandedTo(graph, call, idMap) {
|
|
258
|
+
const argument = call.args.find(a => !graph_1.FunctionArgument.isEmpty(a));
|
|
259
|
+
const reference = argument === undefined ? undefined : unwrapArgument(graph_1.FunctionArgument.getReference(argument), idMap);
|
|
260
|
+
return reference === undefined ? [] : exports.Quoted.sourcesOf(graph, reference);
|
|
261
|
+
}
|
|
146
262
|
/**
|
|
147
263
|
* The arguments of `id` whose promise outlives the call: the callee hands back a closure and never reads the
|
|
148
264
|
* parameter outside it, so R forces them wherever that closure is called, not here. A parameter read in the
|
|
@@ -188,7 +304,7 @@ function unwrapArgument(reference, idMap) {
|
|
|
188
304
|
const node = reference === undefined ? undefined : idMap.get(reference);
|
|
189
305
|
return r_argument_1.RArgument.is(node) ? node.value?.info.id : reference;
|
|
190
306
|
}
|
|
191
|
-
/** `eval(expr, envir)` runs
|
|
307
|
+
/** `eval(expr, envir)` runs in the frame it is given, so the bindings here say nothing. */
|
|
192
308
|
function evaluatesElsewhere(call) {
|
|
193
309
|
return r_function_call_1.RFunctionCall.isNamed(call) && call.arguments.length > 1;
|
|
194
310
|
}
|
|
@@ -27,13 +27,17 @@ const graph_1 = require("../graph/graph");
|
|
|
27
27
|
*/
|
|
28
28
|
function getOriginInDfg(dfg, id) {
|
|
29
29
|
const vtx = dfg.getVertex(id);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
if (vtx === undefined) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
else if (vertex_2.ValueVertex.is(vtx) || vertex_2.FunctionDefinitionVertex.is(vtx)) {
|
|
34
|
+
return [{ type: 4 /* OriginType.ConstantOrigin */, id }];
|
|
35
|
+
}
|
|
36
|
+
else if (dfg.isQuoted(id)) {
|
|
37
|
+
/* a quoted node is never evaluated, so it neither reads, writes, nor calls anything */
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
switch (vtx.tag) {
|
|
37
41
|
case vertex_1.VertexType.VariableDefinition:
|
|
38
42
|
return getVariableDefinitionOrigin(dfg, vtx);
|
|
39
43
|
case vertex_1.VertexType.Use:
|
|
@@ -52,10 +56,19 @@ function getVariableUseOrigin(dfg, use) {
|
|
|
52
56
|
continue;
|
|
53
57
|
}
|
|
54
58
|
const targetVtx = dfg.getVertex(target);
|
|
55
|
-
if (
|
|
56
|
-
|
|
59
|
+
if (node_id_1.NodeId.isBuiltIn(target)) {
|
|
60
|
+
/* a built-in constant such as `pi` carries a value vertex, a built-in function named as a value has none */
|
|
61
|
+
origins.push(vertex_2.ValueVertex.is(targetVtx) ? {
|
|
62
|
+
type: 4 /* OriginType.ConstantOrigin */,
|
|
63
|
+
id: target
|
|
64
|
+
} : {
|
|
65
|
+
type: 3 /* OriginType.BuiltInFunctionOrigin */,
|
|
66
|
+
fn: { name: node_id_1.NodeId.fromBuiltIn(target) },
|
|
67
|
+
id: use.id,
|
|
68
|
+
proc: target
|
|
69
|
+
});
|
|
57
70
|
}
|
|
58
|
-
if (vertex_2.VariableDefinitionVertex.is(targetVtx)) {
|
|
71
|
+
else if (vertex_2.VariableDefinitionVertex.is(targetVtx)) {
|
|
59
72
|
origins.push({
|
|
60
73
|
type: 0 /* OriginType.ReadVariableOrigin */,
|
|
61
74
|
id: target
|
package/dataflow/processor.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Based on a two-way fold, this processor will automatically supply scope information
|
|
3
3
|
*/
|
|
4
|
-
import type { ControlDependency
|
|
4
|
+
import type { ControlDependency } from './info';
|
|
5
|
+
import { DataflowInformation } from './info';
|
|
5
6
|
import type { NormalizedAst, ParentInformation, RNodeWithParent } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
6
7
|
import type { REnvironmentInformation } from './environments/environment';
|
|
7
8
|
import type { RNode } from '../r-bridge/lang-4.x/ast/model/model';
|
package/dataflow/processor.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processDataflowFor = processDataflowFor;
|
|
4
|
+
const info_1 = require("./info");
|
|
5
|
+
const gas_1 = require("../gas");
|
|
4
6
|
/**
|
|
5
7
|
* Originally, dataflow processor was written as a two-way fold, but this produced problems when trying to resolve function calls
|
|
6
8
|
* which require information regarding the calling *and* definition context. While this only is a problem for late bindings as they happen
|
|
@@ -14,6 +16,10 @@ exports.processDataflowFor = processDataflowFor;
|
|
|
14
16
|
* @param data - The initial (/current) information to be passed down
|
|
15
17
|
*/
|
|
16
18
|
function processDataflowFor(current, data) {
|
|
19
|
+
/* a used-up budget prunes the subtree: the fold stops here, and what was built so far stays the result */
|
|
20
|
+
if (gas_1.activeDataflowBudget !== undefined && gas_1.activeDataflowBudget.step()) {
|
|
21
|
+
return info_1.DataflowInformation.initialize(current.info.id, data);
|
|
22
|
+
}
|
|
17
23
|
return data.processors[current.type](current, data);
|
|
18
24
|
}
|
|
19
25
|
//# sourceMappingURL=processor.js.map
|
|
@@ -33,6 +33,8 @@ function explainWritingCode(_shell, ctx) {
|
|
|
33
33
|
### Creating Analyses with _flowR_
|
|
34
34
|
|
|
35
35
|
Nowadays, instances of the ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)} should be used as central frontend to get analysis results from _flowR_.
|
|
36
|
+
The entry points an analysis is written against are re-exported from the package root (\`import { FlowrAnalyzerBuilder } from '@eagleoutice/flowr'\`);
|
|
37
|
+
everything else stays reachable under its own path, as in \`@eagleoutice/flowr/dataflow/graph/graph\`.
|
|
36
38
|
For example, a program slice can be created like this:
|
|
37
39
|
|
|
38
40
|
${ctx.code(staticSliceExample, { dropLinesEnd: 2, dropLinesStart: 1, hideDefinedAt: true })}
|
|
@@ -47,7 +47,7 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify(search, null, 2))}
|
|
|
47
47
|
${collapseResult ? ' <details> <summary style="color:gray">Show Results</summary>' : ''}
|
|
48
48
|
|
|
49
49
|
The query returns the following vetices (all references to \`x\` in the code):
|
|
50
|
-
${result.getElements().map(({ node }) => `<b>${node.info.id} ('${
|
|
50
|
+
${result.getElements().map(({ node }) => `<b>${node.info.id} ('${node_id_1.NodeId.recoverContent(node.info.id, dataflow.graph)}')</b> at L${range_1.SourceRange.format(node.location)}`).join(', ')}
|
|
51
51
|
|
|
52
52
|
${metaInfo}
|
|
53
53
|
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type AbsintAnalysis } from '../abstract-interpretation/absint-inference';
|
|
2
2
|
import { IntervalDomain } from '../abstract-interpretation/domains/interval-domain';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import type { DataflowGraphVertexValue } from '../dataflow/graph/vertex';
|
|
6
|
-
import type { RNumber } from '../r-bridge/lang-4.x/ast/model/nodes/r-number';
|
|
7
|
-
import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
|
+
import type { StateDomain } from '../abstract-interpretation/domains/state-domain';
|
|
4
|
+
import { ValueSemantics } from '../abstract-interpretation/value-semantics';
|
|
8
5
|
import { DocMaker, type DocMakerArgs } from './wiki-mk/doc-maker';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
/** The abstract domains of the interval analysis, i.e. a single interval domain named `interval` */
|
|
7
|
+
export type IntervalDomains = {
|
|
8
|
+
interval: IntervalDomain;
|
|
9
|
+
};
|
|
10
|
+
/** The abstract semantics of the interval analysis for numeric constants, additions, and subtractions */
|
|
11
|
+
export declare const IntervalSemantics: ValueSemantics<StateDomain<IntervalDomain<import("../abstract-interpretation/domains/interval-domain").IntervalLift>>>;
|
|
12
|
+
/** The interval analysis inferring the possible numeric values of the expressions of a program */
|
|
13
|
+
export declare const IntervalAnalysis: AbsintAnalysis<IntervalDomains>;
|
|
17
14
|
export declare class WikiAbsint extends DocMaker<'wiki/Abstract Interpretation.md'> {
|
|
18
15
|
constructor();
|
|
19
16
|
protected text({ ctx }: DocMakerArgs): Promise<string>;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WikiAbsint = exports.
|
|
4
|
-
const
|
|
3
|
+
exports.WikiAbsint = exports.IntervalAnalysis = exports.IntervalSemantics = void 0;
|
|
4
|
+
const absint_inference_1 = require("../abstract-interpretation/absint-inference");
|
|
5
5
|
const abstract_domain_1 = require("../abstract-interpretation/domains/abstract-domain");
|
|
6
6
|
const bounded_set_domain_1 = require("../abstract-interpretation/domains/bounded-set-domain");
|
|
7
7
|
const interval_domain_1 = require("../abstract-interpretation/domains/interval-domain");
|
|
8
8
|
const lattice_1 = require("../abstract-interpretation/domains/lattice");
|
|
9
9
|
const multi_value_state_domain_1 = require("../abstract-interpretation/domains/multi-value-state-domain");
|
|
10
10
|
const shape_inference_1 = require("../abstract-interpretation/data-frame/shape-inference");
|
|
11
|
-
const
|
|
11
|
+
const value_semantics_1 = require("../abstract-interpretation/value-semantics");
|
|
12
12
|
const basic_cfg_guided_visitor_1 = require("../control-flow/basic-cfg-guided-visitor");
|
|
13
|
-
const semantic_cfg_guided_visitor_1 = require("../control-flow/semantic-cfg-guided-visitor");
|
|
14
|
-
const identifier_1 = require("../dataflow/environments/identifier");
|
|
15
13
|
const graph_1 = require("../dataflow/graph/graph");
|
|
16
14
|
const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
|
|
17
15
|
const doc_code_1 = require("./doc-util/doc-code");
|
|
18
16
|
const doc_files_1 = require("./doc-util/doc-files");
|
|
19
17
|
const doc_structure_1 = require("./doc-util/doc-structure");
|
|
20
18
|
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
/** The abstract semantics of the interval analysis for numeric constants, additions, and subtractions */
|
|
20
|
+
exports.IntervalSemantics = new value_semantics_1.ValueSemantics({
|
|
21
|
+
constants: {
|
|
22
|
+
// For numeric constants, the resulting interval consists just of the value of the constant
|
|
23
|
+
number: (state, vertex, ctx, value) => state.set(vertex.id, interval_domain_1.IntervalDomain.from(value.num))
|
|
24
|
+
},
|
|
25
|
+
// We map the numerical operations to the resulting interval after applying the abstract semantics of the operation
|
|
26
|
+
functionCalls: {
|
|
27
|
+
'base::+': applyBinaryOp((left, right) => left.add(right)),
|
|
28
|
+
'base::-': applyBinaryOp((left, right) => left.subtract(right))
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// If an operand does not have an inferred interval, this might not be a numerical operation
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
// We map the numerical operation to the resulting interval after applying the abstract semantics of the operation
|
|
40
|
-
switch (identifier_1.Identifier.getName(call.name)) {
|
|
41
|
-
case '+':
|
|
42
|
-
return this.currentState.set(call.id, left.add(right));
|
|
43
|
-
case '-':
|
|
44
|
-
return this.currentState.set(call.id, left.subtract(right));
|
|
45
|
-
}
|
|
30
|
+
});
|
|
31
|
+
/** The interval analysis inferring the possible numeric values of the expressions of a program */
|
|
32
|
+
exports.IntervalAnalysis = {
|
|
33
|
+
domains: { interval: interval_domain_1.IntervalDomain.top() },
|
|
34
|
+
semantics: { interval: exports.IntervalSemantics }
|
|
35
|
+
};
|
|
36
|
+
/** Creates the abstract semantics of a binary numeric operation, such as `+` or `-` */
|
|
37
|
+
function applyBinaryOp(operation) {
|
|
38
|
+
return (state, vertex, ctx) => {
|
|
39
|
+
if (vertex.args.length !== 2 || !vertex.args.every(graph_1.FunctionArgument.isNotEmpty)) {
|
|
40
|
+
return;
|
|
46
41
|
}
|
|
47
|
-
|
|
42
|
+
const left = ctx.getAbstractValue(vertex.args[0].nodeId, state);
|
|
43
|
+
const right = ctx.getAbstractValue(vertex.args[1].nodeId, state);
|
|
44
|
+
// If an operand does not have an inferred interval, this might not be a numerical operation
|
|
45
|
+
if (left !== undefined && right !== undefined) {
|
|
46
|
+
state.set(vertex.id, operation(left, right));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
48
49
|
}
|
|
49
|
-
exports.IntervalInferenceVisitor = IntervalInferenceVisitor;
|
|
50
50
|
async function inferIntervals() {
|
|
51
51
|
const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder()
|
|
52
52
|
.setEngine('tree-sitter')
|
|
@@ -58,14 +58,14 @@ async function inferIntervals() {
|
|
|
58
58
|
`.trim());
|
|
59
59
|
const ast = await analyzer.normalize();
|
|
60
60
|
const dfg = (await analyzer.dataflow()).graph;
|
|
61
|
-
const cfg = await analyzer.controlflow(
|
|
61
|
+
const cfg = await analyzer.controlflow();
|
|
62
62
|
const ctx = analyzer.inspectContext();
|
|
63
|
-
const inference = new
|
|
63
|
+
const inference = new absint_inference_1.AbstractInterpreter({ controlFlow: cfg, dfg: dfg, normalizedAst: ast, ctx: ctx }, exports.IntervalAnalysis);
|
|
64
64
|
inference.start();
|
|
65
|
-
const result = inference.getEndState();
|
|
66
|
-
return result.
|
|
65
|
+
const result = inference.getEndState('interval');
|
|
66
|
+
return result.entries()
|
|
67
67
|
.map(([id, value]) => `${nodeIdToSlicingCriterion(id, ast.idMap)} -> ${value.toString()}`)
|
|
68
|
-
.join('\n')
|
|
68
|
+
.join('\n');
|
|
69
69
|
}
|
|
70
70
|
function nodeIdToSlicingCriterion(id, idMap) {
|
|
71
71
|
const node = idMap.get(id);
|
|
@@ -117,11 +117,6 @@ In _flowR_, an abstract domain is represented by the class ${ctx.link(abstract_d
|
|
|
117
117
|
* ${ctx.linkM(abstract_domain_1.AbstractDomain, 'widen')} to perform widening with another abstract value to ensure termination of the fixpoint iteration
|
|
118
118
|
* ${ctx.linkM(abstract_domain_1.AbstractDomain, 'narrow')} to perform narrowing with another abstract value to refine the abstract value after widening
|
|
119
119
|
|
|
120
|
-
${(0, doc_structure_1.details)('Class Diagram', `
|
|
121
|
-
All boxes link to their respective implementation in the source code.
|
|
122
|
-
${(0, doc_code_1.codeBlock)('mermaid', ctx.mermaid(abstract_domain_1.AbstractDomain))}
|
|
123
|
-
`.trim())}
|
|
124
|
-
|
|
125
120
|
The ${ctx.link('Top')} and ${ctx.link('Bottom')} symbols can be used to explicitly represent the top or bottom elment of an abstract domain. Additionally, for value abstract domains, there is the ${ctx.link('ValueDomain')} interface that provides the function ${ctx.link('ValueDomain:::satisfies')} to check whether the current abstract value of the abstract domain satisfies a concrete value (see also ${ctx.link('NumericalComparator')} and ${ctx.link('SetComparator')}).
|
|
126
121
|
|
|
127
122
|
_flowR_ already provides different abstract domains for abstract interpretation in ${(0, doc_files_1.linkFlowRSourceFile)('src/abstract-interpretation/domains')}. Many of the abstract domains are generic and can be used for differend kinds of analyses. The existing abstract domains are presented in the following. Some of the listed abstract domains can be expanded to show the inherited abstract domains.
|
|
@@ -139,39 +134,57 @@ ${ctx.code(multiValueExample, { dropLinesStart: 1, dropLinesEnd: 1, hideDefinedA
|
|
|
139
134
|
|
|
140
135
|
${(0, doc_structure_1.section)('Abstract Interpretation', 2, 'abstract-interpretation')}
|
|
141
136
|
|
|
142
|
-
We perform abstract interpretation by forward-traversing the ${ctx.linkPage('wiki/Control Flow Graph', 'control flow graph')} of _flowR_ using an ${ctx.link(
|
|
137
|
+
We perform abstract interpretation by forward-traversing the ${ctx.linkPage('wiki/Control Flow Graph', 'control flow graph')} of _flowR_ using an ${ctx.link(absint_inference_1.AbstractInterpreter)}. For each visited control flow vertex, the abstract interpreter retrieves the current abstract state by joining the abstract states of the predecessors, applies the abstract semantics of the visited control flow vertex to the current state, and updates the abstract state of the currently visited vertex to the current state. The abstract interpreter already handles (delayed) widening at widening points.
|
|
143
138
|
|
|
144
|
-
Joining the predecessors goes through ${ctx.link(`${
|
|
145
|
-
For \`if(u) 3 else 2\` the step onto \`3\` reports the condition \`u\` as the predecessor and the \`if\` as the branch, together with the outcome \`u\` had,
|
|
139
|
+
Joining the predecessors goes through ${ctx.link(`${absint_inference_1.AbstractInterpreter.name}::getPredecessorState`)}, which is handed the branch that was taken to get to the vertex.
|
|
140
|
+
For \`if(u) 3 else 2\` the step onto \`3\` reports the condition \`u\` as the predecessor and the \`if\` as the branch, together with the outcome \`u\` had, which is what the ${ctx.link('AbstractSemantics:::handleConditionBranch')} semantics of a domain are applied to on the way into a branch.
|
|
146
141
|
The other direction is ${ctx.link(`${basic_cfg_guided_visitor_1.BasicCfgGuidedVisitor.name}::getDecidedConstructs`)}: standing on \`u\`, it names the \`if\` that \`u\` decides.
|
|
147
142
|
|
|
148
|
-
The analysis is interprocedural: it steps into what a call dispatches to and continues with the state at the exit points of those functions, using ${ctx.link(`${
|
|
149
|
-
This is what the ${ctx.linkConfig('abstractInterpretation.followCalls')} configuration switches off, and ${ctx.link(`${
|
|
143
|
+
The analysis is interprocedural: it steps into what a call dispatches to and continues with the state at the exit points of those functions, using ${ctx.link(`${absint_inference_1.AbstractInterpreter.name}::enterCall`)}.
|
|
144
|
+
This is what the ${ctx.linkConfig('abstractInterpretation.followCalls')} configuration switches off, and ${ctx.link(`${absint_inference_1.AbstractInterpreter.name}::shouldEnterCall`)} is the hook to decide it per call.
|
|
150
145
|
Each call site hands its own arguments to the parameters of the function it enters, so what a function is worth depends on where it is called, and every definition a call may reach is entered with the state at the call, so what the call is worth is what either of them leaves behind.
|
|
151
146
|
A definition that calls itself is run until what it leaves behind and what its parameters are worth both stop moving: \`shrink(head(x, nrow(x) - 1))\` hands over fewer rows than it was given, so the parameters are as much part of the fixpoint as the result is, and both are widened once the rounds pass the threshold so that they must stop.
|
|
152
147
|
What a call is worth is only known when every way out of every definition it reaches is: a function that leaves a frame behind on one path and something else on another says nothing about its result, the same way \`if(u) df else 42\` does not.
|
|
153
|
-
This is how a ${ctx.link(shape_inference_1.
|
|
148
|
+
This is how a ${ctx.link(shape_inference_1.DataFrameShapeAnalysis)} shape flows through the functions a program defines.
|
|
149
|
+
|
|
150
|
+
An abstract interpretation analysis is described declaratively by an ${ctx.link('AbsintAnalysis')} which is executed using the ${ctx.link(absint_inference_1.AbstractInterpreter)}. An abstract interpretation analysis consists of
|
|
151
|
+
|
|
152
|
+
* \`domains\` — the value abstract domains to infer as a Cartesian product, mapping a name to an instance of the respective abstract domain (the abstract state maps each AST node to the values of _all_ of these domains, so multiple analyses can share a single traversal),
|
|
153
|
+
* \`semantics\` — the ${ctx.link('AbstractSemantics')} to apply for each of these domains, and
|
|
154
|
+
* \`reductions\` — optional reduction functions of the product domain refining the value of one domain based on the values of the others.
|
|
155
|
+
|
|
156
|
+
The ${ctx.link('AbstractSemantics')} for a domain define the abstract semantics of different R constructs with respect to the current abstract state (e.g., ${ctx.link('AbstractSemantics:::handleFunctionCall')}, ${ctx.link('AbstractSemantics:::handleReplacementCall')}, or ${ctx.link('AbstractSemantics:::handleNumberConstant')}). All handlers are optional and receive the current abstract \`state\` to update in place, the dataflow graph vertex of the visited construct, and an ${ctx.link('AbsintContext')} providing access to the analyzed program and to the inferred abstract values (e.g., ${ctx.link('AbsintContext:::getAbstractValue')} to resolve the inferred value of an AST node, which includes resolving symbols, pipes, and if expressions).
|
|
157
|
+
|
|
158
|
+
The abstract semantics for a (non-relational) abstract domain can be defined declaratively using ${ctx.link(value_semantics_1.ValueSemantics)} that receives a record of abstract semantics for constants, function calls, accesses, replacement calls, and condition semantics. Function calls, accesses and replacement calls are dispatched by their qualified name (e.g., \`dplyr::filter\`), so that the semantics of a function are only applied if the called function may actually originate from the expected package. Additionally, ${ctx.link(value_semantics_1.ValueSemantics)} provides default semantics for assignments by assigning the abstract value of the source to the assignment target.
|
|
159
|
+
|
|
160
|
+
After the abstract interpreter is started with ${ctx.linkM(absint_inference_1.AbstractInterpreter, 'start', { hideClass: true })}, it provides the following functions to retrieve the inferred values:
|
|
161
|
+
|
|
162
|
+
* ${ctx.linkM(absint_inference_1.AbstractInterpreter, 'getAbstractValue')} to resolve the inferred abstract value of a domain for an AST node (this includes resolving symbols, pipes, and if expressions)
|
|
163
|
+
* ${ctx.linkM(absint_inference_1.AbstractInterpreter, 'getAbstractState')} to get the inferred abstract state of a domain at an AST node mapping AST nodes to the abstract value of the domain
|
|
164
|
+
* ${ctx.linkM(absint_inference_1.AbstractInterpreter, 'getAbstractTrace')} to get the complete abstract trace mapping AST nodes to abstract states at the respective node
|
|
165
|
+
* ${ctx.linkM(absint_inference_1.AbstractInterpreter, 'getEndState')} to get the inferred abstract state at the end of the program (at the exit points of the control flow graph)
|
|
166
|
+
|
|
167
|
+
For example, if we want to perform a (very basic) interval analysis using abstract interpretation in _flowR_, we can define the following analysis using the ${ctx.link(interval_domain_1.IntervalDomain)}:
|
|
168
|
+
|
|
169
|
+
${ctx.code('IntervalDomains', { hideDefinedAt: true })}
|
|
154
170
|
|
|
155
|
-
|
|
171
|
+
${ctx.code('IntervalSemantics', { hideDefinedAt: true })}
|
|
156
172
|
|
|
157
|
-
|
|
158
|
-
* ${ctx.linkM(absint_visitor_1.AbstractInterpretationVisitor, 'getAbstractState')} to get the inferred abstract state at an AST node mapping AST nodes to abstract values
|
|
159
|
-
* ${ctx.linkM(absint_visitor_1.AbstractInterpretationVisitor, 'getAbstractTrace')} to get the complete abstract trace mapping AST nodes to abstract states at the respective node
|
|
160
|
-
* ${ctx.linkM(absint_visitor_1.AbstractInterpretationVisitor, 'getEndState')} to get the inferred abstract state at the end of the program (at the exit points of the control flow graph)
|
|
173
|
+
${ctx.code('IntervalAnalysis', { hideDefinedAt: true })}
|
|
161
174
|
|
|
162
|
-
|
|
175
|
+
${ctx.code(applyBinaryOp, { hideDefinedAt: true })}
|
|
163
176
|
|
|
164
|
-
|
|
177
|
+
The semantics of the analysis first define the semantics of numeric constants, for which the resulting interval consists just of the value of the constant. We update the abstract state by setting the abstract value of the currently visited constant vertex to this new interval.
|
|
165
178
|
|
|
166
|
-
|
|
179
|
+
In this simple example, we only want to support the addition and subtraction of numeric values. Therefore, we define the semantics of the functions \`base::+\` and \`base::-\` to apply the abstract semantics of additions and subtractions with respect to the interval domain. For the addition and subtraction, we are only interested in function calls with exactly two non-empty arguments. We first resolve the currently inferred abstract value for the left and right operand of the function call. If we have not inferred a value for one of the operands, this function call might not be a numeric function call and we ignore it. Otherwise, we again update the abstract state by setting the abstract value of the currently visited function call vertex to the abstract value resulting from applying the abstract semantics of the operation to the operands.
|
|
167
180
|
|
|
168
|
-
|
|
181
|
+
The data frame shape inference in ${(0, doc_files_1.linkFlowRSourceFile)('src/abstract-interpretation/data-frame')} provides a more comprehensive example of such an abstract interpretation analysis.
|
|
169
182
|
|
|
170
183
|
If we now want to run the interval inference, we can write the following code:
|
|
171
184
|
|
|
172
185
|
${ctx.code(inferIntervals, { dropLinesStart: 1, dropLinesEnd: 5, hideDefinedAt: true })}
|
|
173
186
|
|
|
174
|
-
We first need a ${ctx.linkPage('wiki/Analyzer', 'flowR analyzer')} (in this case, using the ${ctx.linkPage('wiki/Engines', 'tree-sitter engine')}). In this example, we want to analyze a small example code that assigns \`42\` to the variable \`x\`, randomly assigns \`6\` or \`12\` to the variable \`y\`, and assignes the sum of \`x\` and \`y\` to the variable \`z\`. For the abstract
|
|
187
|
+
We first need a ${ctx.linkPage('wiki/Analyzer', 'flowR analyzer')} (in this case, using the ${ctx.linkPage('wiki/Engines', 'tree-sitter engine')}). In this example, we want to analyze a small example code that assigns \`42\` to the variable \`x\`, randomly assigns \`6\` or \`12\` to the variable \`y\`, and assignes the sum of \`x\` and \`y\` to the variable \`z\`. For the abstract interpreter, we need to retrieve the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')}, ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}, ${ctx.linkPage('wiki/Control Flow Graph', 'control flow graph')}, and context of the flowR anaylzer. For performance reasons, we request the control flow graph without simplification passes; it is a view on the dataflow graph and is only projected once something walks it. We then create a new ${ctx.link(absint_inference_1.AbstractInterpreter)} using the control flow graph, dataflow graph, normalized AST, and analyzer context together with our interval analysis, and start the abstract interpreter using ${ctx.linkM(absint_inference_1.AbstractInterpreter, 'start', { hideClass: true })}. After the abstract interpreter is finished, we retrieve the inferred abstract state at the end of the program using ${ctx.linkM(absint_inference_1.AbstractInterpreter, 'getEndState', { hideClass: true })}.
|
|
175
188
|
|
|
176
189
|
If we now print the inferred abstract state at the end of the program, we get the following output:
|
|
177
190
|
|
|
@@ -193,7 +206,8 @@ The test function ${ctx.link('testInferredValues')} combines both tests: it perf
|
|
|
193
206
|
* \`shell\` — the R shell to use for the validation test
|
|
194
207
|
* \`code\` — the R code to analyse and (for validation) to execute
|
|
195
208
|
* \`expected\` — an ${ctx.link('InferenceTestCase')} mapping slicing criteria to expected abstract values, or a list of slicing criteria for validation-only tests
|
|
196
|
-
* \`
|
|
209
|
+
* \`createAnalysis\` — a function creating the ${ctx.link('AbsintAnalysis')} to perform
|
|
210
|
+
* \`domain\` — the name of the abstract domain of the analysis to compare the inferred values for
|
|
197
211
|
* \`createOutputCode\` — a function \`(marker, symbol) => string\` that returns R code printing the analyzed properties of \`symbol\` in a line prefixed with \`marker\`
|
|
198
212
|
* \`parseOutput\` — a function \`(line) => Domain | undefined\` that parses the output line produced by \`createOutputCode\` into an abstract domain value
|
|
199
213
|
* \`options\` — optional inference test settings (_flowR_ configuration, additional project files, domain matching type, \`skipRun\`, etc.)
|
|
@@ -205,7 +219,7 @@ When comparing inferred values with expected values, the framework supports two
|
|
|
205
219
|
* ${ctx.link('DomainMatchingType::Equal')} — the inferred value must equal the expected value (default for assertion tests)
|
|
206
220
|
* ${ctx.link('DomainMatchingType::Overapproximation')} — the inferred value must be an over-approximation of the actual value via ${ctx.linkM(abstract_domain_1.AbstractDomain, 'leq')} (default for validation tests)
|
|
207
221
|
|
|
208
|
-
For example, to use the test framework for the ${ctx.link(
|
|
222
|
+
For example, to use the test framework for the ${ctx.link('IntervalAnalysis')} defined above, we first define how to print the properties of an actual numeric scalar value in R using \`createOutputCode\` and how to parse it into an abstract domain value using \`parseOutput\`. Then, we can use ${ctx.link('testInferredValues')} to create a test for our code example by providing a test name, an R shell, the code to test, the test locations as slicing criteria with expected values, the analysis and the name of its abstract domain, and our \`createOutputCode\` and \`parseOutput\` function:
|
|
209
223
|
|
|
210
224
|
${ctx.codeFile('test/functionality/abstract-interpretation/wiki-absint.ts', { skipImports: true, hideDefinedAt: true })}
|
|
211
225
|
|