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

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

Issue 2709783003: Parse optional and named parameters. (Closed)
Patch Set: Add 'FormalParameterType kind' to endFormalParameter() and add handleFormalParameterWithoutValue(). Created 3 years, 10 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 7 import 'package:kernel/ast.dart' show
8 AsyncMarker, 8 AsyncMarker,
9 ProcedureKind; 9 ProcedureKind;
10 10
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 push(popList(count) ?? NullValue.TypeVariables); 365 push(popList(count) ?? NullValue.TypeVariables);
366 } 366 }
367 367
368 @override 368 @override
369 void handleVoidKeyword(Token token) { 369 void handleVoidKeyword(Token token) {
370 debugEvent("VoidKeyword"); 370 debugEvent("VoidKeyword");
371 push(library.addVoidType(token.charOffset)); 371 push(library.addVoidType(token.charOffset));
372 } 372 }
373 373
374 @override 374 @override
375 void endFormalParameter(Token thisKeyword) { 375 void endFormalParameter(Token thisKeyword, FormalParameterType kind) {
376 debugEvent("FormalParameter"); 376 debugEvent("FormalParameter");
377 String name = pop(); 377 String name = pop();
378 TypeBuilder type = pop(); 378 TypeBuilder type = pop();
379 int modifiers = Modifier.validate(pop()); 379 int modifiers = Modifier.validate(pop());
380 List<MetadataBuilder> metadata = pop(); 380 List<MetadataBuilder> metadata = pop();
381 // TODO(ahe): Needs begin token. 381 // TODO(ahe): Needs begin token.
382 push(library.addFormalParameter(metadata, modifiers, type, name, 382 push(library.addFormalParameter(metadata, modifiers, type, name,
383 thisKeyword != null, thisKeyword?.charOffset ?? -1)); 383 thisKeyword != null, thisKeyword?.charOffset ?? -1));
384 } 384 }
385 385
386 @override 386 @override
387 void handleValuedFormalParameter(Token equals, Token token) { 387 void handleValuedFormalParameter(Token equals, Token token) {
388 debugEvent("ValuedFormalParameter"); 388 debugEvent("ValuedFormalParameter");
389 // Ignored for now. 389 // Ignored for now.
390 } 390 }
391 391
392 @override 392 @override
393 void handleFormalParameterWithoutValue(Token token) {
394 debugEvent("FormalParameterWithoutValue");
395 // Ignored for now.
396 }
397
398 @override
393 void endFunctionTypedFormalParameter(Token token) { 399 void endFunctionTypedFormalParameter(Token token) {
394 debugEvent("FunctionTypedFormalParameter"); 400 debugEvent("FunctionTypedFormalParameter");
395 pop(); // Function type parameters. 401 pop(); // Function type parameters.
396 pop(); // Type variables. 402 pop(); // Type variables.
397 String name = pop(); 403 String name = pop();
398 pop(); // Return type. 404 pop(); // Return type.
399 push(NullValue.Type); 405 push(NullValue.Type);
400 push(name); 406 push(name);
401 } 407 }
402 408
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 Link<Token> handleMemberName(Link<Token> identifiers) { 622 Link<Token> handleMemberName(Link<Token> identifiers) {
617 if (!isDartLibrary || identifiers.isEmpty) return identifiers; 623 if (!isDartLibrary || identifiers.isEmpty) return identifiers;
618 return removeNativeClause(identifiers); 624 return removeNativeClause(identifiers);
619 } 625 }
620 626
621 @override 627 @override
622 void debugEvent(String name) { 628 void debugEvent(String name) {
623 // printEvent(name); 629 // printEvent(name);
624 } 630 }
625 } 631 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698