@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
|
@@ -1,45 +1,415 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processLibrary = processLibrary;
|
|
4
|
+
exports.attachExportVertex = attachExportVertex;
|
|
5
|
+
exports.attachDependencyToEnvironment = attachDependencyToEnvironment;
|
|
4
6
|
const known_call_handling_1 = require("../known-call-handling");
|
|
7
|
+
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
8
|
+
const r_access_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
|
|
9
|
+
const r_logical_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-logical");
|
|
10
|
+
const node_id_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
5
11
|
const logger_1 = require("../../../../../logger");
|
|
6
|
-
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
7
12
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
8
13
|
const make_argument_1 = require("../argument/make-argument");
|
|
9
14
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
10
15
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
16
|
+
const environment_1 = require("../../../../../environments/environment");
|
|
17
|
+
const edge_1 = require("../../../../../graph/edge");
|
|
18
|
+
const assert_1 = require("../../../../../../util/assert");
|
|
19
|
+
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
20
|
+
const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
|
|
21
|
+
const general_1 = require("../../../../../eval/values/general");
|
|
22
|
+
const package_1 = require("../../../../../../project/plugins/package-version-plugins/package");
|
|
23
|
+
const flowr_namespace_file_1 = require("../../../../../../project/plugins/file-plugins/files/flowr-namespace-file");
|
|
24
|
+
const common_1 = require("../common");
|
|
25
|
+
const linker_1 = require("../../../../linker");
|
|
26
|
+
const vertex_1 = require("../../../../../graph/vertex");
|
|
11
27
|
/**
|
|
12
28
|
* Process a library call like `library` or `require`
|
|
13
29
|
*/
|
|
14
|
-
function processLibrary(name, args, rootId, data) {
|
|
30
|
+
function processLibrary(name, args, rootId, data, config = {}) {
|
|
15
31
|
/* we do not really know what loading the library does and what side effects it causes, hence we mark it as an unknown side effect */
|
|
16
|
-
if (args.length
|
|
17
|
-
logger_1.dataflowLogger.warn(`Currently only one-arg library-likes are allows (for ${identifier_1.Identifier.toString(name.content)}), skipping`);
|
|
32
|
+
if (args.length === 0) {
|
|
18
33
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true, origin: 'default' }).information;
|
|
19
34
|
}
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
if (config.boxUse) {
|
|
36
|
+
return processUse(name, args, rootId, data);
|
|
37
|
+
}
|
|
38
|
+
/* parse the import selection before the library flow rewrites `args` below */
|
|
39
|
+
const spec = config.fromImports ? parseFromSpec(args) : { namespaceOnly: config.namespaceOnly };
|
|
40
|
+
const params = {
|
|
41
|
+
'package': 'pkg',
|
|
42
|
+
'character.only': 'char'
|
|
43
|
+
};
|
|
44
|
+
const resolveArgs = { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx };
|
|
45
|
+
const argMaps = (0, linker_1.pMatch)((0, common_1.convertFnArguments)(args), params);
|
|
46
|
+
const packageId = Array.from(new Set(argMaps.get('pkg')));
|
|
47
|
+
const charId = Array.from(new Set(argMaps.get('char')));
|
|
48
|
+
let namesToLoad = packageId.map(v => r_argument_1.RArgument.getValue(args, v));
|
|
49
|
+
//check if library name provided
|
|
50
|
+
namesToLoad = namesToLoad.filter(v => v !== undefined && (v.type === type_1.RType.Symbol || v.type === type_1.RType.String));
|
|
51
|
+
if (namesToLoad.length === 0) {
|
|
22
52
|
logger_1.dataflowLogger.warn('No library name provided, skipping');
|
|
23
53
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true, origin: 'default' }).information;
|
|
24
54
|
}
|
|
25
|
-
|
|
26
|
-
|
|
55
|
+
for (const nameToLoad of namesToLoad) {
|
|
56
|
+
if (nameToLoad !== undefined && (nameToLoad.type === type_1.RType.Symbol || nameToLoad.type === type_1.RType.String) && identifier_1.Identifier.getNamespace(nameToLoad.type === type_1.RType.String ? nameToLoad.content.str : nameToLoad.content) !== undefined) {
|
|
57
|
+
logger_1.dataflowLogger.warn('Namespaced library names are not supported, ignoring namespace of library: ', nameToLoad);
|
|
58
|
+
}
|
|
27
59
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
60
|
+
let isCharacterOnly = config.characterOnly === true;
|
|
61
|
+
if (!config.characterOnly && charId.length >= 1) {
|
|
62
|
+
const values = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(charId[0], resolveArgs));
|
|
63
|
+
if (values?.type === 'set' && values?.elements.length > 0) {
|
|
64
|
+
let hasTrue = 0;
|
|
65
|
+
let hasFalse = 0;
|
|
66
|
+
let hasMaybe = 0;
|
|
67
|
+
for (const elem of values.elements) {
|
|
68
|
+
if (elem.type === 'logical') {
|
|
69
|
+
switch (elem.value) {
|
|
70
|
+
case true:
|
|
71
|
+
hasTrue++;
|
|
72
|
+
break;
|
|
73
|
+
case false:
|
|
74
|
+
hasFalse++;
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
hasMaybe++;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (hasMaybe > 0) {
|
|
83
|
+
isCharacterOnly = 'maybe';
|
|
84
|
+
}
|
|
85
|
+
else if (hasTrue === 0 && hasFalse > 0) {
|
|
86
|
+
isCharacterOnly = false;
|
|
87
|
+
}
|
|
88
|
+
else if (hasTrue > 0 && hasFalse === 0) {
|
|
89
|
+
isCharacterOnly = true;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
isCharacterOnly = 'maybe';
|
|
93
|
+
}
|
|
37
94
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
95
|
+
}
|
|
96
|
+
const packetName = [];
|
|
97
|
+
//case: true or maybe
|
|
98
|
+
if (isCharacterOnly) {
|
|
99
|
+
for (const nameToLoad of namesToLoad) {
|
|
100
|
+
const values = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(nameToLoad.info.id, resolveArgs));
|
|
101
|
+
if (values?.type === 'set' && values.elements.length !== 0) {
|
|
102
|
+
for (const elem of values.elements) {
|
|
103
|
+
if (elem.type === 'string' && 'str' in elem.value) {
|
|
104
|
+
packetName.push(elem.value.str);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (!isCharacterOnly || isCharacterOnly === 'maybe') {
|
|
111
|
+
for (const nameToLoad of namesToLoad) {
|
|
112
|
+
// a quoted literal (`requireNamespace("pkg")`) carries its name in `content.str`, not the quoted `lexeme`
|
|
113
|
+
const packageName = nameToLoad.type === type_1.RType.String ? nameToLoad.content.str : nameToLoad.lexeme;
|
|
114
|
+
if ((0, assert_1.isNotUndefined)(packageName)) {
|
|
115
|
+
packetName.push(packageName);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (!isCharacterOnly || isCharacterOnly === 'maybe') {
|
|
120
|
+
// treat as a function call but convert the first argument to a string
|
|
121
|
+
const newArgs = [];
|
|
122
|
+
for (const nameToLoad of namesToLoad) {
|
|
123
|
+
if (!(nameToLoad.type === type_1.RType.Symbol || nameToLoad.type === type_1.RType.String)) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const newArg = nameToLoad.type === type_1.RType.String ? nameToLoad : {
|
|
127
|
+
type: type_1.RType.String,
|
|
128
|
+
info: nameToLoad.info,
|
|
129
|
+
lexeme: nameToLoad.lexeme,
|
|
130
|
+
location: nameToLoad.location,
|
|
131
|
+
content: {
|
|
132
|
+
quotes: 'none',
|
|
133
|
+
str: identifier_1.Identifier.getName(nameToLoad.content)
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
newArgs.push(newArg);
|
|
137
|
+
}
|
|
138
|
+
args = (0, make_argument_1.wrapArgumentsUnnamed)([...newArgs, ...args.slice(1)], data.completeAst.idMap);
|
|
139
|
+
}
|
|
140
|
+
const info = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
141
|
+
name,
|
|
142
|
+
args, rootId, data,
|
|
143
|
+
hasUnknownSideEffect: false,
|
|
42
144
|
origin: built_in_proc_name_1.BuiltInProcName.Library
|
|
43
145
|
}).information;
|
|
146
|
+
for (const p of packetName) {
|
|
147
|
+
const dependency = data.ctx.deps.getDependency(p);
|
|
148
|
+
if (dependency) {
|
|
149
|
+
linkLibrary(dependency, info, rootId, data, spec);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
info.graph.markIdForUnknownSideEffects(rootId);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (packetName.length === 0) {
|
|
156
|
+
info.graph.markIdForUnknownSideEffects(rootId);
|
|
157
|
+
}
|
|
158
|
+
return info;
|
|
159
|
+
}
|
|
160
|
+
/** The name of a symbol or string literal node, or `undefined` for anything else. */
|
|
161
|
+
function symbolOrStringName(node) {
|
|
162
|
+
if (node?.type === type_1.RType.Symbol) {
|
|
163
|
+
return identifier_1.Identifier.getName(node.content);
|
|
164
|
+
}
|
|
165
|
+
if (node?.type === type_1.RType.String) {
|
|
166
|
+
return node.content.str;
|
|
167
|
+
}
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
/** The string literals of a `"x"` or `c("x", "y")` node (used for `import::from`'s `.except`). */
|
|
171
|
+
function stringLiterals(node) {
|
|
172
|
+
if (node.type === type_1.RType.String) {
|
|
173
|
+
return [node.content.str];
|
|
174
|
+
}
|
|
175
|
+
if (r_function_call_1.RFunctionCall.isNamed(node) && identifier_1.Identifier.getName(node.functionName.content) === 'c') {
|
|
176
|
+
return node.arguments.flatMap(a => a !== r_function_call_1.EmptyArgument && a.value?.type === type_1.RType.String ? [a.value.content.str] : []);
|
|
177
|
+
}
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
/** Parse `import::from(pkg, a, keep = filter, .all = TRUE, .except = c(...))` into which exports to attach. */
|
|
181
|
+
function parseFromSpec(args) {
|
|
182
|
+
const include = new Map();
|
|
183
|
+
const exclude = new Set();
|
|
184
|
+
let all = false;
|
|
185
|
+
for (let i = 1; i < args.length; i++) {
|
|
186
|
+
const arg = args[i];
|
|
187
|
+
if (arg === r_function_call_1.EmptyArgument || arg.value === undefined) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
const argName = arg.name?.lexeme;
|
|
191
|
+
if (argName === '.all') {
|
|
192
|
+
all ||= r_logical_1.RLogical.isTrue(arg.value);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (argName === '.except') {
|
|
196
|
+
for (const s of stringLiterals(arg.value)) {
|
|
197
|
+
exclude.add(s);
|
|
198
|
+
}
|
|
199
|
+
all = true;
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
if (argName?.startsWith('.')) {
|
|
203
|
+
continue; // other control args (.into, .library, ...) do not affect which exports resolve
|
|
204
|
+
}
|
|
205
|
+
const exported = symbolOrStringName(arg.value);
|
|
206
|
+
if (exported !== undefined) {
|
|
207
|
+
include.set(argName ?? exported, exported);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
include: include.size > 0 ? include : undefined,
|
|
212
|
+
exclude: exclude.size > 0 ? exclude : undefined,
|
|
213
|
+
all: all || exclude.size > 0
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/** Parse a `box::use` bracket argument (`pkg[a, b]` or `pkg[...]`) into a package and its attach spec; `undefined` if not a bracket. */
|
|
217
|
+
function parseBoxSpec(first) {
|
|
218
|
+
if (first === undefined || !r_access_1.RAccess.isIndex(first)) {
|
|
219
|
+
return undefined;
|
|
220
|
+
}
|
|
221
|
+
const pack = symbolOrStringName(first.accessed);
|
|
222
|
+
if (pack === undefined) {
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
const include = new Map();
|
|
226
|
+
let all = false;
|
|
227
|
+
for (const el of first.access) {
|
|
228
|
+
if (el === r_function_call_1.EmptyArgument || el.value === undefined) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
if (el.value.type === type_1.RType.Symbol && identifier_1.Identifier.getName(el.value.content) === '...') {
|
|
232
|
+
all = true; // use(pkg[...]) attaches every export
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
const exported = symbolOrStringName(el.value);
|
|
236
|
+
if (exported !== undefined) {
|
|
237
|
+
include.set(el.name?.lexeme ?? exported, exported);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return { pack, spec: { include: include.size > 0 ? include : undefined, all } };
|
|
241
|
+
}
|
|
242
|
+
/** Whether `use` should be read as `box::use` here: a `box::`-qualified call, or `box` is a loaded dependency. */
|
|
243
|
+
function usesBoxSemantics(name, data) {
|
|
244
|
+
if (identifier_1.Identifier.getNamespace(name.content) === "box" /* PkgName.Box */) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
return data.ctx.deps.getDependency("box" /* PkgName.Box */) !== undefined;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Process a `use` call, library-sensitively: `pkg[...]` uses box's bracket selection; a bare `pkg` is box's
|
|
251
|
+
* namespace-only member access when box is loaded, otherwise `import::from`-style extra-argument selection.
|
|
252
|
+
*/
|
|
253
|
+
function processUse(name, args, rootId, data) {
|
|
254
|
+
const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: false, origin: built_in_proc_name_1.BuiltInProcName.Library }).information;
|
|
255
|
+
const first = args[0] === r_function_call_1.EmptyArgument ? undefined : args[0]?.value;
|
|
256
|
+
const parsed = parseUseSpec(name, first, args, data);
|
|
257
|
+
const dependency = parsed && data.ctx.deps.getDependency(parsed.pack);
|
|
258
|
+
if (parsed && dependency) {
|
|
259
|
+
linkLibrary(dependency, info, rootId, data, parsed.spec);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
info.graph.markIdForUnknownSideEffects(rootId);
|
|
263
|
+
}
|
|
264
|
+
return info;
|
|
265
|
+
}
|
|
266
|
+
/** The package and attach spec for a `use` call (see {@link processUse}). */
|
|
267
|
+
function parseUseSpec(name, first, args, data) {
|
|
268
|
+
const bracket = parseBoxSpec(first);
|
|
269
|
+
if (bracket !== undefined) {
|
|
270
|
+
return bracket;
|
|
271
|
+
}
|
|
272
|
+
const pack = symbolOrStringName(first);
|
|
273
|
+
if (pack === undefined) {
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
if (usesBoxSemantics(name, data)) {
|
|
277
|
+
return { pack, spec: { namespaceOnly: true } }; // box: use(pkg) is member access via pkg$fn
|
|
278
|
+
}
|
|
279
|
+
return { pack, spec: parseFromSpec(args) }; // extra-argument selection: use(pkg, a, b) / use(pkg)
|
|
280
|
+
}
|
|
281
|
+
/** Materialize the empty built-in function-definition vertex for a package export (idempotent). */
|
|
282
|
+
function attachExportVertex(graph, builtInId, environment, ctx, cds) {
|
|
283
|
+
if (graph.hasVertex(builtInId)) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
graph.addVertex({
|
|
287
|
+
tag: vertex_1.VertexType.FunctionDefinition,
|
|
288
|
+
id: builtInId,
|
|
289
|
+
environment, cds, params: {},
|
|
290
|
+
subflow: { graph: new Set(), unknownReferences: [], in: [], out: [], environment, entryPoint: builtInId, hooks: [] },
|
|
291
|
+
exitPoints: [],
|
|
292
|
+
}, ctx.env.makeCleanEnv());
|
|
293
|
+
}
|
|
294
|
+
function linkLibrary(dependency, info, rootId, data, spec = {}) {
|
|
295
|
+
if (info.environment.level < 0 || (0, assert_1.isUndefined)(dependency.namespaceInfo)) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
const pack = dependency.name;
|
|
299
|
+
// re-loading an already attached package is a no-op, cf. R's `search()`
|
|
300
|
+
if (isAttached(info.environment.current, pack, spec.namespaceOnly)) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
// by default only the environment carries the exports; their built-in vertices are materialized on
|
|
304
|
+
// demand when a call resolves to one (see attachExportVertex). Eager mode registers them all upfront.
|
|
305
|
+
if (data.ctx.config.solver.eagerlyLoadPackages) {
|
|
306
|
+
for (const { exported: func } of selectExports((0, flowr_namespace_file_1.getCallables)(dependency.namespaceInfo), spec)) {
|
|
307
|
+
const builtInId = node_id_1.NodeId.toBuiltIn(package_1.Package.funcIdentif(pack, func));
|
|
308
|
+
attachExportVertex(info.graph, builtInId, info.environment, data.ctx, data.cds);
|
|
309
|
+
info.graph.addEdge(builtInId, rootId, edge_1.EdgeType.Reads | edge_1.EdgeType.Calls);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
info.environment = attachDependencyToEnvironment(dependency, info.environment, data.ctx, spec, rootId);
|
|
313
|
+
}
|
|
314
|
+
/** The exports of `callables` to attach under `spec` (see {@link AttachSpec}), resolving selection and aliasing. */
|
|
315
|
+
function selectExports(callables, spec) {
|
|
316
|
+
if (spec.include !== undefined && !spec.all) {
|
|
317
|
+
const available = new Set(callables);
|
|
318
|
+
return Array.from(spec.include, ([as, exported]) => ({ exported, as })).filter(e => available.has(e.exported));
|
|
319
|
+
}
|
|
320
|
+
return callables.filter(c => !spec.exclude?.has(c)).map(c => ({ exported: c, as: c }));
|
|
321
|
+
}
|
|
322
|
+
/** The identifier definition binding a package export (or its alias) to its built-in function-definition. */
|
|
323
|
+
function exportDefinition(pack, exp, definedAt = node_id_1.NodeId.toBuiltIn(pack)) {
|
|
324
|
+
return {
|
|
325
|
+
name: identifier_1.Identifier.make(exp.as, pack),
|
|
326
|
+
type: identifier_1.ReferenceType.Function,
|
|
327
|
+
nodeId: node_id_1.NodeId.toBuiltIn(package_1.Package.funcIdentif(pack, exp.exported)),
|
|
328
|
+
definedAt,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/** Whether a subset import restricts the attached exports, so no imports layer is materialized. */
|
|
332
|
+
function isSubsetAttach(spec) {
|
|
333
|
+
return spec.include !== undefined && !spec.all;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Attaches `dependency`'s exports below the global environment (see {@link attachPackageBelowGlobal}) and returns the
|
|
337
|
+
* enriched environment (the graph is untouched). Used by `library()`, `import::from`, `box::use`, `requireNamespace`,
|
|
338
|
+
* and the transitive side-effect propagation.
|
|
339
|
+
*/
|
|
340
|
+
function attachDependencyToEnvironment(dependency, envInfo, ctx, spec = {}, definedAt) {
|
|
341
|
+
const pack = dependency.name;
|
|
342
|
+
if ((0, assert_1.isUndefined)(dependency.namespaceInfo) || isAttached(envInfo.current, pack, spec.namespaceOnly)) {
|
|
343
|
+
return envInfo;
|
|
344
|
+
}
|
|
345
|
+
const exports = selectExports((0, flowr_namespace_file_1.getCallables)(dependency.namespaceInfo), spec);
|
|
346
|
+
if (spec.namespaceOnly || isSubsetAttach(spec)) {
|
|
347
|
+
const layerType = spec.namespaceOnly ? environment_1.EnvType.LoadedNamespace : environment_1.EnvType.Namespace;
|
|
348
|
+
let layer = new environment_1.Environment(envInfo.current).asLibrary(pack, layerType);
|
|
349
|
+
for (const exp of exports) {
|
|
350
|
+
layer = layer.define(exportDefinition(pack, exp, definedAt));
|
|
351
|
+
}
|
|
352
|
+
return { level: envInfo.level, current: environment_1.REnvironment.attachBelowGlobal(envInfo.current, layer, layer) };
|
|
353
|
+
}
|
|
354
|
+
// full attach: imports layer at the bottom, namespace (exports) layer on top
|
|
355
|
+
let importsEnv = new environment_1.Environment(envInfo.current).asLibrary(pack, environment_1.EnvType.Imports);
|
|
356
|
+
importsEnv = recImports(importsEnv, dependency.namespaceInfo, ctx, new Set());
|
|
357
|
+
let namespaceEnv = new environment_1.Environment(importsEnv).asLibrary(pack, environment_1.EnvType.Namespace);
|
|
358
|
+
for (const exp of exports) {
|
|
359
|
+
namespaceEnv = namespaceEnv.define(exportDefinition(pack, exp, definedAt));
|
|
360
|
+
}
|
|
361
|
+
return { level: envInfo.level, current: environment_1.REnvironment.attachBelowGlobal(envInfo.current, namespaceEnv, importsEnv) };
|
|
362
|
+
}
|
|
363
|
+
/** A namespace-only load is subsumed by any layer for `pack`; a full attach ignores a mere {@link EnvType.LoadedNamespace}. */
|
|
364
|
+
function blocksAttach(layer, namespaceOnly) {
|
|
365
|
+
if (namespaceOnly) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
return layer.t !== environment_1.EnvType.LoadedNamespace;
|
|
369
|
+
}
|
|
370
|
+
/** Whether package `pack` is already attached below the global env in a way that makes this (re-)attach a no-op. */
|
|
371
|
+
function isAttached(env, pack, namespaceOnly) {
|
|
372
|
+
for (let e = environment_1.REnvironment.findGlobal(env).parent; e.t !== undefined && !e.builtInEnv; e = e.parent) {
|
|
373
|
+
if (e.n === pack && blocksAttach(e, namespaceOnly)) {
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
function recImports(importsEnv, namespaceInfo, ctx, alreadyImportedAll) {
|
|
380
|
+
for (const imp of namespaceInfo.importedPackages) {
|
|
381
|
+
const importedDependency = ctx.deps.getDependency(imp[0]);
|
|
382
|
+
if ((0, assert_1.isUndefined)(importedDependency)) {
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
const importedNs = importedDependency.namespaceInfo;
|
|
386
|
+
const funcToImport = importedNs === undefined ? undefined
|
|
387
|
+
: imp[1] === 'all' ? (0, flowr_namespace_file_1.getCallables)(importedNs) : (0, flowr_namespace_file_1.getCallables)(importedNs).filter(v => imp[1].includes(v));
|
|
388
|
+
if ((0, assert_1.isUndefined)(funcToImport)) {
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
if (alreadyImportedAll.has(importedDependency.name)) {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
for (const func of funcToImport) {
|
|
395
|
+
if (importsEnv.memory.has(package_1.Package.funcIdentif(importedDependency.name, func))) {
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
importsEnv = importsEnv.define({
|
|
399
|
+
name: identifier_1.Identifier.make(package_1.Package.funcIdentif(importedDependency.name, func), importsEnv.n),
|
|
400
|
+
type: identifier_1.ReferenceType.Function,
|
|
401
|
+
nodeId: node_id_1.NodeId.toBuiltIn(package_1.Package.funcIdentif(importedDependency.name, func)),
|
|
402
|
+
definedAt: node_id_1.NodeId.toBuiltIn(importedDependency.name)
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
if (imp[1] === 'all') {
|
|
406
|
+
alreadyImportedAll.add(importedDependency.name);
|
|
407
|
+
}
|
|
408
|
+
//if only importFrom() we don't have to recursively import
|
|
409
|
+
if (imp[1] === 'all' && importedDependency?.namespaceInfo) {
|
|
410
|
+
importsEnv = recImports(importsEnv, importedDependency.namespaceInfo, ctx, alreadyImportedAll);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return importsEnv;
|
|
44
414
|
}
|
|
45
415
|
//# sourceMappingURL=built-in-library.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Processes `::` and `:::` when called as a function, e.g., `::`(ggplot2, a).
|
|
9
|
+
* Constructs a namespaced symbol identical to what tree-sitter produces for `ggplot2::a`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function processNamespaceAccess<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: {
|
|
12
|
+
internal: boolean;
|
|
13
|
+
}): DataflowInformation;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processNamespaceAccess = processNamespaceAccess;
|
|
4
|
+
const known_call_handling_1 = require("../known-call-handling");
|
|
5
|
+
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
6
|
+
const logger_1 = require("../../../../../logger");
|
|
7
|
+
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
8
|
+
const identifier_1 = require("../../../../../environments/identifier");
|
|
9
|
+
const graph_1 = require("../../../../../graph/graph");
|
|
10
|
+
const vertex_1 = require("../../../../../graph/vertex");
|
|
11
|
+
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
12
|
+
const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
13
|
+
/**
|
|
14
|
+
* Processes `::` and `:::` when called as a function, e.g., `::`(ggplot2, a).
|
|
15
|
+
* Constructs a namespaced symbol identical to what tree-sitter produces for `ggplot2::a`.
|
|
16
|
+
*/
|
|
17
|
+
function processNamespaceAccess(name, args, rootId, data, config) {
|
|
18
|
+
if (args.length !== 2 || args[0] === r_function_call_1.EmptyArgument || args[1] === r_function_call_1.EmptyArgument) {
|
|
19
|
+
logger_1.dataflowLogger.warn(`Namespace access ${identifier_1.Identifier.toString(name.content)} does not have exactly 2 non-empty arguments, falling back`);
|
|
20
|
+
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.NamespaceAccess }).information;
|
|
21
|
+
}
|
|
22
|
+
const nsNode = args[0].value;
|
|
23
|
+
const symNode = args[1].value;
|
|
24
|
+
let namespace;
|
|
25
|
+
let symbolName;
|
|
26
|
+
if (nsNode?.type === type_1.RType.Symbol) {
|
|
27
|
+
namespace = identifier_1.Identifier.getName(nsNode.content);
|
|
28
|
+
}
|
|
29
|
+
else if (nsNode && r_string_1.RString.is(nsNode)) {
|
|
30
|
+
namespace = nsNode.content.str;
|
|
31
|
+
}
|
|
32
|
+
if (symNode?.type === type_1.RType.Symbol) {
|
|
33
|
+
symbolName = identifier_1.Identifier.getName(symNode.content);
|
|
34
|
+
}
|
|
35
|
+
else if (symNode && r_string_1.RString.is(symNode)) {
|
|
36
|
+
symbolName = symNode.content.str;
|
|
37
|
+
}
|
|
38
|
+
if (!namespace || !symbolName) {
|
|
39
|
+
logger_1.dataflowLogger.warn(`Namespace access ${identifier_1.Identifier.toString(name.content)} has non-symbol/string arguments, falling back`);
|
|
40
|
+
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.NamespaceAccess }).information;
|
|
41
|
+
}
|
|
42
|
+
const id = identifier_1.Identifier.make(symbolName, namespace, config.internal);
|
|
43
|
+
return {
|
|
44
|
+
unknownReferences: [{ nodeId: rootId, name: id, cds: data.cds, type: identifier_1.ReferenceType.Unknown }],
|
|
45
|
+
in: [],
|
|
46
|
+
out: [],
|
|
47
|
+
environment: data.environment,
|
|
48
|
+
graph: new graph_1.DataflowGraph(data.completeAst.idMap).addVertex({
|
|
49
|
+
tag: vertex_1.VertexType.Use,
|
|
50
|
+
id: rootId,
|
|
51
|
+
cds: data.cds
|
|
52
|
+
}, data.ctx.env.makeCleanEnv()),
|
|
53
|
+
entryPoint: rootId,
|
|
54
|
+
exitPoints: [{ nodeId: rootId, type: 0 /* ExitPointType.Default */, cds: data.cds }],
|
|
55
|
+
hooks: []
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=built-in-namespace-access.js.map
|
|
@@ -41,7 +41,7 @@ function processRepeatLoop(name, args, rootId, data) {
|
|
|
41
41
|
});
|
|
42
42
|
const body = processedArguments[0];
|
|
43
43
|
(0, assert_1.guard)(body !== undefined, () => `Repeat-Loop ${identifier_1.Identifier.toString(name.content)} has no body, impossible!`);
|
|
44
|
-
(0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph)), body.out);
|
|
44
|
+
(0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph)), body.out, body.environment);
|
|
45
45
|
(0, linker_1.reapplyLoopExitPoints)(body.exitPoints, body.in.concat(body.out, body.unknownReferences), information.graph);
|
|
46
46
|
information.exitPoints = (0, info_1.filterOutLoopExitPoints)(information.exitPoints);
|
|
47
47
|
return information;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { DataflowProcessorInformation } from '../../../../../processor';
|
|
2
2
|
import type { DataflowInformation } from '../../../../../info';
|
|
3
3
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
-
import {
|
|
4
|
+
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
5
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
6
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
/**
|
|
8
|
-
* Process an `rm` call
|
|
8
|
+
* Process an `rm` call, marking the removed variables as {@link KillReference|killed} so the removal is
|
|
9
|
+
* carried to the enclosing scope even when it happens nested within a branch or block.
|
|
9
10
|
*/
|
|
10
11
|
export declare function processRm<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
|