| 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 class PartialParser extends Parser { | 5 class PartialParser extends Parser { |
| 6 PartialParser(Listener listener) : super(listener); | 6 PartialParser(Listener listener) : super(listener); |
| 7 | 7 |
| 8 Token parseClassBody(Token token) => skipBlock(token); | 8 Token parseClassBody(Token token) => skipBlock(token); |
| 9 | 9 |
| 10 Token fullParseClassBody(Token token) => super.parseClassBody(token); | 10 Token fullParseClassBody(Token token) => super.parseClassBody(token); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 if ((value !== '<') && (token is BeginGroupToken)) { | 23 if ((value !== '<') && (token is BeginGroupToken)) { |
| 24 BeginGroupToken begin = token; | 24 BeginGroupToken begin = token; |
| 25 token = (begin.endGroup !== null) ? begin.endGroup : token; | 25 token = (begin.endGroup !== null) ? begin.endGroup : token; |
| 26 } | 26 } |
| 27 token = token.next; | 27 token = token.next; |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 Token parseFunctionBody(Token token, bool isExpression) { | 31 Token parseFunctionBody(Token token, bool isExpression) { |
| 32 assert(!isExpression); | 32 assert(!isExpression); |
| 33 if (optional(';', token)) { | 33 String value = token.stringValue; |
| 34 listener.handleNoFunctionBody(token); | 34 if (value === ';') { |
| 35 return token; | 35 // No body. |
| 36 } else if (optional('=>', token)) { | 36 } else if (value === '=>') { |
| 37 token = parseExpression(token.next); | 37 token = parseExpression(token.next); |
| 38 expectSemicolon(token); | 38 expectSemicolon(token); |
| 39 return token; | |
| 40 } else { | 39 } else { |
| 41 token = skipBlock(token); | 40 token = skipBlock(token); |
| 42 listener.handleNoFunctionBody(token); | |
| 43 return token; | |
| 44 } | 41 } |
| 42 // There is no "skipped function body event", so we use |
| 43 // handleNoFunctionBody instead. |
| 44 listener.handleNoFunctionBody(token); |
| 45 return token; |
| 46 } |
| 47 |
| 48 Token parseFormalParameters(Token token) => skipFormals(token); |
| 49 |
| 50 Token skipFormals(BeginGroupToken token) { |
| 51 listener.beginOptionalFormalParameters(token); |
| 52 expect('(', token); |
| 53 Token endToken = token.endGroup; |
| 54 listener.endFormalParameters(0, token, endToken); |
| 55 return endToken.next; |
| 45 } | 56 } |
| 46 } | 57 } |
| OLD | NEW |