Naga(msl): Clear named expressions after writing each function (#4594)

This appears to match other backends, and fixes
fix the case where expressions which were named in earlier
functions are used in local variable declarations
This commit is contained in:
Daniel McNab 2023-11-02 18:46:36 +00:00 committed by Connor Fitzgerald
parent ca96cb428c
commit 9d57a60d4b
No known key found for this signature in database
GPG Key ID: CF0A1F83B4E1A995

View File

@ -3643,10 +3643,10 @@ impl<W: Write> Writer<W> {
writeln!(self.out, ";")?;
}
self.named_expressions.clear();
self.update_expressions_to_bake(fun, fun_info, &context.expression);
self.put_block(back::Level(1), &fun.body, &context)?;
writeln!(self.out, "}}")?;
self.named_expressions.clear();
}
let mut info = TranslationInfo {
@ -4313,13 +4313,13 @@ impl<W: Write> Writer<W> {
writeln!(self.out, ";")?;
}
self.named_expressions.clear();
self.update_expressions_to_bake(fun, fun_info, &context.expression);
self.put_block(back::Level(1), &fun.body, &context)?;
writeln!(self.out, "}}")?;
if ep_index + 1 != module.entry_points.len() {
writeln!(self.out)?;
}
self.named_expressions.clear();
}
Ok(info)