| 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 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 String value = token.stringValue; | 2000 String value = token.stringValue; |
| 2001 if (identical(value, ';')) { | 2001 if (identical(value, ';')) { |
| 2002 if (!allowAbstract) { | 2002 if (!allowAbstract) { |
| 2003 reportRecoverableError(token, ErrorKind.ExpectedBody); | 2003 reportRecoverableError(token, ErrorKind.ExpectedBody); |
| 2004 } | 2004 } |
| 2005 listener.handleNoFunctionBody(token); | 2005 listener.handleNoFunctionBody(token); |
| 2006 } else { | 2006 } else { |
| 2007 if (identical(value, '=>')) { | 2007 if (identical(value, '=>')) { |
| 2008 token = parseExpression(token.next); | 2008 token = parseExpression(token.next); |
| 2009 expectSemicolon(token); | 2009 expectSemicolon(token); |
| 2010 listener.handleFunctionBodySkipped(token, true); |
| 2010 } else if (identical(value, '=')) { | 2011 } else if (identical(value, '=')) { |
| 2011 reportRecoverableError(token, ErrorKind.ExpectedBody); | 2012 reportRecoverableError(token, ErrorKind.ExpectedBody); |
| 2012 token = parseExpression(token.next); | 2013 token = parseExpression(token.next); |
| 2013 expectSemicolon(token); | 2014 expectSemicolon(token); |
| 2015 listener.handleFunctionBodySkipped(token, true); |
| 2014 } else { | 2016 } else { |
| 2015 token = skipBlock(token); | 2017 token = skipBlock(token); |
| 2018 listener.handleFunctionBodySkipped(token, false); |
| 2016 } | 2019 } |
| 2017 listener.handleFunctionBodySkipped(token); | |
| 2018 } | 2020 } |
| 2019 return token; | 2021 return token; |
| 2020 } | 2022 } |
| 2021 | 2023 |
| 2022 Token parseFunctionBody(Token token, bool isExpression, bool allowAbstract) { | 2024 Token parseFunctionBody(Token token, bool isExpression, bool allowAbstract) { |
| 2023 if (optional(';', token)) { | 2025 if (optional(';', token)) { |
| 2024 if (!allowAbstract) { | 2026 if (!allowAbstract) { |
| 2025 reportRecoverableError(token, ErrorKind.ExpectedBody); | 2027 reportRecoverableError(token, ErrorKind.ExpectedBody); |
| 2026 } | 2028 } |
| 2027 listener.endFunctionBody(0, null, token); | 2029 listener.endFunctionBody(0, null, token); |
| (...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3578 break; | 3580 break; |
| 3579 } | 3581 } |
| 3580 if (isRecoverable) { | 3582 if (isRecoverable) { |
| 3581 listener.handleRecoverableError(token, kind, arguments); | 3583 listener.handleRecoverableError(token, kind, arguments); |
| 3582 return null; | 3584 return null; |
| 3583 } else { | 3585 } else { |
| 3584 return listener.handleUnrecoverableError(token, kind, arguments)?.next; | 3586 return listener.handleUnrecoverableError(token, kind, arguments)?.next; |
| 3585 } | 3587 } |
| 3586 } | 3588 } |
| 3587 } | 3589 } |
| OLD | NEW |