]> git.tdb.fi Git - libs/gl.git/commitdiff
Rename DeclarationValidator to IdentifierValidator
authorMikko Rasa <tdb@tdb.fi>
Thu, 18 Mar 2021 09:49:59 +0000 (11:49 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 18 Mar 2021 11:25:08 +0000 (13:25 +0200)
This name more accurately describes what it does.

source/glsl/compiler.cpp
source/glsl/validate.cpp
source/glsl/validate.h

index 8a18fdf48df64d6224f9fc3f8d0b00d6a749be7e..40dfede3a68688e5ec9ef7a9fb23576af28d393e 100644 (file)
@@ -301,7 +301,7 @@ void Compiler::resolve(Stage &stage, unsigned flags)
 bool Compiler::validate(Stage &stage)
 {
        TypeValidator().apply(stage);
-       DeclarationValidator().apply(stage);
+       IdentifierValidator().apply(stage);
        ReferenceValidator().apply(stage);
        ExpressionValidator().apply(stage);
 
index 99e2dfe86c954d31a5a8e734a78b92a9ea3bc283..e025a61bcfaa0026cdcc18fa9866070f24a5aad3 100644 (file)
@@ -89,17 +89,17 @@ void TypeValidator::visit(VariableDeclaration &var)
 }
 
 
-DeclarationValidator::DeclarationValidator():
+IdentifierValidator::IdentifierValidator():
        anonymous_block(false)
 { }
 
-void DeclarationValidator::multiple_definition(const string &name, Statement &statement, Statement &previous)
+void IdentifierValidator::multiple_definition(const string &name, Statement &statement, Statement &previous)
 {
        error(statement, format("Multiple definition of %s", name));
        add_info(previous, "Previous definition is here");
 }
 
-Statement *DeclarationValidator::find_definition(const string &name)
+Statement *IdentifierValidator::find_definition(const string &name)
 {
        BlockDeclarationMap *decls = &declarations[current_block];
        BlockDeclarationMap::const_iterator i = decls->find(name);
@@ -111,7 +111,7 @@ Statement *DeclarationValidator::find_definition(const string &name)
        return (i!=decls->end() ? i->second : 0);
 }
 
-void DeclarationValidator::check_definition(const string &name, Statement &statement)
+void IdentifierValidator::check_definition(const string &name, Statement &statement)
 {
        if(Statement *previous = find_definition(name))
                multiple_definition(format("'%s'", name), statement, *previous);
@@ -119,31 +119,31 @@ void DeclarationValidator::check_definition(const string &name, Statement &state
                record_definition(name, statement);
 }
 
-void DeclarationValidator::record_definition(const string &name, Statement &statement)
+void IdentifierValidator::record_definition(const string &name, Statement &statement)
 {
        declarations[current_block].insert(make_pair(name, &statement));
        if(anonymous_block)
                declarations[current_block->parent].insert(make_pair(name, &statement));
 }
 
-void DeclarationValidator::visit(TypeDeclaration &type)
+void IdentifierValidator::visit(TypeDeclaration &type)
 {
        check_definition(type.name, type);
 }
 
-void DeclarationValidator::visit(StructDeclaration &strct)
+void IdentifierValidator::visit(StructDeclaration &strct)
 {
        check_definition(strct.name, strct);
        TraversingVisitor::visit(strct);
 }
 
-void DeclarationValidator::visit(VariableDeclaration &var)
+void IdentifierValidator::visit(VariableDeclaration &var)
 {
        check_definition(var.name, var);
        TraversingVisitor::visit(var);
 }
 
-void DeclarationValidator::visit(InterfaceBlock &iface)
+void IdentifierValidator::visit(InterfaceBlock &iface)
 {
        string key = iface.interface+iface.block_name;
        map<string, InterfaceBlock *>::const_iterator i = interface_blocks.find(key);
@@ -172,7 +172,7 @@ void DeclarationValidator::visit(InterfaceBlock &iface)
        }
 }
 
-void DeclarationValidator::visit(FunctionDeclaration &func)
+void IdentifierValidator::visit(FunctionDeclaration &func)
 {
        string key = func.name+func.signature;
        map<string, FunctionDeclaration *>::const_iterator i = overloaded_functions.find(key);
index bafa550bd480d2f32ccbac2652e57bbafaac2a80..6cd5675a07f691f413c8786f2143fb5d2ebb3708 100644 (file)
@@ -41,7 +41,7 @@ private:
        virtual void visit(VariableDeclaration &);
 };
 
-class DeclarationValidator: private Validator
+class IdentifierValidator: private Validator
 {
 private:
        typedef std::map<std::string, Statement *> BlockDeclarationMap;
@@ -52,7 +52,7 @@ private:
        bool anonymous_block;
 
 public:
-       DeclarationValidator();
+       IdentifierValidator();
 
        void apply(Stage &s) { stage = &s; s.content.visit(*this); }