@eagleoutice/flowr 2.14.4 → 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 -313
- package/dataflow/environments/default-builtin-config.js +803 -1012
- package/dataflow/environments/environment.d.ts +26 -49
- package/dataflow/environments/environment.js +34 -47
- package/dataflow/environments/group-generics.d.ts +11 -2
- package/dataflow/environments/group-generics.js +22 -3
- 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 +17 -5
- 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 +49 -4
- 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 +90 -26
- package/project/sigdb/schema.js +12 -6
- 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/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 +5 -10
- package/queries/catalog/signature-query/signature-query-executor.js +87 -93
- package/queries/catalog/signature-query/signature-query-format.d.ts +20 -5
- package/queries/catalog/signature-query/signature-query-format.js +16 -4
- package/queries/catalog/signature-query/signature-query-render.js +18 -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/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
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What a class declaration states across R's object systems (S4, RC, S7, R6) and how declarations relate;
|
|
4
|
+
* which argument means what is configured per built-in in {@link ClassDeclarationConfig}, not guessed.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ClassDeclarations = void 0;
|
|
8
|
+
exports.argFor = argFor;
|
|
9
|
+
exports.classDeclarationOf = classDeclarationOf;
|
|
10
|
+
exports.declaredClasses = declaredClasses;
|
|
11
|
+
exports.superClassesOf = superClassesOf;
|
|
12
|
+
exports.toSigClasses = toSigClasses;
|
|
13
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
14
|
+
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
15
|
+
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
16
|
+
const r_symbol_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
17
|
+
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
18
|
+
const graph_1 = require("../graph/graph");
|
|
19
|
+
const edge_1 = require("../graph/edge");
|
|
20
|
+
const assert_1 = require("../../util/assert");
|
|
21
|
+
const objects_1 = require("../../util/objects");
|
|
22
|
+
const vertex_1 = require("../graph/vertex");
|
|
23
|
+
/** the class name R uses to mark a class as non-instantiable */
|
|
24
|
+
const VirtualClass = 'VIRTUAL';
|
|
25
|
+
/** The argument `ref` names, by name when the call gives one and by position among the unnamed ones otherwise. */
|
|
26
|
+
function argForImpl(args, ref) {
|
|
27
|
+
if (ref === undefined) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
if (ref.name !== undefined) {
|
|
31
|
+
const named = args.find(a => !r_argument_1.RArgument.isEmpty(a) && a.name?.content === ref.name);
|
|
32
|
+
if (named !== undefined && !r_argument_1.RArgument.isEmpty(named)) {
|
|
33
|
+
return named.value;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (ref.idx === undefined) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
let pos = 0;
|
|
40
|
+
for (const a of args) {
|
|
41
|
+
if (r_argument_1.RArgument.isEmpty(a) || a.name !== undefined) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (pos++ === ref.idx) {
|
|
45
|
+
return a.value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The argument `ref` names, by name when the call gives one and by position among the unnamed ones otherwise.
|
|
52
|
+
* Exported so `built-in-s-four.ts` can drop its own copy of this instead of hand-rolling it again; that file
|
|
53
|
+
* already imports {@link ClassArgRef} from here, so the reverse import would cycle.
|
|
54
|
+
* @deprecated use {@link ClassDeclarations.argFor} instead
|
|
55
|
+
*/
|
|
56
|
+
function argFor(args, ref) {
|
|
57
|
+
return exports.ClassDeclarations.argFor(args, ref);
|
|
58
|
+
}
|
|
59
|
+
/** The string a node states literally, `undefined` for anything that is not a literal (a variable, a call, ...). */
|
|
60
|
+
function literal(node) {
|
|
61
|
+
return node !== undefined && r_string_1.RString.is(node) ? node.content.str : undefined;
|
|
62
|
+
}
|
|
63
|
+
/** The character vector a node states: a literal, or the literals of a `c(...)`/`list(...)` around them. */
|
|
64
|
+
function literalVector(node) {
|
|
65
|
+
const values = [];
|
|
66
|
+
const byVariable = [];
|
|
67
|
+
if (node === undefined) {
|
|
68
|
+
return { values, byVariable };
|
|
69
|
+
}
|
|
70
|
+
const collect = (n) => {
|
|
71
|
+
const str = literal(n);
|
|
72
|
+
if (str !== undefined) {
|
|
73
|
+
values.push(str);
|
|
74
|
+
}
|
|
75
|
+
else if (r_symbol_1.RSymbol.is(n)) {
|
|
76
|
+
/* `inherit = Generator` / `parent = Cls`: the name is there, it is just not a string */
|
|
77
|
+
byVariable.push(n.lexeme);
|
|
78
|
+
}
|
|
79
|
+
else if (r_function_call_1.RFunctionCall.isNamed(n)) {
|
|
80
|
+
for (const arg of n.arguments) {
|
|
81
|
+
if (!r_argument_1.RArgument.isEmpty(arg) && arg.value !== undefined) {
|
|
82
|
+
collect(arg.value);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
collect(node);
|
|
88
|
+
return { values, byVariable };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The members a `c(x = "numeric")` / `list(x = ...)` / `representation(...)` argument states, one per named
|
|
92
|
+
* element, plus the bare strings such a call may carry (an RC `fields = c("x", "y")`, or a `"VIRTUAL"` marker).
|
|
93
|
+
*/
|
|
94
|
+
function membersOf(node, ref) {
|
|
95
|
+
const members = [];
|
|
96
|
+
let virtual = false;
|
|
97
|
+
if (node === undefined) {
|
|
98
|
+
return { members, virtual };
|
|
99
|
+
}
|
|
100
|
+
if (!r_function_call_1.RFunctionCall.isNamed(node)) {
|
|
101
|
+
return { members, virtual: literal(node) === VirtualClass };
|
|
102
|
+
}
|
|
103
|
+
for (const arg of node.arguments) {
|
|
104
|
+
if (r_argument_1.RArgument.isEmpty(arg) || arg.value === undefined) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const name = arg.name?.content;
|
|
108
|
+
if (name === undefined) {
|
|
109
|
+
/* an unnamed entry names a member itself (`fields = c("x")`), unless it is the VIRTUAL marker */
|
|
110
|
+
const bare = literal(arg.value);
|
|
111
|
+
if (bare === VirtualClass) {
|
|
112
|
+
virtual = true;
|
|
113
|
+
}
|
|
114
|
+
else if (bare !== undefined) {
|
|
115
|
+
members.push((0, objects_1.compactRecord)({ name: bare, visibility: ref.visibility, method: ref.methods ? true : undefined }));
|
|
116
|
+
}
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
/* S7 states a property's class as the `class_numeric` object, S4 as the `"numeric"` string; both name it */
|
|
120
|
+
const type = ref.typed ? literal(arg.value) ?? (r_symbol_1.RSymbol.is(arg.value) ? arg.value.lexeme : undefined) : undefined;
|
|
121
|
+
const isMethod = ref.methods === true || r_function_definition_1.RFunctionDefinition.is(arg.value);
|
|
122
|
+
members.push((0, objects_1.compactRecord)({ name, type, method: isMethod ? true : undefined, visibility: ref.visibility }));
|
|
123
|
+
}
|
|
124
|
+
return { members, virtual };
|
|
125
|
+
}
|
|
126
|
+
/** Whether an argument states a literal `TRUE`. */
|
|
127
|
+
function isTrue(node) {
|
|
128
|
+
return node?.lexeme === 'TRUE' || node?.lexeme === 'T';
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Reads the {@link ClassDeclaration} a call states, following the argument mapping its built-in declares.
|
|
132
|
+
* An argument that resolves to no literal contributes a {@link ClassDeclaration.byVariable|by-variable} name, or nothing.
|
|
133
|
+
*/
|
|
134
|
+
function classDeclarationOfImpl(config, args) {
|
|
135
|
+
const byVariable = [];
|
|
136
|
+
const nameNode = argForImpl(args, config.nameArg);
|
|
137
|
+
const name = literal(nameNode);
|
|
138
|
+
if (name === undefined && nameNode !== undefined && r_symbol_1.RSymbol.is(nameNode)) {
|
|
139
|
+
byVariable.push(nameNode.lexeme);
|
|
140
|
+
}
|
|
141
|
+
const parents = literalVector(argForImpl(args, config.containsArg));
|
|
142
|
+
byVariable.push(...parents.byVariable);
|
|
143
|
+
const contains = parents.values.filter(c => c !== VirtualClass);
|
|
144
|
+
let virtual = parents.values.includes(VirtualClass) || isTrue(argForImpl(args, config.virtualArg));
|
|
145
|
+
const members = [];
|
|
146
|
+
for (const ref of config.memberArgs ?? []) {
|
|
147
|
+
const found = membersOf(argForImpl(args, ref), ref);
|
|
148
|
+
members.push(...found.members);
|
|
149
|
+
virtual ||= found.virtual;
|
|
150
|
+
}
|
|
151
|
+
const union = config.unionArg === undefined ? undefined : literalVector(argForImpl(args, config.unionArg)).values;
|
|
152
|
+
const prototype = config.prototypeArg === undefined ? []
|
|
153
|
+
: membersOf(argForImpl(args, config.prototypeArg), config.prototypeArg).members.map(m => m.name);
|
|
154
|
+
/* a class union is virtual by construction: it exists to be extended, never to be instantiated */
|
|
155
|
+
const isUnion = union !== undefined && union.length > 0;
|
|
156
|
+
return (0, objects_1.compactRecord)({
|
|
157
|
+
system: config.system,
|
|
158
|
+
name,
|
|
159
|
+
contains,
|
|
160
|
+
members,
|
|
161
|
+
virtual: virtual || isUnion ? true : undefined,
|
|
162
|
+
union: isUnion ? union : undefined,
|
|
163
|
+
prototype: prototype.length > 0 ? prototype : undefined,
|
|
164
|
+
relation: config.relation,
|
|
165
|
+
byVariable
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/** @deprecated use {@link ClassDeclarations.of} instead */
|
|
169
|
+
function classDeclarationOf(config, args) {
|
|
170
|
+
return exports.ClassDeclarations.of(config, args);
|
|
171
|
+
}
|
|
172
|
+
/** Every class the graph declares, keyed by name. A later declaration of the same name wins, as it would in R. */
|
|
173
|
+
function declaredClassesImpl(graph) {
|
|
174
|
+
const classes = new Map();
|
|
175
|
+
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
176
|
+
const decl = vertex.classDecl;
|
|
177
|
+
if (decl?.name === undefined || decl.relation !== undefined) {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
classes.set(decl.name, { ...decl, id, name: decl.name });
|
|
181
|
+
}
|
|
182
|
+
/* R6 and S7 name their parent by the generator *variable*, so `Employee <- R6Class(inherit = Person)`
|
|
183
|
+
only says "Person"; the assignment that bound the generator says which class that is */
|
|
184
|
+
const byGenerator = generatorVariables(graph, classes);
|
|
185
|
+
for (const [name, declared] of classes) {
|
|
186
|
+
const resolved = declared.byVariable.map(v => byGenerator.get(v)).filter(assert_1.isNotUndefined)
|
|
187
|
+
.filter(c => c !== name && !declared.contains.includes(c));
|
|
188
|
+
if (resolved.length > 0) {
|
|
189
|
+
classes.set(name, { ...declared, contains: [...declared.contains, ...resolved] });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/* a `setClassUnion` states its members as subclasses, which is the same fact written the other way round */
|
|
193
|
+
for (const [, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
194
|
+
const decl = vertex.classDecl;
|
|
195
|
+
if (decl?.name === undefined) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
for (const member of decl.union ?? []) {
|
|
199
|
+
const existing = classes.get(member);
|
|
200
|
+
if (existing !== undefined && !existing.contains.includes(decl.name)) {
|
|
201
|
+
classes.set(member, { ...existing, contains: [...existing.contains, decl.name] });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/* `setIs(class1, class2)` states the same is-a relation `contains` does */
|
|
205
|
+
if (decl.relation === 'is') {
|
|
206
|
+
const [sub, sup] = [decl.name, decl.contains[0]];
|
|
207
|
+
const existing = classes.get(sub);
|
|
208
|
+
if (existing !== undefined && sup !== undefined && !existing.contains.includes(sup)) {
|
|
209
|
+
classes.set(sub, { ...existing, contains: [...existing.contains, sup] });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return classes;
|
|
214
|
+
}
|
|
215
|
+
/** @deprecated use {@link ClassDeclarations.declared} instead */
|
|
216
|
+
function declaredClasses(graph) {
|
|
217
|
+
return exports.ClassDeclarations.declared(graph);
|
|
218
|
+
}
|
|
219
|
+
/** Variable name to the class its generator declares, for the `Cls <- R6Class(...)`/`Cls <- new_class(...)` bindings. */
|
|
220
|
+
function generatorVariables(graph, classes) {
|
|
221
|
+
const byName = new Map();
|
|
222
|
+
for (const declared of classes.values()) {
|
|
223
|
+
byName.set(declared.id, declared.name);
|
|
224
|
+
}
|
|
225
|
+
const generators = new Map();
|
|
226
|
+
for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
|
|
227
|
+
const lexeme = graph.idMap?.get(id)?.lexeme;
|
|
228
|
+
if (lexeme === undefined) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
|
|
232
|
+
const cls = byName.get(target);
|
|
233
|
+
if (cls !== undefined && edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy)) {
|
|
234
|
+
generators.set(lexeme, cls);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return generators;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The transitive superclasses of `name` among `classes`, nearest first and each named once. A class the
|
|
242
|
+
* analysis never saw declared ends the chain, so what another package contributes is simply not in the answer.
|
|
243
|
+
*/
|
|
244
|
+
function superClassesOfImpl(name, classes) {
|
|
245
|
+
const chain = [];
|
|
246
|
+
const seen = new Set([name]);
|
|
247
|
+
const queue = [...(classes.get(name)?.contains ?? [])];
|
|
248
|
+
while (queue.length > 0) {
|
|
249
|
+
const next = queue.shift();
|
|
250
|
+
if (seen.has(next)) {
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
seen.add(next);
|
|
254
|
+
chain.push(next);
|
|
255
|
+
queue.push(...(classes.get(next)?.contains ?? []));
|
|
256
|
+
}
|
|
257
|
+
return chain;
|
|
258
|
+
}
|
|
259
|
+
/** @deprecated use {@link ClassDeclarations.superOf} instead */
|
|
260
|
+
function superClassesOf(name, classes) {
|
|
261
|
+
return exports.ClassDeclarations.superOf(name, classes);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The {@link SigClassInfo} records the signature database stores for the classes an analysis found. A class
|
|
265
|
+
* the analysis declared carries no `package`; a referenced class `ownerOf` can place becomes a `foreign` record.
|
|
266
|
+
*/
|
|
267
|
+
function toSigClassesImpl(classes, ownerOf) {
|
|
268
|
+
const records = [];
|
|
269
|
+
for (const declared of classes.values()) {
|
|
270
|
+
records.push((0, objects_1.compactRecord)({
|
|
271
|
+
name: declared.name,
|
|
272
|
+
system: declared.system,
|
|
273
|
+
supers: declared.union ?? declared.contains,
|
|
274
|
+
slots: declared.members.filter(m => !m.method).map(m => (0, objects_1.compactRecord)({ name: m.name, type: m.type })),
|
|
275
|
+
virtual: declared.virtual ? true : undefined,
|
|
276
|
+
union: declared.union !== undefined ? true : undefined
|
|
277
|
+
}));
|
|
278
|
+
}
|
|
279
|
+
if (ownerOf === undefined) {
|
|
280
|
+
return records;
|
|
281
|
+
}
|
|
282
|
+
/* a superclass the analysis never declared belongs to whoever does define it, which is what makes an
|
|
283
|
+
inherited class distinguishable from one the package owns */
|
|
284
|
+
for (const referenced of new Set(records.flatMap(r => r.supers))) {
|
|
285
|
+
if (classes.has(referenced)) {
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
const owner = ownerOf(referenced);
|
|
289
|
+
if (owner !== undefined) {
|
|
290
|
+
records.push({ name: referenced, system: 's4', supers: [], slots: [], package: owner });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return records;
|
|
294
|
+
}
|
|
295
|
+
/** @deprecated use {@link ClassDeclarations.toSig} instead */
|
|
296
|
+
function toSigClasses(classes, ownerOf) {
|
|
297
|
+
return exports.ClassDeclarations.toSig(classes, ownerOf);
|
|
298
|
+
}
|
|
299
|
+
/** Utilities for the class declarations of an analysis. */
|
|
300
|
+
exports.ClassDeclarations = {
|
|
301
|
+
name: 'ClassDeclarations',
|
|
302
|
+
/** The declaration a call states; see {@link classDeclarationOfImpl}. */
|
|
303
|
+
of: classDeclarationOfImpl,
|
|
304
|
+
/** Every class the graph declares, keyed by name; see {@link declaredClassesImpl}. */
|
|
305
|
+
declared: declaredClassesImpl,
|
|
306
|
+
/** The transitive superclasses of a declared class; see {@link superClassesOfImpl}. */
|
|
307
|
+
superOf: superClassesOfImpl,
|
|
308
|
+
/** The signature-database records for a set of declared classes; see {@link toSigClassesImpl}. */
|
|
309
|
+
toSig: toSigClassesImpl,
|
|
310
|
+
/** The argument a class-declaring built-in's config names; see {@link argForImpl}. */
|
|
311
|
+
argFor: argForImpl,
|
|
312
|
+
/** Whether the vertex is a call that declares a class; its {@link DataflowGraphVertexFunctionCall.classDecl} is then set. */
|
|
313
|
+
isDeclaring(vertex) {
|
|
314
|
+
return vertex_1.FunctionCallVertex.is(vertex) && vertex.classDecl !== undefined;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
//# sourceMappingURL=class-declaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PotentiallyEmptyRArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
2
|
+
/** Classes an error carries (`stop` raises a `simpleError`); a `warning`/`message`/`interrupt` names none of them. */
|
|
3
|
+
export declare const ErrorConditionClasses: ReadonlySet<string>;
|
|
4
|
+
/** Whether the arguments written for a condition-handling call name a handler catching an error (matched by name). */
|
|
5
|
+
export declare function namesAnErrorHandler<Info>(args: readonly PotentiallyEmptyRArgument<Info>[]): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorConditionClasses = void 0;
|
|
4
|
+
exports.namesAnErrorHandler = namesAnErrorHandler;
|
|
5
|
+
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
6
|
+
const identifier_1 = require("../environments/identifier");
|
|
7
|
+
/** Classes an error carries (`stop` raises a `simpleError`); a `warning`/`message`/`interrupt` names none of them. */
|
|
8
|
+
exports.ErrorConditionClasses = new Set(['error', 'simpleError', 'condition']);
|
|
9
|
+
/** Whether the arguments written for a condition-handling call name a handler catching an error (matched by name). */
|
|
10
|
+
function namesAnErrorHandler(args) {
|
|
11
|
+
return args.some(a => r_argument_1.RArgument.isNamed(a) && exports.ErrorConditionClasses.has(identifier_1.Identifier.getName(a.name.content)));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=condition-handlers.js.map
|
|
@@ -7,13 +7,27 @@ export interface ExceptionPoint {
|
|
|
7
7
|
}
|
|
8
8
|
/** The exceptions each function may raise, keyed by the id of its definition. */
|
|
9
9
|
export type ExceptionsByFunction = Record<NodeId, ExceptionPoint[]>;
|
|
10
|
+
/** What to ask for beyond the definition itself, see {@link FunctionExceptions.of}. */
|
|
11
|
+
export interface FunctionExceptionsOptions {
|
|
12
|
+
/** seeds additional throwers, e.g. the result of an earlier call, so their callees are counted too */
|
|
13
|
+
readonly knownThrower?: ExceptionsByFunction;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The `NodeId`s of functions that may throw exceptions when called by `id`, restricted to functions known by
|
|
17
|
+
* flowR. `knownThrower` seeds additional throwers, e.g. the result of an earlier call, counting its callees.
|
|
18
|
+
* @useInstead {@link FunctionExceptions.of}
|
|
19
|
+
*/
|
|
20
|
+
declare function exceptionsOfFunction(this: void, id: NodeId, graph: CallGraph, { knownThrower }?: FunctionExceptionsOptions): ExceptionsByFunction;
|
|
21
|
+
/** What the functions of a program may raise, following the calls their bodies reach. */
|
|
22
|
+
export declare const FunctionExceptions: {
|
|
23
|
+
readonly name: "FunctionExceptions";
|
|
24
|
+
/** The exceptions a definition may raise; see {@link exceptionsOfFunction}. */
|
|
25
|
+
readonly of: typeof exceptionsOfFunction;
|
|
26
|
+
};
|
|
10
27
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* With `knownThrower` you can provide additional functions that are known to throw exceptions; the result of
|
|
15
|
-
* an earlier call serves as one, as every definition it passes gets an answer counting its callees.
|
|
16
|
-
* A `try` and its relatives end the search.
|
|
17
|
-
* @returns A record mapping all `NodeId`s of functions that may throw exceptions to their exception points.
|
|
28
|
+
* The `NodeId`s of functions that may throw exceptions when called by `id`, restricted to functions known by
|
|
29
|
+
* flowR. `knownThrower` seeds additional throwers, e.g. the result of an earlier call, counting its callees.
|
|
30
|
+
* @deprecated use {@link FunctionExceptions.of} instead
|
|
18
31
|
*/
|
|
19
32
|
export declare function calculateExceptionsOfFunction(id: NodeId, graph: CallGraph, knownThrower?: ExceptionsByFunction): ExceptionsByFunction;
|
|
33
|
+
export {};
|
|
@@ -1,16 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionExceptions = void 0;
|
|
3
4
|
exports.calculateExceptionsOfFunction = calculateExceptionsOfFunction;
|
|
4
5
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
5
6
|
const built_in_proc_name_1 = require("../environments/built-in-proc-name");
|
|
6
7
|
const vertex_1 = require("../graph/vertex");
|
|
7
8
|
const graph_1 = require("../graph/graph");
|
|
9
|
+
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
10
|
+
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
11
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
12
|
+
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
13
|
+
const built_in_props_1 = require("../environments/built-in-props");
|
|
14
|
+
const query_fn_props_1 = require("../environments/query-fn-props");
|
|
15
|
+
const condition_handlers_1 = require("./condition-handlers");
|
|
16
|
+
const function_props_1 = require("./function-props");
|
|
8
17
|
const CatchHandlers = new Set([built_in_proc_name_1.BuiltInProcName.Try]);
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Whether the vertex catches an error raised below it, which ends the walk. A construct declaring no condition
|
|
20
|
+
* handler of its own (`try`) catches whatever arrives; one that matches handlers by condition class
|
|
21
|
+
* (`tryCatch`) catches only what the names written for it say.
|
|
22
|
+
*/
|
|
23
|
+
function catches(vertex, graph, info) {
|
|
24
|
+
if (!vertex_1.FunctionCallVertex.is(vertex) || vertex.origin === 'unnamed' || !vertex.origin.some(c => CatchHandlers.has(c))) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const sig = info(vertex.name)?.sig;
|
|
28
|
+
if (sig === undefined || !sig.some(([, props]) => (props & built_in_props_1.ArgProp.Callee) !== 0)) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
const node = graph.idMap?.get(vertex.id);
|
|
32
|
+
return r_function_call_1.RFunctionCall.is(node) && (0, condition_handlers_1.namesAnErrorHandler)(node.arguments);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether the call is written in the block of a construct catching what it raises, which keeps an error its
|
|
36
|
+
* callee raises from reaching the function around it. Only the block is guarded, as a handler runs after the
|
|
37
|
+
* error was raised, and the walk ends at the definition the call is written in, as a function defined in the
|
|
38
|
+
* block is not run there.
|
|
39
|
+
*/
|
|
40
|
+
function guarded(id, graph, info) {
|
|
41
|
+
const idMap = graph.idMap;
|
|
42
|
+
let node = idMap === undefined ? undefined : idMap.get(id);
|
|
43
|
+
while (node !== undefined && !r_function_definition_1.RFunctionDefinition.is(node)) {
|
|
44
|
+
const parent = model_1.RNode.directParent(node, idMap);
|
|
45
|
+
if (r_argument_1.RArgument.isUnnamed(node) && r_function_call_1.RFunctionCall.is(parent) && catches(graph.getVertex(parent.info.id), graph, info)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
node = parent;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
12
51
|
}
|
|
13
52
|
function reach(id, graph, knownThrower) {
|
|
53
|
+
const info = (0, query_fn_props_1.builtInLookup)();
|
|
54
|
+
const isGuarded = new Map();
|
|
14
55
|
const calls = new Map();
|
|
15
56
|
const own = new Map();
|
|
16
57
|
const defs = new Set();
|
|
@@ -35,11 +76,15 @@ function reach(id, graph, knownThrower) {
|
|
|
35
76
|
defs.add(current);
|
|
36
77
|
own.set(current, vertex.exitPoints.filter(e => e.type === 4 /* ExitPointType.Error */).map(e => ({ id: e.nodeId, cds: e.cds })));
|
|
37
78
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
79
|
+
/* a guarded call is only ever reached through the construct guarding it, which ends the walk of its own */
|
|
80
|
+
const next = [...(graph.outgoingEdges(current) ?? graph_1.NoEdges).keys()].filter(n => {
|
|
81
|
+
let known = isGuarded.get(n);
|
|
82
|
+
if (known === undefined) {
|
|
83
|
+
known = guarded(n, graph, info);
|
|
84
|
+
isGuarded.set(n, known);
|
|
85
|
+
}
|
|
86
|
+
return !known;
|
|
87
|
+
});
|
|
43
88
|
calls.set(current, next);
|
|
44
89
|
for (const n of next) {
|
|
45
90
|
if (!calls.has(n)) {
|
|
@@ -50,37 +95,17 @@ function reach(id, graph, knownThrower) {
|
|
|
50
95
|
return { calls, own, defs };
|
|
51
96
|
}
|
|
52
97
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* With `knownThrower` you can provide additional functions that are known to throw exceptions; the result of
|
|
57
|
-
* an earlier call serves as one, as every definition it passes gets an answer counting its callees.
|
|
58
|
-
* A `try` and its relatives end the search.
|
|
59
|
-
* @returns A record mapping all `NodeId`s of functions that may throw exceptions to their exception points.
|
|
98
|
+
* The `NodeId`s of functions that may throw exceptions when called by `id`, restricted to functions known by
|
|
99
|
+
* flowR. `knownThrower` seeds additional throwers, e.g. the result of an earlier call, counting its callees.
|
|
100
|
+
* @useInstead {@link FunctionExceptions.of}
|
|
60
101
|
*/
|
|
61
|
-
function
|
|
102
|
+
function exceptionsOfFunction(id, graph, { knownThrower = {} } = {}) {
|
|
62
103
|
const { calls, own, defs } = reach(id, graph, knownThrower);
|
|
63
104
|
const raised = new Map();
|
|
64
105
|
for (const node of calls.keys()) {
|
|
65
106
|
raised.set(node, new Map((own.get(node) ?? []).map(e => [e.id, e])));
|
|
66
107
|
}
|
|
67
|
-
|
|
68
|
-
for (const [node, next] of calls) {
|
|
69
|
-
for (const call of next) {
|
|
70
|
-
const known = callers.get(call);
|
|
71
|
-
if (known === undefined) {
|
|
72
|
-
callers.set(call, [node]);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
known.push(node);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const pending = [...calls.keys()];
|
|
80
|
-
const queued = new Set(pending);
|
|
81
|
-
while (pending.length > 0) {
|
|
82
|
-
const node = pending.pop();
|
|
83
|
-
queued.delete(node);
|
|
108
|
+
(0, function_props_1.propagateToFixpoint)(calls.keys(), calls, node => {
|
|
84
109
|
const into = raised.get(node);
|
|
85
110
|
let grew = false;
|
|
86
111
|
for (const call of calls.get(node) ?? []) {
|
|
@@ -91,16 +116,8 @@ function calculateExceptionsOfFunction(id, graph, knownThrower = {}) {
|
|
|
91
116
|
}
|
|
92
117
|
}
|
|
93
118
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
for (const caller of callers.get(node) ?? []) {
|
|
98
|
-
if (!queued.has(caller)) {
|
|
99
|
-
queued.add(caller);
|
|
100
|
-
pending.push(caller);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
119
|
+
return grew;
|
|
120
|
+
});
|
|
104
121
|
const result = {};
|
|
105
122
|
for (const [node, points] of raised) {
|
|
106
123
|
if (defs.has(node) || node === id) {
|
|
@@ -109,5 +126,19 @@ function calculateExceptionsOfFunction(id, graph, knownThrower = {}) {
|
|
|
109
126
|
}
|
|
110
127
|
return result;
|
|
111
128
|
}
|
|
129
|
+
/** What the functions of a program may raise, following the calls their bodies reach. */
|
|
130
|
+
exports.FunctionExceptions = {
|
|
131
|
+
name: 'FunctionExceptions',
|
|
132
|
+
/** The exceptions a definition may raise; see {@link exceptionsOfFunction}. */
|
|
133
|
+
of: exceptionsOfFunction
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* The `NodeId`s of functions that may throw exceptions when called by `id`, restricted to functions known by
|
|
137
|
+
* flowR. `knownThrower` seeds additional throwers, e.g. the result of an earlier call, counting its callees.
|
|
138
|
+
* @deprecated use {@link FunctionExceptions.of} instead
|
|
139
|
+
*/
|
|
140
|
+
function calculateExceptionsOfFunction(id, graph, knownThrower = {}) {
|
|
141
|
+
return exports.FunctionExceptions.of(id, graph, { knownThrower });
|
|
142
|
+
}
|
|
112
143
|
const NoPoints = new Map();
|
|
113
144
|
//# sourceMappingURL=exceptions-of-function.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DataflowGraph } from '../graph/graph';
|
|
2
|
+
import { EdgeType } from '../graph/edge';
|
|
3
|
+
import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexFunctionDefinition } from '../graph/vertex';
|
|
4
|
+
import type { ArgProps, BuiltInFnInfo } from '../environments/built-in-props';
|
|
5
|
+
import type { Identifier } from '../environments/identifier';
|
|
6
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
|
+
/** What flowR states about the built-in a call names, see {@link BuiltInFnInfo}. */
|
|
8
|
+
export type BuiltInLookup = (name: Identifier) => BuiltInFnInfo | undefined;
|
|
9
|
+
/** The nodes at the far end of `node`'s outgoing edges of any of `types`, shared by every walk here and in the sibling analyses that follow specific edge kinds. */
|
|
10
|
+
export declare function edgeTargets(this: void, graph: DataflowGraph, node: NodeId, types: EdgeType): NodeId[];
|
|
11
|
+
/** The calls a definition's body reaches, id and vertex paired; shared by every walk here and in the sibling analyses that visit them all. */
|
|
12
|
+
export declare function callsIn(definition: DataflowGraphVertexFunctionDefinition, graph: DataflowGraph): Generator<[NodeId, DataflowGraphVertexFunctionCall]>;
|
|
13
|
+
/**
|
|
14
|
+
* Recomputes `recompute(id)` for every node reachable from `seed` along the reverse of `successors`, so a
|
|
15
|
+
* change at a node is carried on to whatever points at it, until nothing grows anymore. `recompute` updates
|
|
16
|
+
* its node's value itself and reports whether it grew; shared by {@link propagateOverCalls} and
|
|
17
|
+
* {@link calculateExceptionsOfFunction}, which differ only in what "grew" means for the value they carry, and
|
|
18
|
+
* by {@link carriersOf} below, which grows a set rather than a bitfield.
|
|
19
|
+
*/
|
|
20
|
+
export declare function propagateToFixpoint(seed: Iterable<NodeId>, successors: ReadonlyMap<NodeId, readonly NodeId[]>, recompute: (id: NodeId) => boolean): void;
|
|
21
|
+
/** What to ask for beyond the definition itself, see {@link FrameReflection.of}. */
|
|
22
|
+
export interface FrameReflectionOptions {
|
|
23
|
+
/** what flowR states about a built-in, answered once per name */
|
|
24
|
+
readonly known: BuiltInLookup;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What `definition`'s body reaches about its own formals through the frame or call it sits in, as the
|
|
28
|
+
* {@link BuiltInFnInfo#frame} bits of the reflective calls it makes (`0` for none). `get("x", envir = e)` and
|
|
29
|
+
* `e$x` are followed to the name directly; `as.list(environment())` and a frame handed elsewhere mean any formal.
|
|
30
|
+
* @useInstead {@link FrameReflection.of}
|
|
31
|
+
*/
|
|
32
|
+
declare function reflectiveRolesOf(this: void, definition: DataflowGraphVertexFunctionDefinition, graph: DataflowGraph, { known }: FrameReflectionOptions): ArgProps;
|
|
33
|
+
/** What a function's body reaches about its own formals through reflection, rather than a direct read. */
|
|
34
|
+
export declare const FrameReflection: {
|
|
35
|
+
readonly name: "FrameReflection";
|
|
36
|
+
/** The reflective {@link ArgProp} bits of one definition; see {@link reflectiveRolesOf}. */
|
|
37
|
+
readonly of: typeof reflectiveRolesOf;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* What `definition`'s body reaches about its own formals through the frame or call it sits in, as the
|
|
41
|
+
* {@link BuiltInFnInfo#frame} bits of the reflective calls it makes (`0` for none). `get("x", envir = e)` and
|
|
42
|
+
* `e$x` are followed to the name directly; `as.list(environment())` and a frame handed elsewhere mean any formal.
|
|
43
|
+
* @deprecated use {@link FrameReflection.of} instead
|
|
44
|
+
*/
|
|
45
|
+
export declare function reflectiveRoles(definition: DataflowGraphVertexFunctionDefinition, graph: DataflowGraph, known: BuiltInLookup): ArgProps;
|
|
46
|
+
export {};
|