- void diagnose(Statement *, Diagnostic::Severity, const std::string &);
- void error(Statement *s, const std::string &m) { diagnose(s, Diagnostic::ERR, m); }
+ void diagnose(Node &, Diagnostic::Severity, const std::string &);
+ void error(Node &n, const std::string &m) { diagnose(n, Diagnostic::ERR, m); }
+};
+
+class TypeValidator: private Validator
+{
+private:
+ bool in_struct;
+
+public:
+ TypeValidator();
+
+ void apply(Stage &s) { stage = &s; s.content.visit(*this); }
+
+private:
+ virtual void visit(BasicTypeDeclaration &);
+ virtual void visit(ImageTypeDeclaration &);
+ virtual void visit(StructDeclaration &);
+ virtual void visit(VariableDeclaration &);