Escape data strings only where needed

This commit is contained in:
Rerumu 2022-06-21 14:27:36 -04:00
parent a4f06afae2
commit 3b0eb59f50
2 changed files with 2 additions and 6 deletions

View File

@ -206,9 +206,7 @@ fn write_data_list(wasm: &Module, type_info: &TypeInfo, w: &mut dyn Write) -> Re
write!(w, "rt.store.string(")?;
write!(w, "MEMORY_LIST[{index}],")?;
write_constant(code, type_info, w)?;
write!(w, ",\"")?;
v.value().iter().try_for_each(|v| write!(w, "\\x{v:02X}"))?;
write!(w, "\")")?;
write!(w, r#","{}")"#, v.value().escape_ascii())?;
}
Ok(())

View File

@ -205,9 +205,7 @@ fn write_data_list(wasm: &Module, type_info: &TypeInfo, w: &mut dyn Write) -> Re
write!(w, "rt.store.string(")?;
write!(w, "MEMORY_LIST[{index}],")?;
write_constant(code, type_info, w)?;
write!(w, ",\"")?;
v.value().iter().try_for_each(|v| write!(w, "\\x{v:02X}"))?;
write!(w, "\")")?;
write!(w, r#","{}")"#, v.value().escape_ascii())?;
}
Ok(())