1
Fork 0

Remove parser support for recv as an initializer in preparation for changing the recv syntax.

This commit is contained in:
Michael Sullivan 2011-05-26 18:17:13 -07:00
parent 55b40e6894
commit ea16e582eb
13 changed files with 32 additions and 29 deletions

View file

@ -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];
}

View file

@ -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;

View file

@ -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);
}

View file

@ -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) {

View file

@ -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;
}
}

View file

@ -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);

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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;
}
auto c; c <- p;
}

View file

@ -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;
}
auto c; c <- p;
}

View file

@ -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;
}

View file

@ -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;

View file

@ -9,7 +9,7 @@ fn main() {
ch <| 42;
auto r <- po;
auto r; r <- po;
log_err r;
}