@eagleoutice/flowr 2.17.4 → 2.17.6
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 +12 -89
- package/abstract-interpretation/absint-inference.d.ts +4 -4
- package/abstract-interpretation/absint-inference.js +12 -13
- package/abstract-interpretation/abstract-semantics.d.ts +2 -1
- package/abstract-interpretation/branch-paths-interpreter.js +60 -0
- package/abstract-interpretation/branch-paths.d.ts +60 -0
- package/abstract-interpretation/branch-paths.js +120 -0
- 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.d.ts +6 -1
- package/abstract-interpretation/data-frame/dataframe-semantics.js +67 -16
- 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 +18 -16
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
- 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/core.js +51 -0
- 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/cfg-dead-code.js +12 -7
- 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/packed.d.ts +10 -0
- package/data/packed.js +33 -0
- package/data/r-base-guards.generated.d.ts +7 -0
- package/data/r-base-guards.generated.js +12 -0
- package/data/r-base-primitives.generated.d.ts +2 -1
- package/data/r-datasets.generated.d.ts +4 -0
- package/data/r-datasets.generated.js +10 -0
- package/data/r-formals.generated.d.ts +4 -0
- package/data/r-formals.generated.js +10 -0
- package/data/r-group-method-guards.generated.d.ts +3 -0
- package/data/r-group-method-guards.generated.js +8 -0
- package/dataflow/cluster.js +1 -2
- package/dataflow/environments/ambient-effect.d.ts +1000 -0
- package/dataflow/environments/ambient-effect.js +234 -0
- package/dataflow/environments/ambient-state-name.d.ts +59 -24
- package/dataflow/environments/ambient-state-name.js +65 -21
- package/dataflow/environments/apply-kill.d.ts +9 -20
- package/dataflow/environments/apply-kill.js +62 -29
- 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 +69 -0
- package/dataflow/environments/built-in-kinds.js +39 -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 +75 -176
- package/dataflow/environments/built-in-props.js +53 -157
- package/dataflow/environments/built-in.d.ts +42 -73
- package/dataflow/environments/built-in.js +49 -93
- 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 +397 -0
- package/dataflow/environments/default-builtin-config/base-language.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/base-language.js +69 -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 +83 -0
- package/dataflow/environments/default-builtin-config/graphics-devices.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/graphics-devices.js +67 -0
- package/dataflow/environments/default-builtin-config/guard-builders.d.ts +16 -0
- package/dataflow/environments/default-builtin-config/guard-builders.js +29 -0
- package/dataflow/environments/default-builtin-config/guards-primitive-lang.d.ts +15 -0
- package/dataflow/environments/default-builtin-config/guards-primitive-lang.js +228 -0
- package/dataflow/environments/default-builtin-config/guards-primitive-ops.d.ts +11 -0
- package/dataflow/environments/default-builtin-config/guards-primitive-ops.js +154 -0
- package/dataflow/environments/default-builtin-config/guards.d.ts +9 -0
- package/dataflow/environments/default-builtin-config/guards.js +211 -0
- package/dataflow/environments/default-builtin-config/index.d.ts +18 -0
- package/dataflow/environments/default-builtin-config/index.js +129 -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 +33 -0
- package/dataflow/environments/default-builtin-config/package-tidyverse.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/package-tidyverse.js +97 -0
- package/dataflow/environments/default-builtin-config/package-utils.d.ts +3 -0
- package/dataflow/environments/default-builtin-config/package-utils.js +38 -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 +33 -0
- package/dataflow/environments/default-builtin-config/r-formals.d.ts +13 -0
- package/dataflow/environments/default-builtin-config/r-formals.js +110 -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 +328 -0
- package/dataflow/environments/default-builtin-config/shared-configs.js +447 -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 +35 -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/diff.js +5 -2
- package/dataflow/environments/environment.d.ts +48 -52
- package/dataflow/environments/environment.js +62 -74
- package/dataflow/environments/group-generics.d.ts +16 -19
- package/dataflow/environments/group-generics.js +28 -15
- package/dataflow/environments/guard-facts.d.ts +169 -0
- package/dataflow/environments/guard-facts.js +26 -0
- package/dataflow/environments/identifier.d.ts +81 -428
- package/dataflow/environments/identifier.js +39 -145
- package/dataflow/environments/pkg-name.d.ts +198 -0
- package/dataflow/environments/pkg-name.js +3 -0
- package/dataflow/environments/query-fn-props.d.ts +28 -79
- package/dataflow/environments/query-fn-props.js +77 -115
- package/dataflow/environments/removal-marker.d.ts +2 -0
- package/dataflow/environments/removal-marker.js +5 -0
- 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 +4 -7
- package/dataflow/eval/resolve/resolve-strings.js +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 +111 -48
- 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 +4 -1
- package/dataflow/fn/condition-handlers.js +3 -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 +5 -5
- package/dataflow/fn/frame-reflection.js +24 -16
- package/dataflow/fn/function-props.d.ts +2 -5
- package/dataflow/fn/function-props.js +30 -46
- package/dataflow/fn/function-semantics.d.ts +44 -26
- package/dataflow/fn/function-semantics.js +19 -18
- package/dataflow/fn/guards/built-in-guards.d.ts +112 -0
- package/dataflow/fn/guards/built-in-guards.js +199 -0
- package/dataflow/fn/guards/call-contracts.d.ts +97 -0
- package/dataflow/fn/guards/call-contracts.js +331 -0
- package/dataflow/fn/guards/condition-grouping.d.ts +20 -0
- package/dataflow/fn/guards/condition-grouping.js +135 -0
- package/dataflow/fn/guards/function-guards.d.ts +112 -0
- package/dataflow/fn/guards/function-guards.js +1549 -0
- package/dataflow/fn/guards/group-method-guards.d.ts +28 -0
- package/dataflow/fn/guards/group-method-guards.js +56 -0
- package/dataflow/fn/guards/guard-claims.d.ts +125 -0
- package/dataflow/fn/guards/guard-claims.js +678 -0
- package/dataflow/fn/guards/guard-knowledge.d.ts +41 -0
- package/dataflow/fn/guards/guard-knowledge.js +180 -0
- package/dataflow/fn/guards/guard-term-syntax.d.ts +9 -0
- package/dataflow/fn/guards/guard-term-syntax.js +210 -0
- package/dataflow/fn/guards/guard-term.d.ts +136 -0
- package/dataflow/fn/guards/guard-term.js +550 -0
- package/dataflow/fn/guards/stated-guards.d.ts +13 -0
- package/dataflow/fn/guards/stated-guards.js +35 -0
- package/dataflow/fn/higher-order-function.d.ts +2 -0
- package/dataflow/fn/higher-order-function.js +3 -4
- package/dataflow/fn/strict-function.d.ts +14 -35
- package/dataflow/fn/strict-function.js +183 -146
- package/dataflow/graph/ambient-access.d.ts +54 -0
- package/dataflow/graph/ambient-access.js +86 -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 +54 -188
- package/dataflow/graph/df-helper.js +122 -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 +50 -97
- package/dataflow/graph/graph.js +72 -75
- 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 +4 -18
- package/dataflow/info.js +3 -1
- package/dataflow/internal/dispatch-linking.d.ts +73 -0
- package/dataflow/internal/dispatch-linking.js +333 -0
- package/dataflow/internal/linker.d.ts +50 -50
- package/dataflow/internal/linker.js +566 -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 +18 -47
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +12 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +12 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +38 -128
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +681 -339
- 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 +78 -45
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +17 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +185 -78
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +26 -5
- 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 +438 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +40 -57
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +214 -117
- 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 +74 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +20 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +420 -115
- 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 +6 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +8 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +530 -140
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +20 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +98 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +2 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +14 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +40 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +18 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +8 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +39 -8
- 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-recall.js +4 -0
- 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 +27 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +74 -38
- 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 +9 -27
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +42 -45
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +12 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +72 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +19 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +286 -81
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +7 -4
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +44 -30
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +723 -115
- 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 +6 -15
- package/dataflow/internal/process/functions/call/quoted.js +48 -65
- 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/dataflow/processor.d.ts +2 -0
- package/documentation/data/dfg/doc-ambient.d.ts +4 -0
- package/documentation/data/dfg/doc-ambient.js +74 -0
- 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 +15 -3
- package/documentation/wiki-interface.js +2 -1
- package/documentation/wiki-linter.js +27 -3
- package/documentation/wiki-linting-and-testing.js +15 -2
- package/documentation/wiki-query.js +223 -30
- package/index.d.ts +3 -1
- package/index.js +6 -3
- package/linter/linter-executor.js +1 -1
- package/linter/linter-rules.d.ts +78 -9
- package/linter/linter-rules.js +12 -1
- package/linter/linter-util.d.ts +3 -3
- package/linter/linter-util.js +1 -1
- package/linter/rules/call-contracts.d.ts +40 -0
- package/linter/rules/call-contracts.js +56 -0
- package/linter/rules/cmd-check/bogus-return.d.ts +2 -1
- package/linter/rules/cmd-check/bogus-return.js +1 -1
- package/linter/rules/cmd-check/call-arguments.d.ts +3 -2
- package/linter/rules/cmd-check/call-arguments.js +10 -11
- package/linter/rules/cmd-check/cmd-check-util.d.ts +8 -13
- package/linter/rules/cmd-check/cmd-check-util.js +0 -28
- 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-hooks.js +2 -1
- 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 +3 -2
- 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/interactive-functions.d.ts +30 -0
- package/linter/rules/interactive-functions.js +87 -0
- 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 +2 -2
- 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 +4 -3
- package/linter/rules/undefined-symbol-util.js +8 -2
- package/linter/rules/undefined-symbol.d.ts +3 -2
- package/linter/rules/undefined-symbol.js +18 -7
- 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/linter/rules/useless-loop.d.ts +1 -1
- 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-dependencies-context.js +2 -1
- 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 +36 -3
- package/project/flowr-analyzer.js +8 -2
- 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 +15 -5
- package/project/sigdb/decode.d.ts +11 -7
- package/project/sigdb/decode.js +11 -3
- package/project/sigdb/dict.d.ts +2 -1
- package/project/sigdb/dict.js +2 -2
- package/project/sigdb/guarded-source.d.ts +6 -0
- package/project/sigdb/guarded-source.js +29 -0
- 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 +90 -80
- package/project/sigdb/reader.js +27 -5
- package/project/sigdb/schema.d.ts +33 -10
- package/project/sigdb/signature-db.d.ts +6 -6
- package/queries/catalog/absint-query/absint-query-format.d.ts +6 -3
- package/queries/catalog/absint-query/absint-query-format.js +57 -2
- package/queries/catalog/ambient-access-query/ambient-access-query-format.d.ts +58 -0
- package/queries/catalog/ambient-access-query/ambient-access-query-format.js +90 -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/cluster-query/cluster-query-format.d.ts +5 -2
- package/queries/catalog/cluster-query/cluster-query-format.js +19 -2
- package/queries/catalog/code-clones-query/code-clones-query-format.d.ts +57 -0
- package/queries/catalog/code-clones-query/code-clones-query-format.js +105 -0
- package/queries/catalog/config-query/config-query-format.d.ts +5 -2
- package/queries/catalog/config-query/config-query-format.js +41 -2
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +5 -2
- package/queries/catalog/control-flow-query/control-flow-query-format.js +19 -2
- package/queries/catalog/data-columns-query/data-columns-query-format.d.ts +72 -0
- package/queries/catalog/data-columns-query/data-columns-query-format.js +215 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +5 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +38 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +5 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.js +18 -2
- 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 +4 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.js +9 -4
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -4
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/tagged-functions.d.ts +11 -0
- package/queries/catalog/dependencies-query/function-info/tagged-functions.js +18 -0
- package/queries/catalog/dependencies-query/implicit-echo.js +2 -1
- package/queries/catalog/dice-query/dice-query-format.d.ts +8 -2
- package/queries/catalog/dice-query/dice-query-format.js +35 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -4
- package/queries/catalog/does-call-query/does-call-query-format.js +115 -2
- package/queries/catalog/files-query/files-query-format.d.ts +5 -2
- package/queries/catalog/files-query/files-query-format.js +45 -2
- 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-format.d.ts +11 -7
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +303 -2
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +9 -4
- package/queries/catalog/happens-before-query/happens-before-query-format.js +38 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +5 -2
- package/queries/catalog/id-map-query/id-map-query-format.js +18 -2
- 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/inspect-exceptions-query/inspect-exception-query-format.d.ts +5 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +29 -2
- package/queries/catalog/inspect-fn-guards-query/inspect-fn-guards-query-format.d.ts +37 -0
- package/queries/catalog/inspect-fn-guards-query/inspect-fn-guards-query-format.js +125 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +3 -2
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +54 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +23 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +15 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +8 -2
- package/queries/catalog/linter-query/linter-query-format.js +72 -6
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +7 -3
- package/queries/catalog/location-map-query/location-map-query-format.js +70 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +5 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +18 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +7 -3
- package/queries/catalog/origin-query/origin-query-format.js +30 -2
- package/queries/catalog/project-query/project-query-format.d.ts +8 -4
- package/queries/catalog/project-query/project-query-format.js +98 -2
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +7 -3
- package/queries/catalog/provenance-query/provenance-query-format.js +31 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +10 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +39 -2
- package/queries/catalog/search-query/search-query-format.d.ts +5 -2
- package/queries/catalog/search-query/search-query-format.js +23 -2
- package/queries/catalog/signature-query/signature-query-executor.d.ts +9 -6
- package/queries/catalog/signature-query/signature-query-executor.js +17 -16
- package/queries/catalog/signature-query/signature-query-format.d.ts +24 -20
- package/queries/catalog/signature-query/signature-query-render.js +24 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +22 -7
- package/queries/catalog/static-slice-query/static-slice-query-format.js +56 -2
- package/queries/catalog/taint-query/taint-query-format.d.ts +6 -3
- package/queries/catalog/taint-query/taint-query-format.js +28 -2
- package/queries/query-function-filter.d.ts +1 -1
- package/queries/query.d.ts +104 -32
- package/queries/query.js +61 -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 +9 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +18 -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 +10 -4
- package/reconstruct/auto-select/magic-comments.js +1 -1
- package/reconstruct/reconstruct.d.ts +0 -5
- package/reconstruct/reconstruct.js +24 -8
- 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 +6 -4
- package/slicing/static/slice-call.d.ts +41 -4
- package/slicing/static/slice-call.js +117 -11
- package/slicing/static/slicer-types.d.ts +2 -1
- package/slicing/static/static-slicer.d.ts +2 -0
- package/slicing/static/static-slicer.js +199 -28
- package/slicing/static/visiting-queue.d.ts +4 -0
- package/slicing/static/visiting-queue.js +8 -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/objects.d.ts +2 -0
- package/util/objects.js +5 -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-datasets.d.ts +27 -0
- package/util/r-datasets.js +45 -0
- 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/playground-link.d.ts +2 -0
- package/util/text/playground-link.js +2 -0
- 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/queries/catalog/absint-query/absint-query-executor.d.ts +0 -6
- package/queries/catalog/absint-query/absint-query-executor.js +0 -61
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +0 -6
- package/queries/catalog/cluster-query/cluster-query-executor.js +0 -21
- package/queries/catalog/config-query/config-query-executor.d.ts +0 -6
- package/queries/catalog/config-query/config-query-executor.js +0 -45
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +0 -6
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +0 -21
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +0 -6
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +0 -40
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +0 -6
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +0 -20
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +0 -9
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +0 -18
- package/queries/catalog/dice-query/dice-query-executor.d.ts +0 -8
- package/queries/catalog/dice-query/dice-query-executor.js +0 -37
- package/queries/catalog/does-call-query/does-call-query-executor.d.ts +0 -6
- package/queries/catalog/does-call-query/does-call-query-executor.js +0 -117
- package/queries/catalog/files-query/files-query-executor.d.ts +0 -6
- package/queries/catalog/files-query/files-query-executor.js +0 -47
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +0 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +0 -307
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +0 -7
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +0 -40
- package/queries/catalog/id-map-query/id-map-query-executor.d.ts +0 -6
- package/queries/catalog/id-map-query/id-map-query-executor.js +0 -20
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -6
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +0 -31
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +0 -4
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +0 -58
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +0 -7
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +0 -25
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +0 -7
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +0 -17
- package/queries/catalog/linter-query/linter-query-executor.d.ts +0 -9
- package/queries/catalog/linter-query/linter-query-executor.js +0 -59
- package/queries/catalog/location-map-query/location-map-query-executor.d.ts +0 -7
- package/queries/catalog/location-map-query/location-map-query-executor.js +0 -73
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +0 -6
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +0 -20
- package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -6
- package/queries/catalog/origin-query/origin-query-executor.js +0 -31
- package/queries/catalog/project-query/project-query-executor.d.ts +0 -6
- package/queries/catalog/project-query/project-query-executor.js +0 -103
- package/queries/catalog/provenance-query/provenance-query-executor.d.ts +0 -6
- package/queries/catalog/provenance-query/provenance-query-executor.js +0 -33
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +0 -10
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +0 -40
- package/queries/catalog/search-query/search-query-executor.d.ts +0 -6
- package/queries/catalog/search-query/search-query-executor.js +0 -25
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +0 -14
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +0 -59
- package/queries/catalog/taint-query/taint-query-executor.d.ts +0 -7
- package/queries/catalog/taint-query/taint-query-executor.js +0 -30
- 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.js +0 -124
- package/taint-analysis/eval/instrumentation.d.ts +0 -59
- package/taint-analysis/eval/instrumentation.js +0 -124
- /package/{taint-analysis/eval/eval.d.ts → abstract-interpretation/branch-paths-interpreter.d.ts} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.callsOfTerms = callsOfTerms;
|
|
4
|
+
exports.reasonsOf = reasonsOf;
|
|
5
|
+
exports.storedGuardsOf = storedGuardsOf;
|
|
6
|
+
exports.statedGuardsOfStored = statedGuardsOfStored;
|
|
7
|
+
exports.builtInClauses = builtInClauses;
|
|
8
|
+
exports.namesWithGuards = namesWithGuards;
|
|
9
|
+
exports.builtInGuards = builtInGuards;
|
|
10
|
+
const objects_1 = require("../../../util/objects");
|
|
11
|
+
const identifier_1 = require("../../environments/identifier");
|
|
12
|
+
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
13
|
+
const function_guards_1 = require("./function-guards");
|
|
14
|
+
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
15
|
+
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
16
|
+
const r_if_then_else_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-if-then-else");
|
|
17
|
+
const r_while_loop_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-while-loop");
|
|
18
|
+
const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
19
|
+
const r_binary_op_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
|
|
20
|
+
const guard_claims_1 = require("./guard-claims");
|
|
21
|
+
const guard_knowledge_1 = require("./guard-knowledge");
|
|
22
|
+
const guards_1 = require("../../environments/default-builtin-config/guards");
|
|
23
|
+
const r_base_guards_generated_1 = require("../../../data/r-base-guards.generated");
|
|
24
|
+
const guard_term_1 = require("./guard-term");
|
|
25
|
+
const guard_term_syntax_1 = require("./guard-term-syntax");
|
|
26
|
+
const group_method_guards_1 = require("./group-method-guards");
|
|
27
|
+
const group_generics_1 = require("../../environments/group-generics");
|
|
28
|
+
const arrays_1 = require("../../../util/collections/arrays");
|
|
29
|
+
/** The functions the terms call, see {@link StatedGuards.calls}. */
|
|
30
|
+
function callsOfTerms(terms) {
|
|
31
|
+
return (0, arrays_1.uniqueArray)(terms.flatMap(term => guard_term_1.GuardTerm.callsOf(term).map(id => identifier_1.Identifier.toString(id))));
|
|
32
|
+
}
|
|
33
|
+
/** {@link GuardReason.loc} of `node`, by the outermost function definition around it and the name it is assigned to. */
|
|
34
|
+
function locationOf(node, idMap, qualified) {
|
|
35
|
+
let definition;
|
|
36
|
+
for (let at = node; at !== undefined; at = model_1.RNode.directParent(at, idMap)) {
|
|
37
|
+
definition = r_function_definition_1.RFunctionDefinition.is(at) ? at : definition;
|
|
38
|
+
}
|
|
39
|
+
const assigned = definition === undefined ? undefined : model_1.RNode.directParent(definition, idMap);
|
|
40
|
+
const name = assigned !== undefined && r_binary_op_1.RBinaryOp.is(assigned) ? assigned.lhs.lexeme?.replaceAll('`', '') : undefined;
|
|
41
|
+
if (node?.location === undefined || definition?.location === undefined || name === undefined) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
return { fn: qualified(name), line: node.location[0] - definition.location[0] + 1, column: node.location[1] };
|
|
45
|
+
}
|
|
46
|
+
const MaxReasonLength = 160;
|
|
47
|
+
function written(node) {
|
|
48
|
+
const text = model_1.RNode.lexeme(node)?.split('\n')[0] ?? '';
|
|
49
|
+
return text.length > MaxReasonLength ? `${text.slice(0, MaxReasonLength)}...` : text;
|
|
50
|
+
}
|
|
51
|
+
/** The failing code shortened, see {@link GuardReason.brief}. */
|
|
52
|
+
function briefOf(node, message, idMap) {
|
|
53
|
+
if (node === undefined) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
else if (r_function_call_1.RFunctionCall.isNamed(node) && message !== undefined && (0, function_guards_1.messageOf)(node) === message) {
|
|
57
|
+
return `${model_1.RNode.ownLexeme(node) ?? ''}(...)`;
|
|
58
|
+
}
|
|
59
|
+
const parent = model_1.RNode.directParent(node, idMap);
|
|
60
|
+
return (r_if_then_else_1.RIfThenElse.is(parent) || r_while_loop_1.RWhileLoop.is(parent)) && parent.condition === node ? `${r_if_then_else_1.RIfThenElse.is(parent) ? 'if' : 'while'} (${written(node)}) ...` : undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The {@link GuardReason} of each of the clauses, reading the code they point at from `idMap`.
|
|
64
|
+
* @param ownerOf - the package defining a function of the program, to qualify {@link GuardReason.via} with
|
|
65
|
+
*/
|
|
66
|
+
function reasonsOf(clauses, idMap, ownerOf = () => undefined) {
|
|
67
|
+
const qualified = (name) => {
|
|
68
|
+
const owner = ownerOf(name);
|
|
69
|
+
return owner === undefined ? name : `${owner}::${name}`;
|
|
70
|
+
};
|
|
71
|
+
return clauses.map(({ requires, rendered, kind, at, via, message }) => {
|
|
72
|
+
const node = idMap.get(at);
|
|
73
|
+
const brief = briefOf(node, message, idMap);
|
|
74
|
+
const called = model_1.RNode.ownLexeme(node);
|
|
75
|
+
const reads = (0, guard_claims_1.readingOf)(requires, (0, guard_knowledge_1.defaultGuardFacts)(), called === undefined ? undefined : (0, group_generics_1.s3GroupGenericOf)(called));
|
|
76
|
+
const formals = [...guard_term_1.GuardTerm.formalsOf(requires)];
|
|
77
|
+
const loc = locationOf(node, idMap, qualified);
|
|
78
|
+
return (0, objects_1.compactRecord)({
|
|
79
|
+
requires: rendered,
|
|
80
|
+
kind,
|
|
81
|
+
fails: written(node),
|
|
82
|
+
brief, reads,
|
|
83
|
+
formals: (0, objects_1.nonEmpty)(formals),
|
|
84
|
+
via: (0, objects_1.nonEmpty)(via)?.map(id => qualified(model_1.RNode.ownLexeme(idMap.get(id)) ?? '')),
|
|
85
|
+
message, loc
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/** The conjunction of what the reasons require, as {@link StatedGuards.requires} writes it. */
|
|
90
|
+
function joinedReasons(because) {
|
|
91
|
+
return because.map(r => because.length > 1 && r.requires.includes('||') ? `(${r.requires})` : r.requires).join(' && ');
|
|
92
|
+
}
|
|
93
|
+
/** The calls the reasons' conditions make, as {@link StatedGuards.calls} lists them, read back from their R syntax. */
|
|
94
|
+
function callsOfReasons(because) {
|
|
95
|
+
const formals = (0, arrays_1.uniqueArray)(because.flatMap(r => r.formals ?? []));
|
|
96
|
+
const terms = because.map(r => (0, guard_term_syntax_1.parseGuardTerm)(r.requires, formals, (0, guard_knowledge_1.defaultGuardFacts)()));
|
|
97
|
+
return terms.every(t => t !== undefined) ? callsOfTerms(terms) : undefined;
|
|
98
|
+
}
|
|
99
|
+
/** The {@link StoredGuards} of `guards`, those of the function `self` (`pkg::name`). */
|
|
100
|
+
function storedGuardsOf(guards, self) {
|
|
101
|
+
const { requires, because, calls, ...rest } = guards;
|
|
102
|
+
const derived = because === undefined ? undefined : callsOfReasons(because);
|
|
103
|
+
return {
|
|
104
|
+
...(because !== undefined && joinedReasons(because) === requires ? {} : { requires }),
|
|
105
|
+
...(calls === undefined || (derived !== undefined && derived.join() === calls.join()) ? {} : { calls }),
|
|
106
|
+
...rest,
|
|
107
|
+
...(because === undefined ? {} : { because: because.map(({ loc, ...reason }) => ({ ...reason, ...(loc === undefined ? {} : { loc: `${loc.fn === self ? '' : loc.fn + ':'}${loc.line}:${loc.column}` }) })) })
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** The {@link StatedGuards} that {@link storedGuardsOf} stored. */
|
|
111
|
+
function statedGuardsOfStored(stored, self) {
|
|
112
|
+
const { requires, because, calls, ...rest } = stored;
|
|
113
|
+
const derived = calls ?? (because === undefined ? undefined : callsOfReasons(because));
|
|
114
|
+
return {
|
|
115
|
+
requires: requires ?? joinedReasons(because ?? []),
|
|
116
|
+
...(derived === undefined || derived.length === 0 ? {} : { calls: derived }),
|
|
117
|
+
...rest,
|
|
118
|
+
...(because === undefined ? {} : { because: because.map(({ loc, ...reason }) => {
|
|
119
|
+
if (loc === undefined) {
|
|
120
|
+
return reason;
|
|
121
|
+
}
|
|
122
|
+
const [line, column] = loc.split(':').slice(-2).map(Number);
|
|
123
|
+
const fn = loc.split(':').slice(0, -2).join(':');
|
|
124
|
+
return { ...reason, loc: { fn: fn === '' ? self : fn, line, column: column } };
|
|
125
|
+
}) })
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/** What R fails on for a function written in C, as the built-in definitions `facts` state it, `undefined` if they state nothing. */
|
|
129
|
+
function builtInClauses(name, facts) {
|
|
130
|
+
const asks = facts(name)?.asks;
|
|
131
|
+
if (asks === undefined) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
const formals = Object.keys(asks);
|
|
135
|
+
return Object.entries(asks).flatMap(([formal, failures]) => {
|
|
136
|
+
/* what the dots hold is several values, none of which a formal of the name `...` could stand for in R code */
|
|
137
|
+
const other = formals.find(f => f !== formal);
|
|
138
|
+
const of = guard_term_1.GuardTerm.formal(formal);
|
|
139
|
+
return formal === '...' ? [] : failures.map(f => ({ formal, requires: (0, guard_knowledge_1.passes)(f, of, () => false, other === undefined ? undefined : guard_term_1.GuardTerm.formal(other), guard_term_1.GuardTerm.formal), message: (0, guard_knowledge_1.messageFor)(f, of) }));
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** What R fails on for a function written in C, and what it returns, as the built-in definitions state it, `undefined` if flowR does not know of any. */
|
|
143
|
+
function requirementsOf(name) {
|
|
144
|
+
const facts = (0, guard_knowledge_1.defaultGuardFacts)()(name);
|
|
145
|
+
const formals = Object.keys(facts?.asks ?? {});
|
|
146
|
+
const stated = builtInClauses(name, (0, guard_knowledge_1.defaultGuardFacts)()) ?? [];
|
|
147
|
+
const returns = facts?.returns === undefined || facts.returns === 'argument' ? undefined : (0, guard_claims_1.returnedClaimOf)(facts.returns);
|
|
148
|
+
const passed = facts?.returns === 'argument' ? formals[0] : undefined;
|
|
149
|
+
if (stated.length === 0 && returns === undefined && passed === undefined && (facts?.required ?? []).length === 0) {
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
const required = facts?.required ?? [];
|
|
153
|
+
const dispatched = formals.filter(f => f !== '...');
|
|
154
|
+
const terms = [...stated.map(c => c.requires), ...(0, group_method_guards_1.groupMethodConditions)(name, dispatched.map(guard_term_1.GuardTerm.formal), new Set(), (0, guard_knowledge_1.defaultGuardFacts)())];
|
|
155
|
+
const claims = (0, guard_claims_1.claimsOf)(terms, (0, arrays_1.uniqueArrayMerge)(stated.map(c => c.formal), required), (0, guard_knowledge_1.defaultGuardFacts)());
|
|
156
|
+
const relations = (0, guard_claims_1.relationsOf)(terms, (0, guard_knowledge_1.defaultGuardFacts)());
|
|
157
|
+
const conditional = (0, guard_claims_1.conditionalClaimsOf)(terms, formals.filter(f => f !== '...'), (0, guard_knowledge_1.defaultGuardFacts)());
|
|
158
|
+
const calls = callsOfTerms(terms);
|
|
159
|
+
return (0, objects_1.compactRecord)({
|
|
160
|
+
requires: terms.length === 0 ? '' : guard_term_1.GuardTerm.render(guard_term_1.GuardTerm.all(...terms)),
|
|
161
|
+
required: (0, objects_1.nonEmpty)(required),
|
|
162
|
+
formals: Object.keys(claims).length > 0 ? claims : undefined,
|
|
163
|
+
relations: (0, objects_1.nonEmpty)(relations),
|
|
164
|
+
conditional: (0, objects_1.nonEmpty)(conditional),
|
|
165
|
+
returns,
|
|
166
|
+
passes: passed,
|
|
167
|
+
calls: (0, objects_1.nonEmpty)(calls),
|
|
168
|
+
origin: { source: 'builtin', r: r_base_guards_generated_1.RBaseGuardsVersion }
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/** Everything with stated guards, as `[package, name]`. */
|
|
172
|
+
function namesWithGuards() {
|
|
173
|
+
const table = (0, r_base_guards_generated_1.RBaseGuards)();
|
|
174
|
+
const inTable = Object.entries(table).flatMap(([pkg, names]) => Object.keys(names).map(name => [pkg, name]));
|
|
175
|
+
const known = new Set(inTable.map(([pkg, name]) => `${pkg}::${name}`));
|
|
176
|
+
return [...inTable, ...(0, guards_1.namesWithGuardFacts)().filter(([, name]) => requirementsOf(name) !== undefined).map(([, name]) => [(0, r_base_packages_1.baseRExportOwner)(name) ?? "base" /* PkgName.Base */, name]).filter(([pkg, name]) => !known.has(`${pkg}::${name}`))];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* What a function of the base packages asks of the calls returning from it: what its closure checks, and else what is known of it being written in C.
|
|
180
|
+
* Like any guard this says nothing of the defaults of its formals: `n = 5L` does not make `n` an integer.
|
|
181
|
+
* @param name - the function
|
|
182
|
+
* @param pkg - the package providing it, by default the one R finds the name in
|
|
183
|
+
*/
|
|
184
|
+
function builtInGuards(name, pkg = (0, r_base_packages_1.baseRExportOwner)(name)) {
|
|
185
|
+
const owner = pkg ?? "base" /* PkgName.Base */;
|
|
186
|
+
const key = `${String(owner)}::${String(name)}`;
|
|
187
|
+
if (!builtInGuardsCache.has(key)) {
|
|
188
|
+
builtInGuardsCache.set(key, readBuiltInGuards(name, owner));
|
|
189
|
+
}
|
|
190
|
+
return builtInGuardsCache.get(key);
|
|
191
|
+
}
|
|
192
|
+
/** {@link builtInGuards} per `pkg::name`, as the table and the facts do not change while flowR runs */
|
|
193
|
+
const builtInGuardsCache = new Map();
|
|
194
|
+
function readBuiltInGuards(name, owner) {
|
|
195
|
+
const stored = (0, r_base_guards_generated_1.RBaseGuards)()[String(owner)]?.[String(name)];
|
|
196
|
+
const read = stored === undefined ? undefined : statedGuardsOfStored(stored, `${String(owner)}::${String(name)}`);
|
|
197
|
+
return read !== undefined ? { ...read, origin: { source: 'base-table', r: r_base_guards_generated_1.RBaseGuardsVersion, date: r_base_guards_generated_1.RBaseGuardsDate, pkg: owner, version: r_base_guards_generated_1.RBaseGuardsVersion } } : ((0, r_base_packages_1.baseRExportOwner)(name) === owner || owner === "base" /* PkgName.Base */ ? requirementsOf(name) : undefined);
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=built-in-guards.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Identifier, type BrandedIdentifier } from '../../environments/identifier';
|
|
2
|
+
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
|
+
import type { AstIdMap } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
+
import type { DataflowGraph } from '../../graph/graph';
|
|
5
|
+
import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
|
|
6
|
+
import { GuardTerm } from './guard-term';
|
|
7
|
+
import { type GuardOrigin, type StatedGuards } from './built-in-guards';
|
|
8
|
+
import { type FunctionGuards } from './function-guards';
|
|
9
|
+
import type { GuardFactsLookup } from '../../environments/guard-facts';
|
|
10
|
+
/** What a function asks of its calls: the conditions of its guards over its formals, and the formals a call has to give. */
|
|
11
|
+
export interface FunctionContract {
|
|
12
|
+
readonly formals: readonly BrandedIdentifier[];
|
|
13
|
+
readonly required: readonly BrandedIdentifier[];
|
|
14
|
+
readonly clauses: readonly GuardTerm[];
|
|
15
|
+
/** `program` if inferred from a definition of the analyzed code, else where the stated guards come from, see {@link GuardOrigin} */
|
|
16
|
+
readonly source: 'program' | GuardOrigin['source'];
|
|
17
|
+
/** the definition the contract is inferred from, for a `program` contract */
|
|
18
|
+
readonly definition?: NodeId;
|
|
19
|
+
/** the guards inferred for {@link FunctionContract.definition} */
|
|
20
|
+
readonly guards?: FunctionGuards;
|
|
21
|
+
/** the guards stated without a program, for any other contract */
|
|
22
|
+
readonly stated?: StatedGuards;
|
|
23
|
+
}
|
|
24
|
+
/** What a call breaks of a contract: a formal it does not give, or a condition that fails for every value the arguments may hold. */
|
|
25
|
+
export type ContractBreach = {
|
|
26
|
+
readonly kind: 'missing';
|
|
27
|
+
readonly formal: BrandedIdentifier;
|
|
28
|
+
} | {
|
|
29
|
+
readonly kind: 'fails';
|
|
30
|
+
readonly condition: string;
|
|
31
|
+
readonly values: readonly (readonly [formal: BrandedIdentifier, shown: string])[];
|
|
32
|
+
};
|
|
33
|
+
/** What the contracts of one program are worked out against, see {@link CallContracts.of}. */
|
|
34
|
+
export interface ContractScope {
|
|
35
|
+
readonly graph: DataflowGraph;
|
|
36
|
+
readonly idMap: AstIdMap;
|
|
37
|
+
readonly ctx: ReadOnlyFlowrAnalyzerContext;
|
|
38
|
+
readonly facts: GuardFactsLookup;
|
|
39
|
+
/** whether code other than the program may bring S3 methods of the given generic */
|
|
40
|
+
readonly mayAddMethods: (generic: BrandedIdentifier) => boolean;
|
|
41
|
+
/** whether the program rewrites a function (`formals(f) <- ...`), after which the contract of its definition no longer holds */
|
|
42
|
+
readonly rewritesFormals: boolean;
|
|
43
|
+
readonly definitions: Map<NodeId, FunctionContract | undefined>;
|
|
44
|
+
readonly functions: Map<string, FunctionContract | undefined>;
|
|
45
|
+
}
|
|
46
|
+
/** The scope to work out the contracts of the calls of the analyzed program in, sharing what they have in common. */
|
|
47
|
+
declare function of(this: void, graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext, idMap?: AstIdMap): ContractScope;
|
|
48
|
+
/** What is stated of a function by name: what the signature database answers (given a context to ask it in), or else flowR's table of the base packages. */
|
|
49
|
+
declare function statedOf(this: void, name: Identifier, ctx?: ReadOnlyFlowrAnalyzerContext): StatedGuards | undefined;
|
|
50
|
+
/** The contract of a function by name: what its closure checks as the base table or the signature database states it, or else what R checks of the function written in C. */
|
|
51
|
+
declare function ofFunction(this: void, name: Identifier, scope: ContractScope): FunctionContract | undefined;
|
|
52
|
+
/** The contract inferred for a definition of the program, none once the program rewrites functions. */
|
|
53
|
+
declare function ofDefinition(this: void, definition: NodeId, scope: ContractScope): FunctionContract | undefined;
|
|
54
|
+
/** The contract of what the call reaches: the one definition of the program it calls, or a function of R flowR knows the guards of. */
|
|
55
|
+
declare function ofCall(this: void, call: NodeId, scope: ContractScope): FunctionContract | undefined;
|
|
56
|
+
/** The contract in the form the signature database stores and the browsers show, see {@link StatedGuards}. */
|
|
57
|
+
declare function stated(this: void, contract: FunctionContract, idMap: AstIdMap): StatedGuards | undefined;
|
|
58
|
+
/** What of the contract the call breaks for sure, each condition with the values it fails for. */
|
|
59
|
+
declare function breaches(this: void, call: NodeId, contract: FunctionContract, scope: ContractScope): ContractBreach[];
|
|
60
|
+
/** The breach in words, as `m >= 0 fails for m = -1`. */
|
|
61
|
+
declare function describe(this: void, breach: ContractBreach): string;
|
|
62
|
+
/** The contract the call reaches and what of it the call breaks for sure, `undefined` if flowR knows no contract of what it calls. */
|
|
63
|
+
declare function check(this: void, call: NodeId, scope: ContractScope): {
|
|
64
|
+
readonly contract: FunctionContract;
|
|
65
|
+
readonly breaches: readonly ContractBreach[];
|
|
66
|
+
} | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* The one layer to ask what a function asks of its calls, its *contract*, and whether a call keeps it: stated by the signature database or
|
|
69
|
+
* flowR's tables for a function by name, or inferred from a definition of the program by the guards analysis, see {@link FunctionGuards}.
|
|
70
|
+
* The conditions of the guards of the callee are taken to the call as the guard analysis takes them to a caller, and a call only breaks
|
|
71
|
+
* a condition if it fails for every value the arguments may hold.
|
|
72
|
+
* @helper api
|
|
73
|
+
*/
|
|
74
|
+
export declare const CallContracts: {
|
|
75
|
+
readonly name: "CallContracts";
|
|
76
|
+
/** The scope to ask for the contracts of one analyzed program in. */
|
|
77
|
+
readonly of: typeof of;
|
|
78
|
+
/** What is stated of a function by name, without a program. */
|
|
79
|
+
readonly statedOf: typeof statedOf;
|
|
80
|
+
/** The contract of a function by name. */
|
|
81
|
+
readonly ofFunction: typeof ofFunction;
|
|
82
|
+
/** The contract inferred for a definition of the program. */
|
|
83
|
+
readonly ofDefinition: typeof ofDefinition;
|
|
84
|
+
/** The contract of what a call reaches. */
|
|
85
|
+
readonly ofCall: typeof ofCall;
|
|
86
|
+
/** The contract in the form the signature database stores and the browsers show. */
|
|
87
|
+
readonly stated: typeof stated;
|
|
88
|
+
/** What of a contract a call breaks for sure. */
|
|
89
|
+
readonly breaches: typeof breaches;
|
|
90
|
+
/** The contract of what a call reaches and what of it the call breaks. */
|
|
91
|
+
readonly check: typeof check;
|
|
92
|
+
/** A breach in words. */
|
|
93
|
+
readonly describe: typeof describe;
|
|
94
|
+
/** The replacement functions that rewrite a function, after which its contract no longer holds. */
|
|
95
|
+
readonly FormalsRewriters: ReadonlySet<BrandedIdentifier>;
|
|
96
|
+
};
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CallContracts = void 0;
|
|
4
|
+
const general_1 = require("../../eval/values/general");
|
|
5
|
+
const resolve_helper_1 = require("../../environments/resolve-helper");
|
|
6
|
+
const r_value_1 = require("../../eval/values/r-value");
|
|
7
|
+
const identifier_1 = require("../../environments/identifier");
|
|
8
|
+
const df_helper_1 = require("../../graph/df-helper");
|
|
9
|
+
const query_fn_props_1 = require("../../environments/query-fn-props");
|
|
10
|
+
const guard_term_1 = require("./guard-term");
|
|
11
|
+
const guard_term_syntax_1 = require("./guard-term-syntax");
|
|
12
|
+
const built_in_guards_1 = require("./built-in-guards");
|
|
13
|
+
const function_guards_1 = require("./function-guards");
|
|
14
|
+
const stated_guards_1 = require("./stated-guards");
|
|
15
|
+
const guard_knowledge_1 = require("./guard-knowledge");
|
|
16
|
+
const guard_claims_1 = require("./guard-claims");
|
|
17
|
+
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
18
|
+
const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
19
|
+
const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
20
|
+
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
21
|
+
const built_in_proc_name_1 = require("../../environments/built-in-proc-name");
|
|
22
|
+
const vertex_1 = require("../../graph/vertex");
|
|
23
|
+
const match_args_1 = require("../../graph/match-args");
|
|
24
|
+
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
25
|
+
const r_s3_generics_generated_1 = require("../../../data/r-s3-generics.generated");
|
|
26
|
+
const arrays_1 = require("../../../util/collections/arrays");
|
|
27
|
+
/** the replacement functions that rewrite a function, after which its formals and checks are no longer those of its definition */
|
|
28
|
+
const FormalsRewriters = new Set(['formals<-', 'body<-', 'args<-']);
|
|
29
|
+
/** How many combinations of the values the arguments may hold a condition is evaluated for. */
|
|
30
|
+
const MaxCombinations = 64;
|
|
31
|
+
/** How many nodes {@link readsParameter} looks at before it gives up. */
|
|
32
|
+
const MaxReads = 1024;
|
|
33
|
+
const LoadingCalls = new Set(['loadNamespace', 'requireNamespace', 'attachNamespace', 'registerS3method', 'source', 'sys.source', 'attach']);
|
|
34
|
+
/** Whether something besides the program may register S3 methods: a package it loads, attaches, or reaches into. */
|
|
35
|
+
function loadsPackages(graph, ctx) {
|
|
36
|
+
if (ctx.deps.getDependencies().length > 0) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
for (const [, vertex] of graph.vertices(true)) {
|
|
40
|
+
if (!vertex_1.DfgVertex.isFunctionCall(vertex)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const namespace = identifier_1.Identifier.getNamespace(vertex.name);
|
|
44
|
+
if (vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Library) || (namespace !== undefined && !(0, r_base_packages_1.isBaseRPackage)(namespace)) || LoadingCalls.has(identifier_1.Identifier.getName(vertex.name))) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
/** The scope to work out the contracts of the calls of the analyzed program in, sharing what they have in common. */
|
|
51
|
+
function of(graph, ctx, idMap = graph.idMap) {
|
|
52
|
+
const bindings = df_helper_1.Dataflow.definitionsByName(graph);
|
|
53
|
+
let loads;
|
|
54
|
+
return {
|
|
55
|
+
graph, idMap, ctx, facts: (0, guard_knowledge_1.guardFactsOf)(ctx),
|
|
56
|
+
mayAddMethods: generic => [...bindings.keys()].some(name => name.startsWith(`${generic}.`)) || (loads ??= loadsPackages(graph, ctx)),
|
|
57
|
+
rewritesFormals: [...graph.verticesOfType(vertex_1.VertexType.FunctionCall)].some(([, v]) => FormalsRewriters.has(identifier_1.Identifier.getName(v.name))),
|
|
58
|
+
definitions: new Map(),
|
|
59
|
+
functions: new Map()
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Whether `a` and `b` name the same release of R, as what the closures of R check only changes between those. */
|
|
63
|
+
function sameRelease(a, b) {
|
|
64
|
+
return a.split('.').slice(0, 2).join('.') === b.split('.').slice(0, 2).join('.');
|
|
65
|
+
}
|
|
66
|
+
/** The conditions of the guards stated without a program, read back into terms over the formals. */
|
|
67
|
+
function statedClauses(name, stated, formals, scope) {
|
|
68
|
+
const texts = stated.because?.map(b => b.requires) ?? [stated.requires];
|
|
69
|
+
const terms = texts.flatMap(text => {
|
|
70
|
+
const term = text === '' ? undefined : (0, guard_term_syntax_1.parseGuardTerm)(text, formals, scope.facts);
|
|
71
|
+
return term === undefined ? [] : guard_term_1.GuardTerm.conjuncts(term);
|
|
72
|
+
});
|
|
73
|
+
/* a value without a class attribute may still run a method another package registers for its implicit class */
|
|
74
|
+
const open = (stated.dispatches !== undefined || r_s3_generics_generated_1.RS3Generics.genericFormals[String(name)] !== undefined) && scope.mayAddMethods(name);
|
|
75
|
+
return terms.filter(t => !open || !guard_term_1.GuardTerm.mentions(t, 'is.object'));
|
|
76
|
+
}
|
|
77
|
+
/** What is stated of a function by name: what the signature database answers (given a context to ask it in), or else flowR's table of the base packages. */
|
|
78
|
+
function statedOf(name, ctx) {
|
|
79
|
+
return (ctx === undefined ? undefined : (0, query_fn_props_1.fnEntry)(name, ctx).entry?.guards) ?? (0, built_in_guards_1.builtInGuards)(identifier_1.Identifier.getName(name), identifier_1.Identifier.getNamespace(name));
|
|
80
|
+
}
|
|
81
|
+
/** The contract of a function by name: what its closure checks as the base table or the signature database states it, or else what R checks of the function written in C. */
|
|
82
|
+
function ofFunction(name, scope) {
|
|
83
|
+
const key = identifier_1.Identifier.toString(name);
|
|
84
|
+
if (!scope.functions.has(key)) {
|
|
85
|
+
scope.functions.set(key, contractOfFunction(name, scope));
|
|
86
|
+
}
|
|
87
|
+
return scope.functions.get(key);
|
|
88
|
+
}
|
|
89
|
+
function contractOfFunction(name, scope) {
|
|
90
|
+
const { ctx, facts } = scope;
|
|
91
|
+
const [bare, namespace] = [identifier_1.Identifier.getName(name), identifier_1.Identifier.getNamespace(name)];
|
|
92
|
+
const formals = (0, query_fn_props_1.builtInLookup)(ctx)(name)?.sig?.map(([formal]) => formal) ?? (0, query_fn_props_1.fnEntry)(name, ctx).entry?.signature.map(p => p.name);
|
|
93
|
+
if (formals === undefined) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
const stated = statedOf(name, ctx);
|
|
97
|
+
const version = ctx.rVersionKnown ? ctx.resolvedRVersion : undefined;
|
|
98
|
+
const ofC = namespace === undefined || (0, r_base_packages_1.isBaseRPackage)(namespace) ? (0, built_in_guards_1.builtInClauses)(bare, facts) : undefined;
|
|
99
|
+
const origin = stated?.origin;
|
|
100
|
+
let clauses = [];
|
|
101
|
+
if (stated !== undefined && origin !== undefined && origin.source !== 'builtin') {
|
|
102
|
+
clauses = origin.source === 'base-table' && version !== undefined && !sameRelease(origin.r, version) ? [] : statedClauses(bare, stated, formals, scope);
|
|
103
|
+
}
|
|
104
|
+
else if (ofC !== undefined) {
|
|
105
|
+
clauses = ofC.map(c => c.requires);
|
|
106
|
+
}
|
|
107
|
+
else if (stated !== undefined) {
|
|
108
|
+
clauses = statedClauses(bare, stated, formals, scope);
|
|
109
|
+
}
|
|
110
|
+
const required = stated?.required ?? [];
|
|
111
|
+
return clauses.length === 0 && required.length === 0 ? undefined : { formals, required, clauses, source: origin?.source ?? 'builtin', stated };
|
|
112
|
+
}
|
|
113
|
+
/** The contract inferred for a definition of the program, none once the program rewrites functions. */
|
|
114
|
+
function ofDefinition(definition, scope) {
|
|
115
|
+
if (scope.rewritesFormals) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
if (!scope.definitions.has(definition)) {
|
|
119
|
+
const node = scope.idMap.get(definition);
|
|
120
|
+
// eslint-disable-next-line flowr/use-instead -- FunctionSemantics exposes this module, so it cannot be imported here
|
|
121
|
+
const guards = r_function_definition_1.RFunctionDefinition.is(node) ? (0, function_guards_1.guardsOfFunctions)([definition], scope.graph, { ctx: scope.ctx })[definition] : undefined;
|
|
122
|
+
/* a definition that asks nothing of its calls has no contract to check them against */
|
|
123
|
+
scope.definitions.set(definition, guards === undefined || !r_function_definition_1.RFunctionDefinition.is(node) || (guards.clauses.length === 0 && guards.required.length === 0) ? undefined : {
|
|
124
|
+
formals: node.parameters.map(p => p.name.content),
|
|
125
|
+
required: guards.required,
|
|
126
|
+
clauses: guards.clauses.map(c => c.requires),
|
|
127
|
+
source: 'program',
|
|
128
|
+
definition,
|
|
129
|
+
guards
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return scope.definitions.get(definition);
|
|
133
|
+
}
|
|
134
|
+
/** The contract of what the call reaches: the one definition of the program it calls, or a function of R flowR knows the guards of. */
|
|
135
|
+
function ofCall(call, scope) {
|
|
136
|
+
const { graph } = scope;
|
|
137
|
+
const origins = df_helper_1.Dataflow.origin(graph, call) ?? [];
|
|
138
|
+
if (origins.length === 1 && origins[0].type === 3 /* OriginType.BuiltInFunctionOrigin */) {
|
|
139
|
+
return ofFunction(origins[0].fn.name, scope);
|
|
140
|
+
}
|
|
141
|
+
const definitions = df_helper_1.Dataflow.calleeDefinitionsOf(graph, call);
|
|
142
|
+
return definitions.length !== 1 || (0, function_guards_1.readsViaParameter)(origins, graph) || origins.some(o => o.type === 3 /* OriginType.BuiltInFunctionOrigin */) ? undefined : ofDefinition(definitions[0].info.id, scope);
|
|
143
|
+
}
|
|
144
|
+
/** The contract in the form the signature database stores and the browsers show, see {@link StatedGuards}. */
|
|
145
|
+
function stated(contract, idMap) {
|
|
146
|
+
return contract.stated ?? (contract.guards === undefined ? undefined : (0, stated_guards_1.statedGuardsOf)(contract.guards, idMap));
|
|
147
|
+
}
|
|
148
|
+
/** Whether what the expression holds may depend on a parameter of a function, which value resolution answers with what the calls flowR sees hand over, and not for every call. */
|
|
149
|
+
function readsParameter(node, scope) {
|
|
150
|
+
const seen = new Set();
|
|
151
|
+
const todo = [node];
|
|
152
|
+
for (let at = todo.pop(); at !== undefined; at = todo.pop()) {
|
|
153
|
+
if (seen.has(at.info.id)) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
else if (seen.size >= MaxReads) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
seen.add(at.info.id);
|
|
160
|
+
if (r_symbol_1.RSymbol.is(at)) {
|
|
161
|
+
const sources = df_helper_1.Dataflow.valueSources(at.info.id, scope.graph);
|
|
162
|
+
if (sources === undefined || sources.some(s => (0, function_guards_1.isParameter)(s, scope.idMap))) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
todo.push(...sources.flatMap(s => s === at.info.id ? [] : [scope.idMap.get(s)].filter(n => n !== undefined)));
|
|
166
|
+
}
|
|
167
|
+
todo.push(...model_1.RNode.directChildren(at).filter(c => c !== r_function_call_1.EmptyArgument));
|
|
168
|
+
}
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
/** A number as literals of the types it may have, as the value domain does not tell `1` from `1L`. */
|
|
172
|
+
function numberLiterals(num, complex) {
|
|
173
|
+
if (complex || Number.isNaN(num)) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
else if (!Number.isFinite(num)) {
|
|
177
|
+
return [{ kind: 'constant', lexeme: num > 0 ? 'Inf' : '-Inf', value: num }];
|
|
178
|
+
}
|
|
179
|
+
const double = { kind: 'constant', lexeme: String(num), value: num };
|
|
180
|
+
return Number.isInteger(num) && Math.abs(num) <= 2147483647 ? [{ kind: 'constant', lexeme: `${num}L`, value: num }, double] : [double];
|
|
181
|
+
}
|
|
182
|
+
/** The literals a single value may be written as, `undefined` if it is none. */
|
|
183
|
+
function scalarLiterals(value) {
|
|
184
|
+
if (typeof value !== 'object' || value === null) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
switch (value.type) {
|
|
188
|
+
case 'string':
|
|
189
|
+
return (0, r_value_1.isValue)(value.value) ? [guard_term_1.GuardTerm.string(value.value.str)] : undefined;
|
|
190
|
+
case 'logical':
|
|
191
|
+
return typeof value.value === 'boolean' ? [value.value ? guard_term_1.GuardTerm.True : guard_term_1.GuardTerm.False] : undefined;
|
|
192
|
+
case 'number':
|
|
193
|
+
return (0, r_value_1.isValue)(value.value) ? numberLiterals(value.value.num, value.value.complexNumber) : undefined;
|
|
194
|
+
case 'interval': {
|
|
195
|
+
const [start, end] = [scalarLiterals(value.start), scalarLiterals(value.end)];
|
|
196
|
+
return value.startInclusive && value.endInclusive && start !== undefined && start[0]?.value === end?.[0]?.value ? start : undefined;
|
|
197
|
+
}
|
|
198
|
+
default:
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** The terms a value may be written as without attributes: a literal, `NULL`, or a `c(...)` of literals of one type, `undefined` if it is none of those. */
|
|
203
|
+
function literalsOf(value) {
|
|
204
|
+
if (typeof value === 'object' && value !== null && value.type === 'null') {
|
|
205
|
+
return [{ kind: 'constant', lexeme: 'NULL' }];
|
|
206
|
+
}
|
|
207
|
+
else if (typeof value !== 'object' || value === null || value.type !== 'vector') {
|
|
208
|
+
return scalarLiterals(value);
|
|
209
|
+
}
|
|
210
|
+
else if (!Array.isArray(value.elements)) {
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
const elements = value.elements.map(scalarLiterals);
|
|
214
|
+
if (elements.length === 0) {
|
|
215
|
+
return [{ kind: 'constant', lexeme: 'NULL' }];
|
|
216
|
+
}
|
|
217
|
+
else if (elements.includes(undefined) || new Set(elements.map(e => e?.length)).size !== 1 || new Set(elements.map(e => typeof e?.[0].value)).size !== 1) {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
/* the elements have one type: all integers or all doubles for numbers */
|
|
221
|
+
const variants = elements[0].map((_, at) => elements.map(e => e[at]));
|
|
222
|
+
return variants.map(v => guard_term_1.GuardTerm.known('c', ...v));
|
|
223
|
+
}
|
|
224
|
+
/** The literals the argument may hold, `undefined` if not all of them are known. */
|
|
225
|
+
function argumentLiterals(node, vertex, scope) {
|
|
226
|
+
if (readsParameter(node, scope)) {
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
const values = (0, general_1.valueSetGuard)(resolve_helper_1.Resolve.toValue(node, { graph: scope.graph, environment: vertex.environment, ctx: scope.ctx }));
|
|
230
|
+
if (values?.type !== 'set' || values.elements.length === 0) {
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
const literals = values.elements.map(literalsOf);
|
|
234
|
+
return literals.includes(undefined) ? undefined : literals.flat();
|
|
235
|
+
}
|
|
236
|
+
/** Every way of choosing one of the literals per placeholder, `undefined` if there are too many. */
|
|
237
|
+
function combinations(choices) {
|
|
238
|
+
let result = [new Map()];
|
|
239
|
+
for (const [name, literals] of choices) {
|
|
240
|
+
result = result.flatMap(binding => literals.map(l => new Map([...binding, [name, l]])));
|
|
241
|
+
if (result.length > MaxCombinations) {
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
/** The literals as R prints them, a number once, rather than as each of the types it may have. */
|
|
248
|
+
function shown(literals) {
|
|
249
|
+
const asDouble = (text) => text.replace(/(?<=[0-9])L\b/g, '');
|
|
250
|
+
return (0, arrays_1.uniqueArray)(literals.map(l => asDouble(guard_term_1.GuardTerm.render(l))));
|
|
251
|
+
}
|
|
252
|
+
/** What of the contract the call breaks for sure, each condition with the values it fails for. */
|
|
253
|
+
function breaches(call, contract, scope) {
|
|
254
|
+
const { graph, facts } = scope;
|
|
255
|
+
const vertex = graph.getVertex(call);
|
|
256
|
+
if (!vertex_1.DfgVertex.isFunctionCall(vertex)) {
|
|
257
|
+
return [];
|
|
258
|
+
}
|
|
259
|
+
const given = match_args_1.MatchArgs.toSpec(vertex.args, Object.fromEntries(contract.formals.map(f => [f, f])));
|
|
260
|
+
const result = match_args_1.MatchArgs.handsOnDots(vertex.args, graph) ? [] : contract.required.filter(f => f !== '...' && (given.get(f)?.length ?? 0) === 0).map(formal => ({ kind: 'missing', formal }));
|
|
261
|
+
const args = new Map();
|
|
262
|
+
const binding = (0, function_guards_1.callBinding)(vertex, contract.formals, graph, node => {
|
|
263
|
+
const placeholder = `#${String(node.info.id)}`;
|
|
264
|
+
args.set(placeholder, { node });
|
|
265
|
+
return guard_term_1.GuardTerm.formal(placeholder);
|
|
266
|
+
});
|
|
267
|
+
const literalsAt = (placeholder) => {
|
|
268
|
+
const argument = args.get(placeholder);
|
|
269
|
+
if (argument !== undefined && argument.literals === undefined) {
|
|
270
|
+
/* what no value is known for is still given, so it is no longer missing */
|
|
271
|
+
argument.literals = argumentLiterals(argument.node, vertex, scope) ?? [{ kind: 'free', name: placeholder }];
|
|
272
|
+
}
|
|
273
|
+
return argument?.literals ?? [];
|
|
274
|
+
};
|
|
275
|
+
for (const clause of contract.clauses) {
|
|
276
|
+
const { requires } = (0, function_guards_1.atCall)(clause, binding, undefined, facts);
|
|
277
|
+
const placeholders = [...guard_term_1.GuardTerm.formalsOf(requires)];
|
|
278
|
+
const bindings = combinations(new Map(placeholders.map(p => [p, literalsAt(p)])));
|
|
279
|
+
if (bindings === undefined || !bindings.every(b => guard_term_1.GuardTerm.isFalse(guard_term_1.GuardTerm.substituteCondition(requires, b, undefined, facts)))) {
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
const values = contract.formals.flatMap(formal => {
|
|
283
|
+
const bound = binding.binding.get(formal);
|
|
284
|
+
const literals = bound?.kind === 'formal' && placeholders.includes(bound.name) ? literalsAt(bound.name) : [];
|
|
285
|
+
const node = bound?.kind === 'formal' ? args.get(bound.name)?.node : undefined;
|
|
286
|
+
return literals.length === 0 ? [] : [[formal, model_1.RConstant.is(node) ? node.lexeme : shown(literals).join(' or ')]];
|
|
287
|
+
});
|
|
288
|
+
result.push({ kind: 'fails', condition: (0, guard_claims_1.readingOf)(clause, facts) ?? guard_term_1.GuardTerm.render(clause), values });
|
|
289
|
+
}
|
|
290
|
+
return result;
|
|
291
|
+
}
|
|
292
|
+
/** The breach in words, as `m >= 0 fails for m = -1`. */
|
|
293
|
+
function describe(breach) {
|
|
294
|
+
return breach.kind === 'missing' ? `${breach.formal} is not given` : `${breach.condition} fails for ${breach.values.map(([formal, value]) => `${formal} = ${value}`).join(', ')}`;
|
|
295
|
+
}
|
|
296
|
+
/** The contract the call reaches and what of it the call breaks for sure, `undefined` if flowR knows no contract of what it calls. */
|
|
297
|
+
function check(call, scope) {
|
|
298
|
+
const contract = ofCall(call, scope);
|
|
299
|
+
return contract === undefined ? undefined : { contract, breaches: breaches(call, contract, scope) };
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* The one layer to ask what a function asks of its calls, its *contract*, and whether a call keeps it: stated by the signature database or
|
|
303
|
+
* flowR's tables for a function by name, or inferred from a definition of the program by the guards analysis, see {@link FunctionGuards}.
|
|
304
|
+
* The conditions of the guards of the callee are taken to the call as the guard analysis takes them to a caller, and a call only breaks
|
|
305
|
+
* a condition if it fails for every value the arguments may hold.
|
|
306
|
+
* @helper api
|
|
307
|
+
*/
|
|
308
|
+
exports.CallContracts = {
|
|
309
|
+
name: 'CallContracts',
|
|
310
|
+
/** The scope to ask for the contracts of one analyzed program in. */
|
|
311
|
+
of,
|
|
312
|
+
/** What is stated of a function by name, without a program. */
|
|
313
|
+
statedOf,
|
|
314
|
+
/** The contract of a function by name. */
|
|
315
|
+
ofFunction,
|
|
316
|
+
/** The contract inferred for a definition of the program. */
|
|
317
|
+
ofDefinition,
|
|
318
|
+
/** The contract of what a call reaches. */
|
|
319
|
+
ofCall,
|
|
320
|
+
/** The contract in the form the signature database stores and the browsers show. */
|
|
321
|
+
stated,
|
|
322
|
+
/** What of a contract a call breaks for sure. */
|
|
323
|
+
breaches,
|
|
324
|
+
/** The contract of what a call reaches and what of it the call breaks. */
|
|
325
|
+
check,
|
|
326
|
+
/** A breach in words. */
|
|
327
|
+
describe,
|
|
328
|
+
/** The replacement functions that rewrite a function, after which its contract no longer holds. */
|
|
329
|
+
FormalsRewriters
|
|
330
|
+
};
|
|
331
|
+
//# sourceMappingURL=call-contracts.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** The parts of `text` separated by `separator` outside of any parentheses, brackets, braces, or strings. */
|
|
2
|
+
export declare function splitTopLevel(this: void, text: string, separator: string): string[];
|
|
3
|
+
/**
|
|
4
|
+
* The condition with its grouping made explicit, so no reader has to know how `and`, `unless`, `||`, and `&&` bind:
|
|
5
|
+
* `a && b || c unless d && e` reads as `((a && b) || c) unless (d && e)`. A connective binds tighter the later it is in {@link Connectives},
|
|
6
|
+
* and a case `if (w): c` keeps its condition `w` and groups what holds then.
|
|
7
|
+
*/
|
|
8
|
+
export declare function grouped(this: void, text: string): string;
|
|
9
|
+
/** The conditions joined by `&&`, those that would mix with it in parentheses. */
|
|
10
|
+
export declare function allOf(this: void, conditions: readonly string[]): string;
|
|
11
|
+
/** The formals in groups of those that `links` tie together, each group in the order of `formals` and the groups by their first formal, so what depends on each other reads together. */
|
|
12
|
+
export declare function linkedGroups(this: void, formals: readonly string[], links: readonly (readonly string[])[]): string[][];
|
|
13
|
+
/**
|
|
14
|
+
* The relations with each comparison once: a comparison that holds unless `u1` and holds unless `u2` holds unless both do,
|
|
15
|
+
* written with what both offer said once, `c || (a1 && a2)` for `c || a1` and `c || a2`, and a comparison stated as well with its sides swapped is the same one.
|
|
16
|
+
*/
|
|
17
|
+
export declare function mergedRelations<T extends {
|
|
18
|
+
readonly holds: string;
|
|
19
|
+
readonly unless?: string;
|
|
20
|
+
}>(this: void, relations: readonly T[]): T[];
|