1
Fork 0

test: Fix tests and the pipe compiler

This commit is contained in:
Patrick Walton 2013-05-06 19:29:04 -07:00
parent db4573a776
commit 278b487cab
27 changed files with 151 additions and 126 deletions

View file

@ -64,6 +64,7 @@ impl gen_send for message {
let mut body = ~"{\n";
body += fmt!("use super::%s;\n", name);
body += ~"let mut pipe = pipe;\n";
if this.proto.is_bounded() {
let (sp, rp) = match (this.dir, next.dir) {
@ -73,12 +74,12 @@ impl gen_send for message {
(recv, recv) => (~"c", ~"s")
};
body += ~"let b = pipe.reuse_buffer();\n";
body += ~"let mut b = pipe.reuse_buffer();\n";
body += fmt!("let %s = ::core::pipes::SendPacketBuffered(\
&(b.buffer.data.%s));\n",
&mut (b.buffer.data.%s));\n",
sp, next.name);
body += fmt!("let %s = ::core::pipes::RecvPacketBuffered(\
&(b.buffer.data.%s));\n",
&mut (b.buffer.data.%s));\n",
rp, next.name);
}
else {
@ -366,7 +367,7 @@ impl gen_init for protocol {
fmt!("data.%s.set_buffer(buffer)",
s.name))),
ext_cx.parse_expr(fmt!(
"::core::ptr::to_unsafe_ptr(&(data.%s))",
"::core::ptr::to_mut_unsafe_ptr(&mut (data.%s))",
self.states[0].name))));
quote_expr!({