]> git.tdb.fi Git - libs/gl.git/commitdiff
Validate member names
authorMikko Rasa <tdb@tdb.fi>
Mon, 8 Mar 2021 17:18:22 +0000 (19:18 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 9 Mar 2021 08:15:11 +0000 (10:15 +0200)
source/glsl/validate.cpp
source/glsl/validate.h

index c4e0a9bda8aa6b21d80fca7e92a5b393217d4a53..4523b7461730e4fadb6a2faec9d904cea70d1c42 100644 (file)
@@ -196,6 +196,13 @@ void ReferenceValidator::visit(VariableReference &var)
                error(var, format("Use of unlinked input variable '%s'", var.name));
 }
 
+void ReferenceValidator::visit(MemberAccess &memacc)
+{
+       if(memacc.left->type && !memacc.declaration)
+               error(memacc, format("Use of undeclared member '%s'", memacc.member));
+       TraversingVisitor::visit(memacc);
+}
+
 void ReferenceValidator::visit(InterfaceBlockReference &iface)
 {
        /* An interface block reference without a declaration should be impossible
index 2efb5199660e149740693a04180d1ba643619d19..b64973276536e2dbc653ac30f142866ccb3b3fcb 100644 (file)
@@ -76,6 +76,7 @@ private:
        virtual void visit(BasicTypeDeclaration &);
        virtual void visit(ImageTypeDeclaration &);
        virtual void visit(VariableReference &);
+       virtual void visit(MemberAccess &);
        virtual void visit(InterfaceBlockReference &);
        virtual void visit(VariableDeclaration &);
        virtual void visit(InterfaceBlock &);