Add result_type into ast::Expression

This CL adds a result_type into the expression to hold the computed
result type for the expression.

Bug: tint:5
Change-Id: I5f2ee35e520f918828cf8cf7bc6fdf6a1b5ebd5f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18824
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair 2020-04-06 18:44:09 +00:00 committed by dan sinclair
parent fa9dbf0dda
commit a71e1a50c8
1 changed files with 9 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#define SRC_AST_EXPRESSION_H_
#include "src/ast/node.h"
#include "src/ast/type/type.h"
namespace tint {
namespace ast {
@ -37,6 +38,12 @@ class Expression : public Node {
public:
~Expression() override;
/// Sets the resulting type of this expression
/// @param type the result type to set
void set_result_type(type::Type* type) { result_type_ = type; }
/// @returns the resulting type from this expression
type::Type* result_type() const { return result_type_; }
/// @returns true if this is an array accessor expression
virtual bool IsArrayAccessor() const { return false; }
/// @returns true if this is an as expression
@ -94,6 +101,8 @@ class Expression : public Node {
private:
Expression(const Expression&) = delete;
type::Type* result_type_ = nullptr;
};
} // namespace ast