@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
|
@@ -7,6 +7,7 @@ exports.applyCdToReferences = applyCdToReferences;
|
|
|
7
7
|
const identifier_1 = require("./identifier");
|
|
8
8
|
const resolve_by_name_1 = require("./resolve-by-name");
|
|
9
9
|
const vertex_1 = require("../graph/vertex");
|
|
10
|
+
const built_in_s_seven_dispatch_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-dispatch");
|
|
10
11
|
function appToCdsUnique(target, toAdd) {
|
|
11
12
|
if (!toAdd) {
|
|
12
13
|
return;
|
|
@@ -43,22 +44,66 @@ function concatCdsUnique(target, toAdd) {
|
|
|
43
44
|
}
|
|
44
45
|
return result;
|
|
45
46
|
}
|
|
47
|
+
/** copy of the definition with the given cds attached */
|
|
48
|
+
function withAppliedCds(definition, defaultCd) {
|
|
49
|
+
return {
|
|
50
|
+
...definition,
|
|
51
|
+
cds: definition.cds ? concatCdsUnique(definition.cds, defaultCd) : (defaultCd ? Array.from(defaultCd) : [])
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** replaces the definitions stored under the given key by copies carrying the additional cds */
|
|
55
|
+
function replaceDefinitions(env, key, toUpdate, defaultCd) {
|
|
56
|
+
const defs = env.memory.get(key);
|
|
57
|
+
if (defs?.some(d => toUpdate.has(d))) {
|
|
58
|
+
env.memory.set(key, defs.map(d => toUpdate.has(d) ? withAppliedCds(d, defaultCd) : d));
|
|
59
|
+
}
|
|
60
|
+
env.cache?.delete(key);
|
|
61
|
+
}
|
|
46
62
|
/**
|
|
47
|
-
*
|
|
63
|
+
* Attaches the given control dependencies to the given definitions within the environment chain.
|
|
64
|
+
* Copy-on-write: definitions are replaced, never mutated in place, so previously cloned
|
|
65
|
+
* environments (e.g., snapshots stored in the dataflow graph) keep their state.
|
|
48
66
|
*/
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
function applyCdsToDefinitions(environments, name, type, definitions, defaultCd) {
|
|
68
|
+
const toUpdate = new Set();
|
|
69
|
+
for (const definition of definitions) {
|
|
70
|
+
if (definition.type !== identifier_1.ReferenceType.BuiltInFunction && definition.type !== identifier_1.ReferenceType.BuiltInConstant
|
|
71
|
+
&& (defaultCd !== undefined || definition.cds === undefined)) {
|
|
72
|
+
toUpdate.add(definition);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (toUpdate.size === 0) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const [plainName] = identifier_1.Identifier.toArray(name);
|
|
79
|
+
const prefix = type === identifier_1.ReferenceType.S3MethodPrefix ? plainName + '.'
|
|
80
|
+
: type === identifier_1.ReferenceType.S7MethodPrefix ? plainName + built_in_s_seven_dispatch_1.S7DispatchSeparator : undefined;
|
|
81
|
+
let current = environments.current;
|
|
82
|
+
while (!current.builtInEnv) {
|
|
83
|
+
if (prefix === undefined) {
|
|
84
|
+
replaceDefinitions(current, plainName, toUpdate, defaultCd);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
for (const key of [...current.memory.keys()]) {
|
|
88
|
+
if (key.startsWith(prefix)) {
|
|
89
|
+
replaceDefinitions(current, key, toUpdate, defaultCd);
|
|
59
90
|
}
|
|
60
91
|
}
|
|
61
92
|
}
|
|
93
|
+
current = current.parent;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Marks the reference as maybe (i.e., as controlled by a set of {@link IdentifierReference#cds|control dependencies}).
|
|
98
|
+
* With `includeDefs`, the cds are also attached (copy-on-write) to the definitions the reference
|
|
99
|
+
* resolves to, see {@link applyCdsToDefinitions}.
|
|
100
|
+
*/
|
|
101
|
+
function makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd = undefined) {
|
|
102
|
+
if (includeDefs && ref.name) {
|
|
103
|
+
const definitions = (0, resolve_by_name_1.resolveByName)(ref.name, environments, ref.type);
|
|
104
|
+
if (definitions && definitions.length > 0) {
|
|
105
|
+
applyCdsToDefinitions(environments, ref.name, ref.type, definitions, defaultCd);
|
|
106
|
+
}
|
|
62
107
|
}
|
|
63
108
|
const node = graph.getVertex(ref.nodeId);
|
|
64
109
|
if (node) {
|
|
@@ -3,10 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resolveByName = resolveByName;
|
|
4
4
|
exports.resolveByNameAnyType = resolveByNameAnyType;
|
|
5
5
|
exports.resolvesToBuiltInConstant = resolvesToBuiltInConstant;
|
|
6
|
+
const environment_1 = require("./environment");
|
|
6
7
|
const logic_1 = require("../../util/logic");
|
|
7
8
|
const identifier_1 = require("./identifier");
|
|
8
9
|
const info_1 = require("../info");
|
|
9
10
|
const built_in_s_seven_dispatch_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-dispatch");
|
|
11
|
+
/** A namespaced lookup only sees its matching layer; a bare lookup skips loaded-but-unattached namespaces (`requireNamespace`). */
|
|
12
|
+
function layerSkipped(layer, ns) {
|
|
13
|
+
if (ns !== undefined) {
|
|
14
|
+
return layer.n !== ns;
|
|
15
|
+
}
|
|
16
|
+
return layer.t === environment_1.EnvType.LoadedNamespace;
|
|
17
|
+
}
|
|
10
18
|
const FunctionTargetTypes = identifier_1.ReferenceType.Function | identifier_1.ReferenceType.BuiltInFunction | identifier_1.ReferenceType.Unknown | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Parameter;
|
|
11
19
|
const VariableTargetTypes = identifier_1.ReferenceType.Variable | identifier_1.ReferenceType.Parameter | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Unknown;
|
|
12
20
|
const ConstantTargetTypes = identifier_1.ReferenceType.Constant | identifier_1.ReferenceType.BuiltInConstant | identifier_1.ReferenceType.Unknown;
|
|
@@ -42,7 +50,7 @@ function resolveByName(id, environment, target) {
|
|
|
42
50
|
let definitions = undefined;
|
|
43
51
|
const wantedType = TargetTypePredicate[target];
|
|
44
52
|
do {
|
|
45
|
-
if (
|
|
53
|
+
if (layerSkipped(current, ns)) {
|
|
46
54
|
current = current.parent;
|
|
47
55
|
continue;
|
|
48
56
|
}
|
|
@@ -90,14 +98,18 @@ function resolveByName(id, environment, target) {
|
|
|
90
98
|
*/
|
|
91
99
|
function resolveByNameAnyType(id, environment) {
|
|
92
100
|
let current = environment.current;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
/* only cache plain names: namespaced ids are arrays (no stable map key) and must not answer plain lookups */
|
|
102
|
+
const cacheable = typeof id === 'string';
|
|
103
|
+
if (cacheable) {
|
|
104
|
+
const g = current.cache?.get(id);
|
|
105
|
+
if (g !== undefined) {
|
|
106
|
+
return g;
|
|
107
|
+
}
|
|
96
108
|
}
|
|
97
109
|
const [name, ns, internal] = identifier_1.Identifier.toArray(id);
|
|
98
110
|
let definitions = undefined;
|
|
99
111
|
do {
|
|
100
|
-
if (
|
|
112
|
+
if (layerSkipped(current, ns)) {
|
|
101
113
|
current = current.parent;
|
|
102
114
|
continue;
|
|
103
115
|
}
|
|
@@ -107,8 +119,10 @@ function resolveByNameAnyType(id, environment) {
|
|
|
107
119
|
definition = definition.filter(({ name }) => name === undefined || !identifier_1.Identifier.accessesInternal(name));
|
|
108
120
|
}
|
|
109
121
|
if (definition.every(d => (0, info_1.happensInEveryBranch)(d.cds))) {
|
|
110
|
-
|
|
111
|
-
|
|
122
|
+
if (cacheable) {
|
|
123
|
+
environment.current.cache ??= new Map();
|
|
124
|
+
environment.current.cache.set(id, definition);
|
|
125
|
+
}
|
|
112
126
|
return definition;
|
|
113
127
|
}
|
|
114
128
|
else if (definition.length > 0) {
|
|
@@ -130,9 +144,9 @@ function resolveByNameAnyType(id, environment) {
|
|
|
130
144
|
else {
|
|
131
145
|
ret = builtIns;
|
|
132
146
|
}
|
|
133
|
-
if (ret) {
|
|
147
|
+
if (ret && cacheable) {
|
|
134
148
|
environment.current.cache ??= new Map();
|
|
135
|
-
environment.current.cache
|
|
149
|
+
environment.current.cache.set(id, ret);
|
|
136
150
|
}
|
|
137
151
|
return ret;
|
|
138
152
|
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { type REnvironmentInformation } from './environment';
|
|
2
2
|
/**
|
|
3
|
-
* Add a new local environment scope to the stack, returns the modified variant
|
|
3
|
+
* Add a new local environment scope to the stack, returns the modified variant (shares the original stack, no deep-clone).
|
|
4
4
|
* @see {@link popLocalEnvironment} - to remove the local scope again
|
|
5
5
|
*/
|
|
6
6
|
export declare function pushLocalEnvironment({ level, current }: REnvironmentInformation): REnvironmentInformation;
|
|
7
7
|
/**
|
|
8
|
-
* Remove the top local environment scope from the stack, returns the modified variant
|
|
8
|
+
* Remove the top local environment scope from the stack, returns the modified variant (shares the original stack, no deep-clone).
|
|
9
9
|
* @see {@link pushLocalEnvironment} - to add a local scope
|
|
10
10
|
*/
|
|
11
11
|
export declare function popLocalEnvironment({ current, level }: REnvironmentInformation): REnvironmentInformation;
|
|
12
|
+
/**
|
|
13
|
+
* Pads whichever of `base`/`next` is shallower with empty local scopes until both are at the same lexical {@link REnvironmentInformation#level|level}.
|
|
14
|
+
*/
|
|
15
|
+
export declare function padToCommonScope(base: REnvironmentInformation, next: REnvironmentInformation): {
|
|
16
|
+
base: REnvironmentInformation;
|
|
17
|
+
next: REnvironmentInformation;
|
|
18
|
+
};
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pushLocalEnvironment = pushLocalEnvironment;
|
|
4
4
|
exports.popLocalEnvironment = popLocalEnvironment;
|
|
5
|
+
exports.padToCommonScope = padToCommonScope;
|
|
5
6
|
const environment_1 = require("./environment");
|
|
6
7
|
const assert_1 = require("../../util/assert");
|
|
7
8
|
/**
|
|
8
|
-
* Add a new local environment scope to the stack, returns the modified variant
|
|
9
|
+
* Add a new local environment scope to the stack, returns the modified variant (shares the original stack, no deep-clone).
|
|
9
10
|
* @see {@link popLocalEnvironment} - to remove the local scope again
|
|
10
11
|
*/
|
|
11
12
|
function pushLocalEnvironment({ level, current }) {
|
|
@@ -15,7 +16,7 @@ function pushLocalEnvironment({ level, current }) {
|
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
|
-
* Remove the top local environment scope from the stack, returns the modified variant
|
|
19
|
+
* Remove the top local environment scope from the stack, returns the modified variant (shares the original stack, no deep-clone).
|
|
19
20
|
* @see {@link pushLocalEnvironment} - to add a local scope
|
|
20
21
|
*/
|
|
21
22
|
function popLocalEnvironment({ current, level }) {
|
|
@@ -25,4 +26,16 @@ function popLocalEnvironment({ current, level }) {
|
|
|
25
26
|
level: level - 1
|
|
26
27
|
};
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Pads whichever of `base`/`next` is shallower with empty local scopes until both are at the same lexical {@link REnvironmentInformation#level|level}.
|
|
31
|
+
*/
|
|
32
|
+
function padToCommonScope(base, next) {
|
|
33
|
+
while (next.level < base.level) {
|
|
34
|
+
next = pushLocalEnvironment(next);
|
|
35
|
+
}
|
|
36
|
+
while (next.level > base.level) {
|
|
37
|
+
base = pushLocalEnvironment(base);
|
|
38
|
+
}
|
|
39
|
+
return { base, next };
|
|
40
|
+
}
|
|
28
41
|
//# sourceMappingURL=scoping.js.map
|
|
@@ -9,6 +9,7 @@ const interval_constants_1 = require("./intervals/interval-constants");
|
|
|
9
9
|
const logical_constants_1 = require("./logical/logical-constants");
|
|
10
10
|
const r_value_1 = require("./r-value");
|
|
11
11
|
const string_constants_1 = require("./string/string-constants");
|
|
12
|
+
const vector_constants_1 = require("./vectors/vector-constants");
|
|
12
13
|
/**
|
|
13
14
|
* Takes n potentially lifted ops and returns `Top` or `Bottom` if any is `Top` or `Bottom`.
|
|
14
15
|
*/
|
|
@@ -50,6 +51,9 @@ function valueFromTsValue(a) {
|
|
|
50
51
|
else if (typeof a === 'boolean') {
|
|
51
52
|
return a ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
|
|
52
53
|
}
|
|
54
|
+
else if (Array.isArray(a)) {
|
|
55
|
+
return (0, vector_constants_1.vectorFrom)(a.map(v => valueFromTsValue(v)));
|
|
56
|
+
}
|
|
53
57
|
return r_value_1.Top;
|
|
54
58
|
}
|
|
55
59
|
/**
|
package/dataflow/extractor.js
CHANGED
|
@@ -18,9 +18,14 @@ const extract_cfg_1 = require("../control-flow/extract-cfg");
|
|
|
18
18
|
const edge_1 = require("./graph/edge");
|
|
19
19
|
const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
20
20
|
const built_in_function_definition_1 = require("./internal/process/functions/call/built-in/built-in-function-definition");
|
|
21
|
+
const transitive_side_effects_1 = require("./internal/process/functions/call/built-in/transitive-side-effects");
|
|
21
22
|
const flowr_file_1 = require("../project/context/flowr-file");
|
|
23
|
+
/** Round cap for the transitive-side-effect fixpoint. */
|
|
24
|
+
const transitiveSideEffectRounds = 32;
|
|
22
25
|
const identifier_1 = require("./environments/identifier");
|
|
23
26
|
const range_1 = require("../util/range");
|
|
27
|
+
const logger_1 = require("./logger");
|
|
28
|
+
const gas_1 = require("../gas");
|
|
24
29
|
/**
|
|
25
30
|
* The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
|
|
26
31
|
* Maps every {@link RType} in the normalized AST to a processor.
|
|
@@ -58,7 +63,15 @@ exports.processors = {
|
|
|
58
63
|
}, (0, make_argument_1.wrapArgumentsUnnamed)(children, d.completeAst.idMap), info.id, d);
|
|
59
64
|
}
|
|
60
65
|
};
|
|
61
|
-
function resolveLinkToSideEffects(ast, graph) {
|
|
66
|
+
function resolveLinkToSideEffects(ast, graph, ctx) {
|
|
67
|
+
const gasLevel = ctx.gas.checkGas(gas_1.GasFeatureKey.SideEffectLinking);
|
|
68
|
+
if (gasLevel >= 2 /* GasLevel.Critical */) {
|
|
69
|
+
logger_1.dataflowLogger.warn('Skipping side-effect link resolution due to resource pressure (gas: critical). See ' + gas_1.GasWikiRef);
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
else if (gasLevel >= 1 /* GasLevel.Problematic */) {
|
|
73
|
+
logger_1.dataflowLogger.warn('Approaching resource limits during side-effect link resolution (gas: problematic). See ' + gas_1.GasWikiRef);
|
|
74
|
+
}
|
|
62
75
|
let cf = undefined;
|
|
63
76
|
let knownCalls;
|
|
64
77
|
let allCallNames = [];
|
|
@@ -135,9 +148,27 @@ function produceDataFlowGraph(parser, completeAst, ctx) {
|
|
|
135
148
|
/* source requests register automatically */
|
|
136
149
|
df = (0, built_in_source_1.standaloneSourceFile)(i, files[i], dfData, df);
|
|
137
150
|
}
|
|
138
|
-
//
|
|
139
|
-
(0, built_in_function_definition_1.updateNestedFunctionCalls)(df.graph, df.environment);
|
|
140
|
-
|
|
151
|
+
// resolve linkages and propagate transitive side effects across calls to a fixpoint
|
|
152
|
+
(0, built_in_function_definition_1.updateNestedFunctionCalls)(df.graph, df.environment, ctx);
|
|
153
|
+
const escapedNames = new Set();
|
|
154
|
+
for (let round = 0; round < transitiveSideEffectRounds; round++) {
|
|
155
|
+
const { environment, grew, escapedNames: roundNames } = (0, transitive_side_effects_1.propagateTransitiveSideEffects)(df.graph, df.environment, ctx);
|
|
156
|
+
df.environment = environment;
|
|
157
|
+
for (const n of roundNames) {
|
|
158
|
+
escapedNames.add(n);
|
|
159
|
+
}
|
|
160
|
+
if (!grew) {
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
(0, built_in_function_definition_1.updateNestedFunctionCalls)(df.graph, df.environment, ctx);
|
|
164
|
+
}
|
|
165
|
+
// resolve top-level reads that now see the escaped `<<-` definitions folded in above
|
|
166
|
+
if (escapedNames.size > 0) {
|
|
167
|
+
(0, transitive_side_effects_1.reResolveOpenReferences)(df.graph, df.environment, [...df.in, ...df.unknownReferences], escapedNames);
|
|
168
|
+
}
|
|
169
|
+
// link on-demand-materialized package exports back to their `library()` loaders
|
|
170
|
+
(0, transitive_side_effects_1.linkMaterializedExportsToLoaders)(df.graph, df.environment);
|
|
171
|
+
df.cfgQuick = resolveLinkToSideEffects(completeAst, df.graph, ctx);
|
|
141
172
|
// performance optimization: return cfgQuick as part of the result to avoid recomputation
|
|
142
173
|
return df;
|
|
143
174
|
}
|
|
@@ -3,6 +3,7 @@ import { EdgeType } from './edge';
|
|
|
3
3
|
import { emptyGraph } from './dataflowgraph-builder';
|
|
4
4
|
import { getOriginInDfg } from '../origin/dfg-get-origin';
|
|
5
5
|
import { CallGraph } from './call-graph';
|
|
6
|
+
import { computeCallGraphSummaries, propagateTransitiveSideEffects } from '../internal/process/functions/call/built-in/transitive-side-effects';
|
|
6
7
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
8
|
import type { REnvironmentInformation } from '../environments/environment';
|
|
8
9
|
import type { DataflowGraphVertexInfo } from './vertex';
|
|
@@ -80,6 +81,13 @@ export declare const Dataflow: {
|
|
|
80
81
|
* @see {@link getOriginInDfg} - for the underlying function
|
|
81
82
|
*/
|
|
82
83
|
readonly origin: typeof getOriginInDfg;
|
|
84
|
+
/**
|
|
85
|
+
* Interprocedural propagation of escaped side effects (attached packages, `<<-` definitions) to their callers.
|
|
86
|
+
*/
|
|
87
|
+
readonly sideEffects: {
|
|
88
|
+
readonly propagateTransitive: typeof propagateTransitiveSideEffects;
|
|
89
|
+
readonly callGraphSummaries: typeof computeCallGraphSummaries;
|
|
90
|
+
};
|
|
83
91
|
/**
|
|
84
92
|
* Only returns the sub-part of the graph that is determined by the given selection.
|
|
85
93
|
* In other words, this will return a graph with only vertices that are part of the selected ids,
|
|
@@ -89,6 +97,12 @@ export declare const Dataflow: {
|
|
|
89
97
|
* @param includeMissingTargets - if set to true, this will include edges which target vertices that are not selected!
|
|
90
98
|
*/
|
|
91
99
|
readonly reduceGraph: <G extends DataflowGraph>(this: void, graph: G, select: ReadonlySet<NodeId>, includeMissingTargets?: boolean) => G;
|
|
100
|
+
/**
|
|
101
|
+
* Equivalent to {@link Dataflow.reduceGraph|`reduceGraph`} followed by {@link Dataflow.invertGraph|`invertGraph`}
|
|
102
|
+
* but in a single pass over the graph, allocating only one intermediate object instead of two.
|
|
103
|
+
* Use this when you need the reduced-and-inverted graph for a forward traversal within a restriction set.
|
|
104
|
+
*/
|
|
105
|
+
readonly reduceAndInvertGraph: <G extends DataflowGraph>(this: void, graph: G, select: ReadonlySet<NodeId>, cleanEnv: REnvironmentInformation) => G;
|
|
92
106
|
/**
|
|
93
107
|
* Given the id of a vertex (usually a variable use),
|
|
94
108
|
* this returns a reachable provenance set by calculating a non-interprocedural and non-context sensitive backward slice, but stopping at the given ids!
|
|
@@ -7,6 +7,7 @@ const dataflowgraph_builder_1 = require("./dataflowgraph-builder");
|
|
|
7
7
|
const dfg_get_origin_1 = require("../origin/dfg-get-origin");
|
|
8
8
|
const graph_helper_1 = require("./graph-helper");
|
|
9
9
|
const call_graph_1 = require("./call-graph");
|
|
10
|
+
const transitive_side_effects_1 = require("../internal/process/functions/call/built-in/transitive-side-effects");
|
|
10
11
|
/**
|
|
11
12
|
* This is the root helper object to work with the {@link DataflowGraph}.
|
|
12
13
|
*
|
|
@@ -50,6 +51,13 @@ exports.Dataflow = {
|
|
|
50
51
|
* @see {@link getOriginInDfg} - for the underlying function
|
|
51
52
|
*/
|
|
52
53
|
origin: dfg_get_origin_1.getOriginInDfg,
|
|
54
|
+
/**
|
|
55
|
+
* Interprocedural propagation of escaped side effects (attached packages, `<<-` definitions) to their callers.
|
|
56
|
+
*/
|
|
57
|
+
sideEffects: {
|
|
58
|
+
propagateTransitive: transitive_side_effects_1.propagateTransitiveSideEffects,
|
|
59
|
+
callGraphSummaries: transitive_side_effects_1.computeCallGraphSummaries,
|
|
60
|
+
},
|
|
53
61
|
/**
|
|
54
62
|
* Only returns the sub-part of the graph that is determined by the given selection.
|
|
55
63
|
* In other words, this will return a graph with only vertices that are part of the selected ids,
|
|
@@ -90,6 +98,39 @@ exports.Dataflow = {
|
|
|
90
98
|
}
|
|
91
99
|
return df;
|
|
92
100
|
},
|
|
101
|
+
/**
|
|
102
|
+
* Equivalent to {@link Dataflow.reduceGraph|`reduceGraph`} followed by {@link Dataflow.invertGraph|`invertGraph`}
|
|
103
|
+
* but in a single pass over the graph, allocating only one intermediate object instead of two.
|
|
104
|
+
* Use this when you need the reduced-and-inverted graph for a forward traversal within a restriction set.
|
|
105
|
+
*/
|
|
106
|
+
reduceAndInvertGraph(graph, select, cleanEnv) {
|
|
107
|
+
const df = new graph_1.DataflowGraph(graph.idMap);
|
|
108
|
+
for (const [id, vtx] of graph.vertices(true)) {
|
|
109
|
+
if (select.has(id)) {
|
|
110
|
+
df.addVertex(vtx, cleanEnv);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (const [from, targets] of graph.edges()) {
|
|
114
|
+
if (!select.has(from)) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
for (const [to, { types }] of targets) {
|
|
118
|
+
if (!select.has(to)) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
df.addEdge(to, from, types);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
for (const u of graph.unknownSideEffects) {
|
|
125
|
+
if (typeof u === 'object' && select.has(u.id)) {
|
|
126
|
+
df.markIdForUnknownSideEffects(u.id, u.linkTo);
|
|
127
|
+
}
|
|
128
|
+
else if (select.has(u)) {
|
|
129
|
+
df.markIdForUnknownSideEffects(u);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return df;
|
|
133
|
+
},
|
|
93
134
|
/**
|
|
94
135
|
* Given the id of a vertex (usually a variable use),
|
|
95
136
|
* this returns a reachable provenance set by calculating a non-interprocedural and non-context sensitive backward slice, but stopping at the given ids!
|
|
@@ -4,7 +4,7 @@ import { type DataflowGraphVertexArgument, type DataflowGraphVertexFunctionCall,
|
|
|
4
4
|
import { EmptyArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
5
|
import type { BrandedIdentifier, IdentifierDefinition, IdentifierReference } from '../environments/identifier';
|
|
6
6
|
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
|
-
import { type REnvironmentInformation } from '../environments/environment';
|
|
7
|
+
import { type EnvType, type REnvironmentInformation } from '../environments/environment';
|
|
8
8
|
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
9
9
|
import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
10
10
|
/**
|
|
@@ -303,4 +303,7 @@ export interface IEnvironmentJson {
|
|
|
303
303
|
parent: IEnvironmentJson;
|
|
304
304
|
memory: Record<BrandedIdentifier, IdentifierDefinition[]>;
|
|
305
305
|
builtInEnv: true | undefined;
|
|
306
|
+
n?: string;
|
|
307
|
+
t?: EnvType;
|
|
308
|
+
globalEnv?: true;
|
|
306
309
|
}
|
package/dataflow/graph/graph.js
CHANGED
|
@@ -307,7 +307,7 @@ class DataflowGraph {
|
|
|
307
307
|
return this;
|
|
308
308
|
}
|
|
309
309
|
const vtag = vertex.tag;
|
|
310
|
-
// keep a clone of the original environment
|
|
310
|
+
// keep a clone of the original environment, isolating the snapshot from later updates
|
|
311
311
|
vertex.environment = vertex.environment ? (0, clone_1.cloneEnvironmentInformation)(vertex.environment) : (vtag === vertex_1.VertexType.FunctionDefinition || (vtag === vertex_1.VertexType.FunctionCall && !vertex.onlyBuiltin) ? fallbackEnv : undefined);
|
|
312
312
|
this.vertexInformation.set(vid, vertex);
|
|
313
313
|
const typeIds = this.types.get(vtag);
|
|
@@ -540,7 +540,11 @@ function envFromJson(json) {
|
|
|
540
540
|
const obj = new environment_1.Environment(parent, json.builtInEnv);
|
|
541
541
|
obj.id = json.id;
|
|
542
542
|
obj.memory = memory;
|
|
543
|
-
|
|
543
|
+
const env = obj;
|
|
544
|
+
env.n = json.n;
|
|
545
|
+
env.t = json.t;
|
|
546
|
+
env.globalEnv = json.globalEnv;
|
|
547
|
+
return env;
|
|
544
548
|
}
|
|
545
549
|
function renvFromJson(json) {
|
|
546
550
|
const current = envFromJson(json.current);
|
package/dataflow/info.d.ts
CHANGED
|
@@ -77,6 +77,27 @@ export declare function addNonDefaultExitPoints(existing: ExitPoint[], invertExi
|
|
|
77
77
|
* Overwrites the existing exit points with the given ones, taking care of cds.
|
|
78
78
|
*/
|
|
79
79
|
export declare function overwriteExitPoints(existing: readonly ExitPoint[], replace: ExitPoint[]): ExitPoint[];
|
|
80
|
+
/**
|
|
81
|
+
* A reference removed from scope within the current subtree (e.g., via `rm`). Like {@link DataflowInformation#out|out}
|
|
82
|
+
* references, kills bubble up so the enclosing scope can apply the removal at the right location.
|
|
83
|
+
* @see {@link applyKills}
|
|
84
|
+
*/
|
|
85
|
+
export type KillReference =
|
|
86
|
+
/** a statically known name (carries {@link IdentifierReference#cds|cds} for conditional removals) */
|
|
87
|
+
{
|
|
88
|
+
readonly kind: 'named';
|
|
89
|
+
readonly reference: IdentifierReference;
|
|
90
|
+
}
|
|
91
|
+
/** the whole current scope is cleared, e.g., `rm(list = ls())` */
|
|
92
|
+
| {
|
|
93
|
+
readonly kind: 'all';
|
|
94
|
+
readonly cds?: readonly ControlDependency[];
|
|
95
|
+
}
|
|
96
|
+
/** a not statically resolvable set of names, e.g., `rm(list = someVector)` */
|
|
97
|
+
| {
|
|
98
|
+
readonly kind: 'unknown';
|
|
99
|
+
readonly cds?: readonly ControlDependency[];
|
|
100
|
+
};
|
|
80
101
|
/** The control flow information for the current DataflowInformation. */
|
|
81
102
|
export interface DataflowCfgInformation {
|
|
82
103
|
/** The entry node into the subgraph */
|
|
@@ -97,7 +118,7 @@ export interface DataflowCfgInformation {
|
|
|
97
118
|
* Each processor during the dataflow analysis may use the information from its children
|
|
98
119
|
* to produce a new state of the dataflow information.
|
|
99
120
|
*
|
|
100
|
-
* You may initialize a new dataflow information with {@link
|
|
121
|
+
* You may initialize a new dataflow information with {@link DataflowInformation.initialize}.
|
|
101
122
|
* @see {@link DataflowCfgInformation} - the control flow aspects
|
|
102
123
|
*/
|
|
103
124
|
export interface DataflowInformation extends DataflowCfgInformation {
|
|
@@ -123,6 +144,11 @@ export interface DataflowInformation extends DataflowCfgInformation {
|
|
|
123
144
|
environment: REnvironmentInformation;
|
|
124
145
|
/** The current constructed dataflow graph */
|
|
125
146
|
graph: DataflowGraph;
|
|
147
|
+
/**
|
|
148
|
+
* References removed from scope within the current subtree (e.g., via `rm`); `undefined` unless an `rm` occurred.
|
|
149
|
+
* @see {@link KillReference}
|
|
150
|
+
*/
|
|
151
|
+
kill?: readonly KillReference[];
|
|
126
152
|
}
|
|
127
153
|
/**
|
|
128
154
|
* Helper object for {@link DataflowInformation}
|
|
@@ -100,8 +100,12 @@ export declare function linkInputs(referencesToLinkAgainstEnvironment: readonly
|
|
|
100
100
|
* }
|
|
101
101
|
* ```
|
|
102
102
|
* `x_2` must get a read marker to `x_1` as `x_1` is the active redefinition in the second loop iteration.
|
|
103
|
+
*
|
|
104
|
+
* When `environment` is supplied the function uses it to discover ALL definitions that are still live at the
|
|
105
|
+
* loop exit, so sequential overwrites contribute a single candidate while if-else branches contribute one
|
|
106
|
+
* candidate per branch.
|
|
103
107
|
*/
|
|
104
|
-
export declare function linkCircularRedefinitionsWithinALoop(graph: DataflowGraph, openIns: NameIdMap, outgoing: readonly IdentifierReference[]): void;
|
|
108
|
+
export declare function linkCircularRedefinitionsWithinALoop(graph: DataflowGraph, openIns: NameIdMap, outgoing: readonly IdentifierReference[], environment?: REnvironmentInformation): void;
|
|
105
109
|
/**
|
|
106
110
|
* Reapplies the loop exit points' control dependencies to the given identifier references.
|
|
107
111
|
*/
|
|
@@ -401,8 +401,13 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
|
|
|
401
401
|
result.add(vertex);
|
|
402
402
|
continue;
|
|
403
403
|
}
|
|
404
|
+
const outgoing = dataflowGraph.outgoingEdges(cid);
|
|
405
|
+
if (!outgoing) {
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
const isSkipType = vertex.tag === vertex_1.VertexType.FunctionCall || (vertex.tag === vertex_1.VertexType.VariableDefinition && vertex.par);
|
|
404
409
|
let hasReturnEdge = false;
|
|
405
|
-
|
|
410
|
+
let followTargets;
|
|
406
411
|
for (const [target, e] of outgoing) {
|
|
407
412
|
if (edge_1.DfEdge.includesType(e, edge_1.EdgeType.Returns)) {
|
|
408
413
|
hasReturnEdge = true;
|
|
@@ -410,12 +415,12 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
|
|
|
410
415
|
potential.push(target);
|
|
411
416
|
}
|
|
412
417
|
}
|
|
418
|
+
else if (!isSkipType && !hasReturnEdge && edge_1.DfEdge.includesType(e, LinkedFnFollowBits) && !visited.has(target)) {
|
|
419
|
+
(followTargets ??= []).push(target);
|
|
420
|
+
}
|
|
413
421
|
}
|
|
414
|
-
if (
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
for (const [target, e] of outgoing) {
|
|
418
|
-
if (edge_1.DfEdge.includesType(e, LinkedFnFollowBits) && !visited.has(target)) {
|
|
422
|
+
if (!hasReturnEdge && followTargets) {
|
|
423
|
+
for (const target of followTargets) {
|
|
419
424
|
potential.push(target);
|
|
420
425
|
}
|
|
421
426
|
}
|
|
@@ -466,10 +471,30 @@ function linkInputs(referencesToLinkAgainstEnvironment, environmentInformation,
|
|
|
466
471
|
* }
|
|
467
472
|
* ```
|
|
468
473
|
* `x_2` must get a read marker to `x_1` as `x_1` is the active redefinition in the second loop iteration.
|
|
474
|
+
*
|
|
475
|
+
* When `environment` is supplied the function uses it to discover ALL definitions that are still live at the
|
|
476
|
+
* loop exit, so sequential overwrites contribute a single candidate while if-else branches contribute one
|
|
477
|
+
* candidate per branch.
|
|
469
478
|
*/
|
|
470
|
-
function linkCircularRedefinitionsWithinALoop(graph, openIns, outgoing) {
|
|
471
|
-
|
|
472
|
-
|
|
479
|
+
function linkCircularRedefinitionsWithinALoop(graph, openIns, outgoing, environment) {
|
|
480
|
+
if (environment !== undefined) {
|
|
481
|
+
const outgoingIds = new Set(outgoing.map(o => o.nodeId));
|
|
482
|
+
for (const [name, targets] of openIns.entries()) {
|
|
483
|
+
const liveDefs = environment.current.memory.get(identifier_1.Identifier.getName(name));
|
|
484
|
+
if (liveDefs === undefined) {
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
for (const def of liveDefs) {
|
|
488
|
+
if (outgoingIds.has(def.nodeId)) {
|
|
489
|
+
for (const target of targets) {
|
|
490
|
+
graph.addEdge(target.nodeId, def.nodeId, edge_1.EdgeType.Reads);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
// fallback: keep only the last definition per identifier (used when no environment is available)
|
|
473
498
|
const lastOutgoing = new Map();
|
|
474
499
|
for (const out of outgoing) {
|
|
475
500
|
const on = out.name;
|
|
@@ -14,6 +14,7 @@ const reference_to_maybe_1 = require("../../../../../environments/reference-to-m
|
|
|
14
14
|
const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
|
|
15
15
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
16
16
|
const built_in_envir_utils_1 = require("./built-in-envir-utils");
|
|
17
|
+
const built_in_stack_env_1 = require("./built-in-stack-env");
|
|
17
18
|
function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
|
|
18
19
|
outInfo.definitionRootNodes.push(rootId);
|
|
19
20
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.TableAssignment }).information;
|
|
@@ -59,15 +60,16 @@ function processAccess(name, args, rootId, data, config) {
|
|
|
59
60
|
}
|
|
60
61
|
/* we include the read edges to the constant arguments as well so that they are included if necessary */
|
|
61
62
|
}
|
|
62
|
-
/* for $ access on a tracked env variable, add Reads edges to the field definition
|
|
63
|
+
/* for $ access on a tracked env variable or a stack env (globalenv()/.GlobalEnv), add Reads edges to the field definition */
|
|
63
64
|
if (config.treatIndicesAsString && identifier_1.Identifier.getName(name.content) === '$'
|
|
64
|
-
&& head !== r_function_call_1.EmptyArgument && head.value
|
|
65
|
+
&& head !== r_function_call_1.EmptyArgument && head.value !== undefined
|
|
65
66
|
&& args.length >= 2 && args[1] !== r_function_call_1.EmptyArgument) {
|
|
66
|
-
const
|
|
67
|
-
|
|
67
|
+
const envState = (0, built_in_stack_env_1.resolveNodeToStackEnv)(head.value, data)
|
|
68
|
+
?? (head.value.type === type_1.RType.Symbol ? (0, built_in_envir_utils_1.resolveSymbolToEnvir)(head.value.content, head.value.info.id, data)?.envDef.envState : undefined);
|
|
69
|
+
if (envState) {
|
|
68
70
|
const fieldNode = (0, unpack_argument_1.unpackArg)(args[1]);
|
|
69
71
|
const fieldName = fieldNode?.type === type_1.RType.String ? fieldNode.content.str : fieldNode?.lexeme;
|
|
70
|
-
const fieldDefs = fieldName ?
|
|
72
|
+
const fieldDefs = fieldName ? envState.current.memory.get(fieldName) : undefined;
|
|
71
73
|
for (const fd of fieldDefs ?? []) {
|
|
72
74
|
info.graph.addEdge(name.info.id, fd.nodeId, edge_1.EdgeType.Reads);
|
|
73
75
|
}
|