MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / lower

Method lower

crates/test-util/src/component_fuzz.rs:692–721  ·  view source on GitHub ↗
(&self, vec: &mut Vec<CoreType>)

Source from the content-addressed store, hash-verified

690 }
691
692 fn lower(&self, vec: &mut Vec<CoreType>) {
693 match self {
694 Type::Bool
695 | Type::U8
696 | Type::S8
697 | Type::S16
698 | Type::U16
699 | Type::S32
700 | Type::U32
701 | Type::Char
702 | Type::Enum(_) => vec.push(CoreType::I32),
703 Type::S64 | Type::U64 => vec.push(CoreType::I64),
704 Type::Float32 => vec.push(CoreType::F32),
705 Type::Float64 => vec.push(CoreType::F64),
706 Type::String | Type::List(_) | Type::Map(_, _) => {
707 vec.push(CoreType::I32);
708 vec.push(CoreType::I32);
709 }
710 Type::Record(types) => lower_record(types.iter(), vec),
711 Type::Tuple(types) => lower_record(types.0.iter(), vec),
712 Type::Variant(types) => lower_variant(types.0.iter().map(|t| t.as_ref()), vec),
713 Type::Option(ty) => lower_variant([None, Some(&**ty)].into_iter(), vec),
714 Type::Result { ok, err } => {
715 lower_variant([ok.as_deref(), err.as_deref()].into_iter(), vec)
716 }
717 Type::Flags(count) => vec.extend(
718 iter::repeat(CoreType::I32).take(u32_count_from_flag_count(*count as usize)),
719 ),
720 }
721 }
722
723 fn size_and_alignment(&self) -> SizeAndAlignment {
724 match self {

Callers 2

lower_recordFunction · 0.45
loweredMethod · 0.45

Calls 11

lower_recordFunction · 0.85
lower_variantFunction · 0.85
repeatFunction · 0.50
pushMethod · 0.45
iterMethod · 0.45
mapMethod · 0.45
as_refMethod · 0.45
into_iterMethod · 0.45
extendMethod · 0.45
takeMethod · 0.45

Tested by

no test coverage detected