| OLD | NEW |
| 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 AsyncMarker, ProcedureKind; | 7 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; |
| 8 | 8 |
| 9 import '../parser/parser.dart' show FormalParameterType, optional; | 9 import '../parser/parser.dart' show FormalParameterType, optional; |
| 10 | 10 |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 push(name); | 418 push(name); |
| 419 } | 419 } |
| 420 | 420 |
| 421 @override | 421 @override |
| 422 void endOptionalFormalParameters( | 422 void endOptionalFormalParameters( |
| 423 int count, Token beginToken, Token endToken) { | 423 int count, Token beginToken, Token endToken) { |
| 424 debugEvent("OptionalFormalParameters"); | 424 debugEvent("OptionalFormalParameters"); |
| 425 FormalParameterType kind = optional("{", beginToken) | 425 FormalParameterType kind = optional("{", beginToken) |
| 426 ? FormalParameterType.NAMED | 426 ? FormalParameterType.NAMED |
| 427 : FormalParameterType.POSITIONAL; | 427 : FormalParameterType.POSITIONAL; |
| 428 List parameters = popList(count); | 428 // When recovering from an empty list of optional arguments, count may be |
| 429 // 0. It might be simpler if the parser didn't call this method in that |
| 430 // case, however, then [beginOptionalFormalParameters] wouldn't always be |
| 431 // matched by this method. |
| 432 List parameters = popList(count) ?? []; |
| 429 for (FormalParameterBuilder parameter in parameters) { | 433 for (FormalParameterBuilder parameter in parameters) { |
| 430 parameter.kind = kind; | 434 parameter.kind = kind; |
| 431 } | 435 } |
| 432 push(parameters); | 436 push(parameters); |
| 433 } | 437 } |
| 434 | 438 |
| 435 @override | 439 @override |
| 436 void endFormalParameters(int count, Token beginToken, Token endToken) { | 440 void endFormalParameters(int count, Token beginToken, Token endToken) { |
| 437 debugEvent("FormalParameters"); | 441 debugEvent("FormalParameters"); |
| 438 List formals = popList(count); | 442 List formals = popList(count); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 Link<Token> handleMemberName(Link<Token> identifiers) { | 641 Link<Token> handleMemberName(Link<Token> identifiers) { |
| 638 if (!isDartLibrary || identifiers.isEmpty) return identifiers; | 642 if (!isDartLibrary || identifiers.isEmpty) return identifiers; |
| 639 return removeNativeClause(identifiers); | 643 return removeNativeClause(identifiers); |
| 640 } | 644 } |
| 641 | 645 |
| 642 @override | 646 @override |
| 643 void debugEvent(String name) { | 647 void debugEvent(String name) { |
| 644 // printEvent(name); | 648 // printEvent(name); |
| 645 } | 649 } |
| 646 } | 650 } |
| OLD | NEW |