| OLD | NEW |
| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 ++parameterCount; | 485 ++parameterCount; |
| 486 String value = token.stringValue; | 486 String value = token.stringValue; |
| 487 if (identical(value, '[')) { | 487 if (identical(value, '[')) { |
| 488 token = parseOptionalFormalParameters(token, false, | 488 token = parseOptionalFormalParameters(token, false, |
| 489 inFunctionType: inFunctionType); | 489 inFunctionType: inFunctionType); |
| 490 break; | 490 break; |
| 491 } else if (identical(value, '{')) { | 491 } else if (identical(value, '{')) { |
| 492 token = parseOptionalFormalParameters(token, true, | 492 token = parseOptionalFormalParameters(token, true, |
| 493 inFunctionType: inFunctionType); | 493 inFunctionType: inFunctionType); |
| 494 break; | 494 break; |
| 495 } else if (identical(value, '[]')) { |
| 496 --parameterCount; |
| 497 reportRecoverableError(token, ErrorKind.EmptyOptionalParameterList); |
| 498 token = token.next; |
| 499 break; |
| 495 } | 500 } |
| 496 token = parseFormalParameter(token, FormalParameterType.REQUIRED, | 501 token = parseFormalParameter(token, FormalParameterType.REQUIRED, |
| 497 inFunctionType: inFunctionType); | 502 inFunctionType: inFunctionType); |
| 498 } while (optional(',', token)); | 503 } while (optional(',', token)); |
| 499 listener.endFormalParameters(parameterCount, begin, token); | 504 listener.endFormalParameters(parameterCount, begin, token); |
| 500 return expect(')', token); | 505 return expect(')', token); |
| 501 } | 506 } |
| 502 | 507 |
| 503 Token parseFormalParameter(Token token, FormalParameterType kind, | 508 Token parseFormalParameter(Token token, FormalParameterType kind, |
| 504 {bool inFunctionType: false}) { | 509 {bool inFunctionType: false}) { |
| (...skipping 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3578 break; | 3583 break; |
| 3579 } | 3584 } |
| 3580 if (isRecoverable) { | 3585 if (isRecoverable) { |
| 3581 listener.handleRecoverableError(token, kind, arguments); | 3586 listener.handleRecoverableError(token, kind, arguments); |
| 3582 return null; | 3587 return null; |
| 3583 } else { | 3588 } else { |
| 3584 return listener.handleUnrecoverableError(token, kind, arguments)?.next; | 3589 return listener.handleUnrecoverableError(token, kind, arguments)?.next; |
| 3585 } | 3590 } |
| 3586 } | 3591 } |
| 3587 } | 3592 } |
| OLD | NEW |