namespace GL {
namespace SL {
+/** Base class for validators. Contains some utilities for adding diagnostic
+messages. */
class Validator: protected TraversingVisitor
{
protected:
void add_info(Node &, const std::string &);
};
+/** Verifies that declarations are valid in isolation. */
class DeclarationValidator: private Validator
{
private:
virtual void visit(FunctionDeclaration &);
};
+/** Verifies that identifiers are unique or, in the case of functions, are
+overloaded only in valid ways. */
class IdentifierValidator: private Validator
{
private:
virtual void visit(FunctionDeclaration &);
};
+/** Verifies that there are no unresolved references. */
class ReferenceValidator: private Validator
{
public:
virtual void visit(FunctionDeclaration &);
};
+/** Verifies that expressions are valid. In most cases an invalid expression
+is indicated by a null result type. */
class ExpressionValidator: private Validator
{
private:
virtual void visit(Return &);
};
+/** Verifies that stage input and output interfaces are valid. Linked
+variables must have matching types and locations and there must not be any
+overlap in locations. */
class StageInterfaceValidator: private Validator
{
private:
virtual void visit(FunctionDeclaration &) { }
};
+/** Verifies that uniform interfaces are valid across the entire module.
+Variables declared with the same binding must have the same name and type. */
class GlobalInterfaceValidator: private Validator
{
private: