| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 part of scanner; | 5 part of scanner; |
| 6 | 6 |
| 7 class PartialParser extends Parser { | 7 class PartialParser extends Parser { |
| 8 PartialParser(Listener listener) : super(listener); | 8 PartialParser(Listener listener) : super(listener); |
| 9 | 9 |
| 10 Token parseClassBody(Token token) => skipClassBody(token); | 10 Token parseClassBody(Token token) => skipClassBody(token); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 BeginGroupToken beginGroupToken = token; | 88 BeginGroupToken beginGroupToken = token; |
| 89 Token endGroup = beginGroupToken.endGroup; | 89 Token endGroup = beginGroupToken.endGroup; |
| 90 if (endGroup == null) { | 90 if (endGroup == null) { |
| 91 return listener.unmatched(beginGroupToken); | 91 return listener.unmatched(beginGroupToken); |
| 92 } else if (!identical(endGroup.kind, $CLOSE_CURLY_BRACKET)) { | 92 } else if (!identical(endGroup.kind, $CLOSE_CURLY_BRACKET)) { |
| 93 return listener.unmatched(beginGroupToken); | 93 return listener.unmatched(beginGroupToken); |
| 94 } | 94 } |
| 95 return endGroup; | 95 return endGroup; |
| 96 } | 96 } |
| 97 | 97 |
| 98 Token parseFunctionBody(Token token, bool isExpression) { | 98 Token parseFunctionBody(Token token, bool isExpression, bool allowAbstract) { |
| 99 assert(!isExpression); | 99 assert(!isExpression); |
| 100 String value = token.stringValue; | 100 String value = token.stringValue; |
| 101 if (identical(value, ';')) { | 101 if (identical(value, ';')) { |
| 102 if (!allowAbstract) { |
| 103 listener.reportError(token, MessageKind.BODY_EXPECTED); |
| 104 } |
| 102 // No body. | 105 // No body. |
| 103 } else if (identical(value, '=>')) { | 106 } else if (identical(value, '=>')) { |
| 104 token = parseExpression(token.next); | 107 token = parseExpression(token.next); |
| 105 expectSemicolon(token); | 108 expectSemicolon(token); |
| 106 } else if (value == '=') { | 109 } else if (value == '=') { |
| 107 token = parseRedirectingFactoryBody(token); | 110 token = parseRedirectingFactoryBody(token); |
| 108 expectSemicolon(token); | 111 expectSemicolon(token); |
| 109 } else { | 112 } else { |
| 110 token = skipBlock(token); | 113 token = skipBlock(token); |
| 111 } | 114 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 125 return token; | 128 return token; |
| 126 } | 129 } |
| 127 return listener.unexpected(token); | 130 return listener.unexpected(token); |
| 128 } | 131 } |
| 129 BeginGroupToken beginGroupToken = token; | 132 BeginGroupToken beginGroupToken = token; |
| 130 Token endToken = beginGroupToken.endGroup; | 133 Token endToken = beginGroupToken.endGroup; |
| 131 listener.endFormalParameters(0, token, endToken); | 134 listener.endFormalParameters(0, token, endToken); |
| 132 return endToken.next; | 135 return endToken.next; |
| 133 } | 136 } |
| 134 } | 137 } |
| OLD | NEW |