virtual bool visit(SgTransformNode& node) { // build up an accumulated RBT stack if (rbtStack_.size() == 0) rbtStack_.push_back(node.getRbt()); else rbtStack_.push_back(rbtStack_.back() * node.getRbt()); // keep track of whether we've hit our target return !(target_ == node); }
virtual bool visit(SgTransformNode& node) { if(node == target_) { rbtStack_.push_back(rbtStack_.back() * node.getRbt()); return false; } else { if(rbtStack_.empty()) rbtStack_.push_back(node.getRbt()); else rbtStack_.push_back(rbtStack_.back() * node.getRbt()); return true; } }
virtual bool visit(SgTransformNode& node) { if (!found_) { rbtStack_.push_back(node.getRbt()); } if (node==target_) { found_ = true; return false; } return true; }