tint: Fix WGSL emission of const_assert

Fixed: tint:1858
Change-Id: I5cd2fc4d7dc0a9a0bd48330366a99dd726e42659
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122661
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton 2023-03-06 14:03:08 +00:00 committed by Dawn LUCI CQ
parent e61ed4520f
commit fd387a37c3
2 changed files with 3 additions and 3 deletions

View File

@ -1149,7 +1149,7 @@ bool GeneratorImpl::EmitReturn(const ast::ReturnStatement* stmt) {
bool GeneratorImpl::EmitConstAssert(const ast::ConstAssert* stmt) {
auto out = line();
out << "static_assert ";
out << "const_assert ";
if (!EmitExpression(out, stmt->condition)) {
return false;
}

View File

@ -27,7 +27,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalConstAssert) {
GeneratorImpl& gen = Build();
ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(static_assert true;
EXPECT_EQ(gen.result(), R"(const_assert true;
)");
}
@ -38,7 +38,7 @@ TEST_F(WgslGeneratorImplTest, Emit_FunctionConstAssert) {
ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(fn f() {
static_assert true;
const_assert true;
}
)");
}