Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 1033333003: improve parser recovery for incomplete prefixed identifier in method/function parameter list (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.parser; 8 library engine.parser;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
(...skipping 7845 matching lines...) Expand 10 before | Expand all | Expand 10 after
7856 * prefixedIdentifier ::= 7856 * prefixedIdentifier ::=
7857 * identifier ('.' identifier)? 7857 * identifier ('.' identifier)?
7858 */ 7858 */
7859 Token _skipPrefixedIdentifier(Token startToken) { 7859 Token _skipPrefixedIdentifier(Token startToken) {
7860 Token token = _skipSimpleIdentifier(startToken); 7860 Token token = _skipSimpleIdentifier(startToken);
7861 if (token == null) { 7861 if (token == null) {
7862 return null; 7862 return null;
7863 } else if (!_tokenMatches(token, TokenType.PERIOD)) { 7863 } else if (!_tokenMatches(token, TokenType.PERIOD)) {
7864 return token; 7864 return token;
7865 } 7865 }
7866 return _skipSimpleIdentifier(token.next); 7866 token = token.next;
7867 Token nextToken = _skipSimpleIdentifier(token);
7868 if (nextToken != null) {
7869 return nextToken;
7870 } else if (_tokenMatches(token, TokenType.CLOSE_PAREN)
7871 || _tokenMatches(token, TokenType.COMMA)) {
7872 // If the `id.` is followed by something that cannot produce a valid
7873 // structure then assume this is a prefixed identifier but missing the
7874 // trailing identifier
7875 return token;
7876 }
7877 return null;
7867 } 7878 }
7868 7879
7869 /** 7880 /**
7870 * Parse a return type, starting at the [startToken], without actually 7881 * Parse a return type, starting at the [startToken], without actually
7871 * creating a return type or changing the current token. Return the token 7882 * creating a return type or changing the current token. Return the token
7872 * following the return type that was parsed, or `null` if the given token is 7883 * following the return type that was parsed, or `null` if the given token is
7873 * not the first token in a valid return type. 7884 * not the first token in a valid return type.
7874 * 7885 *
7875 * This method must be kept in sync with [parseReturnType]. 7886 * This method must be kept in sync with [parseReturnType].
7876 * 7887 *
(...skipping 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after
10577 } 10588 }
10578 10589
10579 /** 10590 /**
10580 * Copy resolution data from the [fromNode] to the [toNode]. 10591 * Copy resolution data from the [fromNode] to the [toNode].
10581 */ 10592 */
10582 static void copyResolutionData(AstNode fromNode, AstNode toNode) { 10593 static void copyResolutionData(AstNode fromNode, AstNode toNode) {
10583 ResolutionCopier copier = new ResolutionCopier(); 10594 ResolutionCopier copier = new ResolutionCopier();
10584 copier._isEqualNodes(fromNode, toNode); 10595 copier._isEqualNodes(fromNode, toNode);
10585 } 10596 }
10586 } 10597 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/completion/optype_test.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698