@eagleoutice/flowr 2.14.4 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -64
- 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 +1665 -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 +24 -6
- 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 +34 -34
- package/dataflow/eval/values/general.d.ts +9 -1
- package/dataflow/eval/values/general.js +22 -3
- package/dataflow/eval/values/sets/set-constants.d.ts +5 -0
- package/dataflow/eval/values/sets/set-constants.js +9 -1
- 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-string-template.js +2 -1
- 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 +101 -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 +57 -100
- package/project/sigdb/reader.js +157 -108
- 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
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionStrictnesses = void 0;
|
|
3
4
|
exports.strictnessOfFunction = strictnessOfFunction;
|
|
4
5
|
exports.strictnessOfFunctions = strictnessOfFunctions;
|
|
5
6
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
7
|
+
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
6
8
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
7
9
|
const graph_1 = require("../graph/graph");
|
|
8
10
|
const edge_1 = require("../graph/edge");
|
|
9
11
|
const vertex_1 = require("../graph/vertex");
|
|
10
12
|
const built_in_proc_name_1 = require("../environments/built-in-proc-name");
|
|
11
13
|
const built_in_props_1 = require("../environments/built-in-props");
|
|
14
|
+
const frame_reflection_1 = require("./frame-reflection");
|
|
12
15
|
const query_fn_props_1 = require("../environments/query-fn-props");
|
|
13
16
|
const identifier_1 = require("../environments/identifier");
|
|
14
17
|
const logic_1 = require("../../util/logic");
|
|
@@ -20,6 +23,8 @@ const r_parameter_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-paramet
|
|
|
20
23
|
* ({@link ArgProp.Nse}), or looked at only for having been supplied ({@link ArgProp.Presence}).
|
|
21
24
|
*/
|
|
22
25
|
const NotEvaluated = built_in_props_1.ArgProp.Nse | built_in_props_1.ArgProp.Presence;
|
|
26
|
+
/** What reflection has to reach for a parameter to be evaluated by it (`as.list(environment())`, not `match.call()`/`nargs()`). */
|
|
27
|
+
const MayEvaluate = built_in_props_1.ArgProp.Value | built_in_props_1.ArgProp.Forced;
|
|
23
28
|
/**
|
|
24
29
|
* The processors whose calls reach their first argument and the rest only on the way the run happens to
|
|
25
30
|
* take: `switch` picks one of its branches, and `try`/`tryCatch` reach a handler only when one is needed.
|
|
@@ -47,14 +52,7 @@ function hasProcessor(vertex, of) {
|
|
|
47
52
|
}
|
|
48
53
|
/** The definition a node sits in. */
|
|
49
54
|
function enclosingDefinition(id, idMap, graph) {
|
|
50
|
-
|
|
51
|
-
while (node !== undefined) {
|
|
52
|
-
if (vertex_1.FunctionDefinitionVertex.is(graph.getVertex(node.info.id))) {
|
|
53
|
-
return node.info.id;
|
|
54
|
-
}
|
|
55
|
-
node = node.info.parent === undefined ? undefined : idMap.get(node.info.parent);
|
|
56
|
-
}
|
|
57
|
-
return undefined;
|
|
55
|
+
return model_1.RNode.findEnclosing(id, idMap, node => vertex_1.FunctionDefinitionVertex.is(graph.getVertex(node.info.id)));
|
|
58
56
|
}
|
|
59
57
|
function makeState(graph, ctx) {
|
|
60
58
|
const idMap = graph.idMap;
|
|
@@ -64,6 +62,18 @@ function makeState(graph, ctx) {
|
|
|
64
62
|
owner.set(node_id_1.NodeId.normalize(param), id);
|
|
65
63
|
}
|
|
66
64
|
}
|
|
65
|
+
const environment = ctx?.env.makeCleanEnv();
|
|
66
|
+
const info = environment === undefined
|
|
67
|
+
? (name) => query_fn_props_1.BuiltInIndex.default().get(name)
|
|
68
|
+
: (name) => (0, query_fn_props_1.queryFnProps)(name, { environment });
|
|
69
|
+
const infos = new Map();
|
|
70
|
+
const fnInfo = (name) => {
|
|
71
|
+
const key = identifier_1.Identifier.getName(name);
|
|
72
|
+
if (!infos.has(key)) {
|
|
73
|
+
infos.set(key, info(name));
|
|
74
|
+
}
|
|
75
|
+
return infos.get(key);
|
|
76
|
+
};
|
|
67
77
|
const dispatch = new Map();
|
|
68
78
|
if (idMap !== undefined) {
|
|
69
79
|
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
@@ -87,11 +97,7 @@ function makeState(graph, ctx) {
|
|
|
87
97
|
dispatch.set(within, { named, certain, next });
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
|
-
|
|
91
|
-
const props = environment === undefined
|
|
92
|
-
? (name) => query_fn_props_1.BuiltInIndex.default().get(name)?.sig
|
|
93
|
-
: (name) => (0, query_fn_props_1.queryFnProps)(name, { environment })?.sig;
|
|
94
|
-
return { graph, idMap, owner, dispatch, sigs: new Map(), props, known: new Map(), asking: new Set(), assumed: false };
|
|
100
|
+
return { graph, idMap, owner, dispatch, fnInfo, sigs: new Map(), props: name => fnInfo(name)?.sig, known: new Map(), asking: new Set(), assumed: false };
|
|
95
101
|
}
|
|
96
102
|
/** What is certain becomes a possibility once something may intervene. */
|
|
97
103
|
function weaken(value) {
|
|
@@ -281,6 +287,12 @@ function strictnessOf(id, state) {
|
|
|
281
287
|
for (const param of params) {
|
|
282
288
|
parameters[param] = strictnessOfParameter(node_id_1.NodeId.normalize(param), vertex, state);
|
|
283
289
|
}
|
|
290
|
+
/* reflection flowR could not follow may read a parameter without any read of it showing in the code */
|
|
291
|
+
if ((frame_reflection_1.FrameReflection.of(vertex, state.graph, { known: state.fnInfo }) & MayEvaluate) !== 0) {
|
|
292
|
+
for (const param of params) {
|
|
293
|
+
parameters[param] = logic_1.TernaryLogic.or(parameters[param], logic_1.Ternary.Maybe);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
284
296
|
const dispatch = state.dispatch.get(id);
|
|
285
297
|
if (dispatch !== undefined) {
|
|
286
298
|
for (const param of params) {
|
|
@@ -313,6 +325,8 @@ function strictnessOf(id, state) {
|
|
|
313
325
|
* {@link ArgProp.Presence} is never evaluated, one stated {@link ArgProp.Forced} always is, and the calls
|
|
314
326
|
* reaching an argument only on the way the run takes are the ones flowR hands to the processor that says so
|
|
315
327
|
* (`switch` picking a branch, `try` reaching a handler, a hook running at exit).
|
|
328
|
+
* A body reading its own call or frame ({@link CallProp.Frame}: `match.call()`, `nargs()`,
|
|
329
|
+
* `as.list(environment())`) reaches every parameter without naming one, so none of them is answered `Never`.
|
|
316
330
|
* For a generic, the methods reached by S3 dispatch decide: they agree on a parameter or it is left open,
|
|
317
331
|
* while the object the dispatch is on is forced by the dispatch itself. A `NextMethod` carries the same
|
|
318
332
|
* question on to the methods it reaches, matched by the position the parameter is written in.
|
|
@@ -322,13 +336,9 @@ function strictnessOf(id, state) {
|
|
|
322
336
|
* only claims certainty where the code gives it.
|
|
323
337
|
* What a built-in does with an argument comes from the {@link ArgProp} bits its signature states, so a
|
|
324
338
|
* configured or overwritten built-in is the one that answers when the analyzer context is handed along.
|
|
325
|
-
* @
|
|
339
|
+
* @useInstead {@link FunctionStrictnesses.of}
|
|
326
340
|
*/
|
|
327
|
-
function
|
|
328
|
-
return strictnessOf(id, makeState(graph, ctx));
|
|
329
|
-
}
|
|
330
|
-
/** The {@link strictnessOfFunction|strictness} of several definitions, sharing the work between them. */
|
|
331
|
-
function strictnessOfFunctions(ids, graph, ctx) {
|
|
341
|
+
function strictnessOfEach(ids, graph, { ctx } = {}) {
|
|
332
342
|
const state = makeState(graph, ctx);
|
|
333
343
|
const result = {};
|
|
334
344
|
for (const id of ids) {
|
|
@@ -336,4 +346,24 @@ function strictnessOfFunctions(ids, graph, ctx) {
|
|
|
336
346
|
}
|
|
337
347
|
return result;
|
|
338
348
|
}
|
|
349
|
+
/** How the functions of a program treat their parameters, see {@link FunctionStrictness}. */
|
|
350
|
+
exports.FunctionStrictnesses = {
|
|
351
|
+
name: 'FunctionStrictnesses',
|
|
352
|
+
/** The strictness of several definitions, sharing the work between them; see {@link strictnessOfEach}. */
|
|
353
|
+
of: strictnessOfEach
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Determines whether the function with the given id is strict, i.e., whether calling it forces its arguments.
|
|
357
|
+
* {@link Ternary#Always} says every call forces every parameter, {@link Ternary#Never} that no call forces
|
|
358
|
+
* all of them, and {@link Ternary#Maybe} that it depends on the path taken, on the caller, or on a function
|
|
359
|
+
* flowR could not resolve. A definition without parameters has nothing to leave unforced and is strict.
|
|
360
|
+
* @deprecated use {@link FunctionStrictnesses.of} instead
|
|
361
|
+
*/
|
|
362
|
+
function strictnessOfFunction(id, graph, ctx) {
|
|
363
|
+
return exports.FunctionStrictnesses.of([id], graph, { ctx })[id];
|
|
364
|
+
}
|
|
365
|
+
/** @deprecated use {@link FunctionStrictnesses.of} instead */
|
|
366
|
+
function strictnessOfFunctions(ids, graph, ctx) {
|
|
367
|
+
return exports.FunctionStrictnesses.of(ids, graph, { ctx });
|
|
368
|
+
}
|
|
339
369
|
//# sourceMappingURL=strict-function.js.map
|
|
@@ -159,6 +159,14 @@ function processFunctionDefinition(vtx, from, graph, result, state) {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* The caller to record for a function definition found in the body of `from`. A definition the body writes is
|
|
164
|
+
* not called by writing it, so it gets none; a definition flowR synthesizes for a deferred expression
|
|
165
|
+
* (`on.exit` and its relatives) is one the body really runs, so it keeps `from`.
|
|
166
|
+
*/
|
|
167
|
+
function callerOfBodyDefinition(from, to) {
|
|
168
|
+
return node_id_1.NodeId.isWritten(to) ? undefined : from;
|
|
169
|
+
}
|
|
162
170
|
/** Follows the `Calls` edges from `seeds`, collecting everything they reach in `reached`. */
|
|
163
171
|
function followCalls(graph, seeds, reached) {
|
|
164
172
|
const toVisit = Array.from(seeds);
|
|
@@ -336,11 +344,11 @@ exports.CallGraph = {
|
|
|
336
344
|
if (v) {
|
|
337
345
|
processUnknown(v, from, graph, result, state);
|
|
338
346
|
if (vertex_1.FunctionDefinitionVertex.is(v)) {
|
|
339
|
-
processFunctionDefinition(v, from, graph, result, state);
|
|
347
|
+
processFunctionDefinition(v, callerOfBodyDefinition(from, to), graph, result, state);
|
|
340
348
|
}
|
|
341
349
|
}
|
|
342
350
|
}
|
|
343
|
-
else {
|
|
351
|
+
else if (callerOfBodyDefinition(from, to) !== undefined || !vertex_1.FunctionDefinitionVertex.is(graph.getVertex(to))) {
|
|
344
352
|
result.addEdge(from, to, edge_1.EdgeType.Calls);
|
|
345
353
|
}
|
|
346
354
|
}
|
|
@@ -200,18 +200,7 @@ export declare const Dataflow: {
|
|
|
200
200
|
* Use this when you need the reduced-and-inverted graph for a forward traversal within a restriction set.
|
|
201
201
|
*/
|
|
202
202
|
readonly reduceAndInvertGraph: <G extends DataflowGraph>(this: void, graph: G, select: ReadonlySet<NodeId>, cleanEnv: REnvironmentInformation) => G;
|
|
203
|
-
/**
|
|
204
|
-
* Whether the node is quoted, i.e., affected by a {@link EdgeType.NonStandardEvaluation} edge that actually
|
|
205
|
-
* keeps it from being evaluated (as `quote` and `substitute` do).
|
|
206
|
-
*
|
|
207
|
-
* Loops mark their body as non-standard-evaluated as well, yet that body really is evaluated (and its symbols
|
|
208
|
-
* really are read), so such an edge does not quote. Use this instead of testing for the edge type directly
|
|
209
|
-
* whenever you want to know whether something is evaluated at all.
|
|
210
|
-
* @param id - The id of the node to check
|
|
211
|
-
* @param graph - The graph the node is part of
|
|
212
|
-
* @param withOutgoing - Whether to also consider the outgoing edges of the node (i.e., whether the node itself
|
|
213
|
-
* quotes something), and not just the ingoing ones (i.e., whether it is quoted)
|
|
214
|
-
*/
|
|
203
|
+
/** See {@link DataflowGraph#isQuoted}, which this answers for `graph`. */
|
|
215
204
|
readonly isQuoted: (this: void, id: NodeId, graph: DataflowGraph, withOutgoing?: boolean) => boolean;
|
|
216
205
|
/**
|
|
217
206
|
* Given the id of a vertex (usually a variable use),
|
|
@@ -12,7 +12,6 @@ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id"
|
|
|
12
12
|
const vertex_1 = require("./vertex");
|
|
13
13
|
const identifier_1 = require("../environments/identifier");
|
|
14
14
|
const resolve_helper_1 = require("../environments/resolve-helper");
|
|
15
|
-
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
16
15
|
const r_base_packages_1 = require("../../util/r-base-packages");
|
|
17
16
|
/**
|
|
18
17
|
* This is the root helper object to work with the {@link DataflowGraph}.
|
|
@@ -226,25 +225,9 @@ exports.Dataflow = {
|
|
|
226
225
|
}
|
|
227
226
|
return df;
|
|
228
227
|
},
|
|
229
|
-
/**
|
|
230
|
-
* Whether the node is quoted, i.e., affected by a {@link EdgeType.NonStandardEvaluation} edge that actually
|
|
231
|
-
* keeps it from being evaluated (as `quote` and `substitute` do).
|
|
232
|
-
*
|
|
233
|
-
* Loops mark their body as non-standard-evaluated as well, yet that body really is evaluated (and its symbols
|
|
234
|
-
* really are read), so such an edge does not quote. Use this instead of testing for the edge type directly
|
|
235
|
-
* whenever you want to know whether something is evaluated at all.
|
|
236
|
-
* @param id - The id of the node to check
|
|
237
|
-
* @param graph - The graph the node is part of
|
|
238
|
-
* @param withOutgoing - Whether to also consider the outgoing edges of the node (i.e., whether the node itself
|
|
239
|
-
* quotes something), and not just the ingoing ones (i.e., whether it is quoted)
|
|
240
|
-
*/
|
|
228
|
+
/** See {@link DataflowGraph#isQuoted}, which this answers for `graph`. */
|
|
241
229
|
isQuoted(id, graph, withOutgoing = false) {
|
|
242
|
-
|
|
243
|
-
const quotes = (source, e) => edge_1.DfEdge.includesType(e, edge_1.EdgeType.NonStandardEvaluation) && !model_1.RLoopConstructs.is(graph.idMap?.get(source));
|
|
244
|
-
if (graph.ingoingEdges(id)?.entries().some(([source, e]) => quotes(source, e))) {
|
|
245
|
-
return true;
|
|
246
|
-
}
|
|
247
|
-
return withOutgoing && (graph.outgoingEdges(id)?.values().some(e => quotes(id, e)) ?? false);
|
|
230
|
+
return graph.isQuoted(id, withOutgoing);
|
|
248
231
|
},
|
|
249
232
|
/**
|
|
250
233
|
* Given the id of a vertex (usually a variable use),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionArgument, type OutgoingEdges } from './graph';
|
|
2
2
|
import { type GenericDifferenceInformation } from '../../util/diff';
|
|
3
|
-
import {
|
|
3
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import type { GraphDifferenceReport, GraphDiffContext } from '../../util/diff-graph';
|
|
5
5
|
/**
|
|
6
6
|
* This is the underlying function to calculate the difference based on a given context.
|
|
@@ -121,8 +121,8 @@ function diffVertices(ctx) {
|
|
|
121
121
|
}
|
|
122
122
|
/* as names are optional, we have to recover the other name if at least one of them is no longer available */
|
|
123
123
|
if (lInfo.name !== undefined || rInfo.name !== undefined) {
|
|
124
|
-
const lname = lInfo.name ??
|
|
125
|
-
const rname = rInfo.name ??
|
|
124
|
+
const lname = lInfo.name ?? node_id_1.NodeId.recoverName(id, ctx.left.idMap) ?? '??';
|
|
125
|
+
const rname = rInfo.name ?? node_id_1.NodeId.recoverName(id, ctx.right.idMap) ?? '??';
|
|
126
126
|
if (lname !== rname) {
|
|
127
127
|
ctx.report.addComment(`Vertex ${id} differs in names. ${ctx.leftname}: ${String(lname)} vs ${ctx.rightname}: ${String(rname)}`, {
|
|
128
128
|
tag: 'vertex',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DFControlFlowEdge
|
|
2
|
-
import { DfEdge } from './edge';
|
|
1
|
+
import type { DFControlFlowEdge } from './edge';
|
|
2
|
+
import { DfEdge, EdgeType } from './edge';
|
|
3
3
|
import type { DataflowInformation } from '../info';
|
|
4
4
|
import { type DataflowGraphVertexArgument, type DataflowGraphVertexFunctionCall, type DataflowGraphVertexInfo } from './vertex';
|
|
5
5
|
import { EmptyArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
@@ -15,122 +15,40 @@ import type { LinkTo } from '../../queries/catalog/call-context-query/call-conte
|
|
|
15
15
|
export type DataflowFunctionFlowInformation = Omit<DataflowInformation, 'graph' | 'exitPoints'> & {
|
|
16
16
|
graph: Set<NodeId>;
|
|
17
17
|
};
|
|
18
|
-
/**
|
|
19
|
-
* A reference with a name, e.g. `a` and `b` in the following function call:
|
|
20
|
-
*
|
|
21
|
-
* ```r
|
|
22
|
-
* foo(a = 3, b = 2)
|
|
23
|
-
* ```
|
|
24
|
-
* @see #isNamedArgument
|
|
25
|
-
* @see PositionalFunctionArgument
|
|
26
|
-
*/
|
|
18
|
+
/** A reference with a name, e.g. `a` and `b` in `foo(a = 3, b = 2)`, see {@link PositionalFunctionArgument}. */
|
|
27
19
|
export interface NamedFunctionArgument extends IdentifierReference {
|
|
28
20
|
readonly name: string;
|
|
29
21
|
readonly valueId: NodeId | undefined;
|
|
30
22
|
}
|
|
31
|
-
/**
|
|
32
|
-
* A reference which does not have a name, like the references to the arguments `3` and `2` in the following:
|
|
33
|
-
*
|
|
34
|
-
* ```r
|
|
35
|
-
* foo(3, 2)
|
|
36
|
-
* ```
|
|
37
|
-
* @see NamedFunctionArgument
|
|
38
|
-
*/
|
|
23
|
+
/** A reference without a name, e.g. the references to `3` and `2` in `foo(3, 2)`, see {@link NamedFunctionArgument}. */
|
|
39
24
|
export interface PositionalFunctionArgument extends Omit<IdentifierReference, 'name'> {
|
|
40
25
|
readonly name?: undefined;
|
|
41
26
|
}
|
|
42
27
|
/**
|
|
43
28
|
* Summarizes either named (`foo(a = 3, b = 2)`), unnamed (`foo(3, 2)`), or empty (`foo(,)`) arguments within a function.
|
|
44
29
|
* See the {@link FunctionArgument} helper functions to check for the specific types.
|
|
45
|
-
* @see {@link FunctionArgument.isNamed|`FunctionArgument.isNamed`} - to check for named arguments
|
|
46
|
-
* @see {@link FunctionArgument.isPositional|`FunctionArgument.isPositional`} - to check for positional arguments
|
|
47
|
-
* @see {@link FunctionArgument.isEmpty|`FunctionArgument.isEmpty`} - to check for empty arguments
|
|
48
30
|
*/
|
|
49
31
|
export type FunctionArgument = NamedFunctionArgument | PositionalFunctionArgument | typeof EmptyArgument;
|
|
50
|
-
/**
|
|
51
|
-
* Helper functions to work with {@link FunctionArgument}s.
|
|
52
|
-
* @see {@link EmptyArgument} - the marker for empty arguments
|
|
53
|
-
*/
|
|
32
|
+
/** Helper functions to work with {@link FunctionArgument}s. {@link EmptyArgument} marks an empty argument. */
|
|
54
33
|
export declare const FunctionArgument: {
|
|
55
34
|
readonly name: "FunctionArgument";
|
|
56
|
-
/**
|
|
57
|
-
* Checks whether the given argument is a positional argument.
|
|
58
|
-
* @example
|
|
59
|
-
* ```r
|
|
60
|
-
* foo(b=3, 2) # the second argument is positional
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
35
|
+
/** Whether `arg` is positional, e.g. the `2` in `foo(b=3, 2)`. */
|
|
63
36
|
readonly isPositional: (this: void, arg: FunctionArgument) => arg is PositionalFunctionArgument;
|
|
64
|
-
/**
|
|
65
|
-
* Checks whether the given argument is a named argument.
|
|
66
|
-
* @example
|
|
67
|
-
* ```r
|
|
68
|
-
* foo(b=3, 2) # the first argument is named
|
|
69
|
-
* ```
|
|
70
|
-
* @see {@link isPositional}
|
|
71
|
-
* @see {@link isEmpty}
|
|
72
|
-
* @see {@link hasName}
|
|
73
|
-
*/
|
|
37
|
+
/** Whether `arg` is named, e.g. the `b=3` in `foo(b=3, 2)`. */
|
|
74
38
|
readonly isNamed: (this: void, arg: FunctionArgument) => arg is NamedFunctionArgument;
|
|
75
|
-
/**
|
|
76
|
-
* Checks whether the given argument is an unnamed argument (either positional or empty).
|
|
77
|
-
* @example
|
|
78
|
-
* ```r
|
|
79
|
-
* foo(, 2) # the first argument is unnamed (empty)
|
|
80
|
-
* foo(3, 2) # both arguments are unnamed (positional)
|
|
81
|
-
* ```
|
|
82
|
-
* @see {@link isNamed}
|
|
83
|
-
*/
|
|
39
|
+
/** Whether `arg` is unnamed, i.e. positional or empty, e.g. both arguments of `foo(, 2)` and `foo(3, 2)`. */
|
|
84
40
|
readonly isUnnamed: (this: void, arg: FunctionArgument) => arg is PositionalFunctionArgument | typeof EmptyArgument;
|
|
85
|
-
/**
|
|
86
|
-
* Checks whether the given argument is an empty argument.
|
|
87
|
-
* @example
|
|
88
|
-
* ```r
|
|
89
|
-
* foo(, 2) # the first argument is empty
|
|
90
|
-
* ```
|
|
91
|
-
* @see {@link isNotEmpty}
|
|
92
|
-
*/
|
|
41
|
+
/** Whether `arg` is the {@link EmptyArgument} marker, e.g. the first argument of `foo(, 2)`. */
|
|
93
42
|
readonly isEmpty: (this: void, arg: unknown) => arg is typeof EmptyArgument;
|
|
94
|
-
/**
|
|
95
|
-
* Checks whether the given argument is not an empty argument.
|
|
96
|
-
* @see {@link FunctionArgument.isEmpty}
|
|
97
|
-
*/
|
|
43
|
+
/** @see {@link FunctionArgument.isEmpty} */
|
|
98
44
|
readonly isNotEmpty: <T>(this: void, arg: T) => arg is Exclude<T, typeof EmptyArgument>;
|
|
99
|
-
/**
|
|
100
|
-
* Returns the id of a non-empty argument.
|
|
101
|
-
* @example
|
|
102
|
-
* ```r
|
|
103
|
-
* foo(a=3, 2) # returns the node id of either `a` or `2`
|
|
104
|
-
* ```
|
|
105
|
-
* @see {@link FunctionArgument.getReference}
|
|
106
|
-
* @see {@link FunctionArgument.getName}
|
|
107
|
-
*/
|
|
45
|
+
/** The node id of a non-empty `arg`, e.g. of either `a` or `2` in `foo(a=3, 2)`. */
|
|
108
46
|
readonly getId: (this: void, arg: FunctionArgument) => NodeId | undefined;
|
|
109
|
-
/**
|
|
110
|
-
* Returns the name of a named argument.
|
|
111
|
-
* @example
|
|
112
|
-
* ```r
|
|
113
|
-
* foo(a = 3, 2) # returns 'a' or undefined
|
|
114
|
-
* ```
|
|
115
|
-
* @see {@link FunctionArgument.getId}
|
|
116
|
-
*/
|
|
47
|
+
/** The name of `arg` if named, `undefined` otherwise. */
|
|
117
48
|
readonly getName: (this: void, arg: FunctionArgument) => string | undefined;
|
|
118
|
-
/**
|
|
119
|
-
* Returns the reference of a non-empty argument.
|
|
120
|
-
* @example
|
|
121
|
-
* ```r
|
|
122
|
-
* foo(a=3, 2) # returns the node id of either `3` or `2`, but skips a
|
|
123
|
-
* ```
|
|
124
|
-
* @see {@link FunctionArgument.getId}
|
|
125
|
-
*/
|
|
49
|
+
/** The value node id of a non-empty `arg`: its own id if positional, or its value's id (skipping the name) if named. */
|
|
126
50
|
readonly getReference: (this: void, arg: FunctionArgument) => NodeId | undefined;
|
|
127
|
-
/**
|
|
128
|
-
* Checks whether the given argument is a named argument with the specified name.
|
|
129
|
-
* Please note that this only checks whether the name is exactly identical and not whether
|
|
130
|
-
* R's argument matching resolves to the correct argument.
|
|
131
|
-
* For this, please refer to the {@link pMatch} function!
|
|
132
|
-
* @see {@link isNamed}
|
|
133
|
-
*/
|
|
51
|
+
/** Whether `arg` is named exactly `name` (textual match only, not R's argument-matching; see {@link pMatch} for that). */
|
|
134
52
|
readonly hasName: (this: void, arg: FunctionArgument, name: string | undefined) => arg is NamedFunctionArgument;
|
|
135
53
|
};
|
|
136
54
|
/**
|
|
@@ -161,9 +79,7 @@ export declare const NoEdges: ReadonlyMap<NodeId, never>;
|
|
|
161
79
|
* Passed to {@link DataflowGraph#qualify}, which caches what it returns.
|
|
162
80
|
*/
|
|
163
81
|
export type CallQualifier = (graph: DataflowGraph, id: NodeId, vertex: DataflowGraphVertexInfo | undefined) => readonly [bare: Identifier | undefined, baseR: Identifier | undefined];
|
|
164
|
-
/**
|
|
165
|
-
* The structure of the serialized {@link DataflowGraph}.
|
|
166
|
-
*/
|
|
82
|
+
/** The structure of the serialized {@link DataflowGraph}. */
|
|
167
83
|
export interface DataflowGraphJson {
|
|
168
84
|
readonly rootVertices: NodeId[];
|
|
169
85
|
readonly vertexInformation: [NodeId, DataflowGraphVertexInfo][];
|
|
@@ -202,20 +118,10 @@ export declare const UnknownSideEffect: {
|
|
|
202
118
|
};
|
|
203
119
|
};
|
|
204
120
|
/**
|
|
205
|
-
* The dataflow graph holds the dataflow information found within the given AST
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* The vertices of the graph are organized in a hierarchical fashion, with a function-definition node containing the node ids of its subgraph.
|
|
210
|
-
* However, all *edges* are hoisted at the top level in the form of an (attributed) adjacency list.
|
|
211
|
-
* After the dataflow analysis, all sources and targets of the edges *must* be part of the vertices.
|
|
212
|
-
* However, this does not have to hold during the construction as edges may point from or to vertices which are yet to be constructed.
|
|
213
|
-
*
|
|
214
|
-
* All methods return the modified graph to allow for chaining.
|
|
215
|
-
* @see {@link DataflowGraph#addEdge|`addEdge`} - to add an edge to the graph
|
|
216
|
-
* @see {@link DataflowGraph#addVertex|`addVertex`} - to add a vertex to the graph
|
|
217
|
-
* @see {@link DataflowGraph#fromJson|`fromJson`} - to construct a dataflow graph object from a deserialized JSON object.
|
|
218
|
-
* @see {@link emptyGraph|`emptyGraph`} - to create an empty graph (useful in tests)
|
|
121
|
+
* The dataflow graph holds the dataflow information found within the given AST: directed edges ({@link EdgeType}) are hoisted
|
|
122
|
+
* into a flat adjacency list, while vertices ({@link DataflowGraphVertexArgument}) nest hierarchically (a function-definition
|
|
123
|
+
* vertex contains its subgraph's node ids). After analysis every edge endpoint must be a vertex, though not yet during construction.
|
|
124
|
+
* All methods return the modified graph to allow for chaining. The helper object associated with the DFG is {@link Dataflow}.
|
|
219
125
|
*/
|
|
220
126
|
export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = DataflowGraphVertexInfo, Edge extends DfEdge = DfEdge> {
|
|
221
127
|
private _idMap;
|
|
@@ -231,32 +137,19 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
231
137
|
private readonly types;
|
|
232
138
|
private qualifiedNames?;
|
|
233
139
|
toJSON(): DataflowGraphJson;
|
|
234
|
-
/**
|
|
235
|
-
* Get the {@link DataflowGraphVertexInfo} attached to a node as well as all outgoing edges.
|
|
236
|
-
* @param id - The id of the node to get
|
|
237
|
-
* @param includeDefinedFunctions - If true this will search function definitions as well and not just the toplevel
|
|
238
|
-
* @returns the node info for the given id (if it exists)
|
|
239
|
-
* @see #getVertex
|
|
240
|
-
*/
|
|
140
|
+
/** Gets the {@link DataflowGraphVertexInfo} attached to `id` (searching function definitions too if `includeDefinedFunctions`) and its outgoing edges. */
|
|
241
141
|
get(id: NodeId, includeDefinedFunctions?: boolean): [Vertex, OutgoingEdges] | undefined;
|
|
242
|
-
/**
|
|
243
|
-
* Get the {@link DataflowGraphVertexInfo} attached to a vertex.
|
|
244
|
-
* @param id - The id of the node to get
|
|
245
|
-
* @returns the node info for the given id (if it exists)
|
|
246
|
-
* @see #get
|
|
247
|
-
* @see #getRootVertex
|
|
248
|
-
*/
|
|
142
|
+
/** Gets the {@link DataflowGraphVertexInfo} attached to `id`, see {@link DataflowGraph#getRootVertex}. */
|
|
249
143
|
getVertex(id: NodeId): Vertex | undefined;
|
|
250
|
-
/**
|
|
251
|
-
* Get the {@link DataflowGraphVertexInfo} attached to a root-level vertex.
|
|
252
|
-
* @param id - The id of the node to get
|
|
253
|
-
* @returns the node info for the given id (if it exists)
|
|
254
|
-
* @see #get
|
|
255
|
-
* @see #getVertex
|
|
256
|
-
*/
|
|
144
|
+
/** Gets the {@link DataflowGraphVertexInfo} attached to `id`, but only if it is a root-level vertex, see {@link DataflowGraph#getVertex}. */
|
|
257
145
|
getRootVertex(id: NodeId): Vertex | undefined;
|
|
258
146
|
outgoingEdges(id: NodeId): OutgoingEdges | undefined;
|
|
259
147
|
ingoingEdges(id: NodeId): ReadonlyIngoingEdges | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Whether `id` is quoted, i.e. affected by a {@link EdgeType.NonStandardEvaluation} edge that keeps it from being
|
|
150
|
+
* evaluated (a loop's own NSE-marked body still is evaluated, so that does not count). `withOutgoing` also checks whether `id` itself quotes something.
|
|
151
|
+
*/
|
|
152
|
+
isQuoted(id: NodeId, withOutgoing?: boolean): boolean;
|
|
260
153
|
/**
|
|
261
154
|
* The cached `pkg::fn` name of the call `id`, asking `resolve` only for a call the cache does not know yet.
|
|
262
155
|
* @useInstead {@link Dataflow.qualify} - which passes the resolution
|
|
@@ -272,45 +165,25 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
272
165
|
private resolveInto;
|
|
273
166
|
/** Drops the cached qualifications, as the graph may no longer imply them */
|
|
274
167
|
private dropQualifications;
|
|
275
|
-
/**
|
|
276
|
-
* Given a node in the normalized AST this either:
|
|
277
|
-
* returns the id if the node directly exists in the DFG
|
|
278
|
-
* returns the ids of all vertices in the DFG that are linked to this
|
|
279
|
-
* returns undefined if the node is not part of the DFG and not linked to any node
|
|
280
|
-
*/
|
|
168
|
+
/** For a node of the normalized AST: `nodeId` if it is a DFG vertex itself, else the DFG vertices linked to it, else `undefined`. */
|
|
281
169
|
getLinked(nodeId: NodeId): NodeId[] | undefined;
|
|
282
170
|
/** Retrieves the id-map to the normalized AST attached to the dataflow graph */
|
|
283
171
|
get idMap(): AstIdMap | undefined;
|
|
284
|
-
/**
|
|
285
|
-
* Retrieves the set of vertices which have side effects that we do not know anything about.
|
|
286
|
-
*/
|
|
172
|
+
/** Retrieves the set of vertices which have side effects that we do not know anything about. */
|
|
287
173
|
get unknownSideEffects(): Set<UnknownSideEffect>;
|
|
288
174
|
/** Allows setting the id-map explicitly (which should only be used when, e.g., you plan to compare two dataflow graphs on the same AST-basis) */
|
|
289
175
|
setIdMap(idMap: AstIdMap): void;
|
|
290
|
-
/**
|
|
291
|
-
* @param includeDefinedFunctions - If true this will iterate over function definitions as well and not just the toplevel
|
|
292
|
-
* @returns the ids of all toplevel vertices in the graph together with their vertex information
|
|
293
|
-
* @see #edges
|
|
294
|
-
*/
|
|
176
|
+
/** Ids of all toplevel vertices (or all, including those nested in function definitions, if `includeDefinedFunctions`) with their info, see {@link DataflowGraph#edges}. */
|
|
295
177
|
vertices(includeDefinedFunctions: boolean): MapIterator<[NodeId, Vertex]>;
|
|
296
178
|
verticesOfType<T extends Vertex['tag']>(type: T): MapIterator<[NodeId, Vertex & {
|
|
297
179
|
tag: T;
|
|
298
180
|
}]>;
|
|
299
181
|
vertexIdsOfType<T extends Vertex['tag']>(type: T): NodeId[];
|
|
300
|
-
/**
|
|
301
|
-
* @returns the ids of all edges in the graph together with their edge information
|
|
302
|
-
* @see #vertices
|
|
303
|
-
*/
|
|
182
|
+
/** Ids of all edges in the graph together with their edge information, see {@link DataflowGraph#vertices}. */
|
|
304
183
|
edges(): MapIterator<[NodeId, OutgoingEdges]>;
|
|
305
|
-
/**
|
|
306
|
-
* Returns true if the graph contains a node with the given id.
|
|
307
|
-
* @param id - The id to check for
|
|
308
|
-
* @param includeDefinedFunctions - If true this will check function definitions as well and not just the toplevel
|
|
309
|
-
*/
|
|
184
|
+
/** Whether the graph contains a node with `id` (checking function definitions too if `includeDefinedFunctions`). */
|
|
310
185
|
hasVertex(id: NodeId, includeDefinedFunctions?: boolean): boolean;
|
|
311
|
-
/**
|
|
312
|
-
* Returns true if the root level of the graph contains a node with the given id.
|
|
313
|
-
*/
|
|
186
|
+
/** Returns true if the root level of the graph contains a node with the given id. */
|
|
314
187
|
isRoot(id: NodeId): boolean;
|
|
315
188
|
rootIds(): ReadonlySet<NodeId>;
|
|
316
189
|
/**
|
|
@@ -319,47 +192,25 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
319
192
|
*/
|
|
320
193
|
removeEdgeType(fromId: NodeId, toId: NodeId, type: EdgeType | number): this;
|
|
321
194
|
/**
|
|
322
|
-
* Adds
|
|
323
|
-
* @
|
|
324
|
-
* @param fallbackEnv - A clean environment to use if no environment is given in the vertex
|
|
325
|
-
* @param asRoot - If false, this will only add the vertex but do not add it to the {@link rootIds|root vertices} of the graph.
|
|
326
|
-
* This is probably only of use, when you construct dataflow graphs for tests.
|
|
327
|
-
* @param overwrite - If true, this will overwrite the vertex if it already exists in the graph (based on the id).
|
|
328
|
-
* @see DataflowGraphVertexInfo
|
|
329
|
-
* @see DataflowGraphVertexArgument
|
|
195
|
+
* Adds `vertex` to the graph, filling in `fallbackEnv` if it carries no environment. `asRoot = false` skips
|
|
196
|
+
* adding it to {@link rootIds|root vertices} (mostly useful when constructing graphs for tests); `overwrite` replaces an existing vertex of the same id.
|
|
330
197
|
*/
|
|
331
198
|
addVertex(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, fallbackEnv: REnvironmentInformation, asRoot?: boolean, overwrite?: boolean): this;
|
|
332
199
|
addEdge(fromId: NodeId, toId: NodeId, type: EdgeType.ControlEdge, data: Omit<DFControlFlowEdge, 'types'>): this;
|
|
333
200
|
addEdge(fromId: NodeId, toId: NodeId, type: Exclude<EdgeType, EdgeType.ControlEdge> | number): this;
|
|
334
|
-
/**
|
|
335
|
-
* Merges the other graph into *this* one (in-place). The return value is only for convenience.
|
|
336
|
-
* @param otherGraph - The graph to merge into this one
|
|
337
|
-
* @param mergeRootVertices - If false, this will only merge the vertices and edges but exclude the root vertices this is probably only of use
|
|
338
|
-
* in the context of function definitions
|
|
339
|
-
*/
|
|
201
|
+
/** Merges `otherGraph` into *this* one in-place (the return value is only for convenience); `mergeRootVertices = false` excludes its root vertices (useful when merging in a function definition). */
|
|
340
202
|
mergeWith(otherGraph: DataflowGraph<Vertex, Edge> | undefined, mergeRootVertices?: boolean): this;
|
|
341
203
|
mergeVertices(otherGraph: DataflowGraph<Vertex, Edge>, mergeRootVertices?: boolean): void;
|
|
342
204
|
private mergeEdges;
|
|
343
|
-
/**
|
|
344
|
-
* Marks a vertex in the graph to be a definition
|
|
345
|
-
* @param reference - The reference to the vertex to mark as definition
|
|
346
|
-
* @param sourceIds - The id of the source vertex of the def, if available
|
|
347
|
-
*/
|
|
205
|
+
/** Marks the vertex referenced by `reference` as a definition, with `sourceIds` as the source vertex ids of the def if known. */
|
|
348
206
|
setDefinitionOfVertex(reference: IdentifierReference, sourceIds: readonly NodeId[] | undefined): void;
|
|
349
|
-
/**
|
|
350
|
-
* Marks a vertex in the graph to be a function call with the new information
|
|
351
|
-
* @param info - The information about the new function call node
|
|
352
|
-
*/
|
|
207
|
+
/** Marks the vertex `info.id` in the graph to be a function call with the new `info`. */
|
|
353
208
|
updateToFunctionCall(info: DataflowGraphVertexFunctionCall): void;
|
|
354
209
|
/** If you do not pass the `to` node, this will just mark the node as maybe */
|
|
355
210
|
addControlDependency(from: NodeId, to: NodeId, when?: boolean): this;
|
|
356
211
|
/** Marks the given node as having unknown side effects */
|
|
357
212
|
markIdForUnknownSideEffects(id: NodeId, target?: LinkTo<RegExp | string>): this;
|
|
358
|
-
/**
|
|
359
|
-
* Constructs a dataflow graph instance from the given JSON data and returns the result.
|
|
360
|
-
* This can be useful for data sent by the flowR server when analyzing it further.
|
|
361
|
-
* @param data - The JSON data to construct the graph from
|
|
362
|
-
*/
|
|
213
|
+
/** Constructs a dataflow graph instance from the given JSON data, e.g. as sent by the flowR server for further analysis. */
|
|
363
214
|
static fromJson(data: DataflowGraphJson): DataflowGraph;
|
|
364
215
|
}
|
|
365
216
|
export interface IEnvironmentJson {
|