Add indentation to Luau output

This commit is contained in:
Rerumu
2022-08-21 02:30:36 -04:00
parent 7efeffeac6
commit 5b96c500df
5 changed files with 206 additions and 130 deletions
+5 -5
View File
@@ -105,9 +105,9 @@ impl Target for Luau {
};
let data = Module::from_data(&bytes);
write!(w, "assert_trap((function() ")?;
writeln!(w, "assert_trap((function()")?;
codegen_luau::from_module_untyped(&data, w)?;
writeln!(w, " end)(), linked)")
writeln!(w, "end)(), linked)")
}
}
}
@@ -154,10 +154,10 @@ impl Target for Luau {
let numeric = codegen_luau::NUMERIC;
writeln!(w, "local Integer = (function()")?;
writeln!(w, "{numeric}")?;
write!(w, "{numeric}")?;
writeln!(w, "end)()")?;
writeln!(w, "local rt = (function()")?;
writeln!(w, "{runtime}")?;
write!(w, "{runtime}")?;
writeln!(w, "end)()")?;
writeln!(w, "{ASSERTION}")
@@ -166,7 +166,7 @@ impl Target for Luau {
fn write_module(data: &Module, name: Option<&str>, w: &mut dyn Write) -> Result<()> {
let type_info = TypeInfo::from_module(data);
write!(w, r#"loaded["temp"] = (function() "#)?;
writeln!(w, r#"loaded["temp"] = (function()"#)?;
codegen_luau::from_module_typed(data, &type_info, w)?;
writeln!(w, "end)()(linked)")?;