@eagleoutice/flowr 2.14.4 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -63
- package/abstract-interpretation/absint-inference.d.ts +347 -0
- package/abstract-interpretation/{absint-visitor.js → absint-inference.js} +327 -97
- package/abstract-interpretation/abstract-semantics.d.ts +246 -0
- package/abstract-interpretation/abstract-semantics.js +3 -0
- package/abstract-interpretation/data-frame/{mappers/arguments.d.ts → arguments.d.ts} +18 -16
- package/abstract-interpretation/data-frame/{mappers/arguments.js → arguments.js} +20 -21
- package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +52 -0
- package/abstract-interpretation/data-frame/dataframe-semantics.js +1656 -0
- package/abstract-interpretation/data-frame/resolve-args.js +4 -4
- package/abstract-interpretation/data-frame/semantics.d.ts +15 -21
- package/abstract-interpretation/data-frame/semantics.js +27 -29
- package/abstract-interpretation/data-frame/shape-inference.d.ts +28 -24
- package/abstract-interpretation/data-frame/shape-inference.js +14 -79
- package/abstract-interpretation/domains/interval-domain.d.ts +5 -1
- package/abstract-interpretation/domains/interval-domain.js +25 -33
- package/abstract-interpretation/domains/multi-value-state-domain.d.ts +6 -3
- package/abstract-interpretation/domains/multi-value-state-domain.js +24 -4
- package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -6
- package/abstract-interpretation/domains/partial-product-domain.js +26 -43
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -6
- package/abstract-interpretation/domains/positive-interval-domain.js +3 -29
- package/abstract-interpretation/domains/product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.d.ts +6 -0
- package/abstract-interpretation/domains/set-range-domain.js +29 -62
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +9 -2
- package/abstract-interpretation/domains/state-abstract-domain.js +26 -37
- package/abstract-interpretation/domains/{state-domain-like.d.ts → state-domain.d.ts} +10 -6
- package/abstract-interpretation/domains/{state-domain-like.js → state-domain.js} +1 -1
- package/abstract-interpretation/value-semantics.d.ts +113 -0
- package/abstract-interpretation/value-semantics.js +115 -0
- package/benchmark/slicer.js +12 -6
- package/benchmark/stats/feature-counts.d.ts +2 -1
- package/benchmark/stats/feature-counts.js +25 -1
- package/benchmark/stats/stats.d.ts +4 -0
- package/benchmark/summarizer/second-phase/graph.js +7 -0
- package/cli/repl/commands/repl-parse.js +11 -22
- package/cli/repl/parser/slice-query-parser.d.ts +2 -0
- package/cli/repl/parser/slice-query-parser.js +1 -0
- package/config.d.ts +30 -205
- package/config.js +37 -3
- package/control-flow/cfg-properties.d.ts +5 -0
- package/control-flow/cfg-properties.js +25 -7
- package/control-flow/control-flow-graph.d.ts +11 -37
- package/control-flow/control-flow-graph.js +33 -77
- package/control-flow/semantic-cfg-guided-visitor.d.ts +63 -320
- package/control-flow/semantic-cfg-guided-visitor.js +65 -320
- package/dataflow/environments/built-in-config.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in-props.d.ts +192 -82
- package/dataflow/environments/built-in-props.js +336 -106
- package/dataflow/environments/built-in.d.ts +21 -9
- package/dataflow/environments/built-in.js +43 -12
- package/dataflow/environments/default-builtin-config.d.ts +3219 -313
- package/dataflow/environments/default-builtin-config.js +803 -1012
- package/dataflow/environments/environment.d.ts +26 -49
- package/dataflow/environments/environment.js +34 -47
- package/dataflow/environments/group-generics.d.ts +11 -2
- package/dataflow/environments/group-generics.js +22 -3
- package/dataflow/environments/identifier.d.ts +106 -6
- package/dataflow/environments/identifier.js +19 -1
- package/dataflow/environments/query-fn-props.d.ts +16 -8
- package/dataflow/environments/query-fn-props.js +45 -21
- package/dataflow/environments/resolve-by-name.js +9 -2
- package/dataflow/environments/scoping.d.ts +5 -0
- package/dataflow/environments/scoping.js +11 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +20 -2
- package/dataflow/eval/resolve/resolve-numbers.d.ts +182 -7
- package/dataflow/eval/resolve/resolve-numbers.js +44 -9
- package/dataflow/eval/resolve/resolve-strings.d.ts +79 -2
- package/dataflow/eval/resolve/resolve-strings.js +16 -7
- package/dataflow/eval/resolve/resolve.d.ts +5 -22
- package/dataflow/eval/resolve/resolve.js +24 -34
- package/dataflow/eval/values/general.d.ts +7 -1
- package/dataflow/eval/values/general.js +17 -3
- package/dataflow/eval/values/string/string-constants.d.ts +16 -15
- package/dataflow/eval/values/string/string-constants.js +59 -27
- package/dataflow/extractor.d.ts +2 -1
- package/dataflow/extractor.js +16 -4
- package/dataflow/fn/argument-roles.d.ts +35 -0
- package/dataflow/fn/argument-roles.js +252 -0
- package/dataflow/fn/class-declaration.d.ts +148 -0
- package/dataflow/fn/class-declaration.js +317 -0
- package/dataflow/fn/condition-handlers.d.ts +5 -0
- package/dataflow/fn/condition-handlers.js +13 -0
- package/dataflow/fn/exceptions-of-function.d.ts +21 -7
- package/dataflow/fn/exceptions-of-function.js +74 -43
- package/dataflow/fn/frame-reflection.d.ts +46 -0
- package/dataflow/fn/frame-reflection.js +169 -0
- package/dataflow/fn/function-props.d.ts +32 -0
- package/dataflow/fn/function-props.js +160 -0
- package/dataflow/fn/higher-order-function.d.ts +23 -5
- package/dataflow/fn/higher-order-function.js +64 -18
- package/dataflow/fn/strict-function.d.ts +24 -2
- package/dataflow/fn/strict-function.js +49 -19
- package/dataflow/graph/call-graph.js +10 -2
- package/dataflow/graph/df-helper.d.ts +1 -12
- package/dataflow/graph/df-helper.js +2 -19
- package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/graph.d.ts +39 -188
- package/dataflow/graph/graph.js +46 -163
- package/dataflow/graph/match-args.d.ts +34 -2
- package/dataflow/graph/match-args.js +45 -12
- package/dataflow/graph/vertex.d.ts +8 -0
- package/dataflow/info.d.ts +7 -5
- package/dataflow/info.js +1 -5
- package/dataflow/internal/control-flow.js +20 -17
- package/dataflow/internal/linker.d.ts +8 -37
- package/dataflow/internal/linker.js +22 -55
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +8 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +43 -50
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.d.ts +23 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.js +24 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +0 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +73 -27
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +131 -92
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +17 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +187 -99
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +0 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +31 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +101 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +23 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +22 -1
- package/dataflow/internal/process/functions/call/common.d.ts +4 -6
- package/dataflow/internal/process/functions/call/common.js +2 -2
- package/dataflow/internal/process/functions/call/deferred.d.ts +1 -1
- package/dataflow/internal/process/functions/call/deferred.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +5 -3
- package/dataflow/internal/process/functions/call/known-call-handling.js +6 -4
- package/dataflow/internal/process/functions/call/named-call-handling.js +19 -13
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -2
- package/dataflow/internal/process/functions/call/quoted.js +144 -28
- package/dataflow/origin/dfg-get-origin.js +23 -10
- package/dataflow/processor.d.ts +2 -1
- package/dataflow/processor.js +6 -0
- package/documentation/data/interface/doc-writing-code.js +2 -0
- package/documentation/doc-util/doc-search.js +1 -1
- package/documentation/wiki-absint.d.ts +11 -14
- package/documentation/wiki-absint.js +73 -59
- package/documentation/wiki-core.js +64 -24
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-query.js +82 -264
- package/documentation/wiki-signature-database.js +17 -5
- package/gas.d.ts +91 -47
- package/gas.js +97 -13
- package/index.d.ts +31 -0
- package/index.js +52 -0
- package/linter/linter-rules.d.ts +87 -23
- package/linter/linter-rules.js +3 -1
- package/linter/rules/absolute-path.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +10 -8
- package/linter/rules/dead-code.d.ts +1 -1
- package/linter/rules/deprecated-functions.js +14 -5
- package/linter/rules/file-path-validity.d.ts +1 -1
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +13 -2
- package/linter/rules/network-functions.d.ts +10 -5
- package/linter/rules/network-functions.js +48 -36
- package/linter/rules/no-leaked-credentials.d.ts +1 -1
- package/linter/rules/problematic-inputs.d.ts +1 -1
- package/linter/rules/problematic-inputs.js +1 -1
- package/linter/rules/seeded-randomness.d.ts +3 -2
- package/linter/rules/seeded-randomness.js +7 -3
- package/linter/rules/software-has-license.d.ts +1 -1
- package/linter/rules/software-has-tests.d.ts +1 -1
- package/linter/rules/stop-with-call-arg.d.ts +1 -1
- package/linter/rules/syntactically-valid.d.ts +1 -1
- package/linter/rules/unclosed-connection.d.ts +3 -3
- package/linter/rules/unclosed-connection.js +3 -4
- package/linter/rules/undefined-symbol.d.ts +1 -1
- package/linter/rules/unescaped-arguments.d.ts +161 -0
- package/linter/rules/unescaped-arguments.js +293 -0
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/unused-definition.js +49 -4
- package/linter/rules/unused-import.d.ts +1 -1
- package/linter/rules/useless-loop.d.ts +1 -1
- package/package.json +3 -198
- package/project/context/flowr-analyzer-environment-context.d.ts +12 -1
- package/project/context/flowr-analyzer-environment-context.js +33 -1
- package/project/context/flowr-analyzer-files-context.d.ts +24 -1
- package/project/context/flowr-analyzer-files-context.js +42 -21
- package/project/context/flowr-analyzer-functions-context.d.ts +8 -0
- package/project/context/flowr-analyzer-functions-context.js +2 -0
- package/project/context/flowr-analyzer-gas-context.d.ts +9 -1
- package/project/context/flowr-analyzer-gas-context.js +21 -0
- package/project/context/flowr-file.d.ts +16 -1
- package/project/context/flowr-file.js +26 -2
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +19 -20
- package/project/plugins/file-plugins/files/flowr-description-file.js +55 -41
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +9 -4
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +11 -3
- package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +6 -9
- package/project/plugins/file-plugins/files/flowr-manifest-files.js +5 -21
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +11 -12
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +48 -61
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +3 -12
- package/project/plugins/file-plugins/files/flowr-news-file.js +2 -19
- package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +145 -0
- package/project/plugins/file-plugins/files/flowr-rd-file.js +676 -0
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +122 -422
- package/project/plugins/file-plugins/files/flowr-rda-file.js +517 -1005
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +8 -2
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +10 -1
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +7 -2
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +9 -1
- package/project/plugins/file-plugins/files/flowr-sysdata-file.d.ts +17 -0
- package/project/plugins/file-plugins/files/flowr-sysdata-file.js +40 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -1
- package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.d.ts +58 -0
- package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.js +95 -0
- package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.d.ts +23 -0
- package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +33 -72
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +17 -15
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +20 -37
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +29 -53
- package/project/plugins/package-version-plugins/package.js +2 -1
- package/project/plugins/plugin-registry.d.ts +3 -1
- package/project/plugins/plugin-registry.js +11 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +20 -4
- package/project/sigdb/build.d.ts +9 -15
- package/project/sigdb/build.js +63 -42
- package/project/sigdb/decode.d.ts +10 -4
- package/project/sigdb/decode.js +60 -21
- package/project/sigdb/memory-source.d.ts +4 -0
- package/project/sigdb/memory-source.js +8 -0
- package/project/sigdb/reader.d.ts +50 -100
- package/project/sigdb/reader.js +84 -105
- package/project/sigdb/schema.d.ts +90 -26
- package/project/sigdb/schema.js +12 -6
- package/queries/base-query-format.d.ts +7 -0
- package/queries/base-query-format.js +29 -0
- package/queries/catalog/absint-query/absint-query-executor.js +8 -6
- package/queries/catalog/absint-query/absint-query-format.d.ts +20 -9
- package/queries/catalog/absint-query/absint-query-format.js +32 -19
- package/queries/catalog/call-context-query/call-context-query-executor.js +3 -3
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +2 -2
- package/queries/catalog/dependencies-query/function-info/derived-functions.js +14 -4
- package/queries/catalog/dependencies-query/function-info/read-functions.js +7 -121
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +2 -2
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +4 -46
- package/queries/catalog/dependencies-query/function-info/write-functions.js +3 -76
- package/queries/catalog/dependencies-query/implicit-echo.js +2 -2
- package/queries/catalog/dependencies-query/link-devices.d.ts +2 -2
- package/queries/catalog/dependencies-query/link-devices.js +6 -7
- package/queries/catalog/dice-query/dice-query-executor.js +1 -1
- package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
- package/queries/catalog/does-call-query/does-call-query-executor.js +4 -0
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -1
- package/queries/catalog/files-query/files-query-format.d.ts +1 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +1 -1
- package/queries/catalog/input-sources-query/input-source-functions.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -17
- package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -27
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +3 -8
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -11
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +4 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +60 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +35 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +63 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -6
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +3 -8
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -11
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +3 -8
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -12
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +3 -8
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -14
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -10
- package/queries/catalog/signature-query/signature-query-executor.js +87 -93
- package/queries/catalog/signature-query/signature-query-format.d.ts +20 -5
- package/queries/catalog/signature-query/signature-query-format.js +16 -4
- package/queries/catalog/signature-query/signature-query-render.js +18 -4
- package/queries/catalog/slice-query-options.d.ts +14 -0
- package/queries/catalog/slice-query-options.js +15 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +2 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.js +7 -5
- package/queries/query-function-filter.d.ts +8 -3
- package/queries/query-function-filter.js +16 -6
- package/queries/query.d.ts +38 -38
- package/queries/query.js +30 -4
- package/r-bridge/lang-4.x/ast/model/model.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/model.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +17 -9
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +35 -27
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -22
- package/reconstruct/reconstruct.d.ts +9 -20
- package/reconstruct/reconstruct.js +66 -28
- package/search/flowr-search-filters.d.ts +7 -6
- package/search/flowr-search-filters.js +6 -4
- package/search/search-executor/search-enrichers.d.ts +10 -10
- package/search/search-executor/search-enrichers.js +32 -3
- package/search/search-executor/search-transformer.js +15 -23
- package/slicing/criterion/parse.js +2 -12
- package/slicing/static/slice-call.js +1 -8
- package/slicing/static/static-slicer.js +1 -1
- package/util/collections/bimap.js +14 -6
- package/util/objects.js +16 -17
- package/util/r-value.d.ts +5 -4
- package/util/record.d.ts +38 -3
- package/util/record.js +48 -1
- package/util/simple-df/dfg-ascii.js +1 -1
- package/util/text/strings.d.ts +5 -0
- package/util/text/strings.js +10 -0
- package/util/version.js +2 -2
- package/abstract-interpretation/absint-visitor.d.ts +0 -223
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +0 -19
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +0 -151
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +0 -287
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +0 -1096
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +0 -15
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +0 -207
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +0 -6
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +0 -25
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +0 -31
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +0 -56
|
@@ -36,7 +36,7 @@ const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
|
36
36
|
const files_query_executor_1 = require("../queries/catalog/files-query/files-query-executor");
|
|
37
37
|
const call_graph_query_executor_1 = require("../queries/catalog/call-graph-query/call-graph-query-executor");
|
|
38
38
|
const inspect_recursion_query_executor_1 = require("../queries/catalog/inspect-recursion-query/inspect-recursion-query-executor");
|
|
39
|
-
const
|
|
39
|
+
const inspect_fn_props_query_executor_1 = require("../queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor");
|
|
40
40
|
const does_call_query_executor_1 = require("../queries/catalog/does-call-query/does-call-query-executor");
|
|
41
41
|
const inspect_exception_query_executor_1 = require("../queries/catalog/inspect-exceptions-query/inspect-exception-query-executor");
|
|
42
42
|
const slice_direction_1 = require("../util/slice-direction");
|
|
@@ -81,20 +81,8 @@ all calls that start with \`read_\` to the kind \`input\` but only if they are n
|
|
|
81
81
|
|
|
82
82
|
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [
|
|
83
83
|
{ type: 'call-context', callName: '^mean$', kind: 'visualize', subkind: 'text' },
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
callName: '^read_',
|
|
87
|
-
kind: 'input',
|
|
88
|
-
subkind: 'csv-file',
|
|
89
|
-
callTargets: identify_link_to_last_call_relation_1.CallTargets.OnlyGlobal
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
type: 'call-context',
|
|
93
|
-
callName: '^points$',
|
|
94
|
-
kind: 'visualize',
|
|
95
|
-
subkind: 'plot',
|
|
96
|
-
linkTo: { type: 'link-to-last-call', callName: '^plot$' }
|
|
97
|
-
}
|
|
84
|
+
{ type: 'call-context', callName: '^read_', kind: 'input', subkind: 'csv-file', callTargets: identify_link_to_last_call_relation_1.CallTargets.OnlyGlobal },
|
|
85
|
+
{ type: 'call-context', callName: '^points$', kind: 'visualize', subkind: 'plot', linkTo: { type: 'link-to-last-call', callName: '^plot$' } }
|
|
98
86
|
], { showCode: false, ctx })}
|
|
99
87
|
|
|
100
88
|
As you can see, all kinds and subkinds with the same name are grouped together.
|
|
@@ -128,9 +116,7 @@ Maybe you want to handle only the result of the query execution, or you just nee
|
|
|
128
116
|
This query type does exactly that!
|
|
129
117
|
|
|
130
118
|
Using the example code \`${exampleCode}\`, the following query returns the dataflow graph of the code:
|
|
131
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
132
|
-
type: 'dataflow'
|
|
133
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
119
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'dataflow' }], { showCode: true, collapseQuery: true, ctx })}
|
|
134
120
|
`;
|
|
135
121
|
}
|
|
136
122
|
});
|
|
@@ -145,9 +131,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
|
145
131
|
This query calculates and returns the ${ctx.linkPage('wiki/Dataflow Graph', 'call graph', 'perspectives-cg')} of the given code.
|
|
146
132
|
|
|
147
133
|
Using the example code \`${exampleCode}\`, the following query returns the dataflow graph of the code:
|
|
148
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
149
|
-
type: 'call-graph'
|
|
150
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
134
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'call-graph' }], { showCode: true, collapseQuery: true, ctx })}
|
|
151
135
|
`;
|
|
152
136
|
}
|
|
153
137
|
});
|
|
@@ -164,12 +148,7 @@ This query checks whether a function calls another function matching given const
|
|
|
164
148
|
Using the example code:
|
|
165
149
|
${(0, doc_code_1.codeBlock)('r', exampleCode)}
|
|
166
150
|
the following query checks whether the call to \`f\` calls \`eval\`:
|
|
167
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
168
|
-
type: 'does-call',
|
|
169
|
-
queryId: 'calls-eval',
|
|
170
|
-
call: '2@f',
|
|
171
|
-
calls: { type: 'name', name: 'eval', nameExact: true }
|
|
172
|
-
}], { showCode: true, collapseQuery: false, shorthand: '(2@f:"eval")', ctx })}
|
|
151
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'does-call', queryId: 'calls-eval', call: '2@f', calls: { type: 'name', name: 'eval', nameExact: true } }], { showCode: true, collapseQuery: false, shorthand: '(2@f:"eval")', ctx })}
|
|
173
152
|
`;
|
|
174
153
|
}
|
|
175
154
|
});
|
|
@@ -181,9 +160,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
|
181
160
|
buildExplanation: async (shell, ctx) => {
|
|
182
161
|
return `
|
|
183
162
|
This query returns the files that match the given criteria.
|
|
184
|
-
${await (0, doc_query_1.showQuery)(shell, '', [{
|
|
185
|
-
type: 'files'
|
|
186
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
163
|
+
${await (0, doc_query_1.showQuery)(shell, '', [{ type: 'files' }], { showCode: true, collapseQuery: true, ctx })}
|
|
187
164
|
`;
|
|
188
165
|
}
|
|
189
166
|
});
|
|
@@ -198,9 +175,7 @@ ${await (0, doc_query_1.showQuery)(shell, '', [{
|
|
|
198
175
|
This query returns the information about the analyzed project.
|
|
199
176
|
If present, it will incorporate plugins to, e.g., extract author and license information from R package DESCRIPTION files.
|
|
200
177
|
|
|
201
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
202
|
-
type: 'project'
|
|
203
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
178
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'project' }], { showCode: true, collapseQuery: true, ctx })}
|
|
204
179
|
`;
|
|
205
180
|
}
|
|
206
181
|
});
|
|
@@ -216,9 +191,7 @@ Maybe you want to handle only the result of the query execution, or you just nee
|
|
|
216
191
|
This query type does exactly that!
|
|
217
192
|
|
|
218
193
|
Using the example code \`${exampleCode}\`, the following query returns the normalized AST of the code:
|
|
219
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
220
|
-
type: 'normalized-ast'
|
|
221
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
194
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'normalized-ast' }], { showCode: true, collapseQuery: true, ctx })}
|
|
222
195
|
`;
|
|
223
196
|
}
|
|
224
197
|
});
|
|
@@ -242,9 +215,7 @@ ${(0, doc_structure_1.details)('Example <code>' + exampleA + '</code>', await (0
|
|
|
242
215
|
${(0, doc_structure_1.details)('Example <code>' + exampleB + '</code>', await (0, doc_query_1.showQuery)(shell, exampleB, [{ type: 'dataflow-cluster' }], { showCode: false, ctx }))}
|
|
243
216
|
|
|
244
217
|
Using the example code from above, the following query returns all clusters:
|
|
245
|
-
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{
|
|
246
|
-
type: 'dataflow-cluster'
|
|
247
|
-
}], { showCode: false, collapseQuery: true, ctx })}
|
|
218
|
+
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{ type: 'dataflow-cluster' }], { showCode: false, collapseQuery: true, ctx })}
|
|
248
219
|
`;
|
|
249
220
|
}
|
|
250
221
|
});
|
|
@@ -261,10 +232,7 @@ With this query you can use flowR's value-tracking capabilities to resolve ident
|
|
|
261
232
|
The extent to which flowR traces values (e.g., built-ins vs. constants) can be configured in flowR's Configuration file (see the ${ctx.linkPage('wiki/Interface', 'Interface')} wiki page for more information).
|
|
262
233
|
|
|
263
234
|
Using the example code \`${exampleCode}\` (with newlines), the following query returns all values of \`x\` in the code:
|
|
264
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
265
|
-
type: 'resolve-value',
|
|
266
|
-
criteria: criteria
|
|
267
|
-
}], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
235
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'resolve-value', criteria: criteria }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
268
236
|
`;
|
|
269
237
|
}
|
|
270
238
|
});
|
|
@@ -277,18 +245,14 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
|
277
245
|
const exampleCode = 'f <- function() function(x) x; f()';
|
|
278
246
|
return `
|
|
279
247
|
With this query you can identify which functions in the code are higher-order functions, i.e., either take a function as an argument or return a function.
|
|
248
|
+
A parameter the body itself calls (\`function(g) g()\`, \`function(g) lapply(x, g)\`) counts as well, without any call site having to hand a function over.
|
|
280
249
|
Please note, that functions that are just identities (e.g., \`function(x) x\`) are not considered higher-order if they do not take a function as an argument.
|
|
281
250
|
|
|
282
251
|
Using the example code \`${exampleCode}\` the following query returns the information for all identified function definitions whether they are higher-order functions:
|
|
283
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
284
|
-
type: 'inspect-higher-order',
|
|
285
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
252
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-higher-order' }], { showCode: true, collapseQuery: true, ctx })}
|
|
286
253
|
|
|
287
254
|
This query also supports a slicing criterion based query mode that only returns information for functions matching the given criteria:
|
|
288
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
289
|
-
type: 'inspect-higher-order',
|
|
290
|
-
filter: ['1@function']
|
|
291
|
-
}], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
255
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-higher-order', filter: ['1@function'] }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
292
256
|
`;
|
|
293
257
|
}
|
|
294
258
|
});
|
|
@@ -304,67 +268,49 @@ With this query you can identify which functions in the code are recursive.
|
|
|
304
268
|
Please note, that functions that *may* be recursive due to indirect calls are also considered recursive.
|
|
305
269
|
|
|
306
270
|
Using the example code \`${exampleCode}\` the following query returns the information for all identified function definitions whether they are recursive:
|
|
307
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
308
|
-
type: 'inspect-recursion',
|
|
309
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
271
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-recursion' }], { showCode: true, collapseQuery: true, ctx })}
|
|
310
272
|
|
|
311
273
|
This query also supports a slicing criterion based query mode that only returns information for functions matching the given criteria:
|
|
312
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
313
|
-
type: 'inspect-recursion',
|
|
314
|
-
filter: ['1@function']
|
|
315
|
-
}], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
274
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-recursion', filter: ['1@function'] }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
316
275
|
`;
|
|
317
276
|
}
|
|
318
277
|
});
|
|
319
|
-
(0, doc_query_1.registerQueryDocumentation)('inspect-
|
|
278
|
+
(0, doc_query_1.registerQueryDocumentation)('inspect-fn-props', {
|
|
320
279
|
type: 'active',
|
|
321
|
-
shortDescription: 'Determine
|
|
322
|
-
functionName:
|
|
323
|
-
functionFile: '../queries/catalog/inspect-
|
|
280
|
+
shortDescription: 'Determine what functions and their formals do',
|
|
281
|
+
functionName: inspect_fn_props_query_executor_1.executeFnPropsQuery.name,
|
|
282
|
+
functionFile: '../queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.ts',
|
|
324
283
|
buildExplanation: async (shell, ctx) => {
|
|
325
|
-
const exampleCode = 'f <- function(
|
|
326
|
-
return `
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
\`
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
such as \`obj$m(x)\`, leaves the parameter \`conditionally\` strict:
|
|
353
|
-
${await (0, doc_query_1.showQuery)(shell, 'f <- function(x, y) UseMethod("f")\nf.default <- function(x, y) x\nf.numeric <- function(x, y) y', [{
|
|
354
|
-
type: 'inspect-strictness',
|
|
355
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
356
|
-
|
|
357
|
-
Using the example code \`${exampleCode}\` the following query returns the information for all identified
|
|
358
|
-
function definitions whether they are strict:
|
|
359
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
360
|
-
type: 'inspect-strictness',
|
|
361
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
284
|
+
const exampleCode = 'f <- function(x, xs, FUN, opt) { if(missing(opt)) print(length(xs)); lapply(xs, FUN); x }';
|
|
285
|
+
return `
|
|
286
|
+
Per function definition this states what each formal is used for, as ${ctx.link('ArgProp')} bits, and what the
|
|
287
|
+
function itself does, as ${ctx.link('CallProp')} bits: the very scheme flowR states its built-ins and the
|
|
288
|
+
signature database stores its parameters with.
|
|
289
|
+
|
|
290
|
+
R hands arguments over as promises, so whether a parameter is evaluated at all is part of the answer:
|
|
291
|
+
${ctx.linkE('ArgProp', 'Forced')} says every call forces it,
|
|
292
|
+
${ctx.linkE('ArgProp', 'Lazy')} that none can, and neither of the two that it depends on the
|
|
293
|
+
path taken, on the caller, or on a function flowR could not resolve. A function forcing every one of its
|
|
294
|
+
parameters is ${ctx.linkE('CallProp', 'Strict')} in turn. A read that only hands the parameter
|
|
295
|
+
on is decided by the function receiving it, resolved through the call graph, while a read in a nested
|
|
296
|
+
definition, in a loop, or under a condition leaves it open.
|
|
297
|
+
|
|
298
|
+
A formal is an alias only if the function *always* returns it (\`return(x)\` under an \`if\` does not count),
|
|
299
|
+
every other bit is the one the calls in the body state for what they are handed, and a formal carrying none at
|
|
300
|
+
all is left out. A body reading its own call or frame (\`match.call()\`, \`nargs()\`,
|
|
301
|
+
\`as.list(environment())\`) reaches every formal without naming one, so they all carry \`nse\`.
|
|
302
|
+
What the function itself does is read off its body: what its calls do it does too, a dispatching body is a
|
|
303
|
+
generic, and one whose result always comes from a call returning invisibly returns invisibly in turn.
|
|
304
|
+
|
|
305
|
+
With \`only\` the query infers just one half (\`arguments\` or \`function\`, skipping the other walk
|
|
306
|
+
entirely), \`formals\` keeps the parameters written as one of the given names, and \`props\` keeps the
|
|
307
|
+
properties named as the \`ArgProp\`/\`CallProp\` members they are.
|
|
308
|
+
|
|
309
|
+
Using the example code \`${exampleCode}\` the following query returns what every identified function and formal does:
|
|
310
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-fn-props' }], { showCode: true, collapseQuery: true, ctx })}
|
|
362
311
|
|
|
363
312
|
This query also supports a slicing criterion based query mode that only returns information for functions matching the given criteria:
|
|
364
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
365
|
-
type: 'inspect-strictness',
|
|
366
|
-
filter: ['1@function']
|
|
367
|
-
}], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
313
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-fn-props', filter: ['1@function'] }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
368
314
|
`;
|
|
369
315
|
}
|
|
370
316
|
});
|
|
@@ -390,9 +336,7 @@ With this query you can identify which functions in the code throw exceptions (k
|
|
|
390
336
|
Using the following example code:
|
|
391
337
|
${(0, doc_code_1.codeBlock)('r', exampleCode)}
|
|
392
338
|
the following query returns the information for all identified function definitions whether they throw exceptions:
|
|
393
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
394
|
-
type: 'inspect-exception',
|
|
395
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
339
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-exception' }], { showCode: true, collapseQuery: true, ctx })}
|
|
396
340
|
`;
|
|
397
341
|
}
|
|
398
342
|
});
|
|
@@ -409,10 +353,7 @@ With this query you can use flowR's origin tracking to find out the read origins
|
|
|
409
353
|
the functions called by a call, and more.
|
|
410
354
|
|
|
411
355
|
Using the example code \`${exampleCode}\` (with the \`print(x)\` in the second line), the following query returns the origins of \`x\` in the code:
|
|
412
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
413
|
-
type: 'origin',
|
|
414
|
-
criterion: criterion
|
|
415
|
-
}], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
356
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'origin', criterion: criterion }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
416
357
|
`;
|
|
417
358
|
}
|
|
418
359
|
});
|
|
@@ -427,10 +368,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
|
427
368
|
With this query you can use the ${ctx.linkPage('wiki/Search API', 'Search API')} to conduct searches on the flowR analysis result.
|
|
428
369
|
|
|
429
370
|
Using the example code \`${exampleCode}\`, the following query returns all uses of 'x' in the code:
|
|
430
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
431
|
-
type: 'search',
|
|
432
|
-
search: flowr_search_builder_1.Q.var('x').filter(vertex_1.VertexType.Use).build()
|
|
433
|
-
}], { showCode: true, collapseQuery: false, ctx })}
|
|
371
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'search', search: flowr_search_builder_1.Q.var('x').filter(vertex_1.VertexType.Use).build() }], { showCode: true, collapseQuery: false, ctx })}
|
|
434
372
|
`;
|
|
435
373
|
}
|
|
436
374
|
});
|
|
@@ -449,11 +387,7 @@ Using the example code:
|
|
|
449
387
|
${(0, doc_code_1.codeBlock)('r', exampleCode)}
|
|
450
388
|
|
|
451
389
|
the following query returns that the first assignment happens always before the other:
|
|
452
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
453
|
-
type: 'happens-before',
|
|
454
|
-
a: '1@x',
|
|
455
|
-
b: '2@y'
|
|
456
|
-
}], { showCode: true, collapseQuery: false, ctx })}
|
|
390
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'happens-before', a: '1@x', b: '2@y' }], { showCode: true, collapseQuery: false, ctx })}
|
|
457
391
|
`;
|
|
458
392
|
}
|
|
459
393
|
});
|
|
@@ -468,9 +402,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
|
468
402
|
This query provides access to all nodes in the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} as a mapping from their id to the node itself.
|
|
469
403
|
|
|
470
404
|
Using the example code \`${exampleCode}\`, the following query returns all nodes from the code:
|
|
471
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
472
|
-
type: 'id-map'
|
|
473
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
405
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'id-map' }], { showCode: true, collapseQuery: true, ctx })}
|
|
474
406
|
`;
|
|
475
407
|
}
|
|
476
408
|
});
|
|
@@ -483,34 +415,18 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
|
483
415
|
return `
|
|
484
416
|
This query provides access to the current configuration of the flowR instance. See the ${ctx.linkPage('wiki/Interface', 'Interface')} wiki page for more information on what the configuration represents.
|
|
485
417
|
Additionally, you can use this query to update the configuration of flowR on-the-fly (please do not rely on this mechanism it is mostly of interest for demonstrations).
|
|
486
|
-
${await (0, doc_query_1.showQuery)(shell, '', [{
|
|
487
|
-
type: 'config',
|
|
488
|
-
update: {
|
|
489
|
-
ignoreSourceCalls: true
|
|
490
|
-
}
|
|
491
|
-
}], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
|
|
418
|
+
${await (0, doc_query_1.showQuery)(shell, '', [{ type: 'config', update: { ignoreSourceCalls: true } }], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
|
|
492
419
|
|
|
493
420
|
Please note that, in the REPL, a special syntax starting with \`+\` (which should be autocompleted) can be used to update the configuration on the fly:
|
|
494
421
|
|
|
495
|
-
${await (0, doc_repl_1.documentReplSession)(shell, [
|
|
496
|
-
{
|
|
497
|
-
command: ':query @config +solver.slicer.threshold=10000',
|
|
498
|
-
description: 'Set the slicing threshold to 10,000.'
|
|
499
|
-
}
|
|
500
|
-
])}
|
|
422
|
+
${await (0, doc_repl_1.documentReplSession)(shell, [{ command: ':query @config +solver.slicer.threshold=10000', description: 'Set the slicing threshold to 10,000.' }])}
|
|
501
423
|
|
|
502
424
|
In the REPL you can also read a single option by its \`.\`-separated path, or several at once with a glob—\`*\` covers
|
|
503
425
|
one path segment, \`**\` any number. This only reads: setting a value still names exactly one key.
|
|
504
426
|
|
|
505
427
|
${await (0, doc_repl_1.documentReplSession)(shell, [
|
|
506
|
-
{
|
|
507
|
-
|
|
508
|
-
description: 'Read every `enabled` option, wherever it sits in the configuration.'
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
command: ':query @config solver.*',
|
|
512
|
-
description: 'Read the direct children of `solver` (use `solver.**` for the whole subtree).'
|
|
513
|
-
}
|
|
428
|
+
{ command: ':query @config **.enabled', description: 'Read every `enabled` option, wherever it sits in the configuration.' },
|
|
429
|
+
{ command: ':query @config solver.*', description: 'Read the direct children of `solver` (use `solver.**` for the whole subtree).' }
|
|
514
430
|
])}
|
|
515
431
|
|
|
516
432
|
One of the most useful options to change on-the-fly are probably those under \`repl\`. For example, setting ${ctx.linkConfig('repl.quickStats', true)}
|
|
@@ -529,17 +445,10 @@ enables quick statistics after each REPL command. Likewise, ${ctx.linkConfig('re
|
|
|
529
445
|
const exampleCode = 'df <- data.frame(id = 1:3) |>\n filter(df, FALSE)';
|
|
530
446
|
return `
|
|
531
447
|
This query infers all shapes of dataframes within the code using abstract interpretaion. For example, you can use:
|
|
532
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
533
|
-
type: 'absint',
|
|
534
|
-
inference: inference
|
|
535
|
-
}], { showCode: true, collapseQuery: true, ctx })}
|
|
448
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'absint', inference: inference }], { showCode: true, collapseQuery: true, ctx })}
|
|
536
449
|
|
|
537
450
|
The query optionally also accepts slice criteria to narrow the results to specific nodes. For example:
|
|
538
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
539
|
-
type: 'absint',
|
|
540
|
-
inference: inference,
|
|
541
|
-
criteria: criteria
|
|
542
|
-
}], { showCode: true, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
451
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'absint', inference: inference, criteria: criteria }], { showCode: true, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
543
452
|
`;
|
|
544
453
|
}
|
|
545
454
|
});
|
|
@@ -561,36 +470,18 @@ It offers the following properties of interest:
|
|
|
561
470
|
For example, consider the following compound query that combines two call-context queries for \`mean\` and \`print\`, both of which are to be
|
|
562
471
|
assigned to the kind \`visualize\` and the subkind \`text\` (using the example code from above):
|
|
563
472
|
|
|
564
|
-
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{
|
|
565
|
-
type: 'compound',
|
|
566
|
-
query: 'call-context',
|
|
567
|
-
commonArguments: { kind: 'visualize', subkind: 'text' },
|
|
568
|
-
arguments: [
|
|
569
|
-
{ callName: '^mean$' },
|
|
570
|
-
{ callName: '^print$' }
|
|
571
|
-
]
|
|
572
|
-
}], { showCode: false, ctx })}
|
|
473
|
+
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{ type: 'compound', query: 'call-context', commonArguments: { kind: 'visualize', subkind: 'text' }, arguments: [{ callName: '^mean$' }, { callName: '^print$' }] }], { showCode: false, ctx })}
|
|
573
474
|
|
|
574
475
|
Of course, in this specific scenario, the following query would be equivalent:
|
|
575
476
|
|
|
576
|
-
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [
|
|
577
|
-
{ type: 'call-context', callName: '^(mean|print)$', kind: 'visualize', subkind: 'text' }
|
|
578
|
-
], { showCode: false, collapseResult: true, ctx })}
|
|
477
|
+
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{ type: 'call-context', callName: '^(mean|print)$', kind: 'visualize', subkind: 'text' }], { showCode: false, collapseResult: true, ctx })}
|
|
579
478
|
|
|
580
479
|
However, compound queries become more useful whenever common arguments can not be expressed as a union in one of their properties.
|
|
581
480
|
Additionally, you can still overwrite default arguments.
|
|
582
481
|
In the following, we (by default) want all calls to not resolve to a local definition, except for those to \`print\` for which we explicitly
|
|
583
482
|
want to resolve to a local definition:
|
|
584
483
|
|
|
585
|
-
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{
|
|
586
|
-
type: 'compound',
|
|
587
|
-
query: 'call-context',
|
|
588
|
-
commonArguments: { kind: 'visualize', subkind: 'text', callTargets: identify_link_to_last_call_relation_1.CallTargets.OnlyGlobal },
|
|
589
|
-
arguments: [
|
|
590
|
-
{ callName: '^mean$' },
|
|
591
|
-
{ callName: '^print$', callTargets: identify_link_to_last_call_relation_1.CallTargets.OnlyLocal }
|
|
592
|
-
]
|
|
593
|
-
}], { showCode: false, ctx })}
|
|
484
|
+
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{ type: 'compound', query: 'call-context', commonArguments: { kind: 'visualize', subkind: 'text', callTargets: identify_link_to_last_call_relation_1.CallTargets.OnlyGlobal }, arguments: [{ callName: '^mean$' }, { callName: '^print$', callTargets: identify_link_to_last_call_relation_1.CallTargets.OnlyLocal }] }], { showCode: false, ctx })}
|
|
594
485
|
|
|
595
486
|
Now, the results no longer contain calls to \`plot\` that are not defined locally.
|
|
596
487
|
|
|
@@ -617,38 +508,23 @@ To exemplify the capabilities, consider the following code:
|
|
|
617
508
|
${(0, doc_code_1.codeBlock)('r', exampleCode)}
|
|
618
509
|
If you are interested in the parts required for the use of \`x\` in the last line and \`z\`, you can use the following query:
|
|
619
510
|
|
|
620
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
621
|
-
type: 'static-slice',
|
|
622
|
-
criteria: criteria
|
|
623
|
-
}], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
511
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'static-slice', criteria: criteria }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
624
512
|
|
|
625
513
|
In general, you may be uninterested in seeing the reconstructed version and want to save some computation time, for this,
|
|
626
514
|
you can use the \`noReconstruction\` flag.
|
|
627
515
|
|
|
628
|
-
${(0, doc_structure_1.details)('No Reconstruction Example', await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
629
|
-
type: 'static-slice',
|
|
630
|
-
criteria: ['4@x'],
|
|
631
|
-
noReconstruction: true
|
|
632
|
-
}], { showCode: false, ctx }))}
|
|
516
|
+
${(0, doc_structure_1.details)('No Reconstruction Example', await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'static-slice', criteria: ['4@x'], noReconstruction: true }], { showCode: false, ctx }))}
|
|
633
517
|
|
|
634
518
|
Likewise, if you want the forward slice for the first use of \`x\`, you can do it like this:
|
|
635
519
|
|
|
636
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
637
|
-
type: 'static-slice',
|
|
638
|
-
criteria: ['1@x'],
|
|
639
|
-
direction: slice_direction_1.SliceDirection.Forward
|
|
640
|
-
}], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@x'], (0, doc_escape_1.escapeNewline)(exampleCode), true), ctx })}
|
|
520
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'static-slice', criteria: ['1@x'], direction: slice_direction_1.SliceDirection.Forward }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@x'], (0, doc_escape_1.escapeNewline)(exampleCode), true), ctx })}
|
|
641
521
|
|
|
642
522
|
If your program pulls in other files with \`source(...)\`, the \`inlineSources\` flag splices the reconstruction
|
|
643
523
|
of each resolvable sourced file into the place of its \`source()\` call, so the slice becomes a single
|
|
644
524
|
self-contained R text (cyclic or unresolvable \`source()\` calls are kept verbatim and reported via
|
|
645
525
|
\`reconstruct.inlineWarnings\`). With the ${(0, doc_cli_option_1.getReplCommand)('query')} REPL command you append an \`i\` to the
|
|
646
526
|
criteria (and may combine it with the forward \`f\` as \`fi\`), for example (with a faked \`library.R\` providing \`greeting\`):
|
|
647
|
-
${await (0, doc_query_1.showQuery)(shell, sourceExample, [{
|
|
648
|
-
type: 'static-slice',
|
|
649
|
-
criteria: sourceCriteria,
|
|
650
|
-
inlineSources: true
|
|
651
|
-
}], {
|
|
527
|
+
${await (0, doc_query_1.showQuery)(shell, sourceExample, [{ type: 'static-slice', criteria: sourceCriteria, inlineSources: true }], {
|
|
652
528
|
showCode: false,
|
|
653
529
|
shorthand: (0, doc_query_1.sliceQueryShorthand)(sourceCriteria, (0, doc_escape_1.escapeNewline)(sourceExample), false, true),
|
|
654
530
|
ctx,
|
|
@@ -676,10 +552,7 @@ To exemplify the capabilities, consider the following code:
|
|
|
676
552
|
${(0, doc_code_1.codeBlock)('r', exampleCode)}
|
|
677
553
|
If you are interested in the provenance of the \`x\` in the last line you can use:
|
|
678
554
|
|
|
679
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
680
|
-
type: 'provenance',
|
|
681
|
-
criterion
|
|
682
|
-
}], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
555
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'provenance', criterion }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
683
556
|
`;
|
|
684
557
|
}
|
|
685
558
|
});
|
|
@@ -708,20 +581,14 @@ To exemplify the query, consider the following code:
|
|
|
708
581
|
${(0, doc_code_1.codeBlock)('r', exampleCode)}
|
|
709
582
|
If you are interested in the input-sources of the \`print\` call, you can use:
|
|
710
583
|
|
|
711
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
712
|
-
type: 'input-sources',
|
|
713
|
-
criterion
|
|
714
|
-
}], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
584
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'input-sources', criterion }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
715
585
|
|
|
716
586
|
Some objects are handed to the code by a framework rather than defined in it, like the \`input\` of a shiny
|
|
717
587
|
server function. The ${ctx.link('InputClassifierConfig::linkedObjects')} configuration lists them, so that reads
|
|
718
588
|
of such an object (and of its fields) classify as user input instead of stopping at a ${ctx.link('InputType::Parameter')}:
|
|
719
589
|
${(0, doc_code_1.codeBlock)('r', shinyCode)}
|
|
720
590
|
|
|
721
|
-
${await (0, doc_query_1.showQuery)(shell, shinyCode, [{
|
|
722
|
-
type: 'input-sources',
|
|
723
|
-
criterion: shinyCriterion
|
|
724
|
-
}], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([shinyCriterion], (0, doc_escape_1.escapeNewline)(shinyCode)), ctx })}
|
|
591
|
+
${await (0, doc_query_1.showQuery)(shell, shinyCode, [{ type: 'input-sources', criterion: shinyCriterion }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([shinyCriterion], (0, doc_escape_1.escapeNewline)(shinyCode)), ctx })}
|
|
725
592
|
|
|
726
593
|
Every ${ctx.link('LinkedInputObject')} names the object, the ${ctx.link('InputType')} to use for it, and optionally
|
|
727
594
|
the parameters the binding function has to declare as well (${ctx.link('LinkedInputObject::withParams')}) - shiny's
|
|
@@ -771,29 +638,20 @@ and more advanced tracking in the ${ctx.linkPage('wiki/Dataflow Graph', 'Dataflo
|
|
|
771
638
|
Loaded libraries are resolved against the ${ctx.linkPage('wiki/Signature Database', 'signature database')}.
|
|
772
639
|
|
|
773
640
|
In other words, if you have a script simply reading: \`${exampleCode}\`, the following query returns the loaded library:
|
|
774
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
775
|
-
type: 'dependencies'
|
|
776
|
-
}], { showCode: false, collapseQuery: true, ctx })}
|
|
641
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'dependencies' }], { showCode: false, collapseQuery: true, ctx })}
|
|
777
642
|
|
|
778
643
|
Of course, this works for more complicated scripts too. The query offers information on the loaded _libraries_, _sourced_ files, data which is _read_ and data which is _written_.
|
|
779
644
|
For example, consider the following script:
|
|
780
645
|
${(0, doc_code_1.codeBlock)('r', longerCode)}
|
|
781
646
|
The following query returns the dependencies of the script.
|
|
782
|
-
${await (0, doc_query_1.showQuery)(shell, longerCode, [{
|
|
783
|
-
type: 'dependencies'
|
|
784
|
-
}], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
|
|
647
|
+
${await (0, doc_query_1.showQuery)(shell, longerCode, [{ type: 'dependencies' }], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
|
|
785
648
|
|
|
786
649
|
Currently, the dependency extraction may fail as it is essentially a set of heuristics guessing the dependencies.
|
|
787
650
|
We welcome any feedback on this (consider opening a [new issue](${doc_issue_1.NewIssueUrl})).
|
|
788
651
|
|
|
789
652
|
In the meantime we offer several properties to overwrite the default behavior (e.g., function names that should be collected)
|
|
790
653
|
|
|
791
|
-
${await (0, doc_query_1.showQuery)(shell, longerCode, [{
|
|
792
|
-
type: 'dependencies',
|
|
793
|
-
ignoreDefaultFunctions: true,
|
|
794
|
-
enabledCategories: ['library'],
|
|
795
|
-
libraryFunctions: [{ package: 'base', name: 'print', argIdx: 0, argName: 'library', resolveValue: true }],
|
|
796
|
-
}], { showCode: false, collapseQuery: false, collapseResult: true, ctx })}
|
|
654
|
+
${await (0, doc_query_1.showQuery)(shell, longerCode, [{ type: 'dependencies', ignoreDefaultFunctions: true, enabledCategories: ['library'], libraryFunctions: [{ package: 'base', name: 'print', argIdx: 0, argName: 'library', resolveValue: true }] }], { showCode: false, collapseQuery: false, collapseResult: true, ctx })}
|
|
797
655
|
|
|
798
656
|
Here, \`resolveValue\` tells the dependency query to resolve the value of this argument in case it is not a constant.
|
|
799
657
|
`;
|
|
@@ -810,20 +668,10 @@ Here, \`resolveValue\` tells the dependency query to resolve the value of this a
|
|
|
810
668
|
This query lints a given R script for common issues, such as missing files, unused variables, and more.
|
|
811
669
|
|
|
812
670
|
In other words, if you have a script simply reading: \`${exampleCode}\`, the following query returns all smells detected:
|
|
813
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
814
|
-
type: 'linter'
|
|
815
|
-
}], { showCode: false, collapseQuery: true, ctx })}
|
|
671
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'linter' }], { showCode: false, collapseQuery: true, ctx })}
|
|
816
672
|
|
|
817
673
|
You can also configure which rules to apply and what settings to use for these rules:
|
|
818
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
819
|
-
type: 'linter',
|
|
820
|
-
rules: ['file-path-validity'],
|
|
821
|
-
}], {
|
|
822
|
-
showCode: false,
|
|
823
|
-
collapseQuery: true,
|
|
824
|
-
shorthand: `rules:file-path-validity "${exampleCode}"`,
|
|
825
|
-
ctx
|
|
826
|
-
})}
|
|
674
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'linter', rules: ['file-path-validity'] }], { showCode: false, collapseQuery: true, shorthand: `rules:file-path-validity "${exampleCode}"`, ctx })}
|
|
827
675
|
|
|
828
676
|
We welcome any feedback and suggestions for new rules on this (consider opening a [new issue](${doc_issue_1.NewIssueUrl})).
|
|
829
677
|
`;
|
|
@@ -840,17 +688,10 @@ We welcome any feedback and suggestions for new rules on this (consider opening
|
|
|
840
688
|
This control-flow query provides you access to the control flow graph.
|
|
841
689
|
|
|
842
690
|
In other words, if you have a script simply reading: \`${exampleCode}\`, the following query returns the CFG:
|
|
843
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
844
|
-
type: 'control-flow'
|
|
845
|
-
}], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
|
|
691
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'control-flow' }], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
|
|
846
692
|
|
|
847
693
|
You can also overwrite the simplification passes to tune the perspective. for example, if you want to have basic blocks:
|
|
848
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
849
|
-
type: 'control-flow',
|
|
850
|
-
config: {
|
|
851
|
-
simplificationPasses: ['unique-cf-sets', 'to-basic-blocks']
|
|
852
|
-
}
|
|
853
|
-
}], { showCode: false, collapseResult: true, ctx })}
|
|
694
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'control-flow', config: { simplificationPasses: ['unique-cf-sets', 'to-basic-blocks'] } }], { showCode: false, collapseResult: true, ctx })}
|
|
854
695
|
|
|
855
696
|
this produces:
|
|
856
697
|
|
|
@@ -858,12 +699,7 @@ ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefi
|
|
|
858
699
|
|
|
859
700
|
|
|
860
701
|
If, on the other hand, you want to prune dead code edges:
|
|
861
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
862
|
-
type: 'control-flow',
|
|
863
|
-
config: {
|
|
864
|
-
simplificationPasses: ['unique-cf-sets', 'analyze-dead-code']
|
|
865
|
-
}
|
|
866
|
-
}], { showCode: false, collapseResult: true, ctx })}
|
|
702
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'control-flow', config: { simplificationPasses: ['unique-cf-sets', 'analyze-dead-code'] } }], { showCode: false, collapseResult: true, ctx })}
|
|
867
703
|
|
|
868
704
|
this produces:
|
|
869
705
|
|
|
@@ -871,12 +707,7 @@ ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefi
|
|
|
871
707
|
|
|
872
708
|
|
|
873
709
|
Or, completely remove dead code:
|
|
874
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
875
|
-
type: 'control-flow',
|
|
876
|
-
config: {
|
|
877
|
-
simplificationPasses: ['unique-cf-sets', 'analyze-dead-code', 'remove-dead-code']
|
|
878
|
-
}
|
|
879
|
-
}], { showCode: false, collapseResult: true, ctx })}
|
|
710
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'control-flow', config: { simplificationPasses: ['unique-cf-sets', 'analyze-dead-code', 'remove-dead-code'] } }], { showCode: false, collapseResult: true, ctx })}
|
|
880
711
|
|
|
881
712
|
this produces:
|
|
882
713
|
|
|
@@ -903,16 +734,11 @@ ${(0, doc_code_1.codeBlock)('r', exampleCode)}
|
|
|
903
734
|
|
|
904
735
|
The following query then gives you the aforementioned mapping:
|
|
905
736
|
|
|
906
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
907
|
-
type: 'location-map'
|
|
908
|
-
}], { showCode: false, collapseQuery: true, ctx })}
|
|
737
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'location-map' }], { showCode: false, collapseQuery: true, ctx })}
|
|
909
738
|
|
|
910
739
|
The query also accepts a list of slice criteria to filter the results to only include the locations of specific nodes. For example:
|
|
911
740
|
|
|
912
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
913
|
-
type: 'location-map',
|
|
914
|
-
ids: criteria
|
|
915
|
-
}], { showCode: false, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
741
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'location-map', ids: criteria }], { showCode: false, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
916
742
|
|
|
917
743
|
All locations are given as a ${ctx.link('SourceRange')} paired with the file id in the format \`[file-id, [start-line, start-column, end-line, end-column]]\`.
|
|
918
744
|
|
|
@@ -941,21 +767,13 @@ ${(0, doc_code_1.codeBlock)('r', exampleCode)}
|
|
|
941
767
|
Asking what connects the definition of \`x\` to the definition of \`z\` drops \`y <- 2\` (it never depends on \`x\`)
|
|
942
768
|
as well as \`w <- z * 2\` and \`print(z)\` (they are not on a path _into_ the \`to\` criterion):
|
|
943
769
|
|
|
944
|
-
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
945
|
-
type: 'dice',
|
|
946
|
-
from: ['1@x'],
|
|
947
|
-
to: ['3@z']
|
|
948
|
-
}], { showCode: false, shorthand: `(1@x->3@z) "${(0, doc_escape_1.escapeNewline)(exampleCode)}"`, ctx })}
|
|
770
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'dice', from: ['1@x'], to: ['3@z'] }], { showCode: false, shorthand: `(1@x->3@z) "${(0, doc_escape_1.escapeNewline)(exampleCode)}"`, ctx })}
|
|
949
771
|
|
|
950
772
|
Beyond \`from\` and \`to\`, the dice query understands the same options as the ${(0, doc_query_1.linkToQueryOfName)('static-slice')}
|
|
951
773
|
(\`noReconstruction\`, \`noMagicComments\`, \`inlineSources\`, \`inlineFull\`, and \`includeCallees\`), as both share the
|
|
952
774
|
\`SliceQueryOptions\` of ${(0, doc_files_1.getFilePathMd)('../queries/catalog/slice-query-options.ts')}.
|
|
953
775
|
|
|
954
|
-
${(0, doc_structure_1.details)('Multiple Criteria per Side', 'Each side accepts several criteria, which are seeded together:' + await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
955
|
-
type: 'dice',
|
|
956
|
-
from: ['1@x', '2@y'],
|
|
957
|
-
to: ['5@print']
|
|
958
|
-
}], { showCode: false, ctx }))}
|
|
776
|
+
${(0, doc_structure_1.details)('Multiple Criteria per Side', 'Each side accepts several criteria, which are seeded together:' + await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'dice', from: ['1@x', '2@y'], to: ['5@print'] }], { showCode: false, ctx }))}
|
|
959
777
|
`;
|
|
960
778
|
}
|
|
961
779
|
});
|