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

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 1062343002: improve parser recovery for import directives (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge 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 side-by-side diff with in-line comments
Download patch
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 50db79161cab990df939a00c2bdc7c6078ea3810..0d2cbc08af064eb694c273ed3920973d8a50b3e4 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -5952,7 +5952,7 @@ class Parser {
* associated with the directive. Return the import directive that was parsed.
*
* importDirective ::=
- * metadata 'import' stringLiteral ('as' identifier)? combinator*';'
+ * metadata 'import' stringLiteral (deferred)? ('as' identifier)? combinator*';'
*/
ImportDirective _parseImportDirective(CommentAndMetadata commentAndMetadata) {
Token importKeyword = _expectKeyword(Keyword.IMPORT);
@@ -5969,6 +5969,13 @@ class Parser {
} else if (deferredToken != null) {
_reportErrorForCurrentToken(
ParserErrorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT);
+ } else if (!_matches(TokenType.SEMICOLON) &&
+ _tokenMatchesKeyword(_peek(), Keyword.AS)) {
+ _reportErrorForCurrentToken(
+ ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken]);
+ _advance();
+ asToken = getAndAdvance();
+ prefix = parseSimpleIdentifier();
}
List<Combinator> combinators = _parseCombinators();
Token semicolon = _expectSemicolon();

Powered by Google App Engine
This is Rietveld 408576698