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 <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair 2022-10-26 21:54:06 +00:00 committed by Dawn LUCI CQ
parent 2e376a9bb0
commit 81ecd739b0
1 changed files with 7 additions and 6 deletions

View File

@ -33,6 +33,13 @@ namespace tint::sem {
/// ast::MemberAccessorExpression node. /// ast::MemberAccessorExpression node.
class MemberAccessorExpression : public Castable<MemberAccessorExpression, Expression> { class MemberAccessorExpression : public Castable<MemberAccessorExpression, Expression> {
public: public:
/// Destructor
~MemberAccessorExpression() override;
/// @returns the object that holds the member being accessed
const Expression* Object() const { return object_; }
protected:
/// Constructor /// Constructor
/// @param declaration the AST node /// @param declaration the AST node
/// @param type the resolved type of the expression /// @param type the resolved type of the expression
@ -51,12 +58,6 @@ class MemberAccessorExpression : public Castable<MemberAccessorExpression, Expre
bool has_side_effects, bool has_side_effects,
const Variable* source_var = nullptr); const Variable* source_var = nullptr);
/// Destructor
~MemberAccessorExpression() override;
/// @returns the object that holds the member being accessed
const Expression* Object() const { return object_; }
private: private:
Expression const* const object_; Expression const* const object_;
}; };