mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 17:05:31 +00:00
tint: Remove semicolon as struct member delimeter
Fixup a couple of internal Dawn shaders that used this syntax. Fixed: tint:1475 Change-Id: Ibd6b3309944bfd955e724fef5d71d1297a84ef5f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93361 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
5286ea9d16
commit
cfa951a662
@@ -275,8 +275,8 @@ TEST(ReplaceIdentifierTest, NotApplicable5) {
|
||||
// (`read` for uniform storage class).
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: S;
|
||||
@group(1) @binding(1) var<uniform> b: S;
|
||||
@@ -310,8 +310,8 @@ TEST(ReplaceIdentifierTest, NotApplicable6) {
|
||||
// Can't replace `ptr_b` with `a` since the latter is not a pointer.
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: S;
|
||||
@group(1) @binding(1) var<uniform> b: S;
|
||||
@@ -346,8 +346,8 @@ TEST(ReplaceIdentifierTest, NotApplicable8) {
|
||||
// storage class.
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: S;
|
||||
@group(1) @binding(1) var<uniform> b: S;
|
||||
@@ -382,8 +382,8 @@ TEST(ReplaceIdentifierTest, NotApplicable9) {
|
||||
// Can't replace `b` with `e` since the latter is not a reference.
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: S;
|
||||
let e = 3;
|
||||
@@ -418,8 +418,8 @@ TEST(ReplaceIdentifierTest, NotApplicable10) {
|
||||
// Can't replace `b` with `e` since the latter has a wrong access mode.
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: S;
|
||||
@group(0) @binding(0) var<storage, read_write> e: S;
|
||||
|
||||
@@ -1348,12 +1348,6 @@ Expect<ast::StructMemberList> ParserImpl::expect_struct_body_decl() {
|
||||
members.push_back(member.value);
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1475): Remove support for semicolons.
|
||||
if (auto sc = peek(); sc.Is(Token::Type::kSemicolon)) {
|
||||
deprecated(sc.source(), "struct members should be separated with commas");
|
||||
next();
|
||||
continue;
|
||||
}
|
||||
if (!match(Token::Type::kComma)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -104,23 +104,5 @@ TEST_F(ParserImplTest, StructDecl_MissingBracketLeft) {
|
||||
EXPECT_EQ(p->error(), "1:10: expected '{' for struct declaration");
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1475): Remove this.
|
||||
TEST_F(ParserImplTest, DEPRECATED_StructDecl_Parses_WithSemicolons) {
|
||||
auto p = parser(R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
})");
|
||||
auto s = p->struct_decl();
|
||||
EXPECT_FALSE(p->has_error());
|
||||
EXPECT_FALSE(s.errored);
|
||||
EXPECT_TRUE(s.matched);
|
||||
ASSERT_NE(s.value, nullptr);
|
||||
ASSERT_EQ(s->name, p->builder().Symbols().Register("S"));
|
||||
ASSERT_EQ(s->members.size(), 2u);
|
||||
EXPECT_EQ(s->members[0]->symbol, p->builder().Symbols().Register("a"));
|
||||
EXPECT_EQ(s->members[1]->symbol, p->builder().Symbols().Register("b"));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::reader::wgsl
|
||||
|
||||
Reference in New Issue
Block a user