]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/visitor.h
Use the new append utility function to build GLSL compile errors
[libs/gl.git] / source / glsl / visitor.h
index 83b310f62ebadbcef621a9b8d1aa65eb571e59c1..cd9dafb0b016338eb2f8a12c58e1eb94eeb48a8c 100644 (file)
@@ -25,7 +25,7 @@ public:
        virtual void visit(MemberAccess &) { }
        virtual void visit(UnaryExpression &) { }
        virtual void visit(BinaryExpression &) { }
-       virtual void visit(Assignment &);
+       virtual void visit(Assignment &) { }
        virtual void visit(FunctionCall &) { }
        virtual void visit(ExpressionStatement &) { }
        virtual void visit(Import &) { }
@@ -58,6 +58,7 @@ public:
        virtual void visit(MemberAccess &);
        virtual void visit(UnaryExpression &);
        virtual void visit(BinaryExpression &);
+       virtual void visit(Assignment &);
        virtual void visit(FunctionCall &);
        virtual void visit(ExpressionStatement &);
        virtual void visit(InterfaceLayout &);
@@ -110,6 +111,23 @@ private:
        virtual void visit(Iteration &);
 };
 
+/** Reorders a set of nodes so they appear before another node.  Only nodes
+on the same hierarchly level as the target node are reordered. */
+class NodeReorderer: private TraversingVisitor
+{
+private:
+       Node *reorder_before;
+       const std::set<Node *> *to_reorder;
+
+public:
+       NodeReorderer();
+
+       void apply(Stage &, Node &, const std::set<Node *> &);
+
+private:
+       virtual void visit(Block &);
+};
+
 } // namespace SL
 } // namespace GL
 } // namespace Msp