]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/visitor.h
Handle expression replacement through TraversingVisitor
[libs/gl.git] / source / glsl / visitor.h
index 6fe1868ca8221a4619fc30cb889524b68f7b9f9e..85f9e848c39b9b45b822c63408ceb6e44a0e5bb9 100644 (file)
@@ -23,6 +23,7 @@ public:
        virtual void visit(VariableReference &) { }
        virtual void visit(InterfaceBlockReference &) { }
        virtual void visit(MemberAccess &) { }
+       virtual void visit(Swizzle &) { }
        virtual void visit(UnaryExpression &) { }
        virtual void visit(BinaryExpression &) { }
        virtual void visit(Assignment &) { }
@@ -56,8 +57,10 @@ protected:
 public:
        virtual void enter(Block &) { }
        virtual void visit(Block &);
+       virtual void visit(RefPtr<Expression> &);
        virtual void visit(ParenthesizedExpression &);
        virtual void visit(MemberAccess &);
+       virtual void visit(Swizzle &);
        virtual void visit(UnaryExpression &);
        virtual void visit(BinaryExpression &);
        virtual void visit(Assignment &);
@@ -74,20 +77,6 @@ public:
        virtual void visit(Return &);
 };
 
-/** Gathers nodes of a particular type from the syntax tree. */
-template<typename T>
-class NodeGatherer: private TraversingVisitor
-{
-private:
-       std::vector<T *> nodes;
-
-public:
-       const std::vector<T *> &apply(Stage &s) { s.content.visit(*this); return nodes; }
-
-private:
-       virtual void visit(T &n) { nodes.push_back(&n); }
-};
-
 /** Removes a set of nodes from the syntax tree. */
 class NodeRemover: private TraversingVisitor
 {