From 81ecd739b0933f182fa68d57c360307f693617bb Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Wed, 26 Oct 2022 21:54:06 +0000 Subject: [PATCH] Protect sem::MemberAccessorExpression constructor. This CL moves the constructor for a sem::MemberAccessorExpression to protected to make it clear that only Swizzle and StructMemberAccess classes can be created. Change-Id: I85eef6c6f41c4c36192d88b84150f15205f1bf22 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107361 Auto-Submit: Dan Sinclair Commit-Queue: Ben Clayton Reviewed-by: Ben Clayton Kokoro: Kokoro --- src/tint/sem/member_accessor_expression.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tint/sem/member_accessor_expression.h b/src/tint/sem/member_accessor_expression.h index b8144f1ca2..2541f33725 100644 --- a/src/tint/sem/member_accessor_expression.h +++ b/src/tint/sem/member_accessor_expression.h @@ -33,6 +33,13 @@ namespace tint::sem { /// ast::MemberAccessorExpression node. class MemberAccessorExpression : public Castable { public: + /// Destructor + ~MemberAccessorExpression() override; + + /// @returns the object that holds the member being accessed + const Expression* Object() const { return object_; } + + protected: /// Constructor /// @param declaration the AST node /// @param type the resolved type of the expression @@ -51,12 +58,6 @@ class MemberAccessorExpression : public Castable