]> git.tdb.fi Git - libs/gl.git/commitdiff
Refactor function call argument type resolving logic a bit
authorMikko Rasa <tdb@tdb.fi>
Mon, 11 Apr 2022 11:22:25 +0000 (14:22 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 11 Apr 2022 11:37:30 +0000 (14:37 +0300)
source/glsl/resolve.cpp

index 115624c496639e5413077779e28aabd9c2321ce6..82c0a367dfd2e70f89d04e9b9335cb4df23c2ded 100644 (file)
@@ -1089,6 +1089,11 @@ void ExpressionResolver::visit(FunctionCall &call)
                {
                        TypeDeclaration *arg_type = call.arguments[i]->type;
                        TypeDeclaration *param_type = call.declaration->parameters[i]->type_declaration;
+                       if(arg_type==param_type)
+                               continue;
+                       else if(!arg_type || !param_type)
+                               return;
+
                        BasicTypeDeclaration *arg_basic = dynamic_cast<BasicTypeDeclaration *>(arg_type);
                        BasicTypeDeclaration *param_basic = dynamic_cast<BasicTypeDeclaration *>(param_type);
                        if(arg_basic && param_basic)
@@ -1097,8 +1102,6 @@ void ExpressionResolver::visit(FunctionCall &call)
                                if(compat==RIGHT_CONVERTIBLE)
                                        convert_to(call.arguments[i], *param_basic);
                        }
-                       else if(!arg_type || !param_type || arg_type!=param_type)
-                               return;
                }
                resolve(call, call.declaration->return_type_declaration, false);
        }