@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
|
@@ -63,6 +63,23 @@ exports.Identifier = {
|
|
|
63
63
|
}
|
|
64
64
|
return ids;
|
|
65
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* The names as every one of the given packages exports them, for a function one package owns and others
|
|
68
|
+
* re-export unchanged (`dplyr::%>%` is `magrittr::%>%`).
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* Identifier.fromAllIn(['magrittr', 'dplyr'], ['%>%']) // [['%>%', 'magrittr'], ['%>%', 'dplyr']]
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
fromAllIn(namespaces, names) {
|
|
75
|
+
const ids = [];
|
|
76
|
+
for (const namespace of namespaces) {
|
|
77
|
+
for (const name of names) {
|
|
78
|
+
ids.push([name, namespace]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return ids;
|
|
82
|
+
},
|
|
66
83
|
/**
|
|
67
84
|
* Verify whether an unknown element has a valid identifier shape!
|
|
68
85
|
*/
|
|
@@ -240,7 +257,8 @@ exports.Identifier = {
|
|
|
240
257
|
return origin.fn.name;
|
|
241
258
|
}
|
|
242
259
|
}
|
|
243
|
-
else {
|
|
260
|
+
else if (!node_id_1.NodeId.isBuiltIn(origin.id)) {
|
|
261
|
+
/* a read that lands on a built-in (e.g. the constant `pi`) is no user definition and must not block step 3 */
|
|
244
262
|
sawUserDefinition = true;
|
|
245
263
|
}
|
|
246
264
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ArgProps, type BuiltInFnInfo, CallProps, type FnSig, type PropSelector, type SemanticCallTags, type StatedProps } from './built-in-props';
|
|
2
2
|
import type { BuiltIns } from './built-in';
|
|
3
3
|
import type { BuiltInDefinition, BuiltInDefinitions } from './built-in-config';
|
|
4
4
|
import type { REnvironmentInformation } from './environment';
|
|
5
5
|
import { Identifier } from './identifier';
|
|
6
6
|
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import type { PackageSignatureSource } from '../../project/sigdb/reader';
|
|
8
|
+
import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
8
9
|
import type { DataflowInformation } from '../info';
|
|
9
10
|
/**
|
|
10
11
|
* Where to look up what flowR knows about a function, in that order:
|
|
@@ -27,6 +28,11 @@ export interface FnPropsSource {
|
|
|
27
28
|
* in the analyzed code, which shadows any built-in.
|
|
28
29
|
*/
|
|
29
30
|
export declare function queryFnProps(name: Identifier, { environment, builtIns, signatures, version }: FnPropsSource): BuiltInFnInfo | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* How to ask what flowR states about a built-in, answering every name once. The analyzer context decides, so a
|
|
33
|
+
* configured or overwritten built-in is what answers; without one the defaults do.
|
|
34
|
+
*/
|
|
35
|
+
export declare function builtInLookup(ctx?: ReadOnlyFlowrAnalyzerContext): (name: Identifier) => BuiltInFnInfo | undefined;
|
|
30
36
|
/** What flowR states about the call `id` makes, together with the name the call resolved to. */
|
|
31
37
|
export declare function callFnProps(id: NodeId, { graph, environment }: Pick<DataflowInformation, 'graph' | 'environment'>): (BuiltInFnInfo & {
|
|
32
38
|
name: Identifier;
|
|
@@ -40,11 +46,13 @@ export declare function inferFnProps(src: PackageSignatureSource, pkg: string, n
|
|
|
40
46
|
/** The identifiers a definition registers, with the suffixes of a replacement spelled out. */
|
|
41
47
|
export declare function builtInNames(definition: BuiltInDefinition): Identifier[];
|
|
42
48
|
/** One built-in as the {@link BuiltInIndex} sees it: the name it is registered under and what flowR states about it. */
|
|
43
|
-
export interface BuiltInEntry {
|
|
49
|
+
export interface BuiltInEntry extends StatedProps {
|
|
44
50
|
/** the identifier the built-in is registered under, with a replacement's suffix spelled out */
|
|
45
51
|
readonly name: Identifier;
|
|
46
52
|
/** the {@link CallProp} bits the definition states, `undefined` when it states none */
|
|
47
53
|
readonly props?: CallProps;
|
|
54
|
+
/** the {@link SemanticCallTags} entries the definition states, `undefined` when it states none */
|
|
55
|
+
readonly tags?: SemanticCallTags;
|
|
48
56
|
/** the declared parameters and what each of their arguments is used for */
|
|
49
57
|
readonly sig?: FnSig;
|
|
50
58
|
/** whether the value solver can fold a call of this built-in to a constant */
|
|
@@ -83,18 +91,18 @@ export declare class BuiltInIndex {
|
|
|
83
91
|
static ofEnvironment(builtIns: BuiltIns): BuiltInIndex;
|
|
84
92
|
/** answers are keyed by what was asked, as every caller asks the same handful of questions over and over */
|
|
85
93
|
private cached;
|
|
86
|
-
/** Every built-in
|
|
87
|
-
with(props:
|
|
94
|
+
/** Every built-in carrying at least one property of `props`, like {@link SemanticCallTag.File} for the file calls. */
|
|
95
|
+
with(props: PropSelector): readonly Identifier[];
|
|
88
96
|
/**
|
|
89
|
-
* Every built-in
|
|
97
|
+
* Every built-in carrying *every* property of `props`, for the questions a single one cannot answer,
|
|
90
98
|
* like {@link FileInputProps} for the calls that read a file rather than only write one.
|
|
91
99
|
*/
|
|
92
|
-
withAll(props:
|
|
100
|
+
withAll(props: PropSelector): readonly Identifier[];
|
|
93
101
|
/**
|
|
94
|
-
* Every built-in that states its props but carries
|
|
102
|
+
* Every built-in that states its props but carries none of `props`. With {@link InputProps} this yields
|
|
95
103
|
* the calls that derive their result from their arguments alone.
|
|
96
104
|
*/
|
|
97
|
-
without(props:
|
|
105
|
+
without(props: PropSelector): readonly Identifier[];
|
|
98
106
|
/** Every built-in flowR states computes a result and nothing else ({@link CallProp.Pure}). */
|
|
99
107
|
get pure(): readonly Identifier[];
|
|
100
108
|
/** Every built-in the value solver can fold to a constant (the ones with a `evalHandler`). */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuiltInIndex = void 0;
|
|
4
4
|
exports.queryFnProps = queryFnProps;
|
|
5
|
+
exports.builtInLookup = builtInLookup;
|
|
5
6
|
exports.callFnProps = callFnProps;
|
|
6
7
|
exports.inferFnProps = inferFnProps;
|
|
7
8
|
exports.builtInNames = builtInNames;
|
|
@@ -43,16 +44,19 @@ function withStatedBuiltIns(definitions, environment) {
|
|
|
43
44
|
return replaced ?? definitions;
|
|
44
45
|
}
|
|
45
46
|
function ofDefinitions(definitions) {
|
|
46
|
-
let sig
|
|
47
|
+
let sig;
|
|
48
|
+
let stated = {};
|
|
49
|
+
let frame;
|
|
47
50
|
for (const d of definitions ?? []) {
|
|
48
51
|
if (d.type !== identifier_1.ReferenceType.BuiltInFunction) {
|
|
49
52
|
continue;
|
|
50
53
|
}
|
|
51
54
|
const info = d.config;
|
|
52
55
|
sig ??= info?.sig;
|
|
53
|
-
|
|
56
|
+
stated = built_in_props_1.CallProps.join(stated, info);
|
|
57
|
+
frame = info?.frame === undefined ? frame : (frame ?? 0) | info.frame;
|
|
54
58
|
}
|
|
55
|
-
return sig === undefined &&
|
|
59
|
+
return sig === undefined && frame === undefined && !built_in_props_1.CallProps.hasAny(stated) ? undefined : { sig, ...stated, frame };
|
|
56
60
|
}
|
|
57
61
|
/**
|
|
58
62
|
* What flowR knows about the function `name`: what the built-in definitions state, filled up with what the
|
|
@@ -81,7 +85,22 @@ function queryFnProps(name, { environment, builtIns, signatures, version }) {
|
|
|
81
85
|
if (known === undefined) {
|
|
82
86
|
return info;
|
|
83
87
|
}
|
|
84
|
-
return { sig: info?.sig ?? known.sig,
|
|
88
|
+
return { sig: info?.sig ?? known.sig, ...built_in_props_1.CallProps.join(info, known), frame: info?.frame };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* How to ask what flowR states about a built-in, answering every name once. The analyzer context decides, so a
|
|
92
|
+
* configured or overwritten built-in is what answers; without one the defaults do.
|
|
93
|
+
*/
|
|
94
|
+
function builtInLookup(ctx) {
|
|
95
|
+
const environment = ctx?.env.makeCleanEnv();
|
|
96
|
+
const known = new Map();
|
|
97
|
+
return name => {
|
|
98
|
+
const key = identifier_1.Identifier.getName(name);
|
|
99
|
+
if (!known.has(key)) {
|
|
100
|
+
known.set(key, environment === undefined ? BuiltInIndex.default().get(name) : queryFnProps(name, { environment }));
|
|
101
|
+
}
|
|
102
|
+
return known.get(key);
|
|
103
|
+
};
|
|
85
104
|
}
|
|
86
105
|
/** What flowR states about the call `id` makes, together with the name the call resolved to. */
|
|
87
106
|
function callFnProps(id, { graph, environment }) {
|
|
@@ -112,11 +131,11 @@ function inferFnProps(src, pkg, name, version) {
|
|
|
112
131
|
}
|
|
113
132
|
const own = (0, built_in_props_1.fnInfoFromSignature)(fn);
|
|
114
133
|
const known = BuiltInIndex.default();
|
|
115
|
-
let props = own
|
|
134
|
+
let props = own;
|
|
116
135
|
for (const callee of src.transitiveCallees(pkg, name, version) ?? fn.callees) {
|
|
117
|
-
props
|
|
136
|
+
props = built_in_props_1.CallProps.join(props, built_in_props_1.CallProps.filter(known.get(callee), built_in_props_1.PropagatedProps));
|
|
118
137
|
}
|
|
119
|
-
return { sig: own.sig, props };
|
|
138
|
+
return { sig: own.sig, ...props };
|
|
120
139
|
}
|
|
121
140
|
/** The identifiers a definition registers, with the suffixes of a replacement spelled out. */
|
|
122
141
|
function builtInNames(definition) {
|
|
@@ -131,18 +150,23 @@ function entryOfDefinition(definition) {
|
|
|
131
150
|
}
|
|
132
151
|
const info = definition.config;
|
|
133
152
|
const folds = definition.type === 'function' && definition.evalHandler !== undefined;
|
|
134
|
-
return builtInNames(definition).map(name => ({ name, props: info?.props, sig: info?.sig, folds }));
|
|
153
|
+
return builtInNames(definition).map(name => ({ name, props: info?.props, tags: info?.tags, sig: info?.sig, folds }));
|
|
135
154
|
}
|
|
136
155
|
function entriesOfMemory(builtIns) {
|
|
137
156
|
const out = [];
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
157
|
+
/* the index says what flowR *knows*, not what is in scope, so the packages R does not attach on startup
|
|
158
|
+
belong in it as much as the always-on built-ins do -- being gated changes when a name resolves, not
|
|
159
|
+
whether flowR can answer for it */
|
|
160
|
+
for (const memory of [builtIns.builtInMemory, ...builtIns.packageMemory.values()]) {
|
|
161
|
+
for (const [registered, definitions] of memory) {
|
|
162
|
+
for (const d of definitions) {
|
|
163
|
+
if (d.type !== identifier_1.ReferenceType.BuiltInFunction) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const info = d.config;
|
|
167
|
+
/* the memory is keyed by the bare name, the definition keeps the namespace it was declared with */
|
|
168
|
+
out.push({ name: d.name ?? registered, props: info?.props, tags: info?.tags, sig: info?.sig, folds: d.evalHandler !== undefined });
|
|
142
169
|
}
|
|
143
|
-
const info = d.config;
|
|
144
|
-
/* the memory is keyed by the bare name, the definition keeps the namespace it was declared with */
|
|
145
|
-
out.push({ name: d.name ?? registered, props: info?.props, sig: info?.sig, folds: d.evalHandler !== undefined });
|
|
146
170
|
}
|
|
147
171
|
}
|
|
148
172
|
return out;
|
|
@@ -189,23 +213,23 @@ class BuiltInIndex {
|
|
|
189
213
|
}
|
|
190
214
|
return found;
|
|
191
215
|
}
|
|
192
|
-
/** Every built-in
|
|
216
|
+
/** Every built-in carrying at least one property of `props`, like {@link SemanticCallTag.File} for the file calls. */
|
|
193
217
|
with(props) {
|
|
194
|
-
return this.cached(`with:${props}`, e => (
|
|
218
|
+
return this.cached(`with:${built_in_props_1.CallProps.key(props)}`, e => built_in_props_1.CallProps.hasAny(e, props));
|
|
195
219
|
}
|
|
196
220
|
/**
|
|
197
|
-
* Every built-in
|
|
221
|
+
* Every built-in carrying *every* property of `props`, for the questions a single one cannot answer,
|
|
198
222
|
* like {@link FileInputProps} for the calls that read a file rather than only write one.
|
|
199
223
|
*/
|
|
200
224
|
withAll(props) {
|
|
201
|
-
return this.cached(`all:${props}`, e => e
|
|
225
|
+
return this.cached(`all:${built_in_props_1.CallProps.key(props)}`, e => built_in_props_1.CallProps.hasAny(e) && built_in_props_1.CallProps.hasAll(e, props));
|
|
202
226
|
}
|
|
203
227
|
/**
|
|
204
|
-
* Every built-in that states its props but carries
|
|
228
|
+
* Every built-in that states its props but carries none of `props`. With {@link InputProps} this yields
|
|
205
229
|
* the calls that derive their result from their arguments alone.
|
|
206
230
|
*/
|
|
207
231
|
without(props) {
|
|
208
|
-
return this.cached(`without:${props}`, e => e
|
|
232
|
+
return this.cached(`without:${built_in_props_1.CallProps.key(props)}`, e => built_in_props_1.CallProps.hasAny(e) && !built_in_props_1.CallProps.hasAny(e, props));
|
|
209
233
|
}
|
|
210
234
|
/** Every built-in flowR states computes a result and nothing else ({@link CallProp.Pure}). */
|
|
211
235
|
get pure() {
|
|
@@ -17,6 +17,13 @@ function layerSkipped(layer, ns) {
|
|
|
17
17
|
}
|
|
18
18
|
return layer.t === environment_1.EnvType.LoadedNamespace;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* What the built-in environment states about `pkg::name` for a package nothing attached: `pkg::fn` reaches its
|
|
22
|
+
* package in R whether or not it is on the search path, so a namespaced name has to find it here.
|
|
23
|
+
*/
|
|
24
|
+
function statedIn(builtIn, name, ns) {
|
|
25
|
+
return ns === undefined ? undefined : builtIn.namespaces?.get(String(ns))?.get(name);
|
|
26
|
+
}
|
|
20
27
|
const FunctionTargetTypes = identifier_1.ReferenceType.Function | identifier_1.ReferenceType.BuiltInFunction | identifier_1.ReferenceType.Unknown | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Parameter;
|
|
21
28
|
const VariableTargetTypes = identifier_1.ReferenceType.Variable | identifier_1.ReferenceType.Parameter | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Unknown;
|
|
22
29
|
const ConstantTargetTypes = identifier_1.ReferenceType.Constant | identifier_1.ReferenceType.BuiltInConstant | identifier_1.ReferenceType.Unknown;
|
|
@@ -135,7 +142,7 @@ function resolveByTargetType(id, environment, target) {
|
|
|
135
142
|
} while (!current.builtInEnv);
|
|
136
143
|
/* the built-in layer is handed over as it is, except to a value position: `filter(df, c > 2)` means the
|
|
137
144
|
column `c`, never `base::c`, and only with nothing left does `ownDefinitions` have its say */
|
|
138
|
-
const known = current.memory.get(name);
|
|
145
|
+
const known = statedIn(current, name, ns) ?? current.memory.get(name);
|
|
139
146
|
const builtIns = target === identifier_1.ReferenceType.NonFunction ? known?.filter(wantedType) : known;
|
|
140
147
|
if (definitions) {
|
|
141
148
|
return builtIns === undefined || builtIns.length === 0 ? definitions : definitions.concat(builtIns);
|
|
@@ -197,7 +204,7 @@ function resolveByNameAnyType(id, environment) {
|
|
|
197
204
|
}
|
|
198
205
|
current = current.parent;
|
|
199
206
|
} while (!current.builtInEnv);
|
|
200
|
-
const builtIns = current.memory.get(name);
|
|
207
|
+
const builtIns = statedIn(current, name, ns) ?? current.memory.get(name);
|
|
201
208
|
let ret;
|
|
202
209
|
if (definitions) {
|
|
203
210
|
ret = builtIns === undefined ? definitions : definitions.concat(builtIns);
|
|
@@ -16,3 +16,8 @@ export declare function padToCommonScope(base: REnvironmentInformation, next: RE
|
|
|
16
16
|
base: REnvironmentInformation;
|
|
17
17
|
next: REnvironmentInformation;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* The environment's search path with an empty global frame: attached packages stay visible, the global frame's
|
|
21
|
+
* binds do not. Prefer this over `makeCleanEnv` wherever an environment is at hand; the chain below is shared.
|
|
22
|
+
*/
|
|
23
|
+
export declare function cleanEnvOf({ current }: REnvironmentInformation): REnvironmentInformation;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.pushLocalEnvironment = pushLocalEnvironment;
|
|
4
4
|
exports.popLocalEnvironment = popLocalEnvironment;
|
|
5
5
|
exports.padToCommonScope = padToCommonScope;
|
|
6
|
+
exports.cleanEnvOf = cleanEnvOf;
|
|
6
7
|
const environment_1 = require("./environment");
|
|
7
8
|
const assert_1 = require("../../util/assert");
|
|
8
9
|
/**
|
|
@@ -38,4 +39,14 @@ function padToCommonScope(base, next) {
|
|
|
38
39
|
}
|
|
39
40
|
return { base, next };
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* The environment's search path with an empty global frame: attached packages stay visible, the global frame's
|
|
44
|
+
* binds do not. Prefer this over `makeCleanEnv` wherever an environment is at hand; the chain below is shared.
|
|
45
|
+
*/
|
|
46
|
+
function cleanEnvOf({ current }) {
|
|
47
|
+
const inner = environment_1.REnvironment.findGlobal(current);
|
|
48
|
+
const global = new environment_1.Environment(inner.parent).asGlobal();
|
|
49
|
+
global.n = inner.n;
|
|
50
|
+
return { level: 0, current: global };
|
|
51
|
+
}
|
|
41
52
|
//# sourceMappingURL=scoping.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VariableResolve } from '../../../config';
|
|
2
2
|
import type { AstIdMap, RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
|
-
import
|
|
3
|
+
import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import type { REnvironmentInformation } from '../../environments/environment';
|
|
5
5
|
import { Identifier } from '../../environments/identifier';
|
|
6
6
|
import type { DataflowGraph } from '../../graph/graph';
|
|
@@ -35,7 +35,7 @@ const AliasHandler = {
|
|
|
35
35
|
function getFunctionCallAlias(sourceId, dataflow, environment) {
|
|
36
36
|
const vertex = dataflow.getVertex(sourceId);
|
|
37
37
|
/* the lexeme of an infix call like `a %% b` is the whole expression, so we prefer the effective name of the vertex */
|
|
38
|
-
const identifier = vertex_1.FunctionCallVertex.is(vertex) ? vertex.name :
|
|
38
|
+
const identifier = vertex_1.FunctionCallVertex.is(vertex) ? vertex.name : node_id_1.NodeId.recoverName(sourceId, dataflow.idMap);
|
|
39
39
|
if (identifier === undefined) {
|
|
40
40
|
return undefined;
|
|
41
41
|
}
|
|
@@ -48,7 +48,7 @@ function getFunctionCallAlias(sourceId, dataflow, environment) {
|
|
|
48
48
|
function getUseAlias(sourceId, dataflow, environment) {
|
|
49
49
|
const definitions = [];
|
|
50
50
|
// Source is Symbol -> resolve definitions of symbol
|
|
51
|
-
const identifier =
|
|
51
|
+
const identifier = node_id_1.NodeId.recoverName(sourceId, dataflow.idMap);
|
|
52
52
|
if (identifier === undefined) {
|
|
53
53
|
return undefined;
|
|
54
54
|
}
|
|
@@ -312,6 +312,18 @@ function iteratedSequence(id, graph, idMap) {
|
|
|
312
312
|
}
|
|
313
313
|
return sequence;
|
|
314
314
|
}
|
|
315
|
+
/** whether the call may run a built-in as well as a definition of the program, so that what it yields is open */
|
|
316
|
+
function callsBuiltInAndDefinition(edges) {
|
|
317
|
+
let builtIn = false;
|
|
318
|
+
let defined = false;
|
|
319
|
+
for (const [target, edge] of edges) {
|
|
320
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls)) {
|
|
321
|
+
builtIn ||= node_id_1.NodeId.isBuiltIn(target);
|
|
322
|
+
defined ||= !node_id_1.NodeId.isBuiltIn(target);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return builtIn && defined;
|
|
326
|
+
}
|
|
315
327
|
/**
|
|
316
328
|
* Please use {@link resolveIdToValue}
|
|
317
329
|
*
|
|
@@ -378,6 +390,12 @@ function trackAliasesInGraph(id, graph, ctx, idMap, blocked) {
|
|
|
378
390
|
}
|
|
379
391
|
const isFn = t === vertex_1.VertexType.FunctionCall;
|
|
380
392
|
const outgoingEdges = graph.outgoingEdges(id) ?? graph_1.NoEdges;
|
|
393
|
+
if (isFn && callsBuiltInAndDefinition(outgoingEdges)) {
|
|
394
|
+
/* `if(u) toupper <- function(x) "z"`: the call may run the built-in just as well as the definition,
|
|
395
|
+
* and what the two hand back has nothing to do with each other, so following the one we can walk
|
|
396
|
+
* would state the value of a call that may never happen */
|
|
397
|
+
return r_value_1.Top;
|
|
398
|
+
}
|
|
381
399
|
let foundRetuns = false;
|
|
382
400
|
// travel all read and defined-by edges
|
|
383
401
|
for (const [targetId, edge] of outgoingEdges) {
|
|
@@ -169,27 +169,27 @@ export declare const NumericFns: {
|
|
|
169
169
|
};
|
|
170
170
|
readonly bitwAnd: {
|
|
171
171
|
readonly params: readonly ["a", "b"];
|
|
172
|
-
readonly fold: (
|
|
172
|
+
readonly fold: (...args: number[]) => number | undefined;
|
|
173
173
|
};
|
|
174
174
|
readonly bitwOr: {
|
|
175
175
|
readonly params: readonly ["a", "b"];
|
|
176
|
-
readonly fold: (
|
|
176
|
+
readonly fold: (...args: number[]) => number | undefined;
|
|
177
177
|
};
|
|
178
178
|
readonly bitwXor: {
|
|
179
179
|
readonly params: readonly ["a", "b"];
|
|
180
|
-
readonly fold: (
|
|
180
|
+
readonly fold: (...args: number[]) => number | undefined;
|
|
181
181
|
};
|
|
182
182
|
readonly bitwNot: {
|
|
183
183
|
readonly params: readonly ["a"];
|
|
184
|
-
readonly fold: (
|
|
184
|
+
readonly fold: (...args: number[]) => number | undefined;
|
|
185
185
|
};
|
|
186
186
|
readonly bitwShiftL: {
|
|
187
187
|
readonly params: readonly ["a", "n"];
|
|
188
|
-
readonly fold: (a: number, n: number) => number;
|
|
188
|
+
readonly fold: (a: number, n: number) => number | undefined;
|
|
189
189
|
};
|
|
190
190
|
readonly bitwShiftR: {
|
|
191
191
|
readonly params: readonly ["a", "n"];
|
|
192
|
-
readonly fold: (a: number, n: number) => number;
|
|
192
|
+
readonly fold: (a: number, n: number) => number | undefined;
|
|
193
193
|
};
|
|
194
194
|
};
|
|
195
195
|
/**
|
|
@@ -198,5 +198,180 @@ export declare const NumericFns: {
|
|
|
198
198
|
* number, a logical (counting as its `0`/`1`), or a vector of numbers, which folds elementwise. Anything that
|
|
199
199
|
* does not resolve, a result that is not finite, and a vector length mismatch all stay `Top`.
|
|
200
200
|
*/
|
|
201
|
-
|
|
201
|
+
declare function resolveAsNumeric(this: void, args: BuiltInEvalHandlerArgs): Value;
|
|
202
|
+
/**
|
|
203
|
+
* Folding the numeric built-ins, from an operator to `sqrt`.
|
|
204
|
+
*/
|
|
205
|
+
export declare const NumericFold: {
|
|
206
|
+
readonly name: "NumericFold";
|
|
207
|
+
/** every numeric built-in that is folded, see {@link NumericFns} */
|
|
208
|
+
readonly fns: {
|
|
209
|
+
readonly '+': {
|
|
210
|
+
readonly params: readonly ["e1", "e2"];
|
|
211
|
+
readonly fold: (a: number, b?: number) => number;
|
|
212
|
+
};
|
|
213
|
+
readonly '-': {
|
|
214
|
+
readonly params: readonly ["e1", "e2"];
|
|
215
|
+
readonly fold: (a: number, b?: number) => number;
|
|
216
|
+
};
|
|
217
|
+
readonly '*': {
|
|
218
|
+
readonly params: readonly ["e1", "e2"];
|
|
219
|
+
readonly fold: (a: number, b: number) => number;
|
|
220
|
+
};
|
|
221
|
+
readonly '/': {
|
|
222
|
+
readonly params: readonly ["e1", "e2"];
|
|
223
|
+
readonly fold: (a: number, b: number) => number;
|
|
224
|
+
};
|
|
225
|
+
readonly '^': {
|
|
226
|
+
readonly params: readonly ["e1", "e2"];
|
|
227
|
+
readonly fold: (a: number, b: number) => number;
|
|
228
|
+
};
|
|
229
|
+
readonly '**': {
|
|
230
|
+
readonly params: readonly ["e1", "e2"];
|
|
231
|
+
readonly fold: (a: number, b: number) => number;
|
|
232
|
+
};
|
|
233
|
+
readonly '%%': {
|
|
234
|
+
readonly params: readonly ["e1", "e2"];
|
|
235
|
+
readonly fold: typeof mod;
|
|
236
|
+
};
|
|
237
|
+
readonly '%/%': {
|
|
238
|
+
readonly params: readonly ["e1", "e2"];
|
|
239
|
+
readonly fold: (a: number, b: number) => number;
|
|
240
|
+
};
|
|
241
|
+
readonly abs: {
|
|
242
|
+
readonly params: readonly ["x"];
|
|
243
|
+
readonly fold: (x: number) => number;
|
|
244
|
+
};
|
|
245
|
+
readonly sqrt: {
|
|
246
|
+
readonly params: readonly ["x"];
|
|
247
|
+
readonly fold: (x: number) => number;
|
|
248
|
+
};
|
|
249
|
+
readonly floor: {
|
|
250
|
+
readonly params: readonly ["x"];
|
|
251
|
+
readonly fold: (x: number) => number;
|
|
252
|
+
};
|
|
253
|
+
readonly ceiling: {
|
|
254
|
+
readonly params: readonly ["x"];
|
|
255
|
+
readonly fold: (x: number) => number;
|
|
256
|
+
};
|
|
257
|
+
readonly trunc: {
|
|
258
|
+
readonly params: readonly ["x"];
|
|
259
|
+
readonly fold: (x: number) => number;
|
|
260
|
+
};
|
|
261
|
+
readonly sign: {
|
|
262
|
+
readonly params: readonly ["x"];
|
|
263
|
+
readonly fold: (x: number) => number;
|
|
264
|
+
};
|
|
265
|
+
readonly round: {
|
|
266
|
+
readonly params: readonly ["x", "digits"];
|
|
267
|
+
readonly fold: typeof roundHalfEven;
|
|
268
|
+
};
|
|
269
|
+
readonly signif: {
|
|
270
|
+
readonly params: readonly ["x", "digits"];
|
|
271
|
+
readonly fold: (x: number, digits?: number) => number | undefined;
|
|
272
|
+
};
|
|
273
|
+
readonly exp: {
|
|
274
|
+
readonly params: readonly ["x"];
|
|
275
|
+
readonly fold: (x: number) => number;
|
|
276
|
+
};
|
|
277
|
+
readonly expm1: {
|
|
278
|
+
readonly params: readonly ["x"];
|
|
279
|
+
readonly fold: (x: number) => number;
|
|
280
|
+
};
|
|
281
|
+
readonly log: {
|
|
282
|
+
readonly params: readonly ["x", "base"];
|
|
283
|
+
readonly fold: (x: number, base?: number) => number;
|
|
284
|
+
};
|
|
285
|
+
readonly log2: {
|
|
286
|
+
readonly params: readonly ["x"];
|
|
287
|
+
readonly fold: (x: number) => number;
|
|
288
|
+
};
|
|
289
|
+
readonly log10: {
|
|
290
|
+
readonly params: readonly ["x"];
|
|
291
|
+
readonly fold: (x: number) => number;
|
|
292
|
+
};
|
|
293
|
+
readonly log1p: {
|
|
294
|
+
readonly params: readonly ["x"];
|
|
295
|
+
readonly fold: (x: number) => number;
|
|
296
|
+
};
|
|
297
|
+
readonly sin: {
|
|
298
|
+
readonly params: readonly ["x"];
|
|
299
|
+
readonly fold: (x: number) => number;
|
|
300
|
+
};
|
|
301
|
+
readonly cos: {
|
|
302
|
+
readonly params: readonly ["x"];
|
|
303
|
+
readonly fold: (x: number) => number;
|
|
304
|
+
};
|
|
305
|
+
readonly tan: {
|
|
306
|
+
readonly params: readonly ["x"];
|
|
307
|
+
readonly fold: (x: number) => number;
|
|
308
|
+
};
|
|
309
|
+
readonly asin: {
|
|
310
|
+
readonly params: readonly ["x"];
|
|
311
|
+
readonly fold: (x: number) => number;
|
|
312
|
+
};
|
|
313
|
+
readonly acos: {
|
|
314
|
+
readonly params: readonly ["x"];
|
|
315
|
+
readonly fold: (x: number) => number;
|
|
316
|
+
};
|
|
317
|
+
readonly atan: {
|
|
318
|
+
readonly params: readonly ["x"];
|
|
319
|
+
readonly fold: (x: number) => number;
|
|
320
|
+
};
|
|
321
|
+
readonly atan2: {
|
|
322
|
+
readonly params: readonly ["y", "x"];
|
|
323
|
+
readonly fold: (y: number, x: number) => number;
|
|
324
|
+
};
|
|
325
|
+
readonly sinh: {
|
|
326
|
+
readonly params: readonly ["x"];
|
|
327
|
+
readonly fold: (x: number) => number;
|
|
328
|
+
};
|
|
329
|
+
readonly cosh: {
|
|
330
|
+
readonly params: readonly ["x"];
|
|
331
|
+
readonly fold: (x: number) => number;
|
|
332
|
+
};
|
|
333
|
+
readonly tanh: {
|
|
334
|
+
readonly params: readonly ["x"];
|
|
335
|
+
readonly fold: (x: number) => number;
|
|
336
|
+
};
|
|
337
|
+
readonly asinh: {
|
|
338
|
+
readonly params: readonly ["x"];
|
|
339
|
+
readonly fold: (x: number) => number;
|
|
340
|
+
};
|
|
341
|
+
readonly acosh: {
|
|
342
|
+
readonly params: readonly ["x"];
|
|
343
|
+
readonly fold: (x: number) => number;
|
|
344
|
+
};
|
|
345
|
+
readonly atanh: {
|
|
346
|
+
readonly params: readonly ["x"];
|
|
347
|
+
readonly fold: (x: number) => number;
|
|
348
|
+
};
|
|
349
|
+
readonly bitwAnd: {
|
|
350
|
+
readonly params: readonly ["a", "b"];
|
|
351
|
+
readonly fold: (...args: number[]) => number | undefined;
|
|
352
|
+
};
|
|
353
|
+
readonly bitwOr: {
|
|
354
|
+
readonly params: readonly ["a", "b"];
|
|
355
|
+
readonly fold: (...args: number[]) => number | undefined;
|
|
356
|
+
};
|
|
357
|
+
readonly bitwXor: {
|
|
358
|
+
readonly params: readonly ["a", "b"];
|
|
359
|
+
readonly fold: (...args: number[]) => number | undefined;
|
|
360
|
+
};
|
|
361
|
+
readonly bitwNot: {
|
|
362
|
+
readonly params: readonly ["a"];
|
|
363
|
+
readonly fold: (...args: number[]) => number | undefined;
|
|
364
|
+
};
|
|
365
|
+
readonly bitwShiftL: {
|
|
366
|
+
readonly params: readonly ["a", "n"];
|
|
367
|
+
readonly fold: (a: number, n: number) => number | undefined;
|
|
368
|
+
};
|
|
369
|
+
readonly bitwShiftR: {
|
|
370
|
+
readonly params: readonly ["a", "n"];
|
|
371
|
+
readonly fold: (a: number, n: number) => number | undefined;
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
/** What a numeric call amounts to; see {@link resolveAsNumeric}. */
|
|
375
|
+
readonly call: typeof resolveAsNumeric;
|
|
376
|
+
};
|
|
202
377
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NumericFns = void 0;
|
|
4
|
-
exports.resolveAsNumeric = resolveAsNumeric;
|
|
3
|
+
exports.NumericFold = exports.NumericFns = void 0;
|
|
5
4
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
6
5
|
const identifier_1 = require("../../environments/identifier");
|
|
7
6
|
const r_value_1 = require("../../../util/r-value");
|
|
@@ -22,6 +21,32 @@ function roundHalfEven(x, digits = 0) {
|
|
|
22
21
|
function mod(a, b) {
|
|
23
22
|
return a - Math.floor(a / b) * b;
|
|
24
23
|
}
|
|
24
|
+
/** the largest R integer there is; the smallest one is its negation, as `-.Machine$integer.max` is `NA` */
|
|
25
|
+
const IntegerMax = 2147483647;
|
|
26
|
+
/** the value as R's `as.integer` sees it, `undefined` for the ones it answers `NA` for */
|
|
27
|
+
function asInteger(x) {
|
|
28
|
+
const truncated = Math.trunc(x);
|
|
29
|
+
return Number.isFinite(truncated) && Math.abs(truncated) <= IntegerMax ? truncated : undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A `bitw*` fold, which R defines on 32-bit integers: an operand it cannot represent as one and a result that
|
|
33
|
+
* is no integer either (`bitwShiftL(1, 31)`) are `NA` in R, so they fold to nothing here.
|
|
34
|
+
*/
|
|
35
|
+
function bitwise(fold) {
|
|
36
|
+
return (...args) => {
|
|
37
|
+
const ints = args.map(asInteger);
|
|
38
|
+
if (ints.includes(undefined)) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const result = fold(...ints);
|
|
42
|
+
return Math.abs(result) <= IntegerMax ? result : undefined;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** a shift, which R answers `NA` for whenever the number of places is not one of the 32 it knows */
|
|
46
|
+
function bitwiseShift(fold) {
|
|
47
|
+
const shift = bitwise(fold);
|
|
48
|
+
return (a, n) => n >= 0 && n <= 31 ? shift(a, n) : undefined;
|
|
49
|
+
}
|
|
25
50
|
/**
|
|
26
51
|
* Every numeric built-in the value solver folds, operators included: `-` is an entry like `sqrt` is, and both
|
|
27
52
|
* are reached through {@link resolveAsNumeric}. Teaching flowR one more is a line here plus the matching
|
|
@@ -71,13 +96,13 @@ exports.NumericFns = {
|
|
|
71
96
|
asinh: { params: ['x'], fold: Math.asinh },
|
|
72
97
|
acosh: { params: ['x'], fold: Math.acosh },
|
|
73
98
|
atanh: { params: ['x'], fold: Math.atanh },
|
|
74
|
-
/* bit twiddling, which R defines on 32-bit integers
|
|
75
|
-
bitwAnd: { params: ['a', 'b'], fold: (a, b) => a & b },
|
|
76
|
-
bitwOr: { params: ['a', 'b'], fold: (a, b) => a | b },
|
|
77
|
-
bitwXor: { params: ['a', 'b'], fold: (a, b) => a ^ b },
|
|
78
|
-
bitwNot: { params: ['a'], fold: (a) => ~a },
|
|
79
|
-
bitwShiftL: { params: ['a', 'n'], fold: (a, n) => a << n },
|
|
80
|
-
bitwShiftR: { params: ['a', 'n'], fold: (a, n) => a >>> n }
|
|
99
|
+
/* bit twiddling, which R defines on the 32-bit integers, see `bitwise` for what falls outside of them */
|
|
100
|
+
bitwAnd: { params: ['a', 'b'], fold: bitwise((a, b) => a & b) },
|
|
101
|
+
bitwOr: { params: ['a', 'b'], fold: bitwise((a, b) => a | b) },
|
|
102
|
+
bitwXor: { params: ['a', 'b'], fold: bitwise((a, b) => a ^ b) },
|
|
103
|
+
bitwNot: { params: ['a'], fold: bitwise((a) => ~a) },
|
|
104
|
+
bitwShiftL: { params: ['a', 'n'], fold: bitwiseShift((a, n) => a << n) },
|
|
105
|
+
bitwShiftR: { params: ['a', 'n'], fold: bitwiseShift((a, n) => a >>> n) }
|
|
81
106
|
};
|
|
82
107
|
/** the number an operand folds to, with a logical counting as its `0`/`1` just like R would coerce it */
|
|
83
108
|
function numeric(node, args) {
|
|
@@ -160,4 +185,14 @@ function resolveAsNumeric(args) {
|
|
|
160
185
|
/* a number is an exact interval everywhere else in the solver, so the elements are lifted the same way */
|
|
161
186
|
return folded === undefined ? r_value_2.Top : (0, vector_constants_1.vectorFrom)(folded.map(n => (0, interval_constants_1.intervalFrom)(n, n)));
|
|
162
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Folding the numeric built-ins, from an operator to `sqrt`.
|
|
190
|
+
*/
|
|
191
|
+
exports.NumericFold = {
|
|
192
|
+
name: 'NumericFold',
|
|
193
|
+
/** every numeric built-in that is folded, see {@link NumericFns} */
|
|
194
|
+
fns: exports.NumericFns,
|
|
195
|
+
/** What a numeric call amounts to; see {@link resolveAsNumeric}. */
|
|
196
|
+
call: resolveAsNumeric
|
|
197
|
+
};
|
|
163
198
|
//# sourceMappingURL=resolve-numbers.js.map
|