diff --git a/src/ast/access_decoration.cc b/src/ast/access_decoration.cc index 18d0d6e06b..a22b99bad3 100644 --- a/src/ast/access_decoration.cc +++ b/src/ast/access_decoration.cc @@ -28,10 +28,6 @@ DecorationKind AccessDecoration::GetKind() const { return Kind; } -bool AccessDecoration::IsKind(DecorationKind kind) const { - return kind == Kind || Base::IsKind(kind); -} - bool AccessDecoration::IsAccess() const { return true; } diff --git a/src/ast/access_decoration.h b/src/ast/access_decoration.h index 489c0e9bbe..41baa63e66 100644 --- a/src/ast/access_decoration.h +++ b/src/ast/access_decoration.h @@ -38,11 +38,6 @@ class AccessDecoration : public Castable { /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is an access decoration bool IsAccess() const override; diff --git a/src/ast/array_decoration.cc b/src/ast/array_decoration.cc index 088a87f474..62338b27e1 100644 --- a/src/ast/array_decoration.cc +++ b/src/ast/array_decoration.cc @@ -31,10 +31,6 @@ DecorationKind ArrayDecoration::GetKind() const { return Kind; } -bool ArrayDecoration::IsKind(DecorationKind kind) const { - return kind == Kind; -} - bool ArrayDecoration::IsStride() const { return false; } diff --git a/src/ast/array_decoration.h b/src/ast/array_decoration.h index 92cb00282e..43141a0034 100644 --- a/src/ast/array_decoration.h +++ b/src/ast/array_decoration.h @@ -37,11 +37,6 @@ class ArrayDecoration : public Castable { /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a stride decoration virtual bool IsStride() const; diff --git a/src/ast/binding_decoration.cc b/src/ast/binding_decoration.cc index 671e319d3b..73f3836a3f 100644 --- a/src/ast/binding_decoration.cc +++ b/src/ast/binding_decoration.cc @@ -28,10 +28,6 @@ DecorationKind BindingDecoration::GetKind() const { return Kind; } -bool BindingDecoration::IsKind(DecorationKind kind) const { - return kind == Kind || Base::IsKind(kind); -} - bool BindingDecoration::IsBinding() const { return true; } diff --git a/src/ast/binding_decoration.h b/src/ast/binding_decoration.h index e747edc7fd..8799656531 100644 --- a/src/ast/binding_decoration.h +++ b/src/ast/binding_decoration.h @@ -38,11 +38,6 @@ class BindingDecoration /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a binding decoration bool IsBinding() const override; diff --git a/src/ast/builtin_decoration.cc b/src/ast/builtin_decoration.cc index e59b592f14..a6202905d5 100644 --- a/src/ast/builtin_decoration.cc +++ b/src/ast/builtin_decoration.cc @@ -28,10 +28,6 @@ DecorationKind BuiltinDecoration::GetKind() const { return Kind; } -bool BuiltinDecoration::IsKind(DecorationKind kind) const { - return kind == Kind || Base::IsKind(kind); -} - bool BuiltinDecoration::IsBuiltin() const { return true; } diff --git a/src/ast/builtin_decoration.h b/src/ast/builtin_decoration.h index cc0dc6d5ab..4aaf215b09 100644 --- a/src/ast/builtin_decoration.h +++ b/src/ast/builtin_decoration.h @@ -37,11 +37,6 @@ class BuiltinDecoration /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a builtin decoration bool IsBuiltin() const override; diff --git a/src/ast/constant_id_decoration.cc b/src/ast/constant_id_decoration.cc index 7b1bc534df..405d06418d 100644 --- a/src/ast/constant_id_decoration.cc +++ b/src/ast/constant_id_decoration.cc @@ -28,10 +28,6 @@ DecorationKind ConstantIdDecoration::GetKind() const { return Kind; } -bool ConstantIdDecoration::IsKind(DecorationKind kind) const { - return kind == Kind || Base::IsKind(kind); -} - bool ConstantIdDecoration::IsConstantId() const { return true; } diff --git a/src/ast/constant_id_decoration.h b/src/ast/constant_id_decoration.h index cc260cf5b5..ec8512c002 100644 --- a/src/ast/constant_id_decoration.h +++ b/src/ast/constant_id_decoration.h @@ -37,11 +37,6 @@ class ConstantIdDecoration /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a constant_id decoration bool IsConstantId() const override; diff --git a/src/ast/decoration.h b/src/ast/decoration.h index bf30452b80..69e3287645 100644 --- a/src/ast/decoration.h +++ b/src/ast/decoration.h @@ -54,11 +54,6 @@ class Decoration : public Castable { /// @return the decoration kind virtual DecorationKind GetKind() const = 0; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - virtual bool IsKind(DecorationKind kind) const = 0; - /// @returns true if the node is valid bool IsValid() const override; @@ -68,19 +63,6 @@ class Decoration : public Castable { explicit Decoration(const Source& source) : Base(source) {} }; -/// As dynamically casts |deco| to the target type |TO|. -/// @return the cast decoration, or nullptr if |deco| is not of the type |TO|. -template -TO* As(Decoration* deco) { - if (deco == nullptr) { - return nullptr; - } - if (deco->Is()) { - return static_cast(deco); - } - return nullptr; -} - /// A list of decorations using DecorationList = std::vector; diff --git a/src/ast/decoration_test.cc b/src/ast/decoration_test.cc index 1df9f9cf89..d5149795f0 100644 --- a/src/ast/decoration_test.cc +++ b/src/ast/decoration_test.cc @@ -81,112 +81,6 @@ TEST_F(DecorationTest, Kinds) { EXPECT_EQ(LocationDecoration::Kind, DecorationKind::kLocation); } -TEST_F(DecorationTest, IsKind) { - std::vector all_kinds{ - DecorationKind::kArray, DecorationKind::kStride, - DecorationKind::kFunction, DecorationKind::kStage, - DecorationKind::kWorkgroup, DecorationKind::kStruct, - DecorationKind::kStructMember, DecorationKind::kStructMemberOffset, - DecorationKind::kType, DecorationKind::kAccess, - DecorationKind::kVariable, DecorationKind::kBinding, - DecorationKind::kBuiltin, DecorationKind::kConstantId, - DecorationKind::kLocation, - }; - - struct ExpectedKinds { - DecorationKind kind; - std::unordered_set expect_true; - }; - - // kArray - // | kStride - // kFunction - // | kStage - // | kWorkgroup - // kStruct - // kStructMember - // | kStructMemberOffset - // kType - // | kAccess - // kVariable - // | kBinding - // | kBuiltin - // | kConstantId - // | kLocation - std::unordered_map> - kind_is{ - { - DecorationKind::kStride, - {DecorationKind::kArray, DecorationKind::kStride}, - }, - { - DecorationKind::kStage, - {DecorationKind::kFunction, DecorationKind::kStage}, - }, - { - DecorationKind::kWorkgroup, - {DecorationKind::kFunction, DecorationKind::kWorkgroup}, - }, - { - DecorationKind::kStruct, - {DecorationKind::kStruct}, - }, - { - DecorationKind::kStructMemberOffset, - {DecorationKind::kStructMember, - DecorationKind::kStructMemberOffset}, - }, - { - DecorationKind::kAccess, - {DecorationKind::kType, DecorationKind::kAccess}, - }, - { - DecorationKind::kBinding, - {DecorationKind::kVariable, DecorationKind::kBinding}, - }, - { - DecorationKind::kBuiltin, - {DecorationKind::kVariable, DecorationKind::kBuiltin}, - }, - { - DecorationKind::kConstantId, - {DecorationKind::kVariable, DecorationKind::kConstantId}, - }, - { - DecorationKind::kLocation, - {DecorationKind::kVariable, DecorationKind::kLocation}, - }, - }; - - auto check = [&](Decoration* d) { - auto& is_set = kind_is[d->GetKind()]; - for (auto test : all_kinds) { - bool is_kind = is_set.find(test) != is_set.end(); - EXPECT_EQ(d->IsKind(test), is_kind) - << "decoration: " << d->GetKind() << " IsKind(" << test << ")"; - } - }; - StrideDecoration stride(0, {}); - StageDecoration stage(PipelineStage::kNone, {}); - WorkgroupDecoration workgroup(0, {}); - StructMemberOffsetDecoration struct_member_offset(0, {}); - AccessDecoration access(AccessControl::kReadOnly, {}); - BindingDecoration binding(0, {}); - BuiltinDecoration builtin(Builtin::kNone, {}); - ConstantIdDecoration constant_id(0, {}); - LocationDecoration location(0, {}); - - check(&stride); - check(&stage); - check(&workgroup); - check(&struct_member_offset); - check(&access); - check(&binding); - check(&builtin); - check(&constant_id); - check(&location); -} - } // namespace } // namespace ast } // namespace tint diff --git a/src/ast/function_decoration.cc b/src/ast/function_decoration.cc index 36861c4093..2f8fe6fa77 100644 --- a/src/ast/function_decoration.cc +++ b/src/ast/function_decoration.cc @@ -32,10 +32,6 @@ DecorationKind FunctionDecoration::GetKind() const { return Kind; } -bool FunctionDecoration::IsKind(DecorationKind kind) const { - return kind == Kind; -} - bool FunctionDecoration::IsStage() const { return false; } diff --git a/src/ast/function_decoration.h b/src/ast/function_decoration.h index 5c15a6cee3..4fb50ab413 100644 --- a/src/ast/function_decoration.h +++ b/src/ast/function_decoration.h @@ -38,11 +38,6 @@ class FunctionDecoration : public Castable { /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a stage decoration virtual bool IsStage() const; /// @returns true if this is a workgroup decoration diff --git a/src/ast/location_decoration.cc b/src/ast/location_decoration.cc index 1ca0e39271..bc0c625f27 100644 --- a/src/ast/location_decoration.cc +++ b/src/ast/location_decoration.cc @@ -28,10 +28,6 @@ DecorationKind LocationDecoration::GetKind() const { return Kind; } -bool LocationDecoration::IsKind(DecorationKind kind) const { - return kind == Kind || Base::IsKind(kind); -} - bool LocationDecoration::IsLocation() const { return true; } diff --git a/src/ast/location_decoration.h b/src/ast/location_decoration.h index c99267d16a..2d1d029a63 100644 --- a/src/ast/location_decoration.h +++ b/src/ast/location_decoration.h @@ -38,11 +38,6 @@ class LocationDecoration /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a location decoration bool IsLocation() const override; diff --git a/src/ast/stage_decoration.cc b/src/ast/stage_decoration.cc index 307503ba9d..da0f52b276 100644 --- a/src/ast/stage_decoration.cc +++ b/src/ast/stage_decoration.cc @@ -28,10 +28,6 @@ DecorationKind StageDecoration::GetKind() const { return Kind; } -bool StageDecoration::IsKind(DecorationKind kind) const { - return kind == Kind || Base::IsKind(kind); -} - bool StageDecoration::IsStage() const { return true; } diff --git a/src/ast/stage_decoration.h b/src/ast/stage_decoration.h index 15b1d60485..15d7490f6b 100644 --- a/src/ast/stage_decoration.h +++ b/src/ast/stage_decoration.h @@ -36,11 +36,6 @@ class StageDecoration : public Castable { /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a stage decoration bool IsStage() const override; diff --git a/src/ast/stride_decoration.cc b/src/ast/stride_decoration.cc index 8e30f3c9c7..a0b2c4e515 100644 --- a/src/ast/stride_decoration.cc +++ b/src/ast/stride_decoration.cc @@ -26,10 +26,6 @@ DecorationKind StrideDecoration::GetKind() const { return Kind; } -bool StrideDecoration::IsKind(DecorationKind kind) const { - return kind == Kind || Base::IsKind(kind); -} - bool StrideDecoration::IsStride() const { return true; } diff --git a/src/ast/stride_decoration.h b/src/ast/stride_decoration.h index a64754a2cf..84acdd3b1f 100644 --- a/src/ast/stride_decoration.h +++ b/src/ast/stride_decoration.h @@ -39,11 +39,6 @@ class StrideDecoration : public Castable { /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a stride decoration bool IsStride() const override; diff --git a/src/ast/struct_decoration.cc b/src/ast/struct_decoration.cc index 68b54a4394..4b372fd2d9 100644 --- a/src/ast/struct_decoration.cc +++ b/src/ast/struct_decoration.cc @@ -27,9 +27,5 @@ DecorationKind StructDecoration::GetKind() const { return Kind; } -bool StructDecoration::IsKind(DecorationKind kind) const { - return kind == Kind; -} - } // namespace ast } // namespace tint diff --git a/src/ast/struct_decoration.h b/src/ast/struct_decoration.h index 75d3e69a82..bba2162d2a 100644 --- a/src/ast/struct_decoration.h +++ b/src/ast/struct_decoration.h @@ -35,11 +35,6 @@ class StructDecoration : public Castable { /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a block struct virtual bool IsBlock() const = 0; diff --git a/src/ast/struct_member_decoration.cc b/src/ast/struct_member_decoration.cc index b56ec520c1..9c3118d9ce 100644 --- a/src/ast/struct_member_decoration.cc +++ b/src/ast/struct_member_decoration.cc @@ -32,10 +32,6 @@ DecorationKind StructMemberDecoration::GetKind() const { return Kind; } -bool StructMemberDecoration::IsKind(DecorationKind kind) const { - return kind == Kind; -} - bool StructMemberDecoration::IsOffset() const { return false; } diff --git a/src/ast/struct_member_decoration.h b/src/ast/struct_member_decoration.h index 2c1400a9c7..837ecc0756 100644 --- a/src/ast/struct_member_decoration.h +++ b/src/ast/struct_member_decoration.h @@ -38,11 +38,6 @@ class StructMemberDecoration /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is an offset decoration virtual bool IsOffset() const; diff --git a/src/ast/struct_member_offset_decoration.cc b/src/ast/struct_member_offset_decoration.cc index 24366584e1..9ded0faff0 100644 --- a/src/ast/struct_member_offset_decoration.cc +++ b/src/ast/struct_member_offset_decoration.cc @@ -27,10 +27,6 @@ DecorationKind StructMemberOffsetDecoration::GetKind() const { return Kind; } -bool StructMemberOffsetDecoration::IsKind(DecorationKind kind) const { - return kind == Kind || Base::IsKind(kind); -} - bool StructMemberOffsetDecoration::IsOffset() const { return true; } diff --git a/src/ast/struct_member_offset_decoration.h b/src/ast/struct_member_offset_decoration.h index 531336df82..e0f015cb1d 100644 --- a/src/ast/struct_member_offset_decoration.h +++ b/src/ast/struct_member_offset_decoration.h @@ -41,11 +41,6 @@ class StructMemberOffsetDecoration /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is an offset decoration bool IsOffset() const override; diff --git a/src/ast/type_decoration.cc b/src/ast/type_decoration.cc index 3f08e1a43d..84f9e5f3ba 100644 --- a/src/ast/type_decoration.cc +++ b/src/ast/type_decoration.cc @@ -31,10 +31,6 @@ DecorationKind TypeDecoration::GetKind() const { return Kind; } -bool TypeDecoration::IsKind(DecorationKind kind) const { - return kind == Kind; -} - bool TypeDecoration::IsAccess() const { return false; } diff --git a/src/ast/type_decoration.h b/src/ast/type_decoration.h index 7b962184dc..987cc9c2c1 100644 --- a/src/ast/type_decoration.h +++ b/src/ast/type_decoration.h @@ -38,11 +38,6 @@ class TypeDecoration : public Castable { /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is an access decoration virtual bool IsAccess() const; diff --git a/src/ast/variable_decoration.cc b/src/ast/variable_decoration.cc index 84ed238558..a3e605d1f2 100644 --- a/src/ast/variable_decoration.cc +++ b/src/ast/variable_decoration.cc @@ -35,10 +35,6 @@ DecorationKind VariableDecoration::GetKind() const { return Kind; } -bool VariableDecoration::IsKind(DecorationKind kind) const { - return kind == Kind; -} - bool VariableDecoration::IsBinding() const { return false; } diff --git a/src/ast/variable_decoration.h b/src/ast/variable_decoration.h index 8fd4e44def..7dc1bc8bb7 100644 --- a/src/ast/variable_decoration.h +++ b/src/ast/variable_decoration.h @@ -42,11 +42,6 @@ class VariableDecoration : public Castable { /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a binding decoration virtual bool IsBinding() const; /// @returns true if this is a builtin decoration diff --git a/src/ast/workgroup_decoration.cc b/src/ast/workgroup_decoration.cc index 045143bd08..1d3040169a 100644 --- a/src/ast/workgroup_decoration.cc +++ b/src/ast/workgroup_decoration.cc @@ -39,10 +39,6 @@ DecorationKind WorkgroupDecoration::GetKind() const { return Kind; } -bool WorkgroupDecoration::IsKind(DecorationKind kind) const { - return kind == Kind || Base::IsKind(kind); -} - bool WorkgroupDecoration::IsWorkgroup() const { return true; } diff --git a/src/ast/workgroup_decoration.h b/src/ast/workgroup_decoration.h index 41c690ccb2..bc6bd99fa7 100644 --- a/src/ast/workgroup_decoration.h +++ b/src/ast/workgroup_decoration.h @@ -51,11 +51,6 @@ class WorkgroupDecoration /// @return the decoration kind DecorationKind GetKind() const override; - /// @param kind the decoration kind - /// @return true if this Decoration is of the (or derives from) the given - /// kind. - bool IsKind(DecorationKind kind) const override; - /// @returns true if this is a workgroup decoration bool IsWorkgroup() const override; diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index 11ef56a0f3..675c2fecba 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -2895,7 +2895,7 @@ std::vector ParserImpl::take_decorations(ast::DecorationList& in) { out.reserve(in.size()); for (auto* deco : in) { if (deco->Is()) { - out.emplace_back(ast::As(deco)); + out.emplace_back(deco->As()); } else { remaining.emplace_back(deco); } diff --git a/src/reader/wgsl/parser_impl_function_decoration_list_test.cc b/src/reader/wgsl/parser_impl_function_decoration_list_test.cc index 9a7da60c48..c77e78371e 100644 --- a/src/reader/wgsl/parser_impl_function_decoration_list_test.cc +++ b/src/reader/wgsl/parser_impl_function_decoration_list_test.cc @@ -30,8 +30,8 @@ TEST_F(ParserImplTest, FunctionDecorationList_Parses) { EXPECT_TRUE(decos.matched); ASSERT_EQ(decos.value.size(), 2u); - auto* deco_0 = ast::As(decos.value[0]); - auto* deco_1 = ast::As(decos.value[1]); + auto* deco_0 = decos.value[0]->As(); + auto* deco_1 = decos.value[1]->As(); ASSERT_NE(deco_0, nullptr); ASSERT_NE(deco_1, nullptr); diff --git a/src/reader/wgsl/parser_impl_function_decoration_test.cc b/src/reader/wgsl/parser_impl_function_decoration_test.cc index 3877cbc1a2..966937bc97 100644 --- a/src/reader/wgsl/parser_impl_function_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_function_decoration_test.cc @@ -30,7 +30,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup) { EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr) << p->error(); ASSERT_FALSE(p->has_error()); - auto* func_deco = ast::As(deco.value); + auto* func_deco = deco.value->As(); ASSERT_NE(func_deco, nullptr); ASSERT_TRUE(func_deco->IsWorkgroup()); @@ -50,7 +50,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_2Param) { EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr) << p->error(); ASSERT_FALSE(p->has_error()); - auto* func_deco = ast::As(deco.value); + auto* func_deco = deco.value->As(); ASSERT_NE(func_deco, nullptr) << p->error(); ASSERT_TRUE(func_deco->IsWorkgroup()); @@ -70,7 +70,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_3Param) { EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr) << p->error(); ASSERT_FALSE(p->has_error()); - auto* func_deco = ast::As(deco.value); + auto* func_deco = deco.value->As(); ASSERT_NE(func_deco, nullptr); ASSERT_TRUE(func_deco->IsWorkgroup()); @@ -257,7 +257,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Stage) { EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr) << p->error(); ASSERT_FALSE(p->has_error()); - auto* func_deco = ast::As(deco.value); + auto* func_deco = deco.value->As(); ASSERT_NE(func_deco, nullptr); ASSERT_TRUE(func_deco->IsStage()); EXPECT_EQ(func_deco->AsStage()->value(), ast::PipelineStage::kCompute); diff --git a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc index a7f320d40f..3cfa9dc1e2 100644 --- a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc @@ -28,7 +28,7 @@ TEST_F(ParserImplTest, StructDecorationDecl_Parses) { EXPECT_FALSE(decos.errored); EXPECT_TRUE(decos.matched); ASSERT_EQ(decos.value.size(), 1u); - auto* struct_deco = ast::As(decos.value[0]); + auto* struct_deco = decos.value[0]->As(); EXPECT_TRUE(struct_deco->IsBlock()); } diff --git a/src/reader/wgsl/parser_impl_struct_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_test.cc index 9e5f09a775..181045115c 100644 --- a/src/reader/wgsl/parser_impl_struct_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decoration_test.cc @@ -43,7 +43,7 @@ TEST_P(StructDecorationTest, Parses) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* struct_deco = ast::As(deco.value); + auto* struct_deco = deco.value->As(); ASSERT_NE(struct_deco, nullptr); EXPECT_EQ(struct_deco->IsBlock(), params.is_block); } diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc index d158cec62c..6d0a3174e6 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc @@ -48,7 +48,7 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_Single) { EXPECT_FALSE(decos.errored); EXPECT_TRUE(decos.matched); ASSERT_EQ(decos.value.size(), 1u); - auto* deco = ast::As(decos.value[0]); + auto* deco = decos.value[0]->As(); ASSERT_NE(deco, nullptr); EXPECT_TRUE(deco->IsOffset()); } diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc index 76da67abc5..c9f235784f 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc @@ -30,7 +30,7 @@ TEST_F(ParserImplTest, StructMemberDecoration_Offset) { ASSERT_NE(deco.value, nullptr); ASSERT_FALSE(p->has_error()); - auto* member_deco = ast::As(deco.value); + auto* member_deco = deco.value->As(); ASSERT_NE(member_deco, nullptr); ASSERT_TRUE(member_deco->IsOffset()); diff --git a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc index f10b13dded..81f5356cb6 100644 --- a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc +++ b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc @@ -31,8 +31,8 @@ TEST_F(ParserImplTest, VariableDecorationList_Parses) { ASSERT_TRUE(decos.matched); ASSERT_EQ(decos.value.size(), 2u); - auto* deco_0 = ast::As(decos.value[0]); - auto* deco_1 = ast::As(decos.value[1]); + auto* deco_0 = decos.value[0]->As(); + auto* deco_1 = decos.value[1]->As(); ASSERT_NE(deco_0, nullptr); ASSERT_NE(deco_1, nullptr); diff --git a/src/reader/wgsl/parser_impl_variable_decoration_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_test.cc index ecef7b0ac6..3126df8b83 100644 --- a/src/reader/wgsl/parser_impl_variable_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_variable_decoration_test.cc @@ -31,7 +31,7 @@ TEST_F(ParserImplTest, VariableDecoration_Location) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* var_deco = ast::As(deco.value); + auto* var_deco = deco.value->As(); ASSERT_NE(var_deco, nullptr); ASSERT_FALSE(p->has_error()); ASSERT_TRUE(var_deco->IsLocation()); @@ -101,7 +101,7 @@ TEST_P(BuiltinTest, VariableDecoration_Builtin) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* var_deco = ast::As(deco.value); + auto* var_deco = deco.value->As(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_NE(var_deco, nullptr); ASSERT_TRUE(var_deco->IsBuiltin()); @@ -180,7 +180,7 @@ TEST_F(ParserImplTest, VariableDecoration_Binding) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* var_deco = ast::As(deco.value); + auto* var_deco = deco.value->As(); ASSERT_NE(var_deco, nullptr); ASSERT_FALSE(p->has_error()); ASSERT_TRUE(var_deco->IsBinding()); @@ -237,7 +237,7 @@ TEST_F(ParserImplTest, VariableDecoration_set) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* var_deco = ast::As(deco.value); + auto* var_deco = deco.value->As(); ASSERT_FALSE(p->has_error()); ASSERT_NE(var_deco, nullptr); ASSERT_TRUE(var_deco->IsSet());