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

This commit is contained in:
Erich Gubler authored and Connor Fitzgerald committed 2022-10-26 16:31:48 -04:00
1 parent 469272c613
commit df4e40327c
1 file changed
+1 -9
+1 -9
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)?;
}