]> git.tdb.fi Git - libs/gl.git/commitdiff
Validate struct name uniqueness
authorMikko Rasa <tdb@tdb.fi>
Thu, 4 Mar 2021 21:41:45 +0000 (23:41 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 4 Mar 2021 22:30:28 +0000 (00:30 +0200)
source/glsl/validate.cpp
source/glsl/validate.h

index f3390048298e2708db5e307e37b0832144c7c2dd..1e967dc88f6f4d54f0e54f9a1f90cb499aaf7c86 100644 (file)
@@ -63,6 +63,12 @@ void DeclarationValidator::record_definition(const string &name, Statement &stat
                declarations[current_block->parent].insert(make_pair(name, &statement));
 }
 
+void DeclarationValidator::visit(StructDeclaration &strct)
+{
+       check_definition(strct.name, strct);
+       TraversingVisitor::visit(strct);
+}
+
 void DeclarationValidator::visit(VariableDeclaration &var)
 {
        check_definition(var.name, var);
index 42c74230c4f90637208b4fb9ca42388f82ad123b..6149fd7f9b439fac7d26c01d7b59ce037624f62c 100644 (file)
@@ -41,6 +41,7 @@ private:
        void check_definition(const std::string &, Statement &);
        void record_definition(const std::string &, Statement &);
 
+       virtual void visit(StructDeclaration &);
        virtual void visit(VariableDeclaration &);
        virtual void visit(InterfaceBlock &);
        virtual void visit(FunctionDeclaration &);