Skip to content

Commit

Permalink
auto merge of rust-lang#10792 : kballard/rust/parse_sugary_call_expr-…
Browse files Browse the repository at this point in the history
…comments, r=alexcrichton

The comments on this function date back from when it was used for `for`
expressions in addition to `do` expressions.
  • Loading branch information
bors committed Dec 4, 2013
2 parents 9b9cf98 + c00837e commit ad58e2c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2530,22 +2530,22 @@ impl Parser {
}


// parse a 'for' or 'do'.
// the 'for' and 'do' expressions parse as calls, but look like
// function calls followed by a closure expression.
// parse a 'do'.
// the 'do' expression parses as a call, but looks like
// a function call followed by a closure expression.
pub fn parse_sugary_call_expr(&self,
lo: BytePos,
keyword: ~str,
sugar: CallSugar,
ctor: |v: @Expr| -> Expr_)
-> @Expr {
// Parse the callee `foo` in
// for foo || {
// for foo.bar || {
// do foo || {
// do foo.bar || {
// etc, or the portion of the call expression before the lambda in
// for foo() || {
// do foo() || {
// or
// for foo.bar(a) || {
// do foo.bar(a) || {
// Turn on the restriction to stop at | or || so we can parse
// them as the lambda arguments
let e = self.parse_expr_res(RESTRICT_NO_BAR_OR_DOUBLEBAR_OP);
Expand Down Expand Up @@ -2592,7 +2592,7 @@ impl Parser {
}
_ => {
// There may be other types of expressions that can
// represent the callee in `for` and `do` expressions
// represent the callee in `do` expressions
// but they aren't represented by tests
debug!("sugary call on {:?}", e.node);
self.span_fatal(
Expand Down

0 comments on commit ad58e2c

Please sign in to comment.