@@ -1660,43 +1660,45 @@ impl Parser {
16601660 // them as the lambda arguments
16611661 let e = self.parse_expr_res(RESTRICT_NO_BAR_OR_DOUBLEBAR_OP);
16621662 match e.node {
1663- expr_call(f, args, false) => {
1664- let block = self.parse_lambda_block_expr();
1665- let last_arg = self.mk_expr(block.span.lo, block.span.hi,
1666- ctor(block));
1667- let args = vec::append(args, ~[last_arg]);
1668- @expr {node: expr_call(f, args, true), .. *e}
1669- }
1670- expr_method_call(f, i, tps, args, false) => {
1671- let block = self.parse_lambda_block_expr();
1672- let last_arg = self.mk_expr(block.span.lo, block.span.hi,
1673- ctor(block));
1674- let args = vec::append(args, ~[last_arg]);
1675- @expr {node: expr_method_call(f, i, tps, args, true), .. *e}
1676- }
1677- expr_field(f, i, tps) => {
1678- let block = self.parse_lambda_block_expr();
1679- let last_arg = self.mk_expr(block.span.lo, block.span.hi,
1680- ctor(block));
1681- @expr {node: expr_method_call(f, i, tps, ~[last_arg], true),
1682- .. *e}
1683- }
1684- expr_path(*) | expr_call(*) | expr_method_call(*) |
1685- expr_paren(*) => {
1686- let block = self.parse_lambda_block_expr();
1687- let last_arg = self.mk_expr(block.span.lo, block.span.hi,
1688- ctor(block));
1689- self.mk_expr(lo.lo, last_arg.span.hi,
1690- expr_call(e, ~[last_arg], true))
1691- }
1692- _ => {
1693- // There may be other types of expressions that can
1694- // represent the callee in `for` and `do` expressions
1695- // but they aren't represented by tests
1696- debug!(" sugary call on %?", e.node);
1697- self.span_fatal(
1698- lo, fmt!(" `%s` must be followed by a block call", keyword));
1699- }
1663+ expr_call(f, args, false) => {
1664+ let block = self.parse_lambda_block_expr();
1665+ let last_arg = self.mk_expr(block.span.lo, block.span.hi,
1666+ ctor(block));
1667+ let args = vec::append(args, ~[last_arg]);
1668+ self.mk_expr(lo.lo, block.span.hi, expr_call(f, args, true))
1669+ }
1670+ expr_method_call(f, i, tps, args, false) => {
1671+ let block = self.parse_lambda_block_expr();
1672+ let last_arg = self.mk_expr(block.span.lo, block.span.hi,
1673+ ctor(block));
1674+ let args = vec::append(args, ~[last_arg]);
1675+ self.mk_expr(lo.lo, block.span.hi,
1676+ expr_method_call(f, i, tps, args, true))
1677+ }
1678+ expr_field(f, i, tps) => {
1679+ let block = self.parse_lambda_block_expr();
1680+ let last_arg = self.mk_expr(block.span.lo, block.span.hi,
1681+ ctor(block));
1682+ self.mk_expr(lo.lo, block.span.hi,
1683+ expr_method_call(f, i, tps, ~[last_arg], true))
1684+ }
1685+ expr_path(*) | expr_call(*) | expr_method_call(*) |
1686+ expr_paren(*) => {
1687+ let block = self.parse_lambda_block_expr();
1688+ let last_arg = self.mk_expr(block.span.lo, block.span.hi,
1689+ ctor(block));
1690+ self.mk_expr(lo.lo, last_arg.span.hi,
1691+ expr_call(e, ~[last_arg], true))
1692+ }
1693+ _ => {
1694+ // There may be other types of expressions that can
1695+ // represent the callee in `for` and `do` expressions
1696+ // but they aren't represented by tests
1697+ debug!(" sugary call on %?", e.node);
1698+ self.span_fatal(
1699+ lo, fmt!(" `%s` must be followed by a block call",
1700+ keyword));
1701+ }
17001702 }
17011703 }
17021704
0 commit comments