Be more careful when parsing block calls
Previously, the parser would try to interpret this as a block call: if true {} // No semicolon {|i, am, a, block|}; Which, though unlikely, might come up in practice.
This commit is contained in:
parent
3b5b93221e
commit
b0a72ee06a
1 changed files with 2 additions and 1 deletions
|
@ -1585,7 +1585,8 @@ fn parse_source_stmt(p: parser) -> @ast::stmt {
|
|||
// Remainder are line-expr stmts.
|
||||
let e = parse_expr(p);
|
||||
// See if it is a block call
|
||||
if p.peek() == token::LBRACE && is_bar(p.look_ahead(1u)) {
|
||||
if expr_has_value(e) && p.peek() == token::LBRACE &&
|
||||
is_bar(p.look_ahead(1u)) {
|
||||
p.bump();
|
||||
let blk = parse_fn_block_expr(p);
|
||||
alt e.node {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue