Wasm: Change panic for literals todo -> internal_error

This commit is contained in:
Brian Carroll 2022-01-15 07:36:52 +00:00
parent 91a0b21e70
commit bafb6e54d0

View file

@ -1295,7 +1295,8 @@ impl<'a> WasmBackend<'a> {
sym: Symbol, sym: Symbol,
layout: &Layout<'a>, layout: &Layout<'a>,
) { ) {
let not_supported_error = || todo!("Literal value {:?}", lit); let invalid_error =
|| internal_error!("Literal value {:?} has invalid storage {:?}", lit, storage);
match storage { match storage {
StoredValue::VirtualMachineStack { value_type, .. } => { StoredValue::VirtualMachineStack { value_type, .. } => {
@ -1306,7 +1307,7 @@ impl<'a> WasmBackend<'a> {
(Literal::Int(x), ValueType::I32) => self.code_builder.i32_const(*x as i32), (Literal::Int(x), ValueType::I32) => self.code_builder.i32_const(*x as i32),
(Literal::Bool(x), ValueType::I32) => self.code_builder.i32_const(*x as i32), (Literal::Bool(x), ValueType::I32) => self.code_builder.i32_const(*x as i32),
(Literal::Byte(x), ValueType::I32) => self.code_builder.i32_const(*x as i32), (Literal::Byte(x), ValueType::I32) => self.code_builder.i32_const(*x as i32),
_ => not_supported_error(), _ => invalid_error(),
}; };
} }
@ -1369,11 +1370,11 @@ impl<'a> WasmBackend<'a> {
self.code_builder.i32_store(Align::Bytes4, offset + 4); self.code_builder.i32_store(Align::Bytes4, offset + 4);
}; };
} }
_ => not_supported_error(), _ => invalid_error(),
} }
} }
_ => not_supported_error(), _ => invalid_error(),
}; };
} }