package wax-lib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=41b580846af8d41bdf6c3f005f62e38feda3e60fe2e9e4aa440db34ce515a153
sha512=4b3a181fcc7d743194a8647260870fb5190770066a197bcc48104c2b77fd40c643228b795c2bcd6b29a120820e969eb42a37a9bcec98b3f608d13f152d9f6579
doc/wax-lib.conversion/Wax_conversion/Recover_match/index.html
Module Wax_conversion.Recover_matchSource
val module_ :
Wax_lang.Ast.location Wax_lang.Ast.module_ ->
Wax_lang.Ast.location Wax_lang.Ast.module_module_ m rewrites each function body, folding the sequential type-test chain that Ast_utils.lower_match emits — a run of discarded blocks, each testing the same scrutinee with br_on_cast_fail/br_on_non_null branching to the block's own label, with the arm body after the test — into a high-level match. The statements after the run become the trailing default (sound because each arm body diverges, so they run only on the no-match path). A bound cast arm's separate local declaration (let p : T;) is dropped, since the recovered arm re-declares the binding on re-lowering.
Folding is the exact inverse of Ast_utils.lower_match, so a Wax match round-trips through the binary. Meant to run on Sink_let.module_ output, which places the binding declaration adjacent to its block.