From: Mikko Rasa Date: Thu, 4 Mar 2021 21:41:45 +0000 (+0200) Subject: Validate struct name uniqueness X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=734bc4a781ace5aecd98254ad1b50d52a06af0af;p=libs%2Fgl.git Validate struct name uniqueness --- diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index f3390048..1e967dc8 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -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); diff --git a/source/glsl/validate.h b/source/glsl/validate.h index 42c74230..6149fd7f 100644 --- a/source/glsl/validate.h +++ b/source/glsl/validate.h @@ -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 &);