X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fvisitor.h;h=cd9dafb0b016338eb2f8a12c58e1eb94eeb48a8c;hb=0febee9a8fdf1f9b03d3f2e23e72f8194b3698c7;hp=83b310f62ebadbcef621a9b8d1aa65eb571e59c1;hpb=39141d961e55f56d540b3678f9f8fe94868f2652;p=libs%2Fgl.git diff --git a/source/glsl/visitor.h b/source/glsl/visitor.h index 83b310f6..cd9dafb0 100644 --- a/source/glsl/visitor.h +++ b/source/glsl/visitor.h @@ -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 *to_reorder; + +public: + NodeReorderer(); + + void apply(Stage &, Node &, const std::set &); + +private: + virtual void visit(Block &); +}; + } // namespace SL } // namespace GL } // namespace Msp