]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/visitor.cpp
Refactor the way of applying visitors to stages
[libs/gl.git] / source / glsl / visitor.cpp
index 58d323ab540fc3be3a02c70a7c0a81dd333977b8..717acad1fdf6dbbd0f03e4e4a9a64ce3f2a4bcd2 100644 (file)
@@ -114,17 +114,6 @@ void TraversingVisitor::visit(Return &ret)
 }
 
 
-StageVisitor::StageVisitor():
-       stage(0)
-{ }
-
-void StageVisitor::apply(Stage &s)
-{
-       SetForScope<Stage *> set(stage, &s);
-       stage->content.visit(*this);
-}
-
-
 BlockModifier::BlockModifier():
        remove_node(false)
 { }
@@ -158,9 +147,16 @@ void BlockModifier::visit(Block &block)
 
 
 NodeRemover::NodeRemover(const set<Node *> &r):
+       stage(0),
        to_remove(r)
 { }
 
+void NodeRemover::apply(Stage &s)
+{
+       SetForScope<Stage *> set_stage(stage, &s);
+       visit(s.content);
+}
+
 void NodeRemover::visit(Block &block)
 {
        for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); )