Remove parser support for recv as an initializer in preparation for changing the recv syntax.
This commit is contained in:
parent
55b40e6894
commit
ea16e582eb
13 changed files with 32 additions and 29 deletions
|
@ -1442,11 +1442,13 @@ fn parse_initializer(&parser p) -> option::t[ast::initializer] {
|
||||||
ret some(rec(op = ast::init_assign,
|
ret some(rec(op = ast::init_assign,
|
||||||
expr = parse_expr(p)));
|
expr = parse_expr(p)));
|
||||||
}
|
}
|
||||||
case (token::LARROW) {
|
// Now that the the channel is the first argument to receive,
|
||||||
p.bump();
|
// combining it with an initializer doesn't really make sense.
|
||||||
ret some(rec(op = ast::init_recv,
|
// case (token::RECV) {
|
||||||
expr = parse_expr(p)));
|
// p.bump();
|
||||||
}
|
// ret some(rec(op = ast::init_recv,
|
||||||
|
// expr = parse_expr(p)));
|
||||||
|
// }
|
||||||
case (_) {
|
case (_) {
|
||||||
ret none[ast::initializer];
|
ret none[ast::initializer];
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ fn main() {
|
||||||
let port[int] po = port();
|
let port[int] po = port();
|
||||||
let chan[int] ch = chan(po);
|
let chan[int] ch = chan(po);
|
||||||
|
|
||||||
auto r <- po;
|
auto r; r <- po;
|
||||||
|
|
||||||
ch <| 42;
|
ch <| 42;
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ fn main() {
|
||||||
let chan[int] ch = chan(po);
|
let chan[int] ch = chan(po);
|
||||||
|
|
||||||
ch <| 10;
|
ch <| 10;
|
||||||
let int i <- po;
|
let int i; i <- po;
|
||||||
assert (i == 10);
|
assert (i == 10);
|
||||||
|
|
||||||
ch <| 11;
|
ch <| 11;
|
||||||
auto j <- po;
|
auto j; j <- po;
|
||||||
assert (j == 11);
|
assert (j == 11);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ type order_info = rec(int order, str msg);
|
||||||
io fn check_order(port[order_info] expected_p) {
|
io fn check_order(port[order_info] expected_p) {
|
||||||
chan(expected_p) <| rec(order=-1, msg="");
|
chan(expected_p) <| rec(order=-1, msg="");
|
||||||
let mutable int actual = 0;
|
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.
|
auto done = -1; // FIXME: Workaround for typechecking bug.
|
||||||
while(expected.order != done) {
|
while(expected.order != done) {
|
||||||
if (expected.order != actual) {
|
if (expected.order != actual) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ fn sub(chan[int] parent, int id) {
|
||||||
} else {
|
} else {
|
||||||
let port[int] p = port();
|
let port[int] p = port();
|
||||||
auto child = spawn sub(chan(p), id-1);
|
auto child = spawn sub(chan(p), id-1);
|
||||||
let int y <- p;
|
let int y; y <- p;
|
||||||
parent <| y + 1;
|
parent <| y + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ fn test_shrink1() {
|
||||||
auto mychan = chan(myport);
|
auto mychan = chan(myport);
|
||||||
|
|
||||||
mychan <| 0i8;
|
mychan <| 0i8;
|
||||||
auto x <- myport;
|
auto x; x <- myport;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_shrink2() {
|
fn test_shrink2() {
|
||||||
|
@ -58,7 +58,7 @@ fn test_shrink2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for each (uint i in uint::range(0u, 100u)) {
|
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);
|
val3=i as u32);
|
||||||
mychan <| val;
|
mychan <| val;
|
||||||
|
|
||||||
auto x <- myport;
|
auto x; x <- myport;
|
||||||
assert (x.val1 == i as u32);
|
assert (x.val1 == i as u32);
|
||||||
assert (x.val2 == i as u32);
|
assert (x.val2 == i as u32);
|
||||||
assert (x.val3 == 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)) {
|
for each (uint i in uint::range(0u, 10u)) {
|
||||||
auto x <- myport;
|
auto x; x <- myport;
|
||||||
assert (x.val1 == i as u32);
|
assert (x.val1 == i as u32);
|
||||||
assert (x.val2 == i as u32);
|
assert (x.val2 == i as u32);
|
||||||
assert (x.val3 == i as u32);
|
assert (x.val3 == i as u32);
|
||||||
|
|
|
@ -15,7 +15,7 @@ fn test05() {
|
||||||
let port[int] po = port();
|
let port[int] po = port();
|
||||||
let chan[int] ch = chan(po);
|
let chan[int] ch = chan(po);
|
||||||
spawn test05_start(chan(po));
|
spawn test05_start(chan(po));
|
||||||
let int value <- po;
|
let int value; value <- po;
|
||||||
value <- po;
|
value <- po;
|
||||||
value <- po;
|
value <- po;
|
||||||
assert (value == 30);
|
assert (value == 30);
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
fn start(chan[chan[str]] c) {
|
fn start(chan[chan[str]] c) {
|
||||||
let port[str] p = port();
|
let port[str] p = port();
|
||||||
c <| chan(p);
|
c <| chan(p);
|
||||||
auto a <- p;
|
auto a; a <- p;
|
||||||
// auto b <- p; // Never read the second string.
|
// auto b; b <- p; // Never read the second string.
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let port[chan[str]] p = port();
|
let port[chan[str]] p = port();
|
||||||
auto child = spawn "start" start(chan(p));
|
auto child = spawn "start" start(chan(p));
|
||||||
auto c <- p;
|
auto c; c <- p;
|
||||||
c <| "A";
|
c <| "A";
|
||||||
c <| "B";
|
c <| "B";
|
||||||
yield;
|
yield;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@ fn start(chan[chan[str]] c) {
|
||||||
fn main() {
|
fn main() {
|
||||||
let port[chan[str]] p = port();
|
let port[chan[str]] p = port();
|
||||||
auto child = spawn "child" start(chan(p));
|
auto child = spawn "child" start(chan(p));
|
||||||
auto c <- p;
|
auto c; c <- p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,5 @@ fn main() {
|
||||||
// the child's point of view the receiver may die. We should
|
// the child's point of view the receiver may die. We should
|
||||||
// drop messages on the floor in this case, and not crash!
|
// drop messages on the floor in this case, and not crash!
|
||||||
auto child = spawn thread "child" start(chan(p), 10);
|
auto child = spawn thread "child" start(chan(p), 10);
|
||||||
auto c <- p;
|
auto c; c <- p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ fn test00(bool is_multithreaded) {
|
||||||
for (task t in tasks) {
|
for (task t in tasks) {
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < number_of_messages) {
|
while (i < number_of_messages) {
|
||||||
let int value <- po;
|
let int value; value <- po;
|
||||||
sum += value;
|
sum += value;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ fn test00(bool is_multithreaded) {
|
||||||
for (task t in tasks) {
|
for (task t in tasks) {
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < number_of_messages) {
|
while (i < number_of_messages) {
|
||||||
let int value <- po;
|
let int value; value <- po;
|
||||||
sum += value;
|
sum += value;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ fn test00(bool is_multithreaded) {
|
||||||
fn test01() {
|
fn test01() {
|
||||||
let port[int] p = port();
|
let port[int] p = port();
|
||||||
log "Reading from a port that is never written to.";
|
log "Reading from a port that is never written to.";
|
||||||
let int value <- p;
|
let int value; value <- p;
|
||||||
log value;
|
log value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ fn test02() {
|
||||||
log "Writing to a local task channel.";
|
log "Writing to a local task channel.";
|
||||||
c <| 42;
|
c <| 42;
|
||||||
log "Reading from a local task port.";
|
log "Reading from a local task port.";
|
||||||
let int value <- p;
|
let int value; value <- p;
|
||||||
log value;
|
log value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ fn test05() {
|
||||||
let port[int] po = port();
|
let port[int] po = port();
|
||||||
let chan[int] ch = chan(po);
|
let chan[int] ch = chan(po);
|
||||||
spawn thread test05_start(ch);
|
spawn thread test05_start(ch);
|
||||||
let int value <- po;
|
let int value; value <- po;
|
||||||
value <- po;
|
value <- po;
|
||||||
value <- po;
|
value <- po;
|
||||||
log value;
|
log value;
|
||||||
|
|
|
@ -9,7 +9,7 @@ fn main() {
|
||||||
|
|
||||||
ch <| 42;
|
ch <| 42;
|
||||||
|
|
||||||
auto r <- po;
|
auto r; r <- po;
|
||||||
|
|
||||||
log_err r;
|
log_err r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue