]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/validate.cpp
Better error message for the subscript operator
[libs/gl.git] / source / glsl / validate.cpp
index 13cb5ccb23ad15e4d6e56798552ffcd35fefd381..4b38c5b755e935f0e3f477c0ecd092202e411c7f 100644 (file)
@@ -338,8 +338,14 @@ void ExpressionValidator::visit(UnaryExpression &unary)
 void ExpressionValidator::visit(BinaryExpression &binary)
 {
        if(!binary.type && binary.left->type && binary.right->type)
-               error(binary, format("No matching operator '%s' found for '%s' and '%s'",
-                       binary.oper->token, binary.left->type->name, binary.right->type->name));
+       {
+               if(binary.oper->token[0]=='[')
+                       error(binary, format("Can't index element of '%s' with '%s'",
+                               binary.left->type->name, binary.right->type->name));
+               else
+                       error(binary, format("No matching operator '%s' found for '%s' and '%s'",
+                               binary.oper->token, binary.left->type->name, binary.right->type->name));
+       }
        TraversingVisitor::visit(binary);
 }