@eagleoutice/flowr 2.10.9 → 2.11.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 +116 -38
- package/abstract-interpretation/absint-visitor.js +6 -3
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
- package/abstract-interpretation/domains/interval-domain.js +1 -1
- package/abstract-interpretation/domains/lattice.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
- package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
- package/abstract-interpretation/domains/singleton-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
- package/abstract-interpretation/unsupported-functions.d.ts +3 -2
- package/abstract-interpretation/unsupported-functions.js +38 -28
- package/cli/benchmark-app.js +2 -1
- package/cli/common/options.d.ts +2 -108
- package/cli/common/options.js +3 -27
- package/cli/common/script.js +3 -2
- package/cli/common/scripts-info.d.ts +2 -123
- package/cli/common/scripts-info.js +0 -17
- package/cli/flowr-main-options.d.ts +5 -0
- package/cli/flowr-main-options.js +10 -0
- package/cli/flowr.js +48 -11
- package/cli/repl/commands/repl-cfg.js +9 -9
- package/cli/repl/commands/repl-commands.js +5 -0
- package/cli/repl/commands/repl-dataflow.js +31 -24
- package/cli/repl/commands/repl-main.d.ts +6 -0
- package/cli/repl/commands/repl-normalize.js +15 -12
- package/cli/repl/commands/repl-parse.js +1 -1
- package/cli/repl/commands/repl-query.js +4 -5
- package/cli/repl/commands/repl-quit.js +2 -1
- package/cli/repl/core.d.ts +11 -0
- package/cli/repl/core.js +101 -3
- package/cli/repl/execute.js +3 -2
- package/cli/repl/parser/slice-query-parser.d.ts +16 -0
- package/cli/repl/parser/slice-query-parser.js +52 -0
- package/cli/repl/print-version.d.ts +3 -1
- package/cli/repl/print-version.js +21 -2
- package/cli/repl/server/connection.d.ts +3 -0
- package/cli/repl/server/connection.js +65 -31
- package/cli/repl/server/messages/message-analysis.d.ts +10 -0
- package/cli/repl/server/messages/message-analysis.js +6 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/script-core/summarizer-core.js +13 -32
- package/cli/wiki.d.ts +3 -1
- package/cli/wiki.js +6 -1
- package/config.d.ts +22 -10
- package/config.js +33 -7
- package/control-flow/diff-cfg.d.ts +1 -1
- package/control-flow/diff-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/control-flow/simple-visitor.js +6 -5
- package/control-flow/useless-loop.js +2 -2
- package/core/print/dataflow-printer.d.ts +2 -2
- package/core/print/dataflow-printer.js +2 -2
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/dataflow/environments/append.d.ts +2 -2
- package/dataflow/environments/append.js +4 -10
- package/dataflow/environments/apply-kill.d.ts +21 -0
- package/dataflow/environments/apply-kill.js +155 -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.d.ts +4 -0
- package/dataflow/environments/built-in.js +4 -0
- package/dataflow/environments/default-builtin-config.d.ts +183 -67
- package/dataflow/environments/default-builtin-config.js +358 -147
- package/dataflow/environments/environment.d.ts +49 -31
- package/dataflow/environments/environment.js +144 -25
- package/dataflow/environments/identifier.d.ts +65 -2
- package/dataflow/environments/identifier.js +37 -2
- package/dataflow/environments/overwrite.js +2 -10
- package/dataflow/environments/reference-to-maybe.d.ts +2 -0
- package/dataflow/environments/reference-to-maybe.js +56 -11
- package/dataflow/environments/resolve-by-name.d.ts +1 -1
- package/dataflow/environments/resolve-by-name.js +23 -9
- package/dataflow/environments/scoping.d.ts +9 -2
- package/dataflow/environments/scoping.js +15 -2
- package/dataflow/eval/values/general.js +4 -0
- package/dataflow/extractor.js +35 -4
- package/dataflow/graph/df-helper.d.ts +14 -0
- package/dataflow/graph/df-helper.js +41 -0
- package/dataflow/graph/graph.d.ts +4 -1
- package/dataflow/graph/graph.js +6 -2
- package/dataflow/info.d.ts +27 -1
- package/dataflow/internal/linker.d.ts +5 -1
- package/dataflow/internal/linker.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +61 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +132 -25
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +11 -4
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +23 -0
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-origin.js +1 -1
- package/dataflow/processor.d.ts +6 -0
- package/documentation/data/faq/faqs.d.ts +2 -1
- package/documentation/data/faq/faqs.js +78 -57
- package/documentation/data/interface/doc-writing-code.js +4 -80
- package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
- package/documentation/data/server/doc-data-server-messages.js +15 -7
- package/documentation/doc-readme.js +15 -15
- package/documentation/doc-util/doc-cfg.d.ts +3 -1
- package/documentation/doc-util/doc-cfg.js +3 -3
- package/documentation/doc-util/doc-dfg.d.ts +3 -1
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-files.d.ts +3 -1
- package/documentation/doc-util/doc-files.js +9 -6
- package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +2 -1
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -0
- package/documentation/doc-util/doc-structure.js +1 -2
- package/documentation/doc-util/doc-types.d.ts +6 -6
- package/documentation/doc-util/doc-types.js +11 -9
- package/documentation/issue-linting-rule.js +1 -2
- package/documentation/wiki-analyzer.js +9 -9
- package/documentation/wiki-cfg.js +40 -41
- package/documentation/wiki-core.js +121 -32
- package/documentation/wiki-create-linting-rules.d.ts +6 -0
- package/documentation/wiki-create-linting-rules.js +95 -0
- package/documentation/wiki-dataflow-graph.js +112 -77
- package/documentation/wiki-engine.js +1 -2
- package/documentation/wiki-faq.d.ts +2 -1
- package/documentation/wiki-faq.js +4 -4
- package/documentation/wiki-interface.js +22 -8
- package/documentation/wiki-linter.d.ts +1 -1
- package/documentation/wiki-linter.js +16 -6
- package/documentation/wiki-linting-and-testing.js +2 -2
- package/documentation/wiki-mk/doc-context.d.ts +3 -3
- package/documentation/wiki-mk/doc-maker.d.ts +2 -0
- package/documentation/wiki-mk/doc-maker.js +7 -1
- package/documentation/wiki-normalized-ast.js +5 -5
- package/documentation/wiki-onboarding.d.ts +2 -1
- package/documentation/wiki-onboarding.js +5 -5
- package/documentation/wiki-overview.js +4 -17
- package/documentation/wiki-package-database.d.ts +9 -0
- package/documentation/wiki-package-database.js +63 -0
- package/documentation/wiki-query.js +86 -84
- package/documentation/wiki-search.js +4 -5
- package/documentation/wiki-setup.js +6 -7
- package/gas.d.ts +74 -0
- package/gas.js +18 -0
- package/linter/linter-executor.js +2 -8
- package/linter/linter-format.d.ts +4 -11
- package/linter/linter-rules.d.ts +111 -86
- package/linter/linter-rules.js +9 -1
- package/linter/rules/absolute-path.d.ts +2 -7
- package/linter/rules/absolute-path.js +8 -5
- package/linter/rules/dataframe-access-validation.d.ts +1 -6
- package/linter/rules/dataframe-access-validation.js +8 -6
- package/linter/rules/dead-code.d.ts +2 -11
- package/linter/rules/dead-code.js +16 -11
- package/linter/rules/deprecated-functions.d.ts +3 -3
- package/linter/rules/file-path-validity.d.ts +1 -6
- package/linter/rules/file-path-validity.js +5 -5
- package/linter/rules/function-finder-util.d.ts +7 -11
- package/linter/rules/function-finder-util.js +9 -6
- package/linter/rules/naming-convention.d.ts +2 -7
- package/linter/rules/naming-convention.js +3 -2
- package/linter/rules/network-functions.d.ts +2 -7
- package/linter/rules/network-functions.js +14 -12
- package/linter/rules/no-leaked-credentials.d.ts +36 -0
- package/linter/rules/no-leaked-credentials.js +75 -0
- package/linter/rules/problematic-inputs.d.ts +1 -8
- package/linter/rules/problematic-inputs.js +5 -4
- package/linter/rules/roxygen-arguments.d.ts +2 -7
- package/linter/rules/roxygen-arguments.js +13 -20
- package/linter/rules/seeded-randomness.d.ts +2 -7
- package/linter/rules/seeded-randomness.js +7 -4
- package/linter/rules/software-has-license.d.ts +31 -0
- package/linter/rules/software-has-license.js +46 -0
- package/linter/rules/software-has-tests.d.ts +38 -0
- package/linter/rules/software-has-tests.js +48 -0
- package/linter/rules/stop-with-call-arg.d.ts +2 -7
- package/linter/rules/stop-with-call-arg.js +3 -2
- package/linter/rules/undefined-symbol.d.ts +39 -0
- package/linter/rules/undefined-symbol.js +80 -0
- package/linter/rules/unused-definition.d.ts +3 -8
- package/linter/rules/unused-definition.js +7 -5
- package/linter/rules/useless-loop.d.ts +2 -7
- package/linter/rules/useless-loop.js +5 -2
- package/package.json +5 -5
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +9 -1
- package/project/context/flowr-analyzer-context.d.ts +13 -14
- package/project/context/flowr-analyzer-context.js +4 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
- package/project/context/flowr-analyzer-dependencies-context.js +36 -4
- package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
- package/project/context/flowr-analyzer-environment-context.js +3 -4
- package/project/context/flowr-analyzer-files-context.d.ts +13 -0
- package/project/context/flowr-analyzer-files-context.js +12 -2
- package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
- package/project/context/flowr-analyzer-gas-context.js +101 -0
- package/project/context/flowr-file.d.ts +2 -0
- package/project/context/flowr-file.js +2 -0
- package/project/flowr-analyzer-builder.js +3 -0
- package/project/flowr-analyzer.d.ts +2 -1
- package/project/flowr-analyzer.js +3 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
- package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
- package/project/plugins/flowr-analyzer-plugin.js +14 -7
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
- package/project/plugins/package-version-plugins/package.d.ts +3 -0
- package/project/plugins/package-version-plugins/package.js +12 -0
- package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
- package/project/plugins/package-version-plugins/pkgdb.js +370 -0
- package/project/plugins/plugin-registry.d.ts +5 -1
- package/project/plugins/plugin-registry.js +10 -1
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +62 -8
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -2
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
- package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
- package/queries/catalog/dice-query/dice-query-executor.js +52 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
- package/queries/catalog/dice-query/dice-query-format.js +102 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
- package/queries/catalog/linter-query/linter-query-executor.js +8 -0
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +1 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
- package/queries/query.d.ts +18 -1
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +7 -2
- package/r-bridge/data/data.js +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
- package/r-bridge/parser.js +2 -9
- package/r-bridge/shell.d.ts +8 -1
- package/r-bridge/shell.js +26 -7
- package/search/flowr-search-builder.d.ts +2 -2
- package/search/flowr-search-builder.js +1 -1
- package/search/flowr-search-filters.d.ts +30 -9
- package/search/flowr-search-filters.js +26 -21
- package/search/search-executor/search-enrichers.d.ts +601 -1
- package/search/search-executor/search-enrichers.js +30 -6
- package/slicing/static/static-slicer.d.ts +39 -11
- package/slicing/static/static-slicer.js +44 -14
- package/util/collections/queue.d.ts +16 -0
- package/util/collections/queue.js +38 -0
- package/util/log.d.ts +1 -1
- package/util/log.js +1 -1
- package/util/mermaid/dfg.d.ts +2 -2
- package/util/mermaid/dfg.js +2 -2
- package/util/mermaid/mermaid.d.ts +4 -0
- package/util/mermaid/mermaid.js +8 -1
- package/util/objects.d.ts +9 -0
- package/util/objects.js +54 -0
- package/util/proc.d.ts +6 -0
- package/util/proc.js +20 -0
- package/util/version.js +10 -2
- package/cli/common/features.d.ts +0 -9
- package/cli/common/features.js +0 -35
- package/cli/script-core/statistics-core.d.ts +0 -6
- package/cli/script-core/statistics-core.js +0 -103
- package/cli/script-core/statistics-helper-core.d.ts +0 -6
- package/cli/script-core/statistics-helper-core.js +0 -85
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -16
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -14
- package/statistics/features/common-syntax-probability.d.ts +0 -38
- package/statistics/features/common-syntax-probability.js +0 -169
- package/statistics/features/feature.d.ts +0 -179
- package/statistics/features/feature.js +0 -38
- package/statistics/features/post-processing.d.ts +0 -18
- package/statistics/features/post-processing.js +0 -26
- package/statistics/features/supported/assignments/assignments.d.ts +0 -12
- package/statistics/features/supported/assignments/assignments.js +0 -56
- package/statistics/features/supported/assignments/post-process.d.ts +0 -6
- package/statistics/features/supported/assignments/post-process.js +0 -126
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -143
- package/statistics/features/supported/comments/post-process.d.ts +0 -6
- package/statistics/features/supported/comments/post-process.js +0 -51
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -69
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
- package/statistics/features/supported/control-flow/post-process.js +0 -66
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -122
- package/statistics/features/supported/data-access/post-process.d.ts +0 -6
- package/statistics/features/supported/data-access/post-process.js +0 -108
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -168
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
- package/statistics/features/supported/expression-list/post-process.js +0 -45
- package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -81
- package/statistics/features/supported/loops/post-process.d.ts +0 -6
- package/statistics/features/supported/loops/post-process.js +0 -73
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -176
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -99
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
- package/statistics/features/supported/used-packages/post-process.js +0 -122
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -140
- package/statistics/features/supported/values/post-process.d.ts +0 -6
- package/statistics/features/supported/values/post-process.js +0 -73
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -111
- package/statistics/features/supported/variables/post-process.d.ts +0 -15
- package/statistics/features/supported/variables/post-process.js +0 -126
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -62
- package/statistics/meta-statistics.d.ts +0 -32
- package/statistics/meta-statistics.js +0 -16
- package/statistics/output/file-provider.d.ts +0 -36
- package/statistics/output/file-provider.js +0 -96
- package/statistics/output/print-stats.d.ts +0 -29
- package/statistics/output/print-stats.js +0 -81
- package/statistics/output/statistics-file.d.ts +0 -36
- package/statistics/output/statistics-file.js +0 -68
- package/statistics/statistics.d.ts +0 -29
- package/statistics/statistics.js +0 -108
- package/statistics/summarizer/auto-detect.d.ts +0 -5
- package/statistics/summarizer/auto-detect.js +0 -34
- package/statistics/summarizer/first-phase/process.d.ts +0 -6
- package/statistics/summarizer/first-phase/process.js +0 -81
- package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
- package/statistics/summarizer/post-process/clusterer.js +0 -40
- package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
- package/statistics/summarizer/post-process/file-based-count.js +0 -47
- package/statistics/summarizer/post-process/histogram.d.ts +0 -57
- package/statistics/summarizer/post-process/histogram.js +0 -126
- package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
- package/statistics/summarizer/post-process/post-process-output.js +0 -102
- package/statistics/summarizer/second-phase/process.d.ts +0 -15
- package/statistics/summarizer/second-phase/process.js +0 -118
- package/statistics/summarizer/summarizer.d.ts +0 -34
- package/statistics/summarizer/summarizer.js +0 -141
|
@@ -5,43 +5,150 @@ const known_call_handling_1 = require("../known-call-handling");
|
|
|
5
5
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
6
6
|
const logger_1 = require("../../../../../logger");
|
|
7
7
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
8
|
+
const identifier_1 = require("../../../../../environments/identifier");
|
|
8
9
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
10
|
+
const prefix_1 = require("../../../../../../util/prefix");
|
|
11
|
+
const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
|
|
12
|
+
const general_1 = require("../../../../../eval/values/general");
|
|
13
|
+
const r_value_1 = require("../../../../../eval/values/r-value");
|
|
14
|
+
const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
|
|
15
|
+
const apply_kill_1 = require("../../../../../environments/apply-kill");
|
|
16
|
+
const define_1 = require("../../../../../environments/define");
|
|
17
|
+
const built_in_envir_utils_1 = require("./built-in-envir-utils");
|
|
18
|
+
/** whether `value` is a call to the *built-in* `ls`/`objects` that lists (and thus clears) the whole scope */
|
|
19
|
+
function isBuiltInLsCall(value, data) {
|
|
20
|
+
if (value.type !== type_1.RType.FunctionCall || !value.named) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const [fn, ns] = identifier_1.Identifier.toArray(value.functionName.content);
|
|
24
|
+
if ((fn !== 'ls' && fn !== 'objects') || (ns !== undefined && ns !== 'base')) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// a `pattern`/`envir` argument restricts the listing, so only a plain listing clears everything
|
|
28
|
+
const listsEverything = value.arguments.every(a => a !== r_function_call_1.EmptyArgument && a.name !== undefined && (a.name.content === 'all.names' || a.name.content === 'sorted'));
|
|
29
|
+
if (!listsEverything) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
// an explicit `base::` is always the built-in; otherwise only when `ls` is not shadowed
|
|
33
|
+
if (ns === 'base') {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
const resolved = (0, resolve_by_name_1.resolveByName)(fn, data.environment, identifier_1.ReferenceType.Function);
|
|
37
|
+
return resolved === undefined || resolved.every(d => (0, identifier_1.isReferenceType)(d.type, identifier_1.ReferenceType.BuiltInFunction));
|
|
38
|
+
}
|
|
39
|
+
/** formal parameters of `rm` that may be given by name; every other positional argument belongs to `...` */
|
|
40
|
+
const RmNamedFormals = ['list', 'pos', 'envir', 'inherits'];
|
|
41
|
+
/** Adds the name a single `...` argument (an unquoted symbol or quoted string) refers to. */
|
|
42
|
+
function collectDotArg(targets, value) {
|
|
43
|
+
if (value?.type === type_1.RType.Symbol) {
|
|
44
|
+
targets.names.push({ name: value.content, nodeId: value.info.id });
|
|
45
|
+
}
|
|
46
|
+
else if (value?.type === type_1.RType.String) {
|
|
47
|
+
targets.names.push({ name: value.content.str, nodeId: value.info.id });
|
|
48
|
+
}
|
|
49
|
+
else if (value !== undefined) {
|
|
50
|
+
logger_1.dataflowLogger.warn(`argument is not a symbol or string in rm, skipping ${JSON.stringify(value)}`);
|
|
51
|
+
targets.unknown = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Resolves the `list=` argument, recognizing a whole-scope clear via built-in `ls()` and concrete string vectors. */
|
|
55
|
+
function collectListArg(targets, value, data) {
|
|
56
|
+
if (!value) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (value.type === type_1.RType.String) {
|
|
60
|
+
targets.names.push({ name: value.content.str, nodeId: value.info.id });
|
|
61
|
+
}
|
|
62
|
+
else if (isBuiltInLsCall(value, data)) {
|
|
63
|
+
targets.all = true;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const elements = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(value.info.id, {
|
|
67
|
+
environment: data.environment,
|
|
68
|
+
idMap: data.completeAst.idMap,
|
|
69
|
+
resolve: data.ctx.config.solver.variables,
|
|
70
|
+
ctx: data.ctx
|
|
71
|
+
}))?.elements;
|
|
72
|
+
if (!elements || elements.length === 0) {
|
|
73
|
+
targets.unknown = true;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
for (const r of elements) {
|
|
77
|
+
if (r.type === 'string' && (0, r_value_1.isValue)(r.value)) {
|
|
78
|
+
targets.names.push({ name: r.value.str, nodeId: value.info.id });
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
targets.unknown = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
9
87
|
/**
|
|
10
|
-
*
|
|
88
|
+
* Collects the removal targets of an `rm` call: every unnamed argument names a variable (`rm`'s `...` swallows
|
|
89
|
+
* all positionals), `list=` is resolved separately, and `pos`/`envir`/`inherits` contribute no names.
|
|
11
90
|
*/
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
logger_1.dataflowLogger.warn('empty rm, skipping');
|
|
15
|
-
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
16
|
-
}
|
|
17
|
-
const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Rm }).information;
|
|
18
|
-
const names = [];
|
|
91
|
+
function collectRmTargets(args, data) {
|
|
92
|
+
const targets = { names: [], all: false, unknown: false };
|
|
19
93
|
for (const arg of args) {
|
|
20
94
|
if (arg === r_function_call_1.EmptyArgument) {
|
|
21
|
-
logger_1.dataflowLogger.warn('empty argument in rm, skipping');
|
|
22
95
|
continue;
|
|
23
96
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
97
|
+
if (arg.name === undefined) {
|
|
98
|
+
collectDotArg(targets, arg.value);
|
|
99
|
+
continue;
|
|
27
100
|
}
|
|
28
|
-
|
|
29
|
-
|
|
101
|
+
const formal = (0, prefix_1.findByPrefixIfUnique)(arg.name.content, RmNamedFormals);
|
|
102
|
+
if (formal === 'list') {
|
|
103
|
+
collectListArg(targets, arg.value, data);
|
|
30
104
|
}
|
|
31
|
-
else if (
|
|
32
|
-
|
|
105
|
+
else if (formal === undefined) {
|
|
106
|
+
// an unknown named argument falls into `...` in R, but we cannot tell which name it removes
|
|
107
|
+
targets.unknown = true;
|
|
33
108
|
}
|
|
34
109
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
110
|
+
return targets;
|
|
111
|
+
}
|
|
112
|
+
/** Builds the {@link KillReference|kills} produced by an `rm` call from its resolved {@link RmTargets}. */
|
|
113
|
+
function buildKills(targets, cds) {
|
|
114
|
+
const kills = [];
|
|
115
|
+
if (targets.all) {
|
|
116
|
+
kills.push({ kind: 'all', cds });
|
|
117
|
+
}
|
|
118
|
+
if (targets.unknown) {
|
|
119
|
+
kills.push({ kind: 'unknown', cds });
|
|
120
|
+
}
|
|
121
|
+
for (const { name, nodeId } of targets.names) {
|
|
122
|
+
kills.push({ kind: 'named', reference: { nodeId, name, cds, type: identifier_1.ReferenceType.Variable } });
|
|
123
|
+
}
|
|
124
|
+
return kills;
|
|
125
|
+
}
|
|
126
|
+
/** Removes the targets from a tracked custom environment (`rm(..., envir=e)`) instead of the lexical scope. */
|
|
127
|
+
function removeFromCustomEnv(res, envir, targets, rootId, cds) {
|
|
128
|
+
const newEnvState = (0, apply_kill_1.applyKills)(envir.envDef.envState, buildKills(targets, cds));
|
|
129
|
+
const environment = (0, define_1.define)({ ...envir.envDef, definedAt: rootId, envState: newEnvState }, false, res.environment);
|
|
130
|
+
return { ...res, environment };
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Process an `rm` call, marking the removed variables as {@link KillReference|killed} so the removal is
|
|
134
|
+
* carried to the enclosing scope even when it happens nested within a branch or block.
|
|
135
|
+
*/
|
|
136
|
+
function processRm(name, args, rootId, data) {
|
|
137
|
+
if (args.length === 0) {
|
|
138
|
+
logger_1.dataflowLogger.warn('empty rm, skipping');
|
|
139
|
+
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
38
140
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
141
|
+
const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Rm }).information;
|
|
142
|
+
const targets = collectRmTargets(args, data);
|
|
143
|
+
// `rm(x, envir=e)` removes from a tracked custom environment instead of the lexical scope
|
|
144
|
+
if (data.ctx.config.solver.trackEnvironments) {
|
|
145
|
+
const envir = (0, built_in_envir_utils_1.resolveEnvirArg)(args, data, 'envir');
|
|
146
|
+
if (envir) {
|
|
147
|
+
return removeFromCustomEnv(res, envir, targets, rootId, data.cds);
|
|
44
148
|
}
|
|
45
|
-
}
|
|
149
|
+
}
|
|
150
|
+
// apply to our own environment so threading reflects it, and emit the kills so a merging parent can re-apply
|
|
151
|
+
const kills = buildKills(targets, data.cds);
|
|
152
|
+
return kills.length > 0 ? { ...res, environment: (0, apply_kill_1.applyKills)(res.environment, kills), kill: kills } : res;
|
|
46
153
|
}
|
|
47
154
|
//# sourceMappingURL=built-in-rm.js.map
|
|
@@ -25,7 +25,7 @@ const parser_1 = require("../../../../../../r-bridge/lang-4.x/ast/parser/json/pa
|
|
|
25
25
|
const shell_executor_1 = require("../../../../../../r-bridge/shell-executor");
|
|
26
26
|
const assert_1 = require("../../../../../../util/assert");
|
|
27
27
|
const path_1 = __importDefault(require("path"));
|
|
28
|
-
const
|
|
28
|
+
const gas_1 = require("../../../../../../gas");
|
|
29
29
|
const general_1 = require("../../../../../eval/values/general");
|
|
30
30
|
const r_value_1 = require("../../../../../eval/values/r-value");
|
|
31
31
|
const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
|
|
@@ -220,15 +220,14 @@ function sourceRequest(rootId, request, data, information, makeMaybe, getId) {
|
|
|
220
220
|
return information;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
223
|
+
const gasLevel = data.ctx.gas.checkGas(gas_1.GasFeatureKey.Source);
|
|
224
|
+
if (gasLevel >= 2 /* GasLevel.Critical */) {
|
|
225
|
+
logger_1.dataflowLogger.warn(`Skipping source of ${JSON.stringify(request)} due to resource pressure (gas: critical). See ${gas_1.GasWikiRef}`);
|
|
226
|
+
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
227
|
+
return information;
|
|
228
|
+
}
|
|
229
|
+
else if (gasLevel >= 1 /* GasLevel.Problematic */) {
|
|
230
|
+
logger_1.dataflowLogger.warn(`Approaching resource limits for source of ${JSON.stringify(request)} (gas: problematic). See ${gas_1.GasWikiRef}`);
|
|
232
231
|
}
|
|
233
232
|
const parsed = (!data.parser.async ? data.parser : new shell_executor_1.RShellExecutor()).parse(textRequest.r);
|
|
234
233
|
const normalized = (typeof parsed !== 'string' ?
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DataflowProcessorInformation } from '../../../../../processor';
|
|
2
|
+
import type { DataflowInformation } from '../../../../../info';
|
|
3
|
+
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
+
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
|
+
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
|
+
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
|
+
import { type REnvironmentInformation } from '../../../../../environments/environment';
|
|
8
|
+
import type { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
|
|
9
|
+
/** The context needed to resolve a stack env: the current environment (for the global) and the built-in environment. */
|
|
10
|
+
type StackEnvContext = Pick<DataflowProcessorInformation<never>, 'environment' | 'ctx'>;
|
|
11
|
+
/**
|
|
12
|
+
* Processes the env-returning builtins (`globalenv`/`baseenv`/`emptyenv`), tagging the call with the
|
|
13
|
+
* {@link BuiltInProcName.StackEnv} origin so an assignment (`e <- globalenv()`) attaches the stack env as the
|
|
14
|
+
* variable's `envState`. Direct forms (`globalenv()$x`, `.GlobalEnv`) go through {@link resolveNodeToStackEnv}.
|
|
15
|
+
*/
|
|
16
|
+
export declare function processStackEnv<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
|
|
17
|
+
/**
|
|
18
|
+
* The stack environment an AST `node` denotes directly: a `.GlobalEnv`/`.BaseEnv` symbol, a
|
|
19
|
+
* `globalenv()`/`baseenv()`/`emptyenv()` call, the current env via `environment()`, the parent via `parent.env(e)`,
|
|
20
|
+
* or a named search-path entry via `as.environment("package:x")`. Returns `undefined` otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveNodeToStackEnv<Info>(node: RNode<Info> | undefined, data: StackEnvContext): REnvironmentInformation | undefined;
|
|
23
|
+
/** If `sourceInfo`'s entry is a {@link BuiltInProcName.StackEnv} call, the stack environment it refers to; else `undefined`. */
|
|
24
|
+
export declare function stackEnvStateFromSource(sourceInfo: DataflowInformation, data: StackEnvContext): REnvironmentInformation | undefined;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processStackEnv = processStackEnv;
|
|
4
|
+
exports.resolveNodeToStackEnv = resolveNodeToStackEnv;
|
|
5
|
+
exports.stackEnvStateFromSource = stackEnvStateFromSource;
|
|
6
|
+
const known_call_handling_1 = require("../known-call-handling");
|
|
7
|
+
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
8
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
9
|
+
const vertex_1 = require("../../../../../graph/vertex");
|
|
10
|
+
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
11
|
+
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
12
|
+
const default_builtin_config_1 = require("../../../../../environments/default-builtin-config");
|
|
13
|
+
/** The stack env kind a builtin/constant `name` denotes, or `undefined`. */
|
|
14
|
+
function stackEnvKind(name) {
|
|
15
|
+
return default_builtin_config_1.StackEnvBuiltins[name];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Processes the env-returning builtins (`globalenv`/`baseenv`/`emptyenv`), tagging the call with the
|
|
19
|
+
* {@link BuiltInProcName.StackEnv} origin so an assignment (`e <- globalenv()`) attaches the stack env as the
|
|
20
|
+
* variable's `envState`. Direct forms (`globalenv()$x`, `.GlobalEnv`) go through {@link resolveNodeToStackEnv}.
|
|
21
|
+
*/
|
|
22
|
+
function processStackEnv(name, args, rootId, data) {
|
|
23
|
+
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.StackEnv }).information;
|
|
24
|
+
}
|
|
25
|
+
/** The fixed stack environment for a `Global`/`Base`/`Empty` kind; `undefined` for kinds that need the call's arguments. */
|
|
26
|
+
function fixedStackEnv(kind, data) {
|
|
27
|
+
switch (kind) {
|
|
28
|
+
case default_builtin_config_1.StackEnvKind.Global:
|
|
29
|
+
return { current: environment_1.REnvironment.findGlobal(data.environment.current), level: 0 };
|
|
30
|
+
case default_builtin_config_1.StackEnvKind.Base:
|
|
31
|
+
return { current: data.ctx.env.builtInEnvironment, level: 0 };
|
|
32
|
+
case default_builtin_config_1.StackEnvKind.Empty:
|
|
33
|
+
return data.ctx.env.makeEmptyEnv();
|
|
34
|
+
default:
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The stack environment an AST `node` denotes directly: a `.GlobalEnv`/`.BaseEnv` symbol, a
|
|
40
|
+
* `globalenv()`/`baseenv()`/`emptyenv()` call, the current env via `environment()`, the parent via `parent.env(e)`,
|
|
41
|
+
* or a named search-path entry via `as.environment("package:x")`. Returns `undefined` otherwise.
|
|
42
|
+
*/
|
|
43
|
+
function resolveNodeToStackEnv(node, data) {
|
|
44
|
+
if (node === undefined) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const name = node.type === type_1.RType.Symbol ? String(node.content)
|
|
48
|
+
: r_function_call_1.RFunctionCall.isNamed(node) && node.functionName.type === type_1.RType.Symbol ? String(node.functionName.content)
|
|
49
|
+
: undefined;
|
|
50
|
+
const kind = name !== undefined ? stackEnvKind(name) : undefined;
|
|
51
|
+
if (kind === undefined) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const firstArg = node.type === type_1.RType.FunctionCall && node.arguments.length > 0 && node.arguments[0] !== r_function_call_1.EmptyArgument ? node.arguments[0].value : undefined;
|
|
55
|
+
switch (kind) {
|
|
56
|
+
case default_builtin_config_1.StackEnvKind.Global:
|
|
57
|
+
case default_builtin_config_1.StackEnvKind.Base:
|
|
58
|
+
case default_builtin_config_1.StackEnvKind.Empty:
|
|
59
|
+
return fixedStackEnv(kind, data);
|
|
60
|
+
case default_builtin_config_1.StackEnvKind.Current: // environment() with no argument is the current environment
|
|
61
|
+
return firstArg === undefined ? { current: data.environment.current, level: data.environment.level } : undefined;
|
|
62
|
+
case default_builtin_config_1.StackEnvKind.Parent: {
|
|
63
|
+
const inner = resolveNodeToStackEnv(firstArg, data);
|
|
64
|
+
return inner !== undefined && !inner.current.builtInEnv ? { current: inner.current.parent, level: inner.level } : undefined;
|
|
65
|
+
}
|
|
66
|
+
case default_builtin_config_1.StackEnvKind.Named:
|
|
67
|
+
return firstArg?.type === type_1.RType.String ? asSearchPathEnv(firstArg.content.str, data) : undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Resolves a named search-path entry: a `.GlobalEnv`/`.BaseEnv` name, or `package:<name>` to that package's namespace layer. */
|
|
71
|
+
function asSearchPathEnv(name, data) {
|
|
72
|
+
const fixed = fixedStackEnv(stackEnvKind(name), data);
|
|
73
|
+
if (fixed !== undefined) {
|
|
74
|
+
return fixed;
|
|
75
|
+
}
|
|
76
|
+
if (name.startsWith('package:')) {
|
|
77
|
+
const pkg = name.slice('package:'.length);
|
|
78
|
+
for (let env = environment_1.REnvironment.findGlobal(data.environment.current).parent; env !== undefined && !env.builtInEnv; env = env.parent) {
|
|
79
|
+
if (env.n === pkg && env.t === environment_1.EnvType.Namespace) {
|
|
80
|
+
return { current: env, level: 0 };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
/** If `sourceInfo`'s entry is a {@link BuiltInProcName.StackEnv} call, the stack environment it refers to; else `undefined`. */
|
|
87
|
+
function stackEnvStateFromSource(sourceInfo, data) {
|
|
88
|
+
const vertex = sourceInfo.graph.getVertex(sourceInfo.entryPoint);
|
|
89
|
+
if (!(0, vertex_1.isFunctionCallVertex)(vertex) || vertex.name === undefined || !vertex.origin.includes(built_in_proc_name_1.BuiltInProcName.StackEnv)) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
return fixedStackEnv(stackEnvKind(String(vertex.name)), data);
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=built-in-stack-env.js.map
|
|
@@ -13,6 +13,7 @@ const identifier_1 = require("../../../../../environments/identifier");
|
|
|
13
13
|
const general_1 = require("../../../../../eval/values/general");
|
|
14
14
|
const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
|
|
15
15
|
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
16
|
+
const apply_kill_1 = require("../../../../../environments/apply-kill");
|
|
16
17
|
const append_1 = require("../../../../../environments/append");
|
|
17
18
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
18
19
|
/**
|
|
@@ -74,10 +75,16 @@ function processWhileLoop(name, args, rootId, data) {
|
|
|
74
75
|
(0, reference_to_maybe_1.applyCdsToAllInGraphButConstants)(body.graph, bodyRead, cdTrue);
|
|
75
76
|
const remainingInputs = (0, linker_1.linkInputs)(bodyRead, information.environment, condition.in.concat(condition.unknownReferences), information.graph, true);
|
|
76
77
|
(0, reference_to_maybe_1.applyCdToReferences)(body.out, cdTrue);
|
|
77
|
-
(0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph, new Set(condition.in.map(i => i.nodeId)))), body.out);
|
|
78
|
+
(0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph, new Set(condition.in.map(i => i.nodeId)))), body.out, body.environment);
|
|
78
79
|
(0, linker_1.reapplyLoopExitPoints)(body.exitPoints, body.in.concat(body.out, body.unknownReferences), information.graph);
|
|
79
80
|
// as the while-loop always evaluates its condition
|
|
80
81
|
information.graph.addEdge(nameId, condition.entryPoint, edge_1.EdgeType.Reads);
|
|
82
|
+
// the body's environment carries its side effects (e.g. a `library()` call), which must survive the loop
|
|
83
|
+
const bodyEnvironment = (0, append_1.appendEnvironment)(information.environment, body.environment);
|
|
84
|
+
// as we do not know whether the loop executes at all, we merge the original environment back in (the body may never run)
|
|
85
|
+
const loopEnvironment = conditionIsAlwaysTrue ? bodyEnvironment : (0, append_1.appendEnvironment)(origEnv, bodyEnvironment);
|
|
86
|
+
// unless the loop always runs, a body removal only happens maybe; apply it as the merge cannot represent it
|
|
87
|
+
const loopKill = body.kill?.length ? (conditionIsAlwaysTrue ? body.kill : (0, apply_kill_1.makeKillsMaybe)(body.kill, cdTrue)) : undefined;
|
|
81
88
|
return {
|
|
82
89
|
unknownReferences: [],
|
|
83
90
|
in: [{ nodeId: nameId, name: name.lexeme, cds: originalDependency, type: identifier_1.ReferenceType.Function }, ...remainingInputs],
|
|
@@ -85,9 +92,9 @@ function processWhileLoop(name, args, rootId, data) {
|
|
|
85
92
|
entryPoint: nameId,
|
|
86
93
|
exitPoints: (0, info_1.filterOutLoopExitPoints)(body.exitPoints),
|
|
87
94
|
graph: information.graph,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
environment: loopKill ? (0, apply_kill_1.applyKills)(loopEnvironment, loopKill) : loopEnvironment,
|
|
96
|
+
hooks: condition.hooks.concat(body.hooks),
|
|
97
|
+
kill: loopKill,
|
|
91
98
|
};
|
|
92
99
|
}
|
|
93
100
|
//# sourceMappingURL=built-in-while-loop.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DataflowGraph } from '../../../../../graph/graph';
|
|
2
|
+
import { type DataflowGraphVertexFunctionDefinition } from '../../../../../graph/vertex';
|
|
3
|
+
import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
|
+
import { type REnvironmentInformation } from '../../../../../environments/environment';
|
|
5
|
+
import type { FlowrAnalyzerContext } from '../../../../../../project/context/flowr-analyzer-context';
|
|
6
|
+
import type { IdentifierReference } from '../../../../../environments/identifier';
|
|
7
|
+
/**
|
|
8
|
+
* Computes, for every function-definition vertex `F`, `summary(F) = own(F)` unioned with `summary(G)` over every transitive callee `G`.
|
|
9
|
+
* @param graph - the fully linked dataflow graph
|
|
10
|
+
* @param own - the effects a single function definition produces itself (its contribution to the summary)
|
|
11
|
+
* @returns a map from each function-definition vertex to its transitive-effect summary
|
|
12
|
+
*/
|
|
13
|
+
export declare function computeCallGraphSummaries<T>(this: void, graph: DataflowGraph, own: (id: NodeId, fdef: DataflowGraphVertexFunctionDefinition) => Iterable<T>): Map<NodeId, Set<T>>;
|
|
14
|
+
/**
|
|
15
|
+
* Links every materialized package-export vertex back to the `library()`/`use()` call that loaded it,
|
|
16
|
+
* reading the loading call from the export binding's `definedAt` in the (final, authoritative) environment.
|
|
17
|
+
* Only vertices created on demand (exports actually referenced) get an edge, keeping the graph small.
|
|
18
|
+
*/
|
|
19
|
+
export declare function linkMaterializedExportsToLoaders(graph: DataflowGraph, environment: REnvironmentInformation): void;
|
|
20
|
+
/** Re-resolves still-open reads whose name is one of the transitively escaped `<<-` definitions in `escapedNames`, adding {@link EdgeType.Reads} edges. */
|
|
21
|
+
export declare function reResolveOpenReferences(this: void, graph: DataflowGraph, environment: REnvironmentInformation, references: readonly IdentifierReference[], escapedNames: ReadonlySet<string>): void;
|
|
22
|
+
/**
|
|
23
|
+
* Propagates every function's escaped side effects (attached packages and `<<-` definitions) to its transitive callers.
|
|
24
|
+
* @returns the enriched top-level environment and whether it grew (so the extractor can re-link and re-run to a fixpoint).
|
|
25
|
+
*/
|
|
26
|
+
export declare function propagateTransitiveSideEffects(this: void, graph: DataflowGraph, environment: REnvironmentInformation, ctx: FlowrAnalyzerContext): {
|
|
27
|
+
environment: REnvironmentInformation;
|
|
28
|
+
grew: boolean;
|
|
29
|
+
escapedNames: Set<string>;
|
|
30
|
+
};
|