diff options
| author | Nick Desaulniers <ndesaulniers@mozilla.com> | 2013-06-01 18:19:16 -0700 |
|---|---|---|
| committer | Nick Desaulniers <ndesaulniers@mozilla.com> | 2013-06-01 18:19:16 -0700 |
| commit | ecd08b989ae006660929bce6b719d9f7bc34a7fe (patch) | |
| tree | 73d8e00e2406a00c0a73efb4b4f0816d517f66e0 /src/libsyntax | |
| parent | 24e85ac82d000a71276eb4cf2090bd176a3638bf (diff) | |
| download | rust-ecd08b989ae006660929bce6b719d9f7bc34a7fe.tar.gz rust-ecd08b989ae006660929bce6b719d9f7bc34a7fe.zip | |
Swap return value of pipes::init Fixes #4501
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 31 |
1 files changed, 7 insertions, 24 deletions
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), |
