+ virtual void visit(Swizzle &);
+ virtual void visit(BinaryExpression &);
+ virtual void visit(Assignment &);
+ void merge_layouts(Layout &, const Layout &);
+ virtual void visit(VariableDeclaration &);
+ virtual void visit(InterfaceBlock &);
+};
+
+/** Resolves types and lvalueness of expressions. */
+class ExpressionResolver: private TraversingVisitor
+{
+private:
+ enum Compatibility
+ {
+ NOT_COMPATIBLE,
+ LEFT_CONVERTIBLE,
+ RIGHT_CONVERTIBLE,
+ SAME_TYPE
+ };
+
+ Stage *stage;
+ std::vector<BasicTypeDeclaration *> basic_types;
+ bool r_any_resolved;
+
+public:
+ ExpressionResolver();
+
+ bool apply(Stage &);
+
+private:
+ static bool is_scalar(BasicTypeDeclaration &);
+ static bool is_vector_or_matrix(BasicTypeDeclaration &);
+ static BasicTypeDeclaration *get_element_type(BasicTypeDeclaration &);
+ static bool can_convert(BasicTypeDeclaration &, BasicTypeDeclaration &);
+ static Compatibility get_compatibility(BasicTypeDeclaration &, BasicTypeDeclaration &);
+ BasicTypeDeclaration *find_type(BasicTypeDeclaration::Kind, unsigned);
+ BasicTypeDeclaration *find_type(BasicTypeDeclaration &, BasicTypeDeclaration::Kind, unsigned);
+ void convert_to(RefPtr<Expression> &, BasicTypeDeclaration &);
+ bool convert_to_element(RefPtr<Expression> &, BasicTypeDeclaration &);
+ void resolve(Expression &, TypeDeclaration *, bool);
+
+ virtual void visit(Literal &);
+ virtual void visit(ParenthesizedExpression &);
+ virtual void visit(VariableReference &);
+ virtual void visit(InterfaceBlockReference &);
+ virtual void visit(MemberAccess &);
+ virtual void visit(Swizzle &);