diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-01-29 15:06:05 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-02-04 15:18:53 -0800 |
| commit | e22aa029fb4d923dc03748b435abd6330933b473 (patch) | |
| tree | eb1dfcaaadd8ec5439fd0b51c0b755c8fd4009e1 /src/libsyntax | |
| parent | e08a805b306398b316a489f76960569ac19b25b2 (diff) | |
| download | rust-e22aa029fb4d923dc03748b435abd6330933b473.tar.gz rust-e22aa029fb4d923dc03748b435abd6330933b473.zip | |
core/syntax: Add transitional code for pipes
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 8c73dcfc04f..4bf59d9c627 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -355,6 +355,34 @@ pub impl protocol: gen_init { })) } + #[cfg(stage0)] + fn gen_init_bounded(ext_cx: ext_ctxt) -> @ast::expr { + debug!("gen_init_bounded"); + let buffer_fields = self.gen_buffer_init(ext_cx); + let buffer = quote_expr!(~{ + header: ::pipes::BufferHeader(), + data: $buffer_fields, + }); + + let entangle_body = ext_cx.block_expr( + ext_cx.block( + self.states.map_to_vec( + |s| ext_cx.parse_stmt( + fmt!("data.%s.set_buffer_(buffer)", + s.name))), + ext_cx.parse_expr( + fmt!("::ptr::addr_of(&(data.%s))", + self.states[0].name)))); + + quote_expr!({ + let buffer = $buffer; + do ::pipes::entangle_buffer(move buffer) |buffer, data| { + $entangle_body + } + }) + } + #[cfg(stage1)] + #[cfg(stage2)] fn gen_init_bounded(ext_cx: ext_ctxt) -> @ast::expr { debug!("gen_init_bounded"); let buffer_fields = self.gen_buffer_init(ext_cx); |
