@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
|
@@ -238,18 +238,30 @@ Every function is a ${ctx.link('DecodedFunction')}:
|
|
|
238
238
|
| field | holds |
|
|
239
239
|
|-------|-------|
|
|
240
240
|
| ${ctx.link('DecodedFunction::exported')} | whether the name is a package export |
|
|
241
|
-
| ${ctx.link('DecodedFunction::signature')} | the parameters, with defaults and
|
|
241
|
+
| ${ctx.link('DecodedFunction::signature')} | the parameters, with their defaults and their ${ctx.link('ArgProp')} mask |
|
|
242
242
|
| ${ctx.link('DecodedFunction::callees')} | the function's own local calls |
|
|
243
243
|
| ${ctx.link('DecodedFunction::topic')} | the Rd help topic when it differs from the name |
|
|
244
244
|
| ${ctx.link('DecodedFunction::file')}, ${ctx.link('DecodedFunction::line')} | source location |
|
|
245
245
|
| ${ctx.link('DecodedFunction::props')} | flags like higher-order, recursive, deprecated |
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
The parameter mask is the one flowR states its own built-ins with, so a parameter carries
|
|
248
|
+
${ctx.linkE('ArgProp', 'NoDefault')} when it has no default, ${ctx.linkE('ArgProp', 'Forced')}
|
|
249
|
+
when the function always evaluates it, and whichever roles the extractor could infer
|
|
250
|
+
(${ctx.linkE('ArgProp', 'Alias')}, ${ctx.linkE('ArgProp', 'Presence')},
|
|
251
|
+
${ctx.linkE('ArgProp', 'Callee')}, ...). Every bit it cannot see stays unset, so an unset bit
|
|
252
|
+
reads as "unknown" rather than "no"; ${ctx.link('fnInfoFromSignature')} hands the mask on unchanged, which is
|
|
253
|
+
what lets a package function answer the same questions a built-in does.
|
|
254
|
+
|
|
255
|
+
Per version the source also answers declared dependencies (${ctx.link('ResolvedDependency')}), release dates, the plain export view (${ctx.link('LibraryExports')}), the versions it carries (${ctx.link('AvailableVersion')}), and its class relations (${ctx.link('SigClassInfo')}, via ${ctx.linkM(reader_1.SigDatabase, 'classes')}).
|
|
256
|
+
|
|
257
|
+
A class record states what a declaration does: its direct superclasses, its slots with the types they were declared with, whether it is virtual, and whether it is a \`setClassUnion\` (whose supers are the members it unites). ${ctx.link('SigClassInfo::package')} names the package *defining* a class the record only relates to, which is what tells a class the package owns from one it inherits -- something the flat name list of ${ctx.link('LibraryExports::s4Classes')} has nowhere to hang. The same shape carries Reference classes, S7 and R6, since all four declare a name, a parent and a set of members. On the analysis side ${ctx.link('declaredClasses')} reads these off \`setClass\`/\`setClassUnion\`/\`setIs\`/\`setRefClass\`/\`new_class\`/\`R6Class\` calls and ${ctx.link('toSigClasses')} hands them over in this form.
|
|
248
258
|
|
|
249
259
|
Beyond the flags above, ${ctx.link('DecodedFunction::props')} also carry ${ctx.linkE('FnProp', 'NoDoc')} (a documented package has no help page for this name), ${ctx.linkE('FnProp', 'S3Method')} (a registered S3 method, from the package NAMESPACE or base R's method table), and ${ctx.linkE('FnProp', 'S3Owner')} (an exported constructor for an S3 class this package OWNS: it also registers at least one S3 method for that class). The owned classes of a version are ${ctx.link('LibraryExports::s3Classes')}, and ${ctx.linkM(reader_1.SigDatabase, 'classOwner')} answers, for a class name, which package owns it (backed by a reverse index built once). This lets ${ctx.linkPage('wiki/Query API', 'version guessing')} mark a package used when the analyzed project's own NAMESPACE registers an S3 method for a class it owns, even with no direct call, e.g. tseries's \`S3method("as.irts","zoo")\` marks \`zoo\` used.
|
|
250
260
|
|
|
251
261
|
The S4 side has ${ctx.linkE('FnProp', 'S4Owner')} for an exported class and ${ctx.linkE('FnProp', 'S4Method')} for a name a package exports because it answered a generic for one of its classes (\`setMethod("sin", "float32", ...)\` plus \`exportMethods(sin)\`), rather than because it defines a function of its own. Such a name is often documented only under its \`sin,float32-method\` Rd alias, so it also carries ${ctx.linkE('FnProp', 'NoDoc')}. Because \`setMethod("Math", ...)\` answers every member of a group at once, ${ctx.link('SignatureDb::functionOf')} falls back to the group entry for a member it finds nothing for: \`pkg::sin\` is served by \`pkg\`'s \`Math\`, which is what the call would dispatch to. ${ctx.link('groupGenericOf')} maps a member to its group.
|
|
252
262
|
|
|
263
|
+
${ctx.linkE('FnProp', 'Generic')} says the definition is one others dispatch on: an S3 generic whose body calls \`UseMethod\`, an S4 one from \`setGeneric\`, or an S7 \`new_generic\`. The call graph shows the same for the S3 case, but only while a bundle carries one, and never for a generic built without an R body -- which is why the bit exists next to it. ${ctx.link('fnInfoFromSignature')} reads it, falling back to the dispatching callee for a bundle written before it.
|
|
264
|
+
|
|
253
265
|
${ctx.linkE('FnProp', 'Value')} says the export binds a value rather than a function (\`pi\`, \`LETTERS\`, ggplot2's \`class_gg\`). Only the extractor can tell: an entry without a definition location is as likely to be a function nothing wrote down, an S4 generic \`setGeneric\` builds or a \`Vectorize\` result, so a reader that has only the location to go on can say no more than that there is none.
|
|
254
266
|
|
|
255
267
|
These are derived on demand by the ${ctx.linkPage('wiki/Query API', 'signature query')}, not stored:
|
|
@@ -338,15 +350,15 @@ Every shard, dictionary, and manifest is published in both brotli (\`.br\`) and
|
|
|
338
350
|
## Format
|
|
339
351
|
|
|
340
352
|
The on-disk format is \`flowr-sigdb\` (schema ${schema_1.SigDbSchema}). Beyond each version's exports it records, per
|
|
341
|
-
version, every function's signature (parameters,
|
|
342
|
-
call graph, together with that version's declared dependencies (\`Depends\`, \`Imports\`, ... with their
|
|
353
|
+
version, every function's signature (the parameters, each with its default and its ${ctx.link('ArgProp')} mask)
|
|
354
|
+
and call graph, together with that version's declared dependencies (\`Depends\`, \`Imports\`, ... with their
|
|
343
355
|
version qualifiers). The layout is NDJSON: a header, then a shared string dictionary, then one
|
|
344
356
|
self-contained blob per package, next to a sidecar \`.idx\`. A reader (${ctx.link(reader_1.SigDatabase)}) therefore
|
|
345
357
|
loads the dictionary once and then **seeks straight to the packages it needs**, never reading the rest.
|
|
346
358
|
The bundle is written by ${ctx.link('SigDbBuilder')} and can be split into several small shards (current-only
|
|
347
359
|
versus full history, top-N versus the rest) that a \`flowr-sigdb-manifest\` routes transparently
|
|
348
360
|
(${ctx.link(reader_1.SigDatabaseSet)}), and which information gets stored is selectable (${ctx.link('SigDbFeatures')}).
|
|
349
|
-
|
|
361
|
+
The extractor produces the bundle from its analysis of CRAN.
|
|
350
362
|
|
|
351
363
|
## Performance
|
|
352
364
|
|
package/gas.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export declare const GasWikiRef = "https://github.com/flowr-analysis/flowr/wiki/
|
|
|
4
4
|
/**
|
|
5
5
|
* Resource-pressure level returned by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}.
|
|
6
6
|
* Numeric ordering lets callers use `>=` for threshold comparisons at zero cost.
|
|
7
|
-
* See the [Gas (Resource Guard)](https://github.com/flowr-analysis/flowr/wiki/Core#gas-resource-guard) wiki section for details.
|
|
8
7
|
*/
|
|
9
8
|
export declare const enum GasLevel {
|
|
10
9
|
/** Safe to continue, all resources are within bounds. */
|
|
@@ -14,23 +13,18 @@ export declare const enum GasLevel {
|
|
|
14
13
|
/** Threshold exceeded. The caller should skip the expensive work. */
|
|
15
14
|
Critical = 2
|
|
16
15
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Known feature keys accepted by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}.
|
|
19
|
-
* Each key corresponds to a sensitivity factor in {@link FlowrGasConfig.features}.
|
|
20
|
-
*/
|
|
16
|
+
/** Known feature keys accepted by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}, each a sensitivity factor in {@link FlowrGasConfig.features}. */
|
|
21
17
|
export declare const GasFeatureKey: {
|
|
22
18
|
/** Gas key for built-in `source()` file analysis. */
|
|
23
19
|
readonly Source: "source";
|
|
24
|
-
/** Gas key for the side-effect link resolution phase of the dataflow extractor
|
|
20
|
+
/** Gas key for the side-effect link resolution phase of the dataflow extractor (matches unknown side effects against call sites via the CFG). */
|
|
25
21
|
readonly SideEffectLinking: "side-effect-linking";
|
|
26
|
-
/** Gas key for the linter, checked once per
|
|
22
|
+
/** Gas key for the linter, checked once per rule; remaining rules are skipped under critical pressure. */
|
|
27
23
|
readonly Linter: "linter";
|
|
28
|
-
/**
|
|
29
|
-
* Gas key for the static slicer, checked while traversing the dataflow graph. Under critical pressure the
|
|
30
|
-
* traversal stops and the slice is returned as far as it got (`SliceResult.stoppedEarly`), which is the only
|
|
31
|
-
* way to bound the otherwise synchronous traversal from the outside.
|
|
32
|
-
*/
|
|
24
|
+
/** Gas key for the static slicer, checked while traversing the dataflow graph; a hit stops traversal early (`SliceResult.stoppedEarly`). */
|
|
33
25
|
readonly Slicer: "slicer";
|
|
26
|
+
/** Gas key for dataflow extraction. Unlike the keys above it is *armed* once per run (see {@link ReadOnlyFlowrAnalyzerGasContext.budget}) and counted as the fold goes. */
|
|
27
|
+
readonly Dataflow: "dataflow";
|
|
34
28
|
};
|
|
35
29
|
export type GasFeatureKey = typeof GasFeatureKey[keyof typeof GasFeatureKey];
|
|
36
30
|
/** Paired low/high thresholds used inside {@link GasThresholdSpec}. */
|
|
@@ -41,37 +35,29 @@ export interface GasThresholdPair extends MergeableRecord {
|
|
|
41
35
|
readonly critical: number;
|
|
42
36
|
}
|
|
43
37
|
/**
|
|
44
|
-
* Thresholds for one gas dimension, either as one pair for every feature or split per {@link GasFeatureKey}
|
|
45
|
-
*
|
|
46
|
-
* ```ts
|
|
47
|
-
* timeMs: {
|
|
48
|
-
* default: { problematic: 60_000, critical: 120_000 },
|
|
49
|
-
* slicer: { problematic: 24_000, critical: 30_000 }
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* Per bound, a feature entry wins over `default`, which wins over the direct pair. A bound nowhere given never triggers.
|
|
38
|
+
* Thresholds for one gas dimension, either as one pair for every feature or split per {@link GasFeatureKey}. Per
|
|
39
|
+
* bound, a feature entry wins over `default`, which wins over the direct pair. A bound nowhere given never triggers.
|
|
54
40
|
*/
|
|
55
41
|
export interface GasThresholdSpec extends MergeableRecord {
|
|
56
|
-
/**
|
|
42
|
+
/** the shared *problematic* bound, for every feature without a more specific entry */
|
|
57
43
|
readonly problematic?: number;
|
|
58
|
-
/**
|
|
44
|
+
/** the shared *critical* bound, for every feature without a more specific entry */
|
|
59
45
|
readonly critical?: number;
|
|
60
46
|
/** Bounds for the features that have no entry of their own. */
|
|
61
47
|
readonly default?: Partial<GasThresholdPair>;
|
|
62
48
|
/** Bounds for one {@link GasFeatureKey}. */
|
|
63
49
|
readonly [feature: string]: number | Partial<GasThresholdPair> | undefined;
|
|
64
50
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Thresholds for {@link GasLevel} transitions used by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}, each
|
|
67
|
-
* dimension boundable per feature (see {@link GasThresholdSpec}).
|
|
68
|
-
* See the [Gas (Resource Guard)](https://github.com/flowr-analysis/flowr/wiki/Core#gas-resource-guard) wiki section.
|
|
69
|
-
*/
|
|
51
|
+
/** Thresholds for {@link GasLevel} transitions used by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}, each dimension boundable per feature (see {@link GasThresholdSpec}). */
|
|
70
52
|
export interface FlowrGasThresholds extends MergeableRecord {
|
|
71
53
|
/** Heap-usage fraction thresholds (0-1, before factor scaling). */
|
|
72
54
|
readonly memory: GasThresholdSpec;
|
|
73
55
|
/** Elapsed analysis time thresholds in milliseconds (before factor scaling). */
|
|
74
56
|
readonly timeMs: GasThresholdSpec;
|
|
57
|
+
/** Processed-AST-node thresholds, counted rather than sampled. Only read by keys that arm a budget (i.e. {@link GasFeatureKey.Dataflow}); absent means unbounded. */
|
|
58
|
+
readonly steps?: GasThresholdSpec;
|
|
59
|
+
/** Created-dataflow-vertex thresholds, counted like {@link FlowrGasThresholds.steps}. */
|
|
60
|
+
readonly vertices?: GasThresholdSpec;
|
|
75
61
|
}
|
|
76
62
|
/** Gas bounds for one feature within a single call, see {@link GasOverrides}. */
|
|
77
63
|
export interface GasFeatureOverride extends MergeableRecord {
|
|
@@ -83,17 +69,16 @@ export interface GasFeatureOverride extends MergeableRecord {
|
|
|
83
69
|
readonly timeMs?: Partial<GasThresholdPair>;
|
|
84
70
|
/** Overrides `config.gas.thresholds.memory` for this call. */
|
|
85
71
|
readonly memory?: Partial<GasThresholdPair>;
|
|
72
|
+
/** Overrides `config.gas.thresholds.steps` for this call, for a key that arms a budget. */
|
|
73
|
+
readonly steps?: Partial<GasThresholdPair>;
|
|
74
|
+
/** Overrides `config.gas.thresholds.vertices` for this call, for a key that arms a budget. */
|
|
75
|
+
readonly vertices?: Partial<GasThresholdPair>;
|
|
86
76
|
/** Sensitivity factor, defaulting to the configured one, or `1` if the feature is disabled. */
|
|
87
77
|
readonly factor?: number;
|
|
88
78
|
}
|
|
89
79
|
/**
|
|
90
|
-
* Gas bounds for a single call, keyed by {@link GasFeatureKey}, measured from that call
|
|
91
|
-
*
|
|
92
|
-
* ```ts
|
|
93
|
-
* analyzer.query([...], { gas: { slicer: { critical: 30_000 } } });
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* Naming a feature enables gas for it even when `config.gas.features` disables it; pass `factor: 0` to keep it off.
|
|
80
|
+
* Gas bounds for a single call, keyed by {@link GasFeatureKey}, measured from that call. Naming a feature enables
|
|
81
|
+
* gas for it even when `config.gas.features` disables it; pass `factor: 0` to keep it off.
|
|
97
82
|
*/
|
|
98
83
|
export type GasOverrides = {
|
|
99
84
|
/** Bounds for the features that have no entry of their own. */
|
|
@@ -107,15 +92,9 @@ export interface GasHeapStatistics {
|
|
|
107
92
|
readonly heap_size_limit: number;
|
|
108
93
|
}
|
|
109
94
|
/**
|
|
110
|
-
* Gas configuration embedded in {@link FlowrConfig.gas}.
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* (see {@link GasFeatureKey} for the recognised keys):
|
|
114
|
-
* - `0` / absent - disabled for that feature, zero overhead.
|
|
115
|
-
* - `1` - normal sensitivity, thresholds in {@link thresholds} apply as-is.
|
|
116
|
-
* - `N` - N times as sensitive, effectively divides each threshold by N.
|
|
117
|
-
*
|
|
118
|
-
* See the [Gas (Resource Guard)](https://github.com/flowr-analysis/flowr/wiki/Core#gas-resource-guard) wiki section.
|
|
95
|
+
* Gas configuration embedded in {@link FlowrConfig.gas}. Each entry in `features` is a sensitivity factor for a
|
|
96
|
+
* named feature (see {@link GasFeatureKey}): `0`/absent disables it at zero overhead, `1` is normal sensitivity,
|
|
97
|
+
* `N` divides each threshold by N.
|
|
119
98
|
*/
|
|
120
99
|
export interface FlowrGasConfig extends MergeableRecord {
|
|
121
100
|
/** Thresholds scaled by each feature factor before comparison, optionally bounded per feature (see {@link GasThresholdSpec}). */
|
|
@@ -123,8 +102,73 @@ export interface FlowrGasConfig extends MergeableRecord {
|
|
|
123
102
|
/** Per-feature sensitivity factors. Missing or `0` disables checking with zero overhead. */
|
|
124
103
|
readonly features: Record<string, number | undefined>;
|
|
125
104
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
105
|
+
* How many calls one accounting of an armed budget covers (default `DefaultCountedCheckEvery`). Trades how far
|
|
106
|
+
* a run may overshoot a bound against what the guard costs per node: `1` counts exactly, larger counts coarsely.
|
|
128
107
|
*/
|
|
108
|
+
readonly countedCheckEvery?: number;
|
|
109
|
+
/** Custom heap statistics source (programmatic configs only), overriding the built-in v8/performance.memory detection. Return undefined to skip the memory check. */
|
|
129
110
|
readonly heapProvider?: () => GasHeapStatistics | undefined;
|
|
130
111
|
}
|
|
112
|
+
/** The dimension a {@link DataflowBudget} ran out in. */
|
|
113
|
+
export declare const enum BudgetDimension {
|
|
114
|
+
/** processed AST nodes (see `processDataflowFor`) */
|
|
115
|
+
Steps = "steps",
|
|
116
|
+
/** vertices added to any graph of the extraction */
|
|
117
|
+
Vertices = "vertices",
|
|
118
|
+
/** elapsed wall-clock time */
|
|
119
|
+
Time = "time"
|
|
120
|
+
}
|
|
121
|
+
/** The bounds of one extraction, as {@link ReadOnlyFlowrAnalyzerGasContext.budget} resolves them (already factor-scaled). A dimension the configuration leaves out arrives as `0`, meaning unbounded. */
|
|
122
|
+
export interface DataflowBudget {
|
|
123
|
+
/** Maximum number of AST nodes to process. */
|
|
124
|
+
readonly steps?: number;
|
|
125
|
+
/** Maximum number of dataflow vertices to create. */
|
|
126
|
+
readonly vertices?: number;
|
|
127
|
+
/** Maximum wall-clock time of the extraction, in milliseconds, measured from the gas contingent's start. */
|
|
128
|
+
readonly timeMs?: number;
|
|
129
|
+
}
|
|
130
|
+
/** What ended an extraction early, attached to the partial result as {@link DataflowInformation.cutShort}. */
|
|
131
|
+
export interface DataflowBudgetExhaustion {
|
|
132
|
+
/** which bound was hit */
|
|
133
|
+
readonly dimension: BudgetDimension;
|
|
134
|
+
/** the bound as it applied, i.e. after the gas feature factor scaled it */
|
|
135
|
+
readonly limit: number;
|
|
136
|
+
/** what the dimension stood at when the bound was seen to be past; may overshoot by up to one {@link FlowrGasConfig.countedCheckEvery} block */
|
|
137
|
+
readonly reached: number;
|
|
138
|
+
}
|
|
139
|
+
/** Whether `budget` bounds anything at all; an unbounded one is never armed. */
|
|
140
|
+
export declare function isBoundedBudget(budget: DataflowBudget | undefined): budget is DataflowBudget;
|
|
141
|
+
/**
|
|
142
|
+
* Counts what one extraction spends and reports when its {@link DataflowBudget} is used up. Both counters are
|
|
143
|
+
* **sampled, not exact**: the hot paths only decrement a countdown, and accounting runs once every
|
|
144
|
+
* {@link FlowrGasConfig.countedCheckEvery} calls, so a bound may be overshot by up to that many steps or vertices.
|
|
145
|
+
*/
|
|
146
|
+
export declare class DataflowBudgetTracker {
|
|
147
|
+
private readonly stepLimit;
|
|
148
|
+
private readonly vertexLimit;
|
|
149
|
+
private readonly deadline;
|
|
150
|
+
private readonly every;
|
|
151
|
+
/** steps left before the next accounting; the only thing {@link step} touches while the budget holds */
|
|
152
|
+
private untilStep;
|
|
153
|
+
/** vertices left before the next accounting, see {@link untilStep} */
|
|
154
|
+
private untilVertex;
|
|
155
|
+
private steps;
|
|
156
|
+
private vertices;
|
|
157
|
+
private hit;
|
|
158
|
+
/** `since` is what the elapsed-time bound is measured from; `every` is how many calls one accounting covers (see {@link FlowrGasConfig.countedCheckEvery}). */
|
|
159
|
+
constructor(budget: DataflowBudget, since: number, every: number);
|
|
160
|
+
/** What ended the extraction early, `undefined` while the budget holds. */
|
|
161
|
+
get exhausted(): DataflowBudgetExhaustion | undefined;
|
|
162
|
+
/** Books one processed node, returning whether the budget is used up (so the caller must not descend). Only every {@link FlowrGasConfig.countedCheckEvery}-th call does more than count down. */
|
|
163
|
+
step(): boolean;
|
|
164
|
+
/** Books one created vertex, sampled like {@link step}. Billed as *created*, so the count bounds the work done rather than the size of the final (possibly merged-away) graph. */
|
|
165
|
+
vertex(): void;
|
|
166
|
+
private exceed;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The tracker of the extraction currently running, or `undefined` when the gas context armed none. A live binding
|
|
170
|
+
* rather than a getter, so an unarmed run pays only a null check. Set it only through {@link withDataflowBudget}.
|
|
171
|
+
*/
|
|
172
|
+
export declare let activeDataflowBudget: DataflowBudgetTracker | undefined;
|
|
173
|
+
/** Runs `fn` with `tracker` as the {@link activeDataflowBudget}, restoring whatever was active before (so a nested extraction bills the budget it was started under). */
|
|
174
|
+
export declare function withDataflowBudget<T>(tracker: DataflowBudgetTracker | undefined, fn: () => T): T;
|
package/gas.js
CHANGED
|
@@ -1,24 +1,108 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GasFeatureKey = exports.GasWikiRef = void 0;
|
|
3
|
+
exports.activeDataflowBudget = exports.DataflowBudgetTracker = exports.GasFeatureKey = exports.GasWikiRef = void 0;
|
|
4
|
+
exports.isBoundedBudget = isBoundedBudget;
|
|
5
|
+
exports.withDataflowBudget = withDataflowBudget;
|
|
4
6
|
/** Wiki reference for the gas resource guard, use this in user-facing warnings. */
|
|
5
7
|
exports.GasWikiRef = 'https://github.com/flowr-analysis/flowr/wiki/Core#gas-resource-guard';
|
|
6
|
-
/**
|
|
7
|
-
* Known feature keys accepted by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}.
|
|
8
|
-
* Each key corresponds to a sensitivity factor in {@link FlowrGasConfig.features}.
|
|
9
|
-
*/
|
|
8
|
+
/** Known feature keys accepted by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}, each a sensitivity factor in {@link FlowrGasConfig.features}. */
|
|
10
9
|
exports.GasFeatureKey = {
|
|
11
10
|
/** Gas key for built-in `source()` file analysis. */
|
|
12
11
|
Source: 'source',
|
|
13
|
-
/** Gas key for the side-effect link resolution phase of the dataflow extractor
|
|
12
|
+
/** Gas key for the side-effect link resolution phase of the dataflow extractor (matches unknown side effects against call sites via the CFG). */
|
|
14
13
|
SideEffectLinking: 'side-effect-linking',
|
|
15
|
-
/** Gas key for the linter, checked once per
|
|
14
|
+
/** Gas key for the linter, checked once per rule; remaining rules are skipped under critical pressure. */
|
|
16
15
|
Linter: 'linter',
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
Slicer: 'slicer'
|
|
16
|
+
/** Gas key for the static slicer, checked while traversing the dataflow graph; a hit stops traversal early (`SliceResult.stoppedEarly`). */
|
|
17
|
+
Slicer: 'slicer',
|
|
18
|
+
/** Gas key for dataflow extraction. Unlike the keys above it is *armed* once per run (see {@link ReadOnlyFlowrAnalyzerGasContext.budget}) and counted as the fold goes. */
|
|
19
|
+
Dataflow: 'dataflow'
|
|
23
20
|
};
|
|
21
|
+
/** Whether `budget` bounds anything at all; an unbounded one is never armed. */
|
|
22
|
+
function isBoundedBudget(budget) {
|
|
23
|
+
return budget !== undefined && ((budget.steps ?? 0) > 0 || (budget.vertices ?? 0) > 0 || (budget.timeMs ?? 0) > 0);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Counts what one extraction spends and reports when its {@link DataflowBudget} is used up. Both counters are
|
|
27
|
+
* **sampled, not exact**: the hot paths only decrement a countdown, and accounting runs once every
|
|
28
|
+
* {@link FlowrGasConfig.countedCheckEvery} calls, so a bound may be overshot by up to that many steps or vertices.
|
|
29
|
+
*/
|
|
30
|
+
class DataflowBudgetTracker {
|
|
31
|
+
stepLimit;
|
|
32
|
+
vertexLimit;
|
|
33
|
+
deadline;
|
|
34
|
+
every;
|
|
35
|
+
/** steps left before the next accounting; the only thing {@link step} touches while the budget holds */
|
|
36
|
+
untilStep;
|
|
37
|
+
/** vertices left before the next accounting, see {@link untilStep} */
|
|
38
|
+
untilVertex;
|
|
39
|
+
steps = 0;
|
|
40
|
+
vertices = 0;
|
|
41
|
+
hit;
|
|
42
|
+
/** `since` is what the elapsed-time bound is measured from; `every` is how many calls one accounting covers (see {@link FlowrGasConfig.countedCheckEvery}). */
|
|
43
|
+
constructor(budget, since, every) {
|
|
44
|
+
this.stepLimit = budget.steps ?? 0;
|
|
45
|
+
this.vertexLimit = budget.vertices ?? 0;
|
|
46
|
+
this.deadline = (budget.timeMs ?? 0) > 0 ? since + budget.timeMs : Number.POSITIVE_INFINITY;
|
|
47
|
+
this.every = Math.max(1, every);
|
|
48
|
+
this.untilStep = this.every;
|
|
49
|
+
this.untilVertex = this.every;
|
|
50
|
+
}
|
|
51
|
+
/** What ended the extraction early, `undefined` while the budget holds. */
|
|
52
|
+
get exhausted() {
|
|
53
|
+
return this.hit;
|
|
54
|
+
}
|
|
55
|
+
/** Books one processed node, returning whether the budget is used up (so the caller must not descend). Only every {@link FlowrGasConfig.countedCheckEvery}-th call does more than count down. */
|
|
56
|
+
step() {
|
|
57
|
+
if (--this.untilStep > 0) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
/* an exhausted budget answers on every call from here on, so the fold stops at the next node */
|
|
61
|
+
this.untilStep = 1;
|
|
62
|
+
if (this.hit !== undefined) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
this.untilStep = this.every;
|
|
66
|
+
this.steps += this.every;
|
|
67
|
+
if (this.stepLimit > 0 && this.steps > this.stepLimit) {
|
|
68
|
+
return this.exceed("steps" /* BudgetDimension.Steps */, this.stepLimit, this.steps);
|
|
69
|
+
}
|
|
70
|
+
if (this.deadline !== Number.POSITIVE_INFINITY && Date.now() > this.deadline) {
|
|
71
|
+
return this.exceed("time" /* BudgetDimension.Time */, this.deadline, Date.now());
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
/** Books one created vertex, sampled like {@link step}. Billed as *created*, so the count bounds the work done rather than the size of the final (possibly merged-away) graph. */
|
|
76
|
+
vertex() {
|
|
77
|
+
if (--this.untilVertex > 0) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.untilVertex = this.every;
|
|
81
|
+
this.vertices += this.every;
|
|
82
|
+
if (this.hit === undefined && this.vertexLimit > 0 && this.vertices > this.vertexLimit) {
|
|
83
|
+
this.exceed("vertices" /* BudgetDimension.Vertices */, this.vertexLimit, this.vertices);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exceed(dimension, limit, reached) {
|
|
87
|
+
this.hit = { dimension, limit, reached };
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.DataflowBudgetTracker = DataflowBudgetTracker;
|
|
92
|
+
/**
|
|
93
|
+
* The tracker of the extraction currently running, or `undefined` when the gas context armed none. A live binding
|
|
94
|
+
* rather than a getter, so an unarmed run pays only a null check. Set it only through {@link withDataflowBudget}.
|
|
95
|
+
*/
|
|
96
|
+
exports.activeDataflowBudget = undefined;
|
|
97
|
+
/** Runs `fn` with `tracker` as the {@link activeDataflowBudget}, restoring whatever was active before (so a nested extraction bills the budget it was started under). */
|
|
98
|
+
function withDataflowBudget(tracker, fn) {
|
|
99
|
+
const previous = exports.activeDataflowBudget;
|
|
100
|
+
exports.activeDataflowBudget = tracker ?? previous;
|
|
101
|
+
try {
|
|
102
|
+
return fn();
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
exports.activeDataflowBudget = previous;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
24
108
|
//# sourceMappingURL=gas.js.map
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `import ... from '@eagleoutice/flowr'` gives you: the entry points an analysis is written against.
|
|
3
|
+
*
|
|
4
|
+
* Everything flowR has stays reachable under its own path (`@eagleoutice/flowr/dataflow/graph/graph` and its
|
|
5
|
+
* kin), which is what the wiki links to. This module only spares the common case from knowing where a name
|
|
6
|
+
* lives, so it re-exports rather than defines.
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { FlowrAnalyzerBuilder } from '@eagleoutice/flowr';
|
|
10
|
+
*
|
|
11
|
+
* const analyzer = await new FlowrAnalyzerBuilder().setEngine('tree-sitter').build();
|
|
12
|
+
* analyzer.addRequest('x <- 1\ny <- x\nx');
|
|
13
|
+
* const slice = await analyzer.query([{ type: 'static-slice', criteria: ['3@x'] }]);
|
|
14
|
+
* ```
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
export { FlowrAnalyzer } from './project/flowr-analyzer';
|
|
18
|
+
export type { FlowrAnalysisOptions, FlowrAnalysisProvider, ReadonlyFlowrAnalysisProvider } from './project/flowr-analyzer';
|
|
19
|
+
export { FlowrAnalyzerBuilder } from './project/flowr-analyzer-builder';
|
|
20
|
+
export type { Query, QueryResults, SupportedQueryTypes } from './queries/query';
|
|
21
|
+
export { SlicingCriteria, SlicingCriterion } from './slicing/criterion/parse';
|
|
22
|
+
export { requestFromInput } from './r-bridge/retriever';
|
|
23
|
+
export type { RParseRequest, RParseRequests } from './r-bridge/retriever';
|
|
24
|
+
export type { KnownParser } from './r-bridge/parser';
|
|
25
|
+
export { RShell } from './r-bridge/shell';
|
|
26
|
+
export { TreeSitterExecutor } from './r-bridge/lang-4.x/tree-sitter/tree-sitter-executor';
|
|
27
|
+
export { FlowrConfig } from './config';
|
|
28
|
+
export { PipelineExecutor } from './core/pipeline-executor';
|
|
29
|
+
export { DEFAULT_DATAFLOW_PIPELINE, DEFAULT_SLICING_PIPELINE, DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE, TREE_SITTER_DATAFLOW_PIPELINE, TREE_SITTER_SLICING_PIPELINE, TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE } from './core/steps/pipeline/default-pipelines';
|
|
30
|
+
export { flowrVersion, retrieveVersionInformation } from './util/version';
|
|
31
|
+
export type { VersionInformation } from './util/version';
|
package/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What `import ... from '@eagleoutice/flowr'` gives you: the entry points an analysis is written against.
|
|
4
|
+
*
|
|
5
|
+
* Everything flowR has stays reachable under its own path (`@eagleoutice/flowr/dataflow/graph/graph` and its
|
|
6
|
+
* kin), which is what the wiki links to. This module only spares the common case from knowing where a name
|
|
7
|
+
* lives, so it re-exports rather than defines.
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { FlowrAnalyzerBuilder } from '@eagleoutice/flowr';
|
|
11
|
+
*
|
|
12
|
+
* const analyzer = await new FlowrAnalyzerBuilder().setEngine('tree-sitter').build();
|
|
13
|
+
* analyzer.addRequest('x <- 1\ny <- x\nx');
|
|
14
|
+
* const slice = await analyzer.query([{ type: 'static-slice', criteria: ['3@x'] }]);
|
|
15
|
+
* ```
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.retrieveVersionInformation = exports.flowrVersion = exports.TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE = exports.TREE_SITTER_SLICING_PIPELINE = exports.TREE_SITTER_DATAFLOW_PIPELINE = exports.DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE = exports.DEFAULT_SLICING_PIPELINE = exports.DEFAULT_DATAFLOW_PIPELINE = exports.PipelineExecutor = exports.FlowrConfig = exports.TreeSitterExecutor = exports.RShell = exports.requestFromInput = exports.SlicingCriterion = exports.SlicingCriteria = exports.FlowrAnalyzerBuilder = exports.FlowrAnalyzer = void 0;
|
|
20
|
+
/* the analyzer, which is the front door: everything else here is what its methods hand you or take */
|
|
21
|
+
var flowr_analyzer_1 = require("./project/flowr-analyzer");
|
|
22
|
+
Object.defineProperty(exports, "FlowrAnalyzer", { enumerable: true, get: function () { return flowr_analyzer_1.FlowrAnalyzer; } });
|
|
23
|
+
var flowr_analyzer_builder_1 = require("./project/flowr-analyzer-builder");
|
|
24
|
+
Object.defineProperty(exports, "FlowrAnalyzerBuilder", { enumerable: true, get: function () { return flowr_analyzer_builder_1.FlowrAnalyzerBuilder; } });
|
|
25
|
+
var parse_1 = require("./slicing/criterion/parse");
|
|
26
|
+
Object.defineProperty(exports, "SlicingCriteria", { enumerable: true, get: function () { return parse_1.SlicingCriteria; } });
|
|
27
|
+
Object.defineProperty(exports, "SlicingCriterion", { enumerable: true, get: function () { return parse_1.SlicingCriterion; } });
|
|
28
|
+
/* what to analyze, and what reads it */
|
|
29
|
+
var retriever_1 = require("./r-bridge/retriever");
|
|
30
|
+
Object.defineProperty(exports, "requestFromInput", { enumerable: true, get: function () { return retriever_1.requestFromInput; } });
|
|
31
|
+
var shell_1 = require("./r-bridge/shell");
|
|
32
|
+
Object.defineProperty(exports, "RShell", { enumerable: true, get: function () { return shell_1.RShell; } });
|
|
33
|
+
var tree_sitter_executor_1 = require("./r-bridge/lang-4.x/tree-sitter/tree-sitter-executor");
|
|
34
|
+
Object.defineProperty(exports, "TreeSitterExecutor", { enumerable: true, get: function () { return tree_sitter_executor_1.TreeSitterExecutor; } });
|
|
35
|
+
/* how it is configured */
|
|
36
|
+
var config_1 = require("./config");
|
|
37
|
+
Object.defineProperty(exports, "FlowrConfig", { enumerable: true, get: function () { return config_1.FlowrConfig; } });
|
|
38
|
+
/* the low-level interface the analyzer is built on, for anyone assembling their own pipeline */
|
|
39
|
+
var pipeline_executor_1 = require("./core/pipeline-executor");
|
|
40
|
+
Object.defineProperty(exports, "PipelineExecutor", { enumerable: true, get: function () { return pipeline_executor_1.PipelineExecutor; } });
|
|
41
|
+
var default_pipelines_1 = require("./core/steps/pipeline/default-pipelines");
|
|
42
|
+
Object.defineProperty(exports, "DEFAULT_DATAFLOW_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.DEFAULT_DATAFLOW_PIPELINE; } });
|
|
43
|
+
Object.defineProperty(exports, "DEFAULT_SLICING_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.DEFAULT_SLICING_PIPELINE; } });
|
|
44
|
+
Object.defineProperty(exports, "DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE; } });
|
|
45
|
+
Object.defineProperty(exports, "TREE_SITTER_DATAFLOW_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.TREE_SITTER_DATAFLOW_PIPELINE; } });
|
|
46
|
+
Object.defineProperty(exports, "TREE_SITTER_SLICING_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.TREE_SITTER_SLICING_PIPELINE; } });
|
|
47
|
+
Object.defineProperty(exports, "TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE; } });
|
|
48
|
+
/* which flowR this is */
|
|
49
|
+
var version_1 = require("./util/version");
|
|
50
|
+
Object.defineProperty(exports, "flowrVersion", { enumerable: true, get: function () { return version_1.flowrVersion; } });
|
|
51
|
+
Object.defineProperty(exports, "retrieveVersionInformation", { enumerable: true, get: function () { return version_1.retrieveVersionInformation; } });
|
|
52
|
+
//# sourceMappingURL=index.js.map
|