mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
ast: Add type nodes
Copy all of the type classes from src/type into ast. Required the merging of: * type::Struct into the existing ast::Struct - ast::Struct now has a name. * type::AccessControl into the existing ast::AccessControl enumerator - The old ast::AccessControl enumerator is now ast::AccessControl::Access Bug: tint:724 Change-Id: Ibb950036ed551ec769c6d3d2c8fb411809cf6931 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48383 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
ba6f260629
commit
8a8d26bbd9
@@ -131,7 +131,8 @@ TEST_P(ArrayDecorationTest, IsValid) {
|
||||
ast::DecorationList{createDecoration(
|
||||
Source{{12, 34}}, *this, params.kind)}))};
|
||||
auto* s = create<ast::Struct>(
|
||||
members, ast::DecorationList{create<ast::StructBlockDecoration>()});
|
||||
Sym("mystruct"), members,
|
||||
ast::DecorationList{create<ast::StructBlockDecoration>()});
|
||||
auto* s_ty = ty.struct_("mystruct", s);
|
||||
AST().AddConstructedType(s_ty);
|
||||
|
||||
@@ -166,7 +167,7 @@ using StructDecorationTest = TestWithParams;
|
||||
TEST_P(StructDecorationTest, IsValid) {
|
||||
auto& params = GetParam();
|
||||
|
||||
auto* s = create<ast::Struct>(ast::StructMemberList{},
|
||||
auto* s = create<ast::Struct>(Sym("mystruct"), ast::StructMemberList{},
|
||||
ast::DecorationList{createDecoration(
|
||||
Source{{12, 34}}, *this, params.kind)});
|
||||
auto* s_ty = ty.struct_("mystruct", s);
|
||||
@@ -207,7 +208,8 @@ TEST_P(StructMemberDecorationTest, IsValid) {
|
||||
Member("a", ty.i32(),
|
||||
ast::DecorationList{
|
||||
createDecoration(Source{{12, 34}}, *this, params.kind)})};
|
||||
auto* s = create<ast::Struct>(members, ast::DecorationList{});
|
||||
auto* s =
|
||||
create<ast::Struct>(Sym("mystruct"), members, ast::DecorationList{});
|
||||
auto* s_ty = ty.struct_("mystruct", s);
|
||||
AST().AddConstructedType(s_ty);
|
||||
|
||||
|
||||
@@ -889,6 +889,7 @@ TEST_F(ResolverTest, Function_ReturnStatements) {
|
||||
|
||||
TEST_F(ResolverTest, Expr_MemberAccessor_Struct) {
|
||||
auto* strct = create<ast::Struct>(
|
||||
Sym("S"),
|
||||
ast::StructMemberList{Member("first_member", ty.i32()),
|
||||
Member("second_member", ty.f32())},
|
||||
ast::DecorationList{});
|
||||
@@ -918,6 +919,7 @@ TEST_F(ResolverTest, Expr_MemberAccessor_Struct) {
|
||||
|
||||
TEST_F(ResolverTest, Expr_MemberAccessor_Struct_Alias) {
|
||||
auto* strct = create<ast::Struct>(
|
||||
Sym("alias"),
|
||||
ast::StructMemberList{Member("first_member", ty.i32()),
|
||||
Member("second_member", ty.f32())},
|
||||
ast::DecorationList{});
|
||||
@@ -999,14 +1001,15 @@ TEST_F(ResolverTest, Expr_Accessor_MultiLevel) {
|
||||
// }
|
||||
//
|
||||
|
||||
auto* strctB =
|
||||
create<ast::Struct>(ast::StructMemberList{Member("foo", ty.vec4<f32>())},
|
||||
ast::DecorationList{});
|
||||
auto* strctB = create<ast::Struct>(
|
||||
Sym("B"), ast::StructMemberList{Member("foo", ty.vec4<f32>())},
|
||||
ast::DecorationList{});
|
||||
auto* stB = ty.struct_("B", strctB);
|
||||
|
||||
sem::Vector vecB(stB, 3);
|
||||
auto* strctA = create<ast::Struct>(
|
||||
ast::StructMemberList{Member("mem", &vecB)}, ast::DecorationList{});
|
||||
auto* strctA =
|
||||
create<ast::Struct>(Sym("A"), ast::StructMemberList{Member("mem", &vecB)},
|
||||
ast::DecorationList{});
|
||||
|
||||
auto* stA = ty.struct_("A", strctA);
|
||||
Global("c", stA, ast::StorageClass::kInput);
|
||||
@@ -1027,6 +1030,7 @@ TEST_F(ResolverTest, Expr_Accessor_MultiLevel) {
|
||||
|
||||
TEST_F(ResolverTest, Expr_MemberAccessor_InBinaryOp) {
|
||||
auto* strct = create<ast::Struct>(
|
||||
Sym("S"),
|
||||
ast::StructMemberList{Member("first_member", ty.f32()),
|
||||
Member("second_member", ty.f32())},
|
||||
ast::DecorationList{});
|
||||
|
||||
@@ -315,7 +315,8 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayIsLast_Pass) {
|
||||
ast::DecorationList decos;
|
||||
decos.push_back(create<ast::StructBlockDecoration>());
|
||||
auto* st =
|
||||
create<ast::Struct>(ast::StructMemberList{Member("vf", ty.f32()),
|
||||
create<ast::Struct>(Sym("Foo"),
|
||||
ast::StructMemberList{Member("vf", ty.f32()),
|
||||
Member("rt", ty.array<f32>())},
|
||||
decos);
|
||||
|
||||
@@ -335,6 +336,7 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayIsLastNoBlock_Fail) {
|
||||
|
||||
ast::DecorationList decos;
|
||||
auto* st = create<ast::Struct>(
|
||||
Sym("Foo"),
|
||||
ast::StructMemberList{Member("vf", ty.f32()),
|
||||
Member(Source{{12, 34}}, "rt", ty.array<f32>())},
|
||||
decos);
|
||||
@@ -362,7 +364,7 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayIsNotLast_Fail) {
|
||||
|
||||
auto* rt = Member(Source{{12, 34}}, "rt", ty.array<f32>());
|
||||
auto* st = create<ast::Struct>(
|
||||
ast::StructMemberList{rt, Member("vf", ty.f32())}, decos);
|
||||
Sym("Foo"), ast::StructMemberList{rt, Member("vf", ty.f32())}, decos);
|
||||
|
||||
auto* struct_type = ty.struct_("Foo", st);
|
||||
|
||||
@@ -438,6 +440,7 @@ TEST_F(ResolverTypeValidationTest, AliasRuntimeArrayIsNotLast_Fail) {
|
||||
ast::DecorationList decos;
|
||||
decos.push_back(create<ast::StructBlockDecoration>());
|
||||
auto* st = create<ast::Struct>(
|
||||
Sym("s"),
|
||||
ast::StructMemberList{Member(Source{{12, 34}}, "b", alias),
|
||||
Member("a", ty.u32())},
|
||||
decos);
|
||||
@@ -467,6 +470,7 @@ TEST_F(ResolverTypeValidationTest, AliasRuntimeArrayIsLast_Pass) {
|
||||
ast::DecorationList decos;
|
||||
decos.push_back(create<ast::StructBlockDecoration>());
|
||||
auto* st = create<ast::Struct>(
|
||||
Sym("s"),
|
||||
ast::StructMemberList{Member("a", ty.u32()), Member("b", alias)}, decos);
|
||||
|
||||
auto* struct_type = ty.struct_("s", st);
|
||||
|
||||
Reference in New Issue
Block a user