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>
diff --git a/src/ast/expression.h b/src/ast/expression.h
index 67ad3c9..63695b2 100644
--- a/src/ast/expression.h
+++ b/src/ast/expression.h
@@ -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 @@
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 @@
private:
Expression(const Expression&) = delete;
+
+ type::Type* result_type_ = nullptr;
};
} // namespace ast