Allow valueless constants

This commit is contained in:
Rerumu 2022-06-23 20:59:43 -04:00
parent 3baeb1df59
commit c226d14569
2 changed files with 4 additions and 8 deletions

View File

@ -52,12 +52,10 @@ fn write_constant(code: &[Instruction], type_info: &TypeInfo, w: &mut dyn Write)
let func = Builder::from_type_info(type_info).build_anonymous(code);
if let Some(Statement::SetTemporary(stat)) = func.code().code().last() {
stat.value().write(&mut Manager::default(), w)?;
stat.value().write(&mut Manager::default(), w)
} else {
panic!("Not a valid constant");
write!(w, r#"error("Valueless constant")"#)
}
Ok(())
}
fn write_import_of<T>(wasm: &Module, lower: &str, cond: T, w: &mut dyn Write) -> Result<()>

View File

@ -51,12 +51,10 @@ fn write_constant(code: &[Instruction], type_info: &TypeInfo, w: &mut dyn Write)
let func = Builder::from_type_info(type_info).build_anonymous(code);
if let Some(Statement::SetTemporary(stat)) = func.code().code().last() {
stat.value().write(&mut Manager::default(), w)?;
stat.value().write(&mut Manager::default(), w)
} else {
panic!("Not a valid constant");
write!(w, r#"error("Valueless constant")"#)
}
Ok(())
}
fn write_import_of<T>(wasm: &Module, lower: &str, cond: T, w: &mut dyn Write) -> Result<()>