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

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

Issue 2948383002: Remove peeking from parseTypedef and parseClassOrNamedMixinApplication. (Closed)
Patch Set: Addressed comments and then some. Created 3 years, 5 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.outline_builder; 5 library fasta.outline_builder;
6 6
7 import 'package:kernel/ast.dart' show ProcedureKind; 7 import 'package:kernel/ast.dart' show ProcedureKind;
8 8
9 import '../fasta_codes.dart' show FastaMessage, codeExpectedBlockToSkip; 9 import '../fasta_codes.dart' show FastaMessage, codeExpectedBlockToSkip;
10 10
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 void endLibraryName(Token libraryKeyword, Token semicolon) { 240 void endLibraryName(Token libraryKeyword, Token semicolon) {
241 debugEvent("endLibraryName"); 241 debugEvent("endLibraryName");
242 popCharOffset(); 242 popCharOffset();
243 String name = pop(); 243 String name = pop();
244 List<MetadataBuilder> metadata = pop(); 244 List<MetadataBuilder> metadata = pop();
245 library.name = name; 245 library.name = name;
246 library.metadata = metadata; 246 library.metadata = metadata;
247 } 247 }
248 248
249 @override 249 @override
250 void beginClassDeclaration(Token begin, Token name) { 250 void beginClassOrNamedMixinApplication(Token token) {
251 library.beginNestedDeclaration(name.lexeme); 251 library.beginNestedDeclaration(null);
252 } 252 }
253 253
254 @override 254 @override
255 void beginClassDeclaration(Token begin, Token name) {
256 library.currentDeclaration.name = name.lexeme;
257 }
258
259 @override
260 void beginNamedMixinApplication(Token beginToken, Token name) {
261 library.currentDeclaration.name = name.lexeme;
262 }
263
264 @override
255 void endClassDeclaration( 265 void endClassDeclaration(
256 int interfacesCount, 266 int interfacesCount,
257 Token beginToken, 267 Token beginToken,
258 Token classKeyword, 268 Token classKeyword,
259 Token extendsKeyword, 269 Token extendsKeyword,
260 Token implementsKeyword, 270 Token implementsKeyword,
261 Token endToken) { 271 Token endToken) {
262 debugEvent("endClassDeclaration"); 272 debugEvent("endClassDeclaration");
263 List<TypeBuilder> interfaces = popList(interfacesCount); 273 List<TypeBuilder> interfaces = popList(interfacesCount);
264 TypeBuilder supertype = pop(); 274 TypeBuilder supertype = pop();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 @override 412 @override
403 void endMixinApplication(Token withKeyword) { 413 void endMixinApplication(Token withKeyword) {
404 debugEvent("MixinApplication"); 414 debugEvent("MixinApplication");
405 List<TypeBuilder> mixins = pop(); 415 List<TypeBuilder> mixins = pop();
406 TypeBuilder supertype = pop(); 416 TypeBuilder supertype = pop();
407 push( 417 push(
408 library.addMixinApplication(supertype, mixins, withKeyword.charOffset)); 418 library.addMixinApplication(supertype, mixins, withKeyword.charOffset));
409 } 419 }
410 420
411 @override 421 @override
412 void beginNamedMixinApplication(Token begin, Token name) {
413 library.beginNestedDeclaration(name.lexeme, hasMembers: false);
414 }
415
416 @override
417 void endNamedMixinApplication(Token beginToken, Token classKeyword, 422 void endNamedMixinApplication(Token beginToken, Token classKeyword,
418 Token equals, Token implementsKeyword, Token endToken) { 423 Token equals, Token implementsKeyword, Token endToken) {
419 debugEvent("endNamedMixinApplication"); 424 debugEvent("endNamedMixinApplication");
420 List<TypeBuilder> interfaces = popIfNotNull(implementsKeyword); 425 List<TypeBuilder> interfaces = popIfNotNull(implementsKeyword);
421 TypeBuilder mixinApplication = pop(); 426 TypeBuilder mixinApplication = pop();
422 List<TypeVariableBuilder> typeVariables = pop(); 427 List<TypeVariableBuilder> typeVariables = pop();
423 int charOffset = pop(); 428 int charOffset = pop();
424 String name = pop(); 429 String name = pop();
425 int modifiers = Modifier.validate(pop()); 430 int modifiers = Modifier.validate(pop());
426 List<MetadataBuilder> metadata = pop(); 431 List<MetadataBuilder> metadata = pop();
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 Link<Token> handleMemberName(Link<Token> identifiers) { 859 Link<Token> handleMemberName(Link<Token> identifiers) {
855 if (!enableNative || identifiers.isEmpty) return identifiers; 860 if (!enableNative || identifiers.isEmpty) return identifiers;
856 return removeNativeClause(identifiers); 861 return removeNativeClause(identifiers);
857 } 862 }
858 863
859 @override 864 @override
860 void debugEvent(String name) { 865 void debugEvent(String name) {
861 // printEvent(name); 866 // printEvent(name);
862 } 867 }
863 } 868 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/parser.md ('k') | pkg/front_end/lib/src/fasta/source/source_library_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698