Adding const As.* functions to expresssion class
Change-Id: I57fbe9d5c5054b65d64f1992e5e33dd31dd64a36 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20263 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
194b6a2fce
commit
cb883a2817
|
@ -89,6 +89,60 @@ bool Expression::IsUnaryMethod() const {
|
|||
bool Expression::IsUnaryOp() const {
|
||||
return false;
|
||||
}
|
||||
const ArrayAccessorExpression* Expression::AsArrayAccessor() const {
|
||||
assert(IsArrayAccessor());
|
||||
return static_cast<const ArrayAccessorExpression*>(this);
|
||||
}
|
||||
|
||||
const AsExpression* Expression::AsAs() const {
|
||||
assert(IsAs());
|
||||
return static_cast<const AsExpression*>(this);
|
||||
}
|
||||
|
||||
const BinaryExpression* Expression::AsBinary() const {
|
||||
assert(IsBinary());
|
||||
return static_cast<const BinaryExpression*>(this);
|
||||
}
|
||||
|
||||
const CallExpression* Expression::AsCall() const {
|
||||
assert(IsCall());
|
||||
return static_cast<const CallExpression*>(this);
|
||||
}
|
||||
|
||||
const CastExpression* Expression::AsCast() const {
|
||||
assert(IsCast());
|
||||
return static_cast<const CastExpression*>(this);
|
||||
}
|
||||
|
||||
const ConstructorExpression* Expression::AsConstructor() const {
|
||||
assert(IsConstructor());
|
||||
return static_cast<const ConstructorExpression*>(this);
|
||||
}
|
||||
|
||||
const IdentifierExpression* Expression::AsIdentifier() const {
|
||||
assert(IsIdentifier());
|
||||
return static_cast<const IdentifierExpression*>(this);
|
||||
}
|
||||
|
||||
const MemberAccessorExpression* Expression::AsMemberAccessor() const {
|
||||
assert(IsMemberAccessor());
|
||||
return static_cast<const MemberAccessorExpression*>(this);
|
||||
}
|
||||
|
||||
const UnaryDerivativeExpression* Expression::AsUnaryDerivative() const {
|
||||
assert(IsUnaryDerivative());
|
||||
return static_cast<const UnaryDerivativeExpression*>(this);
|
||||
}
|
||||
|
||||
const UnaryMethodExpression* Expression::AsUnaryMethod() const {
|
||||
assert(IsUnaryMethod());
|
||||
return static_cast<const UnaryMethodExpression*>(this);
|
||||
}
|
||||
|
||||
const UnaryOpExpression* Expression::AsUnaryOp() const {
|
||||
assert(IsUnaryOp());
|
||||
return static_cast<const UnaryOpExpression*>(this);
|
||||
}
|
||||
|
||||
ArrayAccessorExpression* Expression::AsArrayAccessor() {
|
||||
assert(IsArrayAccessor());
|
||||
|
|
|
@ -71,6 +71,29 @@ class Expression : public Node {
|
|||
virtual bool IsUnaryOp() const;
|
||||
|
||||
/// @returns the expression as an array accessor
|
||||
const ArrayAccessorExpression* AsArrayAccessor() const;
|
||||
/// @returns the expression as an as
|
||||
const AsExpression* AsAs() const;
|
||||
/// @returns the expression as a call
|
||||
const CallExpression* AsCall() const;
|
||||
/// @returns the expression as a cast
|
||||
const CastExpression* AsCast() const;
|
||||
/// @returns the expression as an identifier
|
||||
const IdentifierExpression* AsIdentifier() const;
|
||||
/// @returns the expression as an constructor
|
||||
const ConstructorExpression* AsConstructor() const;
|
||||
/// @returns the expression as a member accessor
|
||||
const MemberAccessorExpression* AsMemberAccessor() const;
|
||||
/// @returns the expression as a binary expression
|
||||
const BinaryExpression* AsBinary() const;
|
||||
/// @returns the expression as a unary derivative expression
|
||||
const UnaryDerivativeExpression* AsUnaryDerivative() const;
|
||||
/// @returns the expression as a unary method expression
|
||||
const UnaryMethodExpression* AsUnaryMethod() const;
|
||||
/// @returns the expression as a unary op expression
|
||||
const UnaryOpExpression* AsUnaryOp() const;
|
||||
|
||||
/// @returns the expression as an array accessor
|
||||
ArrayAccessorExpression* AsArrayAccessor();
|
||||
/// @returns the expression as an as
|
||||
AsExpression* AsAs();
|
||||
|
|
Loading…
Reference in New Issue