Implement char type in adapter fusion (#4544)

This commit implements the translation of `char` which validates that
it's in the valid range of unicode scalar values. The precise validation
here is lifted from LLVM in the hopes that it's probably better than
whatever I would concoct by hand.
This commit is contained in:
Alex Crichton
2022-07-28 11:47:01 -05:00
committed by GitHub
parent 8137432e67
commit e1148e43be
4 changed files with 175 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ enum ValType {
S64,
Float32,
Float64,
Char,
Record(Vec<ValType>),
Tuple(Vec<ValType>),
Variant(NonZeroLenVec<ValType>),
@@ -206,6 +207,7 @@ fn intern(types: &mut ComponentTypesBuilder, ty: &ValType) -> InterfaceType {
ValType::S64 => InterfaceType::S64,
ValType::Float32 => InterfaceType::Float32,
ValType::Float64 => InterfaceType::Float64,
ValType::Char => InterfaceType::Char,
ValType::Record(tys) => {
let ty = TypeRecord {
fields: tys