| 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 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 listener.handleFunctionBodySkipped(token); | 2017 listener.handleFunctionBodySkipped(token); |
| 2018 } | 2018 } |
| 2019 return token; | 2019 return token; |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 Token parseFunctionBody(Token token, bool isExpression, bool allowAbstract) { | 2022 Token parseFunctionBody(Token token, bool isExpression, bool allowAbstract) { |
| 2023 if (optional(';', token)) { | 2023 if (optional(';', token)) { |
| 2024 if (!allowAbstract) { | 2024 if (!allowAbstract) { |
| 2025 reportRecoverableError(token, ErrorKind.ExpectedBody); | 2025 reportRecoverableError(token, ErrorKind.ExpectedBody); |
| 2026 } | 2026 } |
| 2027 listener.endFunctionBody(0, null, token); | 2027 listener.endEmptyFunctionBody(token); |
| 2028 return token; | 2028 return token; |
| 2029 } else if (optional('=>', token)) { | 2029 } else if (optional('=>', token)) { |
| 2030 Token begin = token; | 2030 Token begin = token; |
| 2031 token = parseExpression(token.next); | 2031 token = parseExpression(token.next); |
| 2032 if (!isExpression) { | 2032 if (!isExpression) { |
| 2033 expectSemicolon(token); | 2033 expectSemicolon(token); |
| 2034 listener.endExpressionFunctionBody(begin, token); | 2034 listener.endExpressionFunctionBody(begin, token); |
| 2035 } else { | 2035 } else { |
| 2036 listener.endExpressionFunctionBody(begin, null); | 2036 listener.endExpressionFunctionBody(begin, null); |
| 2037 } | 2037 } |
| (...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3578 break; | 3578 break; |
| 3579 } | 3579 } |
| 3580 if (isRecoverable) { | 3580 if (isRecoverable) { |
| 3581 listener.handleRecoverableError(token, kind, arguments); | 3581 listener.handleRecoverableError(token, kind, arguments); |
| 3582 return null; | 3582 return null; |
| 3583 } else { | 3583 } else { |
| 3584 return listener.handleUnrecoverableError(token, kind, arguments)?.next; | 3584 return listener.handleUnrecoverableError(token, kind, arguments)?.next; |
| 3585 } | 3585 } |
| 3586 } | 3586 } |
| 3587 } | 3587 } |
| OLD | NEW |