syntax: Stop parsing old closure syntax
This commit is contained in:
parent
d1fc2b5995
commit
494264711d
1 changed files with 10 additions and 26 deletions
|
@ -776,8 +776,6 @@ class parser {
|
||||||
hi = self.span.hi;
|
hi = self.span.hi;
|
||||||
self.expect(token::RBRACE);
|
self.expect(token::RBRACE);
|
||||||
ex = expr_rec(fields, base);
|
ex = expr_rec(fields, base);
|
||||||
} else if token::is_bar(self.token) {
|
|
||||||
ret pexpr(self.parse_fn_block_expr_old());
|
|
||||||
} else {
|
} else {
|
||||||
let blk = self.parse_block_tail(lo, default_blk);
|
let blk = self.parse_block_tail(lo, default_blk);
|
||||||
ret self.mk_pexpr(blk.span.lo, blk.span.hi, expr_block(blk));
|
ret self.mk_pexpr(blk.span.lo, blk.span.hi, expr_block(blk));
|
||||||
|
@ -1357,14 +1355,6 @@ class parser {
|
||||||
expr_fn(proto, decl, body, capture_clause));
|
expr_fn(proto, decl, body, capture_clause));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_fn_block_expr_old() -> @expr {
|
|
||||||
let lo = self.last_span.lo;
|
|
||||||
let (decl, captures) = self.parse_fn_block_decl();
|
|
||||||
let body = self.parse_block_tail(lo, default_blk);
|
|
||||||
ret self.mk_expr(lo, body.span.hi,
|
|
||||||
expr_fn_block(decl, body, captures));
|
|
||||||
}
|
|
||||||
|
|
||||||
// `|args| { ... }` like in `do` expressions
|
// `|args| { ... }` like in `do` expressions
|
||||||
fn parse_lambda_block_expr() -> @expr {
|
fn parse_lambda_block_expr() -> @expr {
|
||||||
self.parse_lambda_expr_(|| {
|
self.parse_lambda_expr_(|| {
|
||||||
|
@ -1379,11 +1369,6 @@ class parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_lambda_expr_(parse_body: fn&() -> @expr) -> @expr {
|
fn parse_lambda_expr_(parse_body: fn&() -> @expr) -> @expr {
|
||||||
if self.token == token::LBRACE {
|
|
||||||
// Old style lambdas `{|args| ... }`
|
|
||||||
self.expect(token::LBRACE);
|
|
||||||
ret self.parse_fn_block_expr_old();
|
|
||||||
} else {
|
|
||||||
let lo = self.last_span.lo;
|
let lo = self.last_span.lo;
|
||||||
// New style lambdas `|args| expr`
|
// New style lambdas `|args| expr`
|
||||||
let (decl, captures) = self.parse_fn_block_decl();
|
let (decl, captures) = self.parse_fn_block_decl();
|
||||||
|
@ -1395,7 +1380,6 @@ class parser {
|
||||||
ret self.mk_expr(lo, body.span.hi,
|
ret self.mk_expr(lo, body.span.hi,
|
||||||
expr_fn_block(decl, fakeblock, captures));
|
expr_fn_block(decl, fakeblock, captures));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_else_expr() -> @expr {
|
fn parse_else_expr() -> @expr {
|
||||||
if self.eat_keyword("if") {
|
if self.eat_keyword("if") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue