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:
parent
e61ed4520f
commit
fd387a37c3
|
@ -1149,7 +1149,7 @@ bool GeneratorImpl::EmitReturn(const ast::ReturnStatement* stmt) {
|
||||||
|
|
||||||
bool GeneratorImpl::EmitConstAssert(const ast::ConstAssert* stmt) {
|
bool GeneratorImpl::EmitConstAssert(const ast::ConstAssert* stmt) {
|
||||||
auto out = line();
|
auto out = line();
|
||||||
out << "static_assert ";
|
out << "const_assert ";
|
||||||
if (!EmitExpression(out, stmt->condition)) {
|
if (!EmitExpression(out, stmt->condition)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalConstAssert) {
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
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();
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
EXPECT_EQ(gen.result(), R"(fn f() {
|
EXPECT_EQ(gen.result(), R"(fn f() {
|
||||||
static_assert true;
|
const_assert true;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue