package wax-lib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=41b580846af8d41bdf6c3f005f62e38feda3e60fe2e9e4aa440db34ce515a153
sha512=4b3a181fcc7d743194a8647260870fb5190770066a197bcc48104c2b77fd40c643228b795c2bcd6b29a120820e969eb42a37a9bcec98b3f608d13f152d9f6579
doc/wax-lib.wasm/Wax_wasm/Types/index.html
Module Wax_wasm.TypesSource
Type handling for Wasm.
The internal (resolved) type representation: type references carry the abstract Id.t rather than the wire format's int. This is what the type store and validation reason about; the codec stays on Ast.Binary.
type ref_index = | Def of Id.t| Rec of int(*A reference inside a rec group being registered (
*)Normalized):Def iddenotes an already-defined type by its canonical index, whileRec posdenotes the group's ownpos-th member. Making the intra-group back-reference a constructor — rather than a canonical index and a negative sign bit sharing one integer space — means the two cannot be confused, and anId.tis only ever a genuine store index.
The normalized form fed to add_rectype: like Internal, but references are ref_index so a rec group's own members are named relatively (by position) and the group dedups regardless of where it lands. A caller resolving a source rec group builds this directly.
A type context holding recursive type definitions.
Add a recursive type definition to the context. Returns the canonical index of the first type defined. Raises Invalid_argument if the group is not well-formed (a Rec back-reference out of range, or a Def referring to a type not yet defined).
last_index context returns the index that the next freshly-added type would receive (i.e. the number of types currently defined).
Information needed for subtyping checks.
subtyping_info context extracts subtyping information from the context.
get_subtype info index returns the subtype at the given canonical index.
Returns all recursive type definitions from the context.
heap_subtype info ht1 ht2 checks if ht1 is a subtype of ht2.
ref_subtype info rt1 rt2 checks if rt1 is a subtype of rt2.
val_subtype info vt1 vt2 checks if vt1 is a subtype of vt2.