From ea16e582eb253460b951cb14514a330d84c9a3ca Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Thu, 26 May 2011 18:17:13 -0700 Subject: [PATCH] Remove parser support for recv as an initializer in preparation for changing the recv syntax. --- src/comp/front/parser.rs | 12 +++++++----- src/test/run-fail/trivial-message2.rs | 2 +- src/test/run-pass/decl-with-recv.rs | 4 ++-- src/test/run-pass/destructor-ordering.rs | 3 ++- src/test/run-pass/many.rs | 2 +- src/test/run-pass/rt-circular-buffer.rs | 8 ++++---- src/test/run-pass/task-comm-0.rs | 2 +- src/test/run-pass/task-comm-10.rs | 8 ++++---- src/test/run-pass/task-comm-11.rs | 4 ++-- src/test/run-pass/task-comm-15.rs | 4 ++-- src/test/run-pass/task-comm-3.rs | 2 +- src/test/run-pass/task-comm.rs | 8 ++++---- src/test/run-pass/trivial-message.rs | 2 +- 13 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 4974e3c3fc49..5b6f42ea945f 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -1442,11 +1442,13 @@ fn parse_initializer(&parser p) -> option::t[ast::initializer] { ret some(rec(op = ast::init_assign, expr = parse_expr(p))); } - case (token::LARROW) { - p.bump(); - ret some(rec(op = ast::init_recv, - expr = parse_expr(p))); - } + // Now that the the channel is the first argument to receive, + // combining it with an initializer doesn't really make sense. + // case (token::RECV) { + // p.bump(); + // ret some(rec(op = ast::init_recv, + // expr = parse_expr(p))); + // } case (_) { ret none[ast::initializer]; } diff --git a/src/test/run-fail/trivial-message2.rs b/src/test/run-fail/trivial-message2.rs index 09bd04f95f15..8b41e5f5a46c 100644 --- a/src/test/run-fail/trivial-message2.rs +++ b/src/test/run-fail/trivial-message2.rs @@ -9,7 +9,7 @@ fn main() { let port[int] po = port(); let chan[int] ch = chan(po); - auto r <- po; + auto r; r <- po; ch <| 42; diff --git a/src/test/run-pass/decl-with-recv.rs b/src/test/run-pass/decl-with-recv.rs index 36487aa83b53..923024251b19 100644 --- a/src/test/run-pass/decl-with-recv.rs +++ b/src/test/run-pass/decl-with-recv.rs @@ -5,10 +5,10 @@ fn main() { let chan[int] ch = chan(po); ch <| 10; - let int i <- po; + let int i; i <- po; assert (i == 10); ch <| 11; - auto j <- po; + auto j; j <- po; assert (j == 11); } diff --git a/src/test/run-pass/destructor-ordering.rs b/src/test/run-pass/destructor-ordering.rs index 37190749e64a..23c4737307cd 100644 --- a/src/test/run-pass/destructor-ordering.rs +++ b/src/test/run-pass/destructor-ordering.rs @@ -24,7 +24,8 @@ type order_info = rec(int order, str msg); io fn check_order(port[order_info] expected_p) { chan(expected_p) <| rec(order=-1, msg=""); let mutable int actual = 0; - auto expected <- expected_p; // FIXME #121: Workaround for while(true) bug. + // FIXME #121: Workaround for while(true) bug. + auto expected; expected <- expected_p; auto done = -1; // FIXME: Workaround for typechecking bug. while(expected.order != done) { if (expected.order != actual) { diff --git a/src/test/run-pass/many.rs b/src/test/run-pass/many.rs index 2c1398fca236..e4e5dbd062e7 100644 --- a/src/test/run-pass/many.rs +++ b/src/test/run-pass/many.rs @@ -9,7 +9,7 @@ fn sub(chan[int] parent, int id) { } else { let port[int] p = port(); auto child = spawn sub(chan(p), id-1); - let int y <- p; + let int y; y <- p; parent <| y + 1; } } diff --git a/src/test/run-pass/rt-circular-buffer.rs b/src/test/run-pass/rt-circular-buffer.rs index 30a8e57d1b7e..19705d2a60ef 100644 --- a/src/test/run-pass/rt-circular-buffer.rs +++ b/src/test/run-pass/rt-circular-buffer.rs @@ -44,7 +44,7 @@ fn test_shrink1() { auto mychan = chan(myport); mychan <| 0i8; - auto x <- myport; + auto x; x <- myport; } fn test_shrink2() { @@ -58,7 +58,7 @@ fn test_shrink2() { } for each (uint i in uint::range(0u, 100u)) { - auto x <- myport; + auto x; x <- myport; } } @@ -73,7 +73,7 @@ fn test_rotate() { val3=i as u32); mychan <| val; - auto x <- myport; + auto x; x <- myport; assert (x.val1 == i as u32); assert (x.val2 == i as u32); assert (x.val3 == i as u32); @@ -95,7 +95,7 @@ fn test_rotate_grow() { } for each (uint i in uint::range(0u, 10u)) { - auto x <- myport; + auto x; x <- myport; assert (x.val1 == i as u32); assert (x.val2 == i as u32); assert (x.val3 == i as u32); diff --git a/src/test/run-pass/task-comm-0.rs b/src/test/run-pass/task-comm-0.rs index cf968cb90a36..5046e145cbc7 100644 --- a/src/test/run-pass/task-comm-0.rs +++ b/src/test/run-pass/task-comm-0.rs @@ -15,7 +15,7 @@ fn test05() { let port[int] po = port(); let chan[int] ch = chan(po); spawn test05_start(chan(po)); - let int value <- po; + let int value; value <- po; value <- po; value <- po; assert (value == 30); diff --git a/src/test/run-pass/task-comm-10.rs b/src/test/run-pass/task-comm-10.rs index 934a78c6ae85..47506999feab 100644 --- a/src/test/run-pass/task-comm-10.rs +++ b/src/test/run-pass/task-comm-10.rs @@ -4,15 +4,15 @@ fn start(chan[chan[str]] c) { let port[str] p = port(); c <| chan(p); - auto a <- p; - // auto b <- p; // Never read the second string. + auto a; a <- p; + // auto b; b <- p; // Never read the second string. } fn main() { let port[chan[str]] p = port(); auto child = spawn "start" start(chan(p)); - auto c <- p; + auto c; c <- p; c <| "A"; c <| "B"; yield; -} \ No newline at end of file +} diff --git a/src/test/run-pass/task-comm-11.rs b/src/test/run-pass/task-comm-11.rs index 011b65caa9eb..24c6837b02c5 100644 --- a/src/test/run-pass/task-comm-11.rs +++ b/src/test/run-pass/task-comm-11.rs @@ -9,5 +9,5 @@ fn start(chan[chan[str]] c) { fn main() { let port[chan[str]] p = port(); auto child = spawn "child" start(chan(p)); - auto c <- p; -} \ No newline at end of file + auto c; c <- p; +} diff --git a/src/test/run-pass/task-comm-15.rs b/src/test/run-pass/task-comm-15.rs index 2862ef321d0e..9e23108006c0 100644 --- a/src/test/run-pass/task-comm-15.rs +++ b/src/test/run-pass/task-comm-15.rs @@ -17,5 +17,5 @@ fn main() { // the child's point of view the receiver may die. We should // drop messages on the floor in this case, and not crash! auto child = spawn thread "child" start(chan(p), 10); - auto c <- p; -} \ No newline at end of file + auto c; c <- p; +} diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs index 907a7f280353..374c598f473e 100644 --- a/src/test/run-pass/task-comm-3.rs +++ b/src/test/run-pass/task-comm-3.rs @@ -47,7 +47,7 @@ fn test00(bool is_multithreaded) { for (task t in tasks) { i = 0; while (i < number_of_messages) { - let int value <- po; + let int value; value <- po; sum += value; i = i + 1; } diff --git a/src/test/run-pass/task-comm.rs b/src/test/run-pass/task-comm.rs index 826743d0937f..6c51aba306a6 100644 --- a/src/test/run-pass/task-comm.rs +++ b/src/test/run-pass/task-comm.rs @@ -48,7 +48,7 @@ fn test00(bool is_multithreaded) { for (task t in tasks) { i = 0; while (i < number_of_messages) { - let int value <- po; + let int value; value <- po; sum += value; i = i + 1; } @@ -66,7 +66,7 @@ fn test00(bool is_multithreaded) { fn test01() { let port[int] p = port(); log "Reading from a port that is never written to."; - let int value <- p; + let int value; value <- p; log value; } @@ -76,7 +76,7 @@ fn test02() { log "Writing to a local task channel."; c <| 42; log "Reading from a local task port."; - let int value <- p; + let int value; value <- p; log value; } @@ -126,7 +126,7 @@ fn test05() { let port[int] po = port(); let chan[int] ch = chan(po); spawn thread test05_start(ch); - let int value <- po; + let int value; value <- po; value <- po; value <- po; log value; diff --git a/src/test/run-pass/trivial-message.rs b/src/test/run-pass/trivial-message.rs index 2e08da8be745..5391f919d01c 100644 --- a/src/test/run-pass/trivial-message.rs +++ b/src/test/run-pass/trivial-message.rs @@ -9,7 +9,7 @@ fn main() { ch <| 42; - auto r <- po; + auto r; r <- po; log_err r; }