]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove fallback from Assignment to BinaryExpression in TraversingVisitor
authorMikko Rasa <tdb@tdb.fi>
Sat, 6 Mar 2021 11:39:20 +0000 (13:39 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 6 Mar 2021 11:42:10 +0000 (13:42 +0200)
It's causing some trouble when the base class version is called for an
assignment and it gets handled as a binary expression.  Almost all classes
are handling the two separately anyway.

source/glsl/optimize.h
source/glsl/visitor.cpp

index 455a2d84a52d1ac82c7b769b3b419e3bab962537..652ac252cf32bf5a3015f3e87441826df8b29296 100644 (file)
@@ -88,6 +88,7 @@ private:
        virtual void visit(Block &);
        virtual void visit(UnaryExpression &);
        virtual void visit(BinaryExpression &);
+       virtual void visit(Assignment &a) { visit(static_cast<BinaryExpression &>(a)); }
        virtual void visit(MemberAccess &);
        virtual void visit(FunctionCall &);
        virtual void visit(ExpressionStatement &);
index dad8baddce0c5a5bd74c1b56c4abeb4a93d48fd9..c740d1188a15cf2f02614f19248ddd2a2c259e75 100644 (file)
@@ -39,7 +39,8 @@ void TraversingVisitor::visit(BinaryExpression &binary)
 
 void TraversingVisitor::visit(Assignment &assign)
 {
-       visit(static_cast<BinaryExpression &>(assign));
+       assign.left->visit(*this);
+       assign.right->visit(*this);
 }
 
 void TraversingVisitor::visit(FunctionCall &call)