| Index: pkg/analyzer/lib/src/generated/parser.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
|
| index 07ef20ea86ca9002c5c292c2b36e0b7aafb2f370..a823e7d2d470ab7c0822f3a1b561d42a2546e2b8 100644
|
| --- a/pkg/analyzer/lib/src/generated/parser.dart
|
| +++ b/pkg/analyzer/lib/src/generated/parser.dart
|
| @@ -6372,7 +6372,7 @@ class Parser {
|
| Expression initialization = null;
|
| if (!_matches(TokenType.SEMICOLON)) {
|
| CommentAndMetadata commentAndMetadata = _parseCommentAndMetadata();
|
| - if (_matchesIdentifier() && _tokenMatchesKeyword(_peek(), Keyword.IN)) {
|
| + if (_matchesIdentifier() && (_tokenMatchesKeyword(_peek(), Keyword.IN) || _tokenMatches(_peek(), TokenType.COLON))) {
|
| List<VariableDeclaration> variables = new List<VariableDeclaration>();
|
| SimpleIdentifier variableName = parseSimpleIdentifier();
|
| variables.add(
|
| @@ -6389,7 +6389,10 @@ class Parser {
|
| } else {
|
| initialization = parseExpression2();
|
| }
|
| - if (_matchesKeyword(Keyword.IN)) {
|
| + if (_matchesKeyword(Keyword.IN) || _matches(TokenType.COLON)) {
|
| + if (_matches(TokenType.COLON)) {
|
| + _reportErrorForCurrentToken(ParserErrorCode.COLON_IN_PLACE_OF_IN);
|
| + }
|
| DeclaredIdentifier loopVariable = null;
|
| SimpleIdentifier identifier = null;
|
| if (variableList == null) {
|
| @@ -6426,7 +6429,7 @@ class Parser {
|
| identifier = variable.name;
|
| }
|
| }
|
| - Token inKeyword = _expectKeyword(Keyword.IN);
|
| + Token inKeyword = andAdvance;
|
| Expression iterator = parseExpression2();
|
| Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
|
| Statement body = parseStatement2();
|
| @@ -10085,6 +10088,10 @@ class ParserErrorCode extends ErrorCode {
|
| 'BREAK_OUTSIDE_OF_LOOP',
|
| "A break statement cannot be used outside of a loop or switch statement");
|
|
|
| + static const ParserErrorCode COLON_IN_PLACE_OF_IN = const ParserErrorCode(
|
| + 'COLON_IN_PLACE_OF_IN',
|
| + "For-in loops use 'in' rather than a colon");
|
| +
|
| static const ParserErrorCode CONST_AND_FINAL = const ParserErrorCode(
|
| 'CONST_AND_FINAL',
|
| "Members cannot be declared to be both 'const' and 'final'");
|
|
|