From: Mikko Rasa Date: Sat, 3 Sep 2022 19:25:27 +0000 (+0300) Subject: Compare constructor calls in TypeComparer X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=d99c2663e8c6a213507878d28d073c732e1e5f7f;p=libs%2Fgl.git Compare constructor calls in TypeComparer These may arise if e.g. an uint constant is initialized with an integer literal. --- diff --git a/source/glsl/reflect.cpp b/source/glsl/reflect.cpp index e64b9a3c..becc833e 100644 --- a/source/glsl/reflect.cpp +++ b/source/glsl/reflect.cpp @@ -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 && iarguments[i], *call.arguments[i]); + } + } +} + void TypeComparer::visit(BasicTypeDeclaration &basic) { if(BasicTypeDeclaration *basic1 = multi_visit(basic)) diff --git a/source/glsl/reflect.h b/source/glsl/reflect.h index 6e6f9d83..308d7c80 100644 --- a/source/glsl/reflect.h +++ b/source/glsl/reflect.h @@ -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 &);