]> git.tdb.fi Git - libs/gl.git/commitdiff
Compare constructor calls in TypeComparer
authorMikko Rasa <tdb@tdb.fi>
Sat, 3 Sep 2022 19:25:27 +0000 (22:25 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 3 Sep 2022 19:25:27 +0000 (22:25 +0300)
These may arise if e.g. an uint constant is initialized with an integer
literal.

source/glsl/reflect.cpp
source/glsl/reflect.h

index e64b9a3c5f175fe6cf3d046f80da15990686456a..becc833e28ef7da9c9bbcd5fc5ad6e6fe7d81ce6 100644 (file)
@@ -159,6 +159,25 @@ void TypeComparer::visit(TernaryExpression &ternary)
        }
 }
 
+void TypeComparer::visit(FunctionCall &call)
+{
+       if(FunctionCall *call1 = multi_visit(call))
+       {
+               if(!call1->constructor || !call.constructor)
+                       r_result = false;
+               else if(call1->name!=call.name)
+                       r_result = false;
+               else if(call1->arguments.size()!=call.arguments.size())
+                       r_result = false;
+               else
+               {
+                       r_result = true;
+                       for(unsigned i=0; (r_result && i<call.arguments.size()); ++i)
+                               compare(*call1->arguments[i], *call.arguments[i]);
+               }
+       }
+}
+
 void TypeComparer::visit(BasicTypeDeclaration &basic)
 {
        if(BasicTypeDeclaration *basic1 = multi_visit(basic))
index 6e6f9d8316bf2c5af1522a03b097bf301c057df6..308d7c8038c5d59c149df472f374226110adecd3 100644 (file)
@@ -35,6 +35,7 @@ private:
        virtual void visit(UnaryExpression &);
        virtual void visit(BinaryExpression &);
        virtual void visit(TernaryExpression &);
+       virtual void visit(FunctionCall &);
        virtual void visit(BasicTypeDeclaration &);
        virtual void visit(ImageTypeDeclaration &);
        virtual void visit(StructDeclaration &);