| 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 ClassElementParser extends PartialParser { | 7 class ClassElementParser extends PartialParser { |
| 8 ClassElementParser(Listener listener) : super(listener); | 8 ClassElementParser(Listener listener) : super(listener); |
| 9 | 9 |
| 10 Token parseClassBody(Token token) => fullParseClassBody(token); | 10 Token parseClassBody(Token token) => fullParseClassBody(token); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 void endMethod(Token getOrSet, Token beginToken, Token endToken) { | 118 void endMethod(Token getOrSet, Token beginToken, Token endToken) { |
| 119 super.endMethod(getOrSet, beginToken, endToken); | 119 super.endMethod(getOrSet, beginToken, endToken); |
| 120 FunctionExpression method = popNode(); | 120 FunctionExpression method = popNode(); |
| 121 pushNode(null); | 121 pushNode(null); |
| 122 bool isConstructor = isConstructorName(method.name); | 122 bool isConstructor = isConstructorName(method.name); |
| 123 String name = getMethodNameHack(method.name); | 123 String name = getMethodNameHack(method.name); |
| 124 ElementKind kind = ElementKind.FUNCTION; | 124 ElementKind kind = ElementKind.FUNCTION; |
| 125 if (isConstructor) { | 125 if (isConstructor) { |
| 126 if (getOrSet != null) { | 126 if (getOrSet != null) { |
| 127 recoverableError('illegal modifier', token: getOrSet); | 127 recoverableError(getOrSet, 'illegal modifier'); |
| 128 } | 128 } |
| 129 kind = ElementKind.GENERATIVE_CONSTRUCTOR; | 129 kind = ElementKind.GENERATIVE_CONSTRUCTOR; |
| 130 } else if (getOrSet != null) { | 130 } else if (getOrSet != null) { |
| 131 kind = (identical(getOrSet.stringValue, 'get')) | 131 kind = (identical(getOrSet.stringValue, 'get')) |
| 132 ? ElementKind.GETTER : ElementKind.SETTER; | 132 ? ElementKind.GETTER : ElementKind.SETTER; |
| 133 } | 133 } |
| 134 bool hasNoBody = !isConstructor && !method.hasBody(); | 134 bool hasNoBody = !isConstructor && !method.hasBody(); |
| 135 Element memberElement = | 135 Element memberElement = |
| 136 new PartialFunctionElement(name, beginToken, getOrSet, endToken, | 136 new PartialFunctionElement(name, beginToken, getOrSet, endToken, |
| 137 kind, method.modifiers, enclosingElement, | 137 kind, method.modifiers, enclosingElement, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) { | 195 void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) { |
| 196 popNode(); // Discard arguments. | 196 popNode(); // Discard arguments. |
| 197 if (periodBeforeName != null) { | 197 if (periodBeforeName != null) { |
| 198 popNode(); // Discard name. | 198 popNode(); // Discard name. |
| 199 } | 199 } |
| 200 popNode(); // Discard node (Send or Identifier). | 200 popNode(); // Discard node (Send or Identifier). |
| 201 pushMetadata(new PartialMetadataAnnotation(beginToken, endToken)); | 201 pushMetadata(new PartialMetadataAnnotation(beginToken, endToken)); |
| 202 } | 202 } |
| 203 } | 203 } |
| OLD | NEW |