status visit(const loop &node) { if (node.size() == 1) { // test if the inner node matches a clear loop test_inner_sequence_visitor v; if (node.seq::accept(v) == CONTINUE) { // replace loop, just set cell to 0 opt_seq.emplace_back(new set(node.loc(), 0, 0)); return CONTINUE; } } // else optimize inner sequence return opt_seq_base_visitor::handle_loop(node); }
status handle_loop(const loop &node) { // create an empty sequence seq temp_seq; // swap our optimized sequence for the empty one opt_seq.swap(temp_seq); // optimize the node's inner sequence node.seq::accept(*this); // swap back the old optimized sequence opt_seq.swap(temp_seq); // create a new node and add to the sequence opt_seq.emplace_back(new loop(node.loc(), temp_seq)); return CONTINUE; }
Pipe(loop& l, const bool fd_pass = false): stream() { uv_pipe_init(l.get(), get(), fd_pass ? 1 : 0); }
Signal(loop& l): handle<uv_signal_t>() { uv_signal_init(l.get(), get()); }
Resolver(loop& l) : request<uv_getaddrinfo_t>(), m_loop(l.get()) { }