From ecd08b989ae006660929bce6b719d9f7bc34a7fe Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Sat, 1 Jun 2013 18:19:16 -0700 Subject: Swap return value of pipes::init Fixes #4501 --- src/libsyntax/ext/pipes/pipec.rs | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index db0efdd7b0f..83cafcd8a6a 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -89,10 +89,10 @@ impl gen_send for message { } else { let pat = match (this.dir, next.dir) { - (send, send) => "(c, s)", - (send, recv) => "(s, c)", - (recv, send) => "(s, c)", - (recv, recv) => "(c, s)" + (send, send) => "(s, c)", + (send, recv) => "(c, s)", + (recv, send) => "(c, s)", + (recv, recv) => "(s, c)" }; body += fmt!("let %s = ::std::pipes::entangle();\n", pat); @@ -317,30 +317,13 @@ impl gen_init for protocol { let start_state = self.states[0]; let body = if !self.is_bounded() { - match start_state.dir { - send => quote_expr!( ::std::pipes::entangle() ), - recv => { - quote_expr!({ - let (s, c) = ::std::pipes::entangle(); - (c, s) - }) - } - } + quote_expr!( ::std::pipes::entangle() ) } else { - let body = self.gen_init_bounded(ext_cx); - match start_state.dir { - send => body, - recv => { - quote_expr!({ - let (s, c) = $body; - (c, s) - }) - } - } + self.gen_init_bounded(ext_cx) }; - cx.parse_item(fmt!("pub fn init%s() -> (client::%s, server::%s)\ + cx.parse_item(fmt!("pub fn init%s() -> (server::%s, client::%s)\ { pub use std::pipes::HasBuffer; %s }", start_state.generics.to_source(cx), start_state.to_ty(cx).to_source(cx), -- cgit 1.4.1-3-g733a5