diff options
Diffstat (limited to 'sources/scalac/ast/parser/Parser.java')
-rw-r--r-- | sources/scalac/ast/parser/Parser.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sources/scalac/ast/parser/Parser.java b/sources/scalac/ast/parser/Parser.java index 21b2e6e0bf..d6dc8fd37a 100644 --- a/sources/scalac/ast/parser/Parser.java +++ b/sources/scalac/ast/parser/Parser.java @@ -865,14 +865,11 @@ public class Parser implements Tokens { accept(LPAREN); enums = enumerators(); accept(RPAREN); - if (s.token == DO) { - return makeFor(s.skipToken(), enums, Names.foreach, Names.foreach, expr()); - } else if (s.token == YIELD) { + if (s.token == YIELD) return makeFor(s.skipToken(), enums, Names.map, Names.flatmap, expr()); - } else { - return syntaxError("`do' or `yield' expected", true); - } - } else if (s.token == RETURN) { + else + return makeFor(s.pos, enums, Names.foreach, Names.foreach, expr()); + } else if (s.token == RETURN) { int pos = s.skipToken(); Tree e = (isExprIntro()) ? expr() : make.Block(pos, Tree.EMPTY_ARRAY); |