class TraversingVisitor: public NodeVisitor
{
protected:
- TraversingVisitor() { }
+ Block *current_block;
+
+ TraversingVisitor(): current_block(0) { }
public:
- using NodeVisitor::visit;
virtual void visit(Block &);
virtual void visit(ParenthesizedExpression &);
virtual void visit(MemberAccess &);
std::vector<T *> nodes;
public:
- const std::vector<T *> &apply(Stage &s) { nodes.clear(); visit(s.content); return nodes; }
+ const std::vector<T *> &apply(Stage &s) { s.content.visit(*this); return nodes; }
private:
- using TraversingVisitor::visit;
virtual void visit(T &n) { nodes.push_back(&n); }
};
private:
void remove_variable(std::map<std::string, VariableDeclaration *> &, VariableDeclaration &);
- using TraversingVisitor::visit;
virtual void visit(Block &);
virtual void visit(StructDeclaration &);
virtual void visit(VariableDeclaration &);