ProgramBuilder: Don't wrap call-exprs with a call-stmts

ast::CallExpression will soon encompase function & intrinsic calls,
along with type-constructors and type-casts. The latter two cannot be
wrapped with a CallStatement, so change
ProgramBuilder::WrapInStatement() to always assign the expression to a
temporary.

Fix the few places that actually relied on this behavior to use
CallStmt() explicitly.

Bug: tint:888
Change-Id: I48b8a2be73128df9cd2b4bdcc00ae81c4a872359
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69104
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-11-12 13:20:46 +00:00
committed by Tint LUCI CQ
parent a539d8d33c
commit 9de93ca105
5 changed files with 40 additions and 43 deletions

View File

@@ -913,8 +913,8 @@ TEST_F(ResolverTest, Function_CallSites) {
auto* call_2 = Call("foo");
auto* bar = Func("bar", ast::VariableList{}, ty.void_(),
{
WrapInStatement(call_1),
WrapInStatement(call_2),
CallStmt(call_1),
CallStmt(call_2),
});
EXPECT_TRUE(r()->Resolve()) << r()->error();