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

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 2750503012: Re-land "Add support for metadata on type variables to Fasta parser." (with fixes). (Closed)
Patch Set: Fixes Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library fasta.parser.parser; 5 library fasta.parser.parser;
6 6
7 import '../scanner.dart' show ErrorToken; 7 import '../scanner.dart' show ErrorToken;
8 8
9 import '../scanner/recover.dart' show closeBraceFor, skipToEof; 9 import '../scanner/recover.dart' show closeBraceFor, skipToEof;
10 10
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 Token expect(String string, Token token) { 894 Token expect(String string, Token token) {
895 if (!identical(string, token.stringValue)) { 895 if (!identical(string, token.stringValue)) {
896 return reportUnrecoverableError( 896 return reportUnrecoverableError(
897 token, ErrorKind.ExpectedButGot, {"expected": string})?.next; 897 token, ErrorKind.ExpectedButGot, {"expected": string})?.next;
898 } 898 }
899 return token.next; 899 return token.next;
900 } 900 }
901 901
902 Token parseTypeVariable(Token token) { 902 Token parseTypeVariable(Token token) {
903 listener.beginTypeVariable(token); 903 listener.beginTypeVariable(token);
904 token = parseMetadataStar(token);
904 token = parseIdentifier(token, IdentifierContext.typeVariableDeclaration); 905 token = parseIdentifier(token, IdentifierContext.typeVariableDeclaration);
905 Token extendsOrSuper = null; 906 Token extendsOrSuper = null;
906 if (optional('extends', token) || optional('super', token)) { 907 if (optional('extends', token) || optional('super', token)) {
907 extendsOrSuper = token; 908 extendsOrSuper = token;
908 token = parseType(token.next); 909 token = parseType(token.next);
909 } else { 910 } else {
910 listener.handleNoType(token); 911 listener.handleNoType(token);
911 } 912 }
912 listener.endTypeVariable(token, extendsOrSuper); 913 listener.endTypeVariable(token, extendsOrSuper);
913 return token; 914 return token;
(...skipping 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after
3604 break; 3605 break;
3605 } 3606 }
3606 if (isRecoverable) { 3607 if (isRecoverable) {
3607 listener.handleRecoverableError(token, kind, arguments); 3608 listener.handleRecoverableError(token, kind, arguments);
3608 return null; 3609 return null;
3609 } else { 3610 } else {
3610 return listener.handleUnrecoverableError(token, kind, arguments); 3611 return listener.handleUnrecoverableError(token, kind, arguments);
3611 } 3612 }
3612 } 3613 }
3613 } 3614 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/listener.dart ('k') | pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698