refactor(wgsl-out): use for loop for function arg. writing

This commit is contained in:
Erich Gubler
2022-10-18 21:50:57 -04:00
committed by Connor Fitzgerald
parent 469272c613
commit df4e40327c

View File

@@ -1609,15 +1609,7 @@ impl<W: Write> Writer<W> {
Function::Regular(fun_name) => {
write!(self.out, "{}(", fun_name)?;
self.write_expr(module, arg, func_ctx)?;
if let Some(arg) = arg1 {
write!(self.out, ", ")?;
self.write_expr(module, arg, func_ctx)?;
}
if let Some(arg) = arg2 {
write!(self.out, ", ")?;
self.write_expr(module, arg, func_ctx)?;
}
if let Some(arg) = arg3 {
for arg in IntoIterator::into_iter([arg1, arg2, arg3]).flatten() {
write!(self.out, ", ")?;
self.write_expr(module, arg, func_ctx)?;
}