From caa84a9d8adce6dc702f6e0ae32961b77a0a73ea Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 6 Mar 2021 13:39:20 +0200 Subject: [PATCH] Remove fallback from Assignment to BinaryExpression in TraversingVisitor 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 | 1 + source/glsl/visitor.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/glsl/optimize.h b/source/glsl/optimize.h index 455a2d84..652ac252 100644 --- a/source/glsl/optimize.h +++ b/source/glsl/optimize.h @@ -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(a)); } virtual void visit(MemberAccess &); virtual void visit(FunctionCall &); virtual void visit(ExpressionStatement &); diff --git a/source/glsl/visitor.cpp b/source/glsl/visitor.cpp index dad8badd..c740d118 100644 --- a/source/glsl/visitor.cpp +++ b/source/glsl/visitor.cpp @@ -39,7 +39,8 @@ void TraversingVisitor::visit(BinaryExpression &binary) void TraversingVisitor::visit(Assignment &assign) { - visit(static_cast(assign)); + assign.left->visit(*this); + assign.right->visit(*this); } void TraversingVisitor::visit(FunctionCall &call) -- 2.45.2