@eagleoutice/flowr 2.17.4 → 2.17.5
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 +13 -52
- package/abstract-interpretation/absint-inference.js +1 -2
- package/abstract-interpretation/data-frame/arguments.d.ts +14 -3
- package/abstract-interpretation/data-frame/arguments.js +34 -0
- package/abstract-interpretation/data-frame/dataframe-semantics.js +7 -15
- package/abstract-interpretation/data-frame/resolve-args.d.ts +2 -2
- package/abstract-interpretation/data-frame/semantics.d.ts +8 -1
- package/abstract-interpretation/data-frame/semantics.js +14 -6
- package/abstract-interpretation/domains/state-abstract-domain.js +28 -18
- package/abstract-interpretation/domains/state-map.d.ts +43 -0
- package/abstract-interpretation/domains/state-map.js +147 -0
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +8 -7
- package/cli/repl/commands/repl-dataflow.js +5 -5
- package/cli/repl/commands/repl-execute.js +3 -2
- package/cli/repl/commands/repl-parse.js +2 -1
- package/cli/repl/print-version.d.ts +1 -1
- package/cli/repl/print-version.js +2 -1
- package/cli/repl/server/connection.d.ts +1 -1
- package/cli/repl/server/connection.js +7 -9
- package/cli/slicer-app.js +2 -1
- package/clones/algorithms/baxter-ast.d.ts +33 -0
- package/clones/algorithms/baxter-ast.js +70 -0
- package/clones/algorithms/greedy-string-tiling.d.ts +17 -0
- package/clones/algorithms/greedy-string-tiling.js +56 -0
- package/clones/algorithms/winnowing.d.ts +27 -0
- package/clones/algorithms/winnowing.js +66 -0
- package/clones/clone-ast.d.ts +75 -0
- package/clones/clone-ast.js +174 -0
- package/clones/clone-dataflow.d.ts +11 -0
- package/clones/clone-dataflow.js +83 -0
- package/clones/clone-detector.d.ts +116 -0
- package/clones/clone-detector.js +200 -0
- package/clones/clone-index.d.ts +54 -0
- package/clones/clone-index.js +56 -0
- package/config.d.ts +21 -2
- package/config.js +7 -1
- package/control-flow/basic-cfg-guided-visitor.js +1 -2
- package/control-flow/happens-before.d.ts +2 -0
- package/control-flow/happens-before.js +15 -9
- package/control-flow/simple-visitor.js +2 -4
- package/core/steps/all/core/00-parse.js +2 -1
- package/core/steps/all/core/01-parse-tree-sitter.js +2 -1
- package/core/steps/all/core/10-normalize.js +2 -1
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -1
- package/core/steps/all/static-slicing/00-slice.js +2 -1
- package/core/steps/all/static-slicing/10-reconstruct.js +2 -1
- package/core/steps/pipeline/create-pipeline.js +1 -2
- package/core/steps/pipeline/default-pipelines.d.ts +1 -1
- package/core/steps/pipeline/default-pipelines.js +5 -4
- package/core/steps/pipeline-step.d.ts +3 -1
- package/core/steps/pipeline-step.js +5 -0
- package/data/r-base-primitives.generated.d.ts +2 -1
- package/dataflow/cluster.js +1 -2
- package/dataflow/environments/ambient-state-name.d.ts +14 -22
- package/dataflow/environments/ambient-state-name.js +4 -18
- package/dataflow/environments/apply-kill.d.ts +9 -20
- package/dataflow/environments/apply-kill.js +51 -25
- package/dataflow/environments/built-in-config.d.ts +7 -15
- package/dataflow/environments/built-in-config.js +15 -16
- package/dataflow/environments/built-in-eval-name.d.ts +5 -6
- package/dataflow/environments/built-in-eval-name.js +4 -5
- package/dataflow/environments/built-in-kinds.d.ts +111 -0
- package/dataflow/environments/built-in-kinds.js +35 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +11 -0
- package/dataflow/environments/built-in-props.d.ts +62 -175
- package/dataflow/environments/built-in-props.js +42 -154
- package/dataflow/environments/built-in.d.ts +37 -73
- package/dataflow/environments/built-in.js +41 -62
- package/dataflow/environments/data-masking-functions.d.ts +2 -2
- package/dataflow/environments/default-builtin-config/base-functions.d.ts +7 -0
- package/dataflow/environments/default-builtin-config/base-functions.js +339 -0
- package/dataflow/environments/default-builtin-config/base-language.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/base-language.js +66 -0
- package/dataflow/environments/default-builtin-config/base-operators.d.ts +58 -0
- package/dataflow/environments/default-builtin-config/base-operators.js +169 -0
- package/dataflow/environments/default-builtin-config/database-access.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/database-access.js +16 -0
- package/dataflow/environments/default-builtin-config/define-helpers.d.ts +45 -0
- package/dataflow/environments/default-builtin-config/define-helpers.js +50 -0
- package/dataflow/environments/default-builtin-config/dev-tooling.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/dev-tooling.js +63 -0
- package/dataflow/environments/default-builtin-config/file-io.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/file-io.js +81 -0
- package/dataflow/environments/default-builtin-config/graphics-devices.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/graphics-devices.js +57 -0
- package/dataflow/environments/default-builtin-config/index.d.ts +18 -0
- package/dataflow/environments/default-builtin-config/index.js +114 -0
- package/dataflow/environments/default-builtin-config/media-formats.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/media-formats.js +41 -0
- package/dataflow/environments/default-builtin-config/misc-packages.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/misc-packages.js +18 -0
- package/dataflow/environments/default-builtin-config/network-access.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/network-access.js +47 -0
- package/dataflow/environments/default-builtin-config/object-systems.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/object-systems.js +39 -0
- package/dataflow/environments/default-builtin-config/package-data-table.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/package-data-table.js +18 -0
- package/dataflow/environments/default-builtin-config/package-spatial.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/package-spatial.js +32 -0
- package/dataflow/environments/default-builtin-config/package-tidyverse.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/package-tidyverse.js +96 -0
- package/dataflow/environments/default-builtin-config/package-utils.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/package-utils.js +35 -0
- package/dataflow/environments/default-builtin-config/package-withr.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/package-withr.js +41 -0
- package/dataflow/environments/default-builtin-config/parallel-execution.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/parallel-execution.js +31 -0
- package/dataflow/environments/default-builtin-config/session-interactive.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/session-interactive.js +31 -0
- package/dataflow/environments/default-builtin-config/shared-configs.d.ts +267 -0
- package/dataflow/environments/default-builtin-config/shared-configs.js +483 -0
- package/dataflow/environments/default-builtin-config/shared-signatures.d.ts +21 -0
- package/dataflow/environments/default-builtin-config/shared-signatures.js +32 -0
- package/dataflow/environments/default-builtin-config/statistics.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/statistics.js +32 -0
- package/dataflow/environments/default-builtin-config/unit-testing.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/unit-testing.js +13 -0
- package/dataflow/environments/environment.d.ts +28 -52
- package/dataflow/environments/environment.js +24 -71
- package/dataflow/environments/group-generics.d.ts +12 -19
- package/dataflow/environments/group-generics.js +17 -14
- package/dataflow/environments/identifier.d.ts +72 -427
- package/dataflow/environments/identifier.js +34 -145
- package/dataflow/environments/pkg-name.d.ts +197 -0
- package/dataflow/environments/pkg-name.js +3 -0
- package/dataflow/environments/query-fn-props.d.ts +27 -76
- package/dataflow/environments/query-fn-props.js +34 -95
- package/dataflow/environments/resolve-by-name.d.ts +6 -16
- package/dataflow/environments/resolve-by-name.js +23 -35
- package/dataflow/environments/scoping.d.ts +5 -5
- package/dataflow/environments/scoping.js +13 -5
- package/dataflow/eval/resolve/alias-tracking.d.ts +31 -68
- package/dataflow/eval/resolve/alias-tracking.js +611 -126
- package/dataflow/eval/resolve/match-arguments.d.ts +5 -3
- package/dataflow/eval/resolve/resolve-argument.d.ts +11 -11
- package/dataflow/eval/resolve/resolve-argument.js +25 -30
- package/dataflow/eval/resolve/resolve-field.d.ts +10 -0
- package/dataflow/eval/resolve/resolve-field.js +127 -0
- package/dataflow/eval/resolve/resolve-replacement.d.ts +10 -0
- package/dataflow/eval/resolve/resolve-replacement.js +80 -0
- package/dataflow/eval/resolve/resolve-strings.d.ts +2 -2
- package/dataflow/eval/resolve/resolve.d.ts +13 -10
- package/dataflow/eval/resolve/resolve.js +81 -32
- package/dataflow/eval/values/general.d.ts +6 -24
- package/dataflow/eval/values/general.js +12 -29
- package/dataflow/eval/values/lists/list-constants.d.ts +11 -0
- package/dataflow/eval/values/lists/list-constants.js +65 -0
- package/dataflow/eval/values/r-value.d.ts +20 -23
- package/dataflow/eval/values/r-value.js +22 -17
- package/dataflow/extractor.d.ts +2 -10
- package/dataflow/extractor.js +100 -46
- package/dataflow/fn/argument-roles.d.ts +2 -4
- package/dataflow/fn/argument-roles.js +49 -23
- package/dataflow/fn/class-declaration.d.ts +36 -52
- package/dataflow/fn/class-declaration.js +22 -56
- package/dataflow/fn/condition-handlers.d.ts +2 -1
- package/dataflow/fn/dispatch.d.ts +70 -0
- package/dataflow/fn/dispatch.js +434 -0
- package/dataflow/fn/exceptions-of-function.d.ts +1 -2
- package/dataflow/fn/exceptions-of-function.js +36 -106
- package/dataflow/fn/frame-reflection.d.ts +1 -3
- package/dataflow/fn/frame-reflection.js +8 -16
- package/dataflow/fn/function-props.d.ts +2 -5
- package/dataflow/fn/function-props.js +27 -36
- package/dataflow/fn/function-semantics.d.ts +14 -26
- package/dataflow/fn/function-semantics.js +4 -18
- package/dataflow/fn/higher-order-function.js +2 -4
- package/dataflow/fn/strict-function.d.ts +10 -35
- package/dataflow/fn/strict-function.js +126 -138
- package/dataflow/graph/ambient-access.d.ts +51 -0
- package/dataflow/graph/ambient-access.js +80 -0
- package/dataflow/graph/call-graph.d.ts +9 -29
- package/dataflow/graph/call-graph.js +17 -41
- package/dataflow/graph/closure-frames.d.ts +46 -0
- package/dataflow/graph/closure-frames.js +225 -0
- package/dataflow/graph/dataflowgraph-builder.d.ts +25 -96
- package/dataflow/graph/dataflowgraph-builder.js +29 -97
- package/dataflow/graph/df-helper.d.ts +48 -188
- package/dataflow/graph/df-helper.js +107 -208
- package/dataflow/graph/diff-dataflow-graph.d.ts +5 -15
- package/dataflow/graph/diff-dataflow-graph.js +25 -25
- package/dataflow/graph/edge.js +1 -1
- package/dataflow/graph/graph-helper.d.ts +10 -46
- package/dataflow/graph/graph-helper.js +16 -50
- package/dataflow/graph/graph.d.ts +44 -97
- package/dataflow/graph/graph.js +83 -79
- package/dataflow/graph/match-args.d.ts +21 -88
- package/dataflow/graph/match-args.js +284 -97
- package/dataflow/graph/vertex.d.ts +101 -128
- package/dataflow/graph/vertex.js +23 -20
- package/dataflow/hooks.d.ts +7 -14
- package/dataflow/hooks.js +15 -13
- package/dataflow/info.d.ts +2 -17
- package/dataflow/internal/dispatch-linking.d.ts +71 -0
- package/dataflow/internal/dispatch-linking.js +332 -0
- package/dataflow/internal/linker.d.ts +48 -50
- package/dataflow/internal/linker.js +457 -155
- package/dataflow/internal/process/functions/call/argument/make-argument.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +2 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +16 -46
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +10 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +23 -75
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +263 -97
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +10 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +66 -45
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +15 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +82 -62
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.d.ts +15 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.js +416 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +37 -54
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +192 -111
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +60 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +80 -76
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +1 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +4 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +436 -140
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +18 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +90 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +5 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +9 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +12 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +3 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +9 -24
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +10 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +8 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +20 -28
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +17 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +117 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +5 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +8 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +18 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +7 -25
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +31 -35
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +4 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +13 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +18 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +130 -65
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +38 -30
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +584 -114
- package/dataflow/internal/process/functions/call/common.d.ts +8 -24
- package/dataflow/internal/process/functions/call/common.js +24 -24
- package/dataflow/internal/process/functions/call/deferred.d.ts +7 -27
- package/dataflow/internal/process/functions/call/deferred.js +6 -27
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +6 -26
- package/dataflow/internal/process/functions/call/known-call-handling.js +6 -16
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -4
- package/dataflow/internal/process/functions/call/named-call-handling.js +14 -35
- package/dataflow/internal/process/functions/call/nse.d.ts +2 -9
- package/dataflow/internal/process/functions/call/nse.js +6 -13
- package/dataflow/internal/process/functions/call/quoted.d.ts +4 -15
- package/dataflow/internal/process/functions/call/quoted.js +26 -62
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +3 -6
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +29 -11
- package/dataflow/internal/process/functions/process-parameter.js +1 -1
- package/dataflow/internal/program-order.d.ts +3 -10
- package/dataflow/internal/program-order.js +19 -10
- package/dataflow/origin/dfg-get-origin.js +2 -1
- package/documentation/data/faq/faqs.js +16 -1
- package/documentation/data/interface/doc-writing-code.js +5 -7
- package/documentation/doc-capabilities.js +3 -3
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-code.d.ts +0 -5
- package/documentation/doc-util/doc-code.js +2 -22
- package/documentation/doc-util/doc-query.d.ts +1 -2
- package/documentation/doc-util/doc-query.js +4 -5
- package/documentation/doc-util/doc-search.js +1 -1
- package/documentation/wiki-analyzer.js +4 -3
- package/documentation/wiki-core.js +5 -5
- package/documentation/wiki-dataflow-graph.js +6 -0
- package/documentation/wiki-interface.js +2 -1
- package/documentation/wiki-linter.js +15 -3
- package/documentation/wiki-linting-and-testing.js +15 -2
- package/documentation/wiki-query.js +111 -29
- package/index.d.ts +3 -1
- package/index.js +6 -3
- package/linter/linter-executor.js +1 -1
- package/linter/linter-rules.d.ts +37 -8
- package/linter/linter-rules.js +8 -1
- package/linter/linter-util.d.ts +3 -3
- package/linter/linter-util.js +1 -1
- package/linter/rules/cmd-check/bogus-return.d.ts +2 -1
- package/linter/rules/cmd-check/call-arguments.d.ts +3 -2
- package/linter/rules/cmd-check/call-arguments.js +5 -5
- package/linter/rules/cmd-check/cmd-check-util.d.ts +9 -8
- package/linter/rules/cmd-check/dependency-declaration.d.ts +2 -1
- package/linter/rules/cmd-check/dependency-declaration.js +1 -1
- package/linter/rules/cmd-check/documentation-mismatch.d.ts +3 -2
- package/linter/rules/cmd-check/documentation-mismatch.js +2 -1
- package/linter/rules/cmd-check/file-checks.d.ts +2 -2
- package/linter/rules/cmd-check/foreign-function-calls.d.ts +2 -1
- package/linter/rules/cmd-check/global-environment-modification.d.ts +6 -5
- package/linter/rules/cmd-check/namespace-tampering.d.ts +2 -1
- package/linter/rules/cmd-check/non-ascii-code.js +1 -1
- package/linter/rules/cmd-check/package-files.d.ts +2 -2
- package/linter/rules/cmd-check/package-hooks.d.ts +5 -4
- package/linter/rules/cmd-check/package-runtime.js +2 -2
- package/linter/rules/cmd-check/rd-files.js +2 -1
- package/linter/rules/cmd-check/s-three-method-consistency.d.ts +3 -2
- package/linter/rules/cmd-check/s-three-method-consistency.js +2 -1
- package/linter/rules/code-clones.d.ts +57 -0
- package/linter/rules/code-clones.js +53 -0
- package/linter/rules/deprecated-functions.js +3 -6
- package/linter/rules/file-path-validity.js +6 -4
- package/linter/rules/function-finder-util.d.ts +4 -2
- package/linter/rules/naming-convention.d.ts +6 -5
- package/linter/rules/naming-convention.js +2 -3
- package/linter/rules/no-leaked-credentials.d.ts +2 -1
- package/linter/rules/no-leaked-credentials.js +1 -1
- package/linter/rules/overwritten-file.d.ts +2 -1
- package/linter/rules/problematic-inputs.d.ts +2 -1
- package/linter/rules/problematic-inputs.js +3 -3
- package/linter/rules/process-state-in-session.d.ts +7 -6
- package/linter/rules/process-state-in-session.js +1 -1
- package/linter/rules/roxygen-arguments.d.ts +1 -1
- package/linter/rules/secret-exfiltration.js +1 -1
- package/linter/rules/seeded-randomness.d.ts +3 -3
- package/linter/rules/unclosed-connection.js +1 -2
- package/linter/rules/undefined-symbol-util.d.ts +3 -2
- package/linter/rules/undefined-symbol.d.ts +3 -2
- package/linter/rules/unescaped-arguments.d.ts +1 -1
- package/linter/rules/unescaped-arguments.js +6 -8
- package/linter/rules/unused-definition.d.ts +4 -3
- package/linter/rules/unused-definition.js +10 -12
- package/linter/rules/unused-import.d.ts +6 -5
- package/package.json +1 -1
- package/project/attached-packages.d.ts +5 -4
- package/project/cache/flowr-analyzer-cache.d.ts +14 -1
- package/project/cache/flowr-analyzer-cache.js +40 -3
- package/project/context/flowr-analyzer-dependencies-context.d.ts +12 -12
- package/project/context/flowr-analyzer-environment-context.d.ts +3 -3
- package/project/context/flowr-analyzer-environment-context.js +3 -3
- package/project/context/flowr-analyzer-functions-context.d.ts +9 -7
- package/project/context/flowr-analyzer-gas-context.d.ts +25 -0
- package/project/context/flowr-analyzer-gas-context.js +34 -4
- package/project/dependency-version-space.d.ts +30 -29
- package/project/dependency-version-space.js +1 -2
- package/project/flowr-analyzer-builder.d.ts +2 -3
- package/project/flowr-analyzer.d.ts +35 -3
- package/project/flowr-analyzer.js +11 -5
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +15 -14
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-on-demand-plugin.d.ts +5 -4
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-on-demand-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +2 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +2 -1
- package/project/plugins/package-version-plugins/package.d.ts +6 -5
- package/project/sigdb/build.js +1 -1
- package/project/sigdb/decode.d.ts +8 -7
- package/project/sigdb/decode.js +1 -2
- package/project/sigdb/dict.d.ts +2 -1
- package/project/sigdb/dict.js +2 -2
- package/project/sigdb/index-format.d.ts +2 -1
- package/project/sigdb/manifest.d.ts +1 -1
- package/project/sigdb/memory-source.d.ts +18 -17
- package/project/sigdb/on-demand/package-sources.d.ts +4 -3
- package/project/sigdb/on-demand/recoverer.d.ts +2 -1
- package/project/sigdb/on-demand/remote-sources.d.ts +2 -1
- package/project/sigdb/reader.d.ts +85 -80
- package/project/sigdb/reader.js +0 -4
- package/project/sigdb/schema.d.ts +9 -8
- package/project/sigdb/signature-db.d.ts +6 -6
- package/queries/catalog/ambient-access-query/ambient-access-query-executor.d.ts +6 -0
- package/queries/catalog/ambient-access-query/ambient-access-query-executor.js +50 -0
- package/queries/catalog/ambient-access-query/ambient-access-query-format.d.ts +54 -0
- package/queries/catalog/ambient-access-query/ambient-access-query-format.js +45 -0
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +2 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +2 -2
- package/queries/catalog/call-graph-query/expand-library-internals.d.ts +3 -2
- package/queries/catalog/code-clones-query/code-clones-query-executor.d.ts +6 -0
- package/queries/catalog/code-clones-query/code-clones-query-executor.js +38 -0
- package/queries/catalog/code-clones-query/code-clones-query-format.d.ts +54 -0
- package/queries/catalog/code-clones-query/code-clones-query-format.js +73 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +3 -3
- package/queries/catalog/dependencies-query/data-flow.d.ts +5 -4
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +5 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +5 -5
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -4
- package/queries/catalog/dependencies-query/implicit-echo.js +2 -1
- package/queries/catalog/dice-query/dice-query-format.d.ts +1 -0
- package/queries/catalog/dice-query/dice-query-format.js +1 -0
- package/queries/catalog/does-call-query/does-call-query-executor.js +1 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -0
- package/queries/catalog/does-call-query/does-call-query-format.js +1 -0
- package/queries/catalog/function-info-query/function-info-query-format.d.ts +2 -1
- package/queries/catalog/function-info-query/function-origin.d.ts +3 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +3 -3
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +5 -4
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +7 -3
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +9 -9
- package/queries/catalog/input-sources-query/simple-input-classifier.js +1 -1
- package/queries/catalog/linter-query/linter-query-executor.js +4 -1
- package/queries/catalog/linter-query/linter-query-format.js +3 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -0
- package/queries/catalog/origin-query/origin-query-format.js +1 -0
- package/queries/catalog/project-query/project-query-format.d.ts +2 -1
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +1 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
- package/queries/catalog/signature-query/signature-query-executor.d.ts +9 -6
- package/queries/catalog/signature-query/signature-query-executor.js +14 -15
- package/queries/catalog/signature-query/signature-query-format.d.ts +21 -20
- package/queries/catalog/signature-query/signature-query-render.js +1 -1
- 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 +9 -5
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
- package/queries/query-function-filter.d.ts +1 -1
- package/queries/query.d.ts +59 -8
- package/queries/query.js +59 -37
- package/r-bridge/data/data.d.ts +39 -28
- package/r-bridge/data/data.js +37 -28
- package/r-bridge/lang-4.x/ast/model/model.d.ts +10 -1
- package/r-bridge/lang-4.x/ast/model/model.js +30 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +21 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +25 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +2 -2
- 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 +4 -3
- 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 +5 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +2 -7
- 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 +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +2 -2
- 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/decorate.js +4 -5
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +7 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +14 -6
- package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +2 -2
- package/r-bridge/lang-4.x/ast/model/type.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/type.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +3 -2
- package/r-bridge/parser.d.ts +8 -2
- package/r-bridge/parser.js +6 -0
- package/r-bridge/shell-executor.d.ts +2 -2
- package/r-bridge/shell-executor.js +3 -2
- package/r-bridge/shell.d.ts +2 -2
- package/r-bridge/shell.js +3 -2
- package/reconstruct/auto-select/magic-comments.js +1 -1
- package/reconstruct/reconstruct.d.ts +0 -5
- package/reconstruct/reconstruct.js +6 -5
- package/search/flowr-search-builder.d.ts +14 -0
- package/search/flowr-search-builder.js +7 -0
- package/search/flowr-search-executor.js +2 -2
- package/search/flowr-search-filters.js +8 -9
- package/search/flowr-search.js +1 -1
- package/search/search-executor/search-enrichers.d.ts +2 -0
- package/search/search-executor/search-enrichers.js +6 -1
- package/search/search-executor/search-generators.d.ts +2 -2
- package/search/search-executor/search-generators.js +13 -8
- package/search/search-executor/search-mappers.js +1 -1
- package/search/search-executor/search-transformer.d.ts +2 -2
- package/search/search-executor/search-transformer.js +6 -6
- package/slicing/criterion/parse.d.ts +2 -1
- package/slicing/criterion/parse.js +2 -1
- package/slicing/static/removal-slice.js +2 -1
- package/slicing/static/slice-call.d.ts +30 -4
- package/slicing/static/slice-call.js +74 -9
- package/slicing/static/slicer-types.d.ts +2 -1
- package/slicing/static/static-slicer.js +66 -11
- package/slicing/static/visiting-queue.d.ts +2 -0
- package/slicing/static/visiting-queue.js +4 -0
- package/taint-analysis/builder/report-template.d.ts +3 -3
- package/util/arg-matching.d.ts +1 -1
- package/util/collections/relation.d.ts +23 -0
- package/util/collections/relation.js +63 -0
- package/util/fixpoint.d.ts +65 -0
- package/util/fixpoint.js +216 -0
- package/util/flowr-version.d.ts +1 -1
- package/util/flowr-version.js +2 -2
- package/util/json.d.ts +4 -0
- package/util/json.js +12 -3
- package/util/mermaid/cfg.js +1 -2
- package/util/mermaid/dfg.d.ts +1 -1
- package/util/mermaid/dfg.js +1 -1
- package/util/mermaid/mermaid.d.ts +2 -1
- package/util/monoid.d.ts +26 -0
- package/util/monoid.js +31 -0
- package/util/prefix.d.ts +1 -1
- package/util/r-base-packages.d.ts +10 -7
- package/util/r-base-packages.js +11 -6
- package/util/r-package-urls.d.ts +10 -9
- package/util/r-value.js +2 -1
- package/util/r-version-order.d.ts +2 -0
- package/util/r-version-order.js +19 -0
- package/util/r-version.d.ts +2 -1
- package/util/r-version.js +2 -14
- package/util/range.d.ts +38 -29
- package/util/range.js +10 -5
- package/util/simple-df/dfg-ascii.js +2 -2
- package/util/text/ansi.d.ts +13 -9
- package/util/text/ansi.js +4 -6
- package/util/text/strings.d.ts +10 -3
- package/util/text/strings.js +10 -1
- package/util/version.d.ts +1 -1
- package/util/version.js +2 -1
- package/dataflow/environments/default-builtin-config.d.ts +0 -8874
- package/dataflow/environments/default-builtin-config.js +0 -1737
- package/r-bridge/lang-4.x/ast/model/operators.d.ts +0 -33
- package/r-bridge/lang-4.x/ast/model/operators.js +0 -54
- package/taint-analysis/eval/eval.d.ts +0 -1
- package/taint-analysis/eval/eval.js +0 -124
- package/taint-analysis/eval/instrumentation.d.ts +0 -59
- package/taint-analysis/eval/instrumentation.js +0 -124
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DispatchNarrower = exports.MaxContextDepth = void 0;
|
|
4
|
+
exports.ruledOutPerCall = ruledOutPerCall;
|
|
5
|
+
exports.callsNextMethod = callsNextMethod;
|
|
6
|
+
exports.runsOnlyAfter = runsOnlyAfter;
|
|
7
|
+
exports.linkedFunctionIds = linkedFunctionIds;
|
|
8
|
+
exports.internalGenericMethods = internalGenericMethods;
|
|
9
|
+
exports.methodOnlyEdges = methodOnlyEdges;
|
|
10
|
+
exports.unlinkExcludedMethods = unlinkExcludedMethods;
|
|
11
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
12
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
13
|
+
const r_symbol_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
14
|
+
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
15
|
+
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
16
|
+
const edge_1 = require("../graph/edge");
|
|
17
|
+
const vertex_1 = require("../graph/vertex");
|
|
18
|
+
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
19
|
+
const program_order_1 = require("./program-order");
|
|
20
|
+
const assert_1 = require("../../util/assert");
|
|
21
|
+
const arrays_1 = require("../../util/collections/arrays");
|
|
22
|
+
const arg_matching_1 = require("../../util/arg-matching");
|
|
23
|
+
const df_helper_1 = require("../graph/df-helper");
|
|
24
|
+
const built_in_proc_name_1 = require("../environments/built-in-proc-name");
|
|
25
|
+
const function_semantics_1 = require("../fn/function-semantics");
|
|
26
|
+
const dispatch_1 = require("../fn/dispatch");
|
|
27
|
+
const linker_1 = require("./linker");
|
|
28
|
+
const identifier_1 = require("../environments/identifier");
|
|
29
|
+
const resolve_helper_1 = require("../environments/resolve-helper");
|
|
30
|
+
/** how many contexts of calls a dispatch is decided for on its own, beyond that all of them share one decision */
|
|
31
|
+
const MaxDispatchContexts = 64;
|
|
32
|
+
/** how many calls deep the contexts of a dispatch go, the call of the function holding it the first */
|
|
33
|
+
exports.MaxContextDepth = 3;
|
|
34
|
+
/** What `excludedOf` rules out per context of `contexts` beyond what the contexts around it rule out (`above`), the contexts that rule out nothing more left out. */
|
|
35
|
+
function ruledOutPerCall(contexts, excludedOf, above = new Set()) {
|
|
36
|
+
const ruledOut = [];
|
|
37
|
+
for (const { call, narrowed, within } of contexts) {
|
|
38
|
+
const methods = excludedOf(narrowed).filter(m => !above.has(m));
|
|
39
|
+
const deeper = within === undefined ? undefined : ruledOutPerCall(within, excludedOf, new Set([...above, ...methods]));
|
|
40
|
+
if (deeper !== undefined) {
|
|
41
|
+
ruledOut.push({ call, methods, within: deeper });
|
|
42
|
+
}
|
|
43
|
+
else if (methods.length > 0) {
|
|
44
|
+
ruledOut.push({ call, methods });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return ruledOut.length > 0 ? ruledOut : undefined;
|
|
48
|
+
}
|
|
49
|
+
/** What the narrowing of the calls of one linking pass shares: the S4 methods of the program and its class hierarchy, found once. */
|
|
50
|
+
class DispatchNarrower {
|
|
51
|
+
info;
|
|
52
|
+
graph;
|
|
53
|
+
s4State;
|
|
54
|
+
registers;
|
|
55
|
+
constructor(graph, ctx) {
|
|
56
|
+
this.graph = graph;
|
|
57
|
+
this.info = { graph, idMap: graph.idMap, ctx };
|
|
58
|
+
}
|
|
59
|
+
s4Info() {
|
|
60
|
+
if (this.s4State === undefined) {
|
|
61
|
+
const methods = (0, dispatch_1.s4MethodsOf)(this.graph, ids => linkedFunctionIds(ids, this.graph));
|
|
62
|
+
const byFunction = new Map();
|
|
63
|
+
for (const method of methods.values().flatMap(m => m)) {
|
|
64
|
+
for (const fn of method.functions) {
|
|
65
|
+
byFunction.set(fn, [...byFunction.get(fn) ?? [], method]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
this.s4State = { methods, byFunction, hierarchy: (0, dispatch_1.s4HierarchyOf)(this.graph) };
|
|
69
|
+
}
|
|
70
|
+
return this.s4State;
|
|
71
|
+
}
|
|
72
|
+
/** Whether one of `targets` is a method the program registers with `setMethod`, so that the call dispatches on S4 classes. */
|
|
73
|
+
reachesS4Method(targets) {
|
|
74
|
+
this.registers ??= this.graph.verticesOfType(vertex_1.VertexType.FunctionCall).some(([, v]) => v.s4Method !== undefined);
|
|
75
|
+
if (!this.registers) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const { byFunction } = this.s4Info();
|
|
79
|
+
return Iterator.from(targets).some(target => byFunction.has(target));
|
|
80
|
+
}
|
|
81
|
+
/** The methods among `targets` the S4 dispatch of `call` (a call of `name`) cannot run for the classes of its arguments, and the methods `callNextMethod()` in each method may run, `undefined` if nothing can be narrowed. */
|
|
82
|
+
s4(call, name, targets, registeredLater, info = this.info) {
|
|
83
|
+
const { methods, byFunction, hierarchy } = this.s4Info();
|
|
84
|
+
const created = call.instantiates;
|
|
85
|
+
const generics = created === undefined ? undefined : new Set([...targets].flatMap(t => byFunction.get(t) ?? []).map(m => m.generic));
|
|
86
|
+
const generic = generics === undefined ? name : generics.size === 1 ? [...generics][0] : undefined;
|
|
87
|
+
/* only the methods registered where the call runs compete, one registered after a call at the top level does not */
|
|
88
|
+
const all = generic === undefined ? undefined : (0, dispatch_1.s4CandidatesFor)(generic, methods);
|
|
89
|
+
const candidates = all?.filter(m => !registeredLater(m.registration) && m.functions.some(f => targets.has(f)));
|
|
90
|
+
if (all === undefined || candidates === undefined) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
const formals = created === undefined ? this.s4Formals(targets, candidates) : firstFormalOf(candidates, this.info.idMap);
|
|
94
|
+
/* a signature naming a formal the generic does not dispatch on is not understood, so nothing is ruled out */
|
|
95
|
+
if (formals === undefined || formals.length === 0 || candidates.some(m => (0, dispatch_1.signatureFor)(m, formals) === undefined)) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
/* a method set again for its signature before the call is gone */
|
|
99
|
+
const live = candidates.filter(m => !this.replacedBefore(m, candidates, formals, call.id));
|
|
100
|
+
/* what is no method, like the function a generic was made from, is the default a next method may fall back to */
|
|
101
|
+
const others = this.otherFunctions(targets, t => byFunction.has(t));
|
|
102
|
+
const next = new Map();
|
|
103
|
+
for (const method of live) {
|
|
104
|
+
const reached = [...(0, dispatch_1.nextS4Methods)(method, live, formals, hierarchy).flatMap(m => m.functions), ...others];
|
|
105
|
+
for (const fn of method.functions) {
|
|
106
|
+
next.set(fn, [...next.get(fn) ?? [], ...reached]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const reads = [];
|
|
110
|
+
const s3Class = (vector) => {
|
|
111
|
+
const registration = this.oldClassRegistration(vector[0], all);
|
|
112
|
+
if (registration !== undefined) {
|
|
113
|
+
reads.push(registration);
|
|
114
|
+
}
|
|
115
|
+
return registration === undefined ? undefined : vector[0];
|
|
116
|
+
};
|
|
117
|
+
const bound = created === undefined ? boundArguments(call, formals, this.info.idMap) : undefined;
|
|
118
|
+
const tuples = created !== undefined ? (created.length === 1 ? [[created[0]]] : undefined) : bound === undefined ? undefined : (0, dispatch_1.s4ActualClasses)(bound, info, s3Class);
|
|
119
|
+
if (tuples === undefined) {
|
|
120
|
+
return { excluded: new Set(), next };
|
|
121
|
+
}
|
|
122
|
+
const selected = new Set(tuples.flatMap(actual => (0, dispatch_1.selectS4Methods)(live, formals, actual, hierarchy)).flatMap(m => m.functions));
|
|
123
|
+
/* a method handing on with `callNextMethod()` runs the next one as well */
|
|
124
|
+
for (const fn of selected) {
|
|
125
|
+
if (callsNextMethod(fn, this.graph)) {
|
|
126
|
+
next.get(fn)?.forEach(n => selected.add(n));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return { excluded: new Set(all.flatMap(m => m.functions).filter(fn => !selected.has(fn) && targets.has(fn))), next, reads: (0, arrays_1.uniqueArray)(reads) };
|
|
130
|
+
}
|
|
131
|
+
/** Whether `setMethod` surely sets another of `candidates` for the signature of `method` after it and before every run of `call`, which replaces `method` for good: R keeps one method per signature. */
|
|
132
|
+
replacedBefore(method, candidates, formals, call) {
|
|
133
|
+
const own = (0, dispatch_1.signatureFor)(method, formals)?.join(',');
|
|
134
|
+
const at = program_order_1.ProgramOrder.runsOnceAt(method.registration, this.graph);
|
|
135
|
+
return at !== undefined && candidates.some(other => {
|
|
136
|
+
const otherAt = other === method || (0, dispatch_1.signatureFor)(other, formals)?.join(',') !== own || (this.graph.getVertex(other.registration)?.cds ?? []).length > 0
|
|
137
|
+
? undefined : program_order_1.ProgramOrder.runsOnceAt(other.registration, this.graph);
|
|
138
|
+
return otherAt !== undefined && program_order_1.ProgramOrder.offset(other.registration, at, this.graph) > 0 && runsOnlyAfter(call, otherAt, this.graph);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/** The formals of the generic among `targets` that `candidates` are methods of, which S4 dispatches on. */
|
|
142
|
+
s4Formals(targets, candidates) {
|
|
143
|
+
const { byFunction } = this.s4Info();
|
|
144
|
+
const generics = [...targets].filter(t => !byFunction.has(t) && vertex_1.DfgVertex.isFunctionDefinition(this.graph.getVertex(t)) && this.graph.getVertex(t).mode?.includes(vertex_1.FunctionDispatch.S4));
|
|
145
|
+
return generics.length <= 1 ? (0, dispatch_1.s4DispatchFormals)(generics[0], candidates, this.info.idMap) : undefined;
|
|
146
|
+
}
|
|
147
|
+
/** The `setOldClass` call registering the S3 class `cls` if S4 dispatch surely sees it: the only registration of `cls`, run once before any of `methods` is set. */
|
|
148
|
+
oldClassRegistration(cls, methods) {
|
|
149
|
+
const registrations = cls === undefined ? undefined : this.s4Info().hierarchy.oldClasses?.get(cls);
|
|
150
|
+
const registration = registrations?.length === 1 ? registrations[0] : undefined;
|
|
151
|
+
const at = registration === undefined ? undefined : program_order_1.ProgramOrder.runsOnceAt(registration, this.graph);
|
|
152
|
+
if (registration === undefined || at === undefined || (this.graph.getVertex(registration)?.cds ?? []).length > 0) {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
return methods.every(m => program_order_1.ProgramOrder.offset(m.registration, at, this.graph) > 0) ? registration : undefined;
|
|
156
|
+
}
|
|
157
|
+
/** The `<prefix>.<class>` methods among `targets` an S3 dispatch on the objects `objects` cannot run, and what `NextMethod()` in each method it runs may run, `undefined` if the class of an object is not known. */
|
|
158
|
+
s3(objects, prefixes, targets, info = this.info) {
|
|
159
|
+
const perObject = objects.map(o => (0, dispatch_1.s3DispatchClassesOf)(o, info));
|
|
160
|
+
if (perObject.length === 0 || !perObject.every(assert_1.isNotUndefined)) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
const methodOf = (fn) => s3ClassOfMethod(fn, prefixes, this.graph);
|
|
164
|
+
const methods = [...targets].filter(t => methodOf(t) !== undefined);
|
|
165
|
+
const { runs, next } = (0, dispatch_1.s3Dispatch)(perObject.flat(), methods, methodOf);
|
|
166
|
+
const others = this.otherFunctions(targets, t => methodOf(t) !== undefined);
|
|
167
|
+
return { excluded: new Set(methods.filter(m => !runs.has(m))), next: new Map(next.entries().map(([m, after]) => [m, [...after, ...others]])) };
|
|
168
|
+
}
|
|
169
|
+
/** Per call of the function holding the dispatch `call`, how `decide` narrows the dispatch for the classes the context of that call gives, and where that leaves more than one of `targets` beyond what `shared` rules out for every call, per call of the function holding that call in turn, up to a few calls deep. */
|
|
170
|
+
perCall(call, targets, shared, decide) {
|
|
171
|
+
const methods = [...targets].filter(t => vertex_1.DfgVertex.isFunctionDefinition(this.graph.getVertex(t)) && !shared?.excluded.has(t));
|
|
172
|
+
return methods.length < 2 ? undefined : this.contextsOf(call, new Map(), methods, decide, { left: MaxDispatchContexts });
|
|
173
|
+
}
|
|
174
|
+
contextsOf(inner, context, methods, decide, budget) {
|
|
175
|
+
const fn = this.graph.isRoot(inner) ? undefined : model_1.RNode.strictlyEnclosingFunction(inner, this.info.idMap);
|
|
176
|
+
const callers = fn === undefined || context.has(fn) || context.size >= exports.MaxContextDepth ? [] : df_helper_1.Dataflow.sourcesOf(this.graph, fn, edge_1.EdgeType.Calls);
|
|
177
|
+
if (fn === undefined || callers.length === 0 || callers.length > budget.left || !calledByNameOnly(fn, callers, this.graph)) {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
budget.left -= callers.length;
|
|
181
|
+
return callers.map(caller => {
|
|
182
|
+
const at = new Map(context).set(fn, caller);
|
|
183
|
+
const narrowed = decide({ ...this.info, callContext: at });
|
|
184
|
+
const open = methods.filter(m => !narrowed?.excluded.has(m)).length;
|
|
185
|
+
return { call: caller, narrowed, within: open > 1 ? this.contextsOf(caller, at, methods, decide, budget) : undefined };
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/** The function definitions among `targets` that are no method by `isMethod`. */
|
|
189
|
+
otherFunctions(targets, isMethod) {
|
|
190
|
+
return [...targets].filter(t => !isMethod(t) && vertex_1.DfgVertex.isFunctionDefinition(this.graph.getVertex(t)));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.DispatchNarrower = DispatchNarrower;
|
|
194
|
+
/** Whether the function `fn` hands on to the next method, with `NextMethod()` or `callNextMethod()`. */
|
|
195
|
+
function callsNextMethod(fn, graph) {
|
|
196
|
+
const vertex = graph.getVertex(fn);
|
|
197
|
+
return vertex_1.DfgVertex.isFunctionDefinition(vertex) && df_helper_1.Dataflow.callsIn(vertex, graph).some(([, c]) => vertex_1.DfgVertex.hasOrigin(c, built_in_proc_name_1.BuiltInProcName.S3DispatchNext));
|
|
198
|
+
}
|
|
199
|
+
/** Whether the function `fn` is bound to names (through assignments, `f <- g <- function...` as well) that only `callers` read, so that they are all the ways it runs. */
|
|
200
|
+
function calledByNameOnly(fn, callers, graph) {
|
|
201
|
+
const seen = new Set([fn]);
|
|
202
|
+
const todo = [fn];
|
|
203
|
+
let bound = false;
|
|
204
|
+
for (let at = todo.pop(); at !== undefined; at = todo.pop()) {
|
|
205
|
+
for (const source of df_helper_1.Dataflow.sourcesOf(graph, at, edge_1.EdgeType.DefinedBy | edge_1.EdgeType.Reads)) {
|
|
206
|
+
const vertex = graph.getVertex(source);
|
|
207
|
+
const holds = vertex_1.DfgVertex.isVariableDefinition(vertex) || vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Assignment);
|
|
208
|
+
if (!holds && !callers.includes(source)) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
else if (holds && !seen.has(source)) {
|
|
212
|
+
bound ||= vertex_1.DfgVertex.isVariableDefinition(vertex);
|
|
213
|
+
seen.add(source);
|
|
214
|
+
todo.push(source);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return bound;
|
|
219
|
+
}
|
|
220
|
+
/** how many calls deep {@link runsOnlyAfter} follows the calls of the function holding a call */
|
|
221
|
+
const MaxOrderDepth = 3;
|
|
222
|
+
/** Whether every run of `call` comes after the top-level `statement`, which runs once: `call` runs once after it, or it is in a function that only calls by name run, each of which only after the statement. */
|
|
223
|
+
function runsOnlyAfter(call, statement, graph, depth = 0) {
|
|
224
|
+
const at = program_order_1.ProgramOrder.runsOnceAt(call, graph);
|
|
225
|
+
if (at !== undefined) {
|
|
226
|
+
return program_order_1.ProgramOrder.offset(call, statement, graph) > 0;
|
|
227
|
+
}
|
|
228
|
+
const fn = depth >= MaxOrderDepth || graph.isRoot(call) || graph.idMap === undefined ? undefined : model_1.RNode.strictlyEnclosingFunction(call, graph.idMap);
|
|
229
|
+
const callers = fn === undefined ? [] : df_helper_1.Dataflow.sourcesOf(graph, fn, edge_1.EdgeType.Calls);
|
|
230
|
+
return fn !== undefined && callers.length > 0 && calledByNameOnly(fn, callers, graph) && callers.every(c => runsOnlyAfter(c, statement, graph, depth + 1));
|
|
231
|
+
}
|
|
232
|
+
/** The first formal the functions of `methods` share, which an instantiation hands the new object. */
|
|
233
|
+
function firstFormalOf(methods, idMap) {
|
|
234
|
+
const firsts = new Set(methods.flatMap(m => m.functions).map(fn => {
|
|
235
|
+
const node = idMap.get(fn);
|
|
236
|
+
return r_function_definition_1.RFunctionDefinition.is(node) ? node.parameters[0]?.name.content : undefined;
|
|
237
|
+
}));
|
|
238
|
+
const first = firsts.size === 1 ? [...firsts][0] : undefined;
|
|
239
|
+
return first === undefined || first === arg_matching_1.DotsParameterName ? undefined : [first];
|
|
240
|
+
}
|
|
241
|
+
/** The class the function `fn` is the S3 method of, for one of the generics `prefixes`, `undefined` unless every name it is bound to says the same. */
|
|
242
|
+
function s3ClassOfMethod(fn, prefixes, graph) {
|
|
243
|
+
let cls;
|
|
244
|
+
for (const def of df_helper_1.Dataflow.sourcesOf(graph, fn, edge_1.EdgeType.DefinedBy)) {
|
|
245
|
+
const name = node_id_1.NodeId.recoverBareName(def, graph.idMap);
|
|
246
|
+
const prefix = name === undefined ? undefined : prefixes.find(p => name.startsWith(p + '.'));
|
|
247
|
+
const of = prefix === undefined ? undefined : name?.slice(prefix.length + 1);
|
|
248
|
+
if (of === undefined || (cls !== undefined && cls !== of)) {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
cls = of;
|
|
252
|
+
}
|
|
253
|
+
return cls;
|
|
254
|
+
}
|
|
255
|
+
/** Per formal, the argument `call` binds to it, `undefined` for none; `undefined` overall if the call hands on `...` or binds several. */
|
|
256
|
+
function boundArguments(call, formals, idMap) {
|
|
257
|
+
if (call.args.some(a => a !== r_function_call_1.EmptyArgument && r_symbol_1.RSymbol.is(r_argument_1.RArgument.valueOf(idMap.get(a.nodeId))) && r_argument_1.RArgument.valueOf(idMap.get(a.nodeId))?.lexeme === '...')) {
|
|
258
|
+
return undefined;
|
|
259
|
+
}
|
|
260
|
+
const spec = function_semantics_1.FunctionSemantics.call.match.toSpec(call.args, Object.fromEntries(formals.map(f => [f, f])));
|
|
261
|
+
const bound = formals.map(f => spec.get(f));
|
|
262
|
+
return bound.every(b => b === undefined || b.length <= 1) ? bound.map(b => b?.[0]) : undefined;
|
|
263
|
+
}
|
|
264
|
+
/** The function definitions the definitions or reads `ids` lead to. */
|
|
265
|
+
function linkedFunctionIds(ids, graph) {
|
|
266
|
+
return (0, linker_1.getAllLinkedFunctionDefinitions)(ids, graph)[0].values().map(d => d.id).toArray();
|
|
267
|
+
}
|
|
268
|
+
/** The methods `environment` binds for the generics a built-in dispatches to on its own (see `dispatches` of a built-in): every `<generic>.<class>` and every function `setMethod` registers for one, whatever the class, as it may be that of a part. */
|
|
269
|
+
function internalGenericMethods(generics, environment, graph) {
|
|
270
|
+
return generics.flatMap(g => [
|
|
271
|
+
...resolve_helper_1.Resolve.byNameAndType(g, environment, identifier_1.ReferenceType.S3MethodPrefix) ?? [],
|
|
272
|
+
...resolve_helper_1.Resolve.byNameAndType(g, environment, identifier_1.ReferenceType.Function)?.filter(d => {
|
|
273
|
+
const registration = graph.getVertex(d.definedAt);
|
|
274
|
+
return vertex_1.DfgVertex.isFunctionCall(registration) && registration.s4Method !== undefined;
|
|
275
|
+
}) ?? []
|
|
276
|
+
]).filter(d => !node_id_1.NodeId.isBuiltIn(d.nodeId));
|
|
277
|
+
}
|
|
278
|
+
/** the edges by which a call reaches a definition registering a method, by name or as what a generic hands on */
|
|
279
|
+
const RegistrationEdges = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall | edge_1.EdgeType.Calls;
|
|
280
|
+
/** Per target, the edges from `call` only its link to the method definitions `excluded` needs: the call and the returns of them, the reads of the definitions registering only them, and what only their bodies read on the call. */
|
|
281
|
+
function methodOnlyEdges(graph, call, excluded) {
|
|
282
|
+
const only = new Map();
|
|
283
|
+
const add = (target, types) => only.set(target, (only.get(target) ?? 0) | types);
|
|
284
|
+
const definitions = (ids) => [...ids].map(t => graph.getVertex(t)).filter(v => vertex_1.DfgVertex.isFunctionDefinition(v));
|
|
285
|
+
const removed = definitions(excluded);
|
|
286
|
+
const kept = definitions(df_helper_1.Dataflow.targetsOf(graph, call, edge_1.EdgeType.Calls).filter(t => !excluded.has(t)));
|
|
287
|
+
for (const fn of removed) {
|
|
288
|
+
add(fn.id, edge_1.EdgeType.Calls);
|
|
289
|
+
fn.exitPoints.forEach(exit => add(exit.nodeId, edge_1.EdgeType.Returns));
|
|
290
|
+
}
|
|
291
|
+
const within = (bodies, node) => bodies.some(b => b.subflow.graph.has(node));
|
|
292
|
+
for (const [target, edge] of graph.edgesFrom(call)) {
|
|
293
|
+
if (edge_1.DfEdge.includesType(edge, RegistrationEdges) && edge_1.DfEdge.doesNotIncludeType(edge, edge_1.EdgeType.Argument) && vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target))) {
|
|
294
|
+
const registers = linkedFunctionIds(new Set([target]), graph);
|
|
295
|
+
if (registers.length > 0 && registers.every(r => excluded.has(r))) {
|
|
296
|
+
add(target, RegistrationEdges);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinesOnCall)) {
|
|
300
|
+
const readers = df_helper_1.Dataflow.sourcesOf(graph, target, edge_1.EdgeType.DefinedByOnCall);
|
|
301
|
+
if (readers.some(r => within(removed, r)) && !readers.some(r => within(kept, r))) {
|
|
302
|
+
add(target, edge_1.EdgeType.DefinesOnCall);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return only;
|
|
307
|
+
}
|
|
308
|
+
/** Removes what linking `call` to the method definitions `excluded` added: the edges {@link methodOnlyEdges} names and the arguments bound to the parameters of the methods. */
|
|
309
|
+
function unlinkExcludedMethods(graph, call, excluded) {
|
|
310
|
+
const id = call.id;
|
|
311
|
+
for (const [target, types] of methodOnlyEdges(graph, id, excluded)) {
|
|
312
|
+
graph.removeEdgeType(id, target, types);
|
|
313
|
+
/* the calls of the generic handed a registering definition on to this dispatch alone */
|
|
314
|
+
if ((types & edge_1.EdgeType.DefinedByOnCall) !== 0 && df_helper_1.Dataflow.sourcesOf(graph, target, edge_1.EdgeType.DefinedByOnCall).length === 0) {
|
|
315
|
+
for (const caller of df_helper_1.Dataflow.sourcesOf(graph, target, edge_1.EdgeType.DefinesOnCall)) {
|
|
316
|
+
graph.removeEdgeType(caller, target, edge_1.EdgeType.DefinesOnCall);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
for (const fn of excluded) {
|
|
321
|
+
const definition = graph.idMap?.get(fn);
|
|
322
|
+
for (const param of r_function_definition_1.RFunctionDefinition.is(definition) ? definition.parameters : []) {
|
|
323
|
+
for (const arg of call.args) {
|
|
324
|
+
if (arg !== r_function_call_1.EmptyArgument) {
|
|
325
|
+
graph.removeEdgeType(arg.nodeId, param.name.info.id, edge_1.EdgeType.DefinesOnCall);
|
|
326
|
+
graph.removeEdgeType(param.name.info.id, arg.nodeId, edge_1.EdgeType.DefinedByOnCall);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
//# sourceMappingURL=dispatch-linking.js.map
|
|
@@ -3,71 +3,76 @@ import { RNode } from '../../r-bridge/lang-4.x/ast/model/model';
|
|
|
3
3
|
import type { BuiltIn } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
5
|
import { Identifier, type IdentifierDefinition, type IdentifierReference } from '../environments/identifier';
|
|
6
|
-
import type { DataflowGraph } from '../graph/graph';
|
|
6
|
+
import type { DataflowFunctionFlowInformation, DataflowGraph } from '../graph/graph';
|
|
7
7
|
import type { AstIdMap, ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
8
|
import { type DataflowGraphVertexFunctionCall, type DataflowGraphVertexFunctionDefinition, type DataflowGraphVertexInfo } from '../graph/vertex';
|
|
9
|
-
import type
|
|
9
|
+
import { type REnvironmentInformation } from '../environments/environment';
|
|
10
10
|
import type { ExitPoint } from '../info';
|
|
11
11
|
import type { BuiltInLookup } from '../fn/frame-reflection';
|
|
12
12
|
export type NameIdMap = DefaultMap<Identifier, IdentifierReference[]>;
|
|
13
|
-
/**
|
|
14
|
-
* Find all reads within the graph that do not reference a local definition in the graph.
|
|
15
|
-
*/
|
|
13
|
+
/** Find all reads within the graph that do not reference a local definition in the graph. */
|
|
16
14
|
export declare function findNonLocalReads(graph: DataflowGraph, ignores?: ReadonlySet<NodeId>): IdentifierReference[];
|
|
17
|
-
/**
|
|
18
|
-
* Produces a map from names to all identifier references sharing that name.
|
|
19
|
-
*/
|
|
15
|
+
/** Produces a map from names to all identifier references sharing that name. */
|
|
20
16
|
export declare function produceNameSharedIdMap(references: IdentifierReference[]): NameIdMap;
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
*/
|
|
24
|
-
export declare function
|
|
17
|
+
/** Links the reads of the names a method sees its instance by (`self`, `private`, `.self`) to the definitions holding the instance the call runs the method on. */
|
|
18
|
+
export declare function linkInstanceReads(graph: DataflowGraph, info: DataflowGraphVertexFunctionCall, fn: Pick<DataflowGraphVertexFunctionDefinition, 'id' | 'subflow'>, environment: REnvironmentInformation, idMap: AstIdMap): void;
|
|
19
|
+
/** Which free reads of the function `fn` are in a closure it makes without calling it: such a closure reads its free variables where it is called, which links them there (or, if nothing calls it, at the end of its scope), so a call of `fn` does not read them. */
|
|
20
|
+
export declare function readsOfUncalledClosures(fn: NodeId, subflow: DataflowFunctionFlowInformation, graph: DataflowGraph, idMap: AstIdMap): (read: NodeId) => boolean;
|
|
21
|
+
/** Links a function call with a single target function definition. */
|
|
22
|
+
export declare function linkFunctionCallWithSingleTarget(graph: DataflowGraph, { subflow: fnSubflow, exitPoints, id: fnId, params, envOps }: DataflowGraphVertexFunctionDefinition, info: DataflowGraphVertexFunctionCall, idMap: AstIdMap): ExitPoint[];
|
|
25
23
|
/** What {@link linkFunctionCalls} reports for a call it linked. */
|
|
26
24
|
export type CalledFunctions = {
|
|
27
25
|
functionCall: NodeId;
|
|
28
26
|
called: readonly DataflowGraphVertexInfo[];
|
|
29
27
|
propagateExitPoints: readonly ExitPoint[];
|
|
30
28
|
calledBuiltIns?: readonly NodeId[];
|
|
29
|
+
/** the call runs one of `called`, as a dispatch picks one method, so each only may write what it writes */
|
|
30
|
+
alternatives?: boolean;
|
|
31
31
|
};
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*/
|
|
32
|
+
/** Whether `target` lies within an argument of `call`, which the call reads when it forces that argument, not to find its function. */
|
|
33
|
+
export declare function isWithinArgumentOf(graph: DataflowGraph, call: NodeId, target: NodeId): boolean;
|
|
34
|
+
/** Returns the called functions within `graph` (ideally a superset of `thisGraph`, the graph searched for calls), which can be used to merge the environments with the call; also links the corresponding arguments. */
|
|
36
35
|
export declare function linkFunctionCalls(graph: DataflowGraph, idMap: AstIdMap, thisGraph: DataflowGraph,
|
|
37
36
|
/** calls `graph` knows of that `thisGraph` does not, as a read that became a call */
|
|
38
37
|
alsoCalls?: readonly NodeId[]): CalledFunctions[];
|
|
39
38
|
/**
|
|
40
|
-
* convenience function returning all known call targets, as well as the name source which defines them
|
|
39
|
+
* convenience function returning all known call targets, as well as the name source which defines them Over-approximates for calls through reads and aliases (all functions the read may evaluate to are returned).
|
|
41
40
|
* @useInstead {@link Dataflow.callTargetsOf}
|
|
42
41
|
*/
|
|
43
|
-
export declare function getAllFunctionCallTargets(call: NodeId, graph: DataflowGraph, environment?: REnvironmentInformation): NodeId[];
|
|
44
|
-
/**
|
|
45
|
-
* Finds all linked function definitions starting from the given read ids; expects the caller to already have resolved
|
|
46
|
-
* the accessed objects (first layer of reads/returns/calls/...). For call targets, use {@link Dataflow.callTargetsOf} instead.
|
|
47
|
-
*/
|
|
42
|
+
export declare function getAllFunctionCallTargets(call: NodeId, graph: DataflowGraph, environment?: REnvironmentInformation, resolver?: LinkedFunctionResolver): NodeId[];
|
|
43
|
+
/** Finds all linked function definitions starting from the given read ids; expects the caller to already have resolved the accessed objects (first layer of reads/returns/calls/...). */
|
|
48
44
|
export declare function getAllLinkedFunctionDefinitions(functionDefinitionReadIds: ReadonlySet<NodeId>, dataflowGraph: DataflowGraph): [Set<Required<DataflowGraphVertexFunctionDefinition>>, Set<BuiltIn>];
|
|
45
|
+
/** Finds the function definitions and built-ins that reads may evaluate to (see {@link getAllLinkedFunctionDefinitions}). */
|
|
46
|
+
export declare class LinkedFunctionResolver {
|
|
47
|
+
private readonly graph;
|
|
48
|
+
/** the number of each state, by whether an access led to it, its vertex, and its call */
|
|
49
|
+
private readonly numbers;
|
|
50
|
+
private readonly states;
|
|
51
|
+
/** the built-ins and function definitions the walk ends at, by their state */
|
|
52
|
+
private readonly ends;
|
|
53
|
+
private readonly scopes;
|
|
54
|
+
private readonly summaries;
|
|
55
|
+
constructor(graph: DataflowGraph);
|
|
56
|
+
/** The function definitions and built-ins the reads with the given ids may evaluate to. */
|
|
57
|
+
resolve(reads: ReadonlySet<NodeId>): [Set<Required<DataflowGraphVertexFunctionDefinition>>, Set<BuiltIn>];
|
|
58
|
+
private state;
|
|
59
|
+
/** The states the walk goes on to from `state`, none for a built-in or function definition it ends at. */
|
|
60
|
+
private expand;
|
|
61
|
+
}
|
|
49
62
|
/**
|
|
50
|
-
* Links every name in the expression rooted at `expr` against `environment`, as if it were written there, and
|
|
51
|
-
* hands back what stays unresolved. This is how an expression that was captured elsewhere is read here.
|
|
63
|
+
* Links every name in the expression rooted at `expr` against `environment`, as if it were written there, and hands back what stays unresolved.
|
|
52
64
|
* @useInstead {@link FunctionSemantics.call.quoted.evaluateIn}
|
|
53
65
|
*/
|
|
54
66
|
export declare function linkExpressionIn<Info>(this: void, graph: DataflowGraph, expr: NodeId, environment: REnvironmentInformation, idMap: AstIdMap<Info & ParentInformation>): readonly IdentifierReference[];
|
|
55
67
|
/** Links the call `callId` to the functions the given definitions bind, which it did not know of when it was processed. */
|
|
56
68
|
export declare function linkCallToDefinitions(graph: DataflowGraph, callId: NodeId, definitions: readonly NodeId[], idMap: AstIdMap): void;
|
|
57
|
-
/**
|
|
58
|
-
* Links a set of read variables to definitions in `environmentInformation`; each reference that cannot be linked (or
|
|
59
|
-
* links to built-ins only) is added to `givenInputs` (marked maybe if `maybeForRemaining`), and the extended list is returned.
|
|
60
|
-
* @param alsoFrom - a node that reads every definition found as well
|
|
61
|
-
*/
|
|
69
|
+
/** Links a set of read variables to definitions in `environmentInformation`; each reference that cannot be linked (or links to built-ins only) is added to `givenInputs` (marked maybe if `maybeForRemaining`), and the extended list is returned. */
|
|
62
70
|
export declare function linkInputs(referencesToLinkAgainstEnvironment: readonly IdentifierReference[], environmentInformation: REnvironmentInformation, givenInputs: IdentifierReference[], graph: DataflowGraph, maybeForRemaining: boolean, alsoFrom?: NodeId): IdentifierReference[];
|
|
63
|
-
/**
|
|
64
|
-
* A loop variable read before its within-loop redefinition gets a maybe marker to that def (e.g. `x_2` may read the
|
|
65
|
-
* prior iteration's `x_1` in `for(...) { x_1 <- x_2 + 1 }`); with `environment`, this uses all defs live at loop exit.
|
|
66
|
-
*/
|
|
71
|
+
/** A loop variable read before its within-loop redefinition gets a maybe marker to that def (e.g. `x_2` may read the prior iteration's `x_1` in `for(...) { x_1 <- x_2 + 1 }`); with `environment`, this uses all defs live at loop exit, which the calls in the loop see as well (see {@link linkLoopCarriedCalls}). */
|
|
67
72
|
export declare function linkCircularRedefinitionsWithinALoop(graph: DataflowGraph, openIns: NameIdMap, outgoing: readonly IdentifierReference[], environment?: REnvironmentInformation): void;
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
*/
|
|
73
|
+
/** A call in a loop runs again, so what its callee writes reaches the reads of the loop before the call as well: in `ch <- function() g <<- 2; for(i in 1:2) { s <- g; ch() }` the second `s <- g` reads `g <<- 2`. */
|
|
74
|
+
export declare function linkWritesCarriedByLoop(graph: DataflowGraph, call: NodeId, written: readonly IdentifierDefinition[], idMap: AstIdMap): void;
|
|
75
|
+
/** Reapplies the loop exit points' control dependencies to the given identifier references. */
|
|
71
76
|
export declare function reapplyLoopExitPoints(exits: readonly ExitPoint[], references: readonly IdentifierReference[], graph: DataflowGraph): void;
|
|
72
77
|
/**
|
|
73
78
|
* The open references a function definition still carries into its closure.
|
|
@@ -75,23 +80,16 @@ export declare function reapplyLoopExitPoints(exits: readonly ExitPoint[], refer
|
|
|
75
80
|
*/
|
|
76
81
|
export declare const ClosureRefs: {
|
|
77
82
|
readonly name: "ClosureRefs";
|
|
78
|
-
/**
|
|
79
|
-
* Resolves the open ingoing references of a definition called anonymously at `callId` against `environment`,
|
|
80
|
-
* links what resolves, and leaves only the references that stay open.
|
|
81
|
-
*/
|
|
83
|
+
/** Resolves the open ingoing references of a definition called anonymously at `callId` against `environment`, links what resolves, and leaves only the references that stay open. */
|
|
82
84
|
readonly resolveOpenIngoing: (this: void, graph: DataflowGraph, callId: NodeId, definition: DataflowGraphVertexFunctionDefinition, environment: REnvironmentInformation) => void;
|
|
83
85
|
};
|
|
84
86
|
/** The field an access names, if it is written out: `x$f`, `x[["f"]]`, or `x[[2]]`, which is how a list records its positional entries. */
|
|
85
87
|
export declare function accessedFieldName(fieldNode: RNode<ParentInformation> | undefined, treatIndicesAsString: boolean | undefined): string | undefined;
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* An access `x$f` written where `x` was still open reads the field of whatever `x` is bound to once that binding is
|
|
93
|
-
* known, so binding the read at `readId` to a definition holding `envState` links the access to that field.
|
|
94
|
-
*/
|
|
95
|
-
export declare function bindAccessedField(graph: DataflowGraph, readId: NodeId, envState: REnvironmentInformation, idMap: AstIdMap): void;
|
|
88
|
+
/** Adds the definitions `found` to what the lookup `lookup` finds where it is written, or when `call` runs it, see {@link DataflowGraphVertexFunctionCall#found} and {@link DataflowGraphVertexFunctionCall#foundOnCall}. */
|
|
89
|
+
export declare function recordFound(graph: DataflowGraph, lookup: NodeId, found: readonly NodeId[], call?: NodeId): void;
|
|
90
|
+
/** Links the access at `accessId` to the `fieldDefs` it reaches; a function held in a field is what the access returns, and so may be a field of unknown kind, like the `read.csv` of `assign("f", read.csv, envir = e)`. */
|
|
91
|
+
export declare function linkFieldReads(graph: DataflowGraph, accessId: NodeId, fieldDefs: readonly IdentifierDefinition[] | undefined, returnsFunctions: boolean, call?: NodeId): void;
|
|
92
|
+
/** An access `x$f` written where `x` was still open reads the field of whatever `x` is bound to once that binding is known, so binding the read at `readId` to a definition holding `envState` links the access to that field. */
|
|
93
|
+
export declare function bindAccessedField(graph: DataflowGraph, readId: NodeId, envState: REnvironmentInformation, idMap: AstIdMap, call?: NodeId): void;
|
|
96
94
|
/** A closure's `<<-` into its factory frame is seen only by calls of closures from the same factory call, so such calls depend on each other instead. */
|
|
97
95
|
export declare function separateClosureInstances(graph: DataflowGraph, known: BuiltInLookup): void;
|