| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if (isPatched) { | 50 if (isPatched) { |
| 51 // TODO(lrn): Perhaps extract functionality so it doesn't | 51 // TODO(lrn): Perhaps extract functionality so it doesn't |
| 52 // need compiler. | 52 // need compiler. |
| 53 compiler.patchParser.parsePatchClassNode(patch); | 53 compiler.patchParser.parsePatchClassNode(patch); |
| 54 } | 54 } |
| 55 }); | 55 }); |
| 56 }); | 56 }); |
| 57 return cachedNode; | 57 return cachedNode; |
| 58 } | 58 } |
| 59 | 59 |
| 60 Token position() => beginToken; | 60 Token get position => beginToken; |
| 61 | 61 |
| 62 // TODO(johnniwinther): Ensure that modifiers are always available. | 62 // TODO(johnniwinther): Ensure that modifiers are always available. |
| 63 Modifiers get modifiers => | 63 Modifiers get modifiers => |
| 64 cachedNode != null ? cachedNode.modifiers : Modifiers.EMPTY; | 64 cachedNode != null ? cachedNode.modifiers : Modifiers.EMPTY; |
| 65 | 65 |
| 66 accept(ElementVisitor visitor) => visitor.visitClassElement(this); | 66 accept(ElementVisitor visitor) => visitor.visitClassElement(this); |
| 67 } | 67 } |
| 68 | 68 |
| 69 class MemberListener extends NodeListener { | 69 class MemberListener extends NodeListener { |
| 70 final ClassElement enclosingElement; | 70 final ClassElement enclosingElement; |
| 71 | 71 |
| 72 MemberListener(DiagnosticListener listener, | 72 MemberListener(DiagnosticListener listener, |
| 73 Element enclosingElement) | 73 Element enclosingElement) |
| 74 : this.enclosingElement = enclosingElement, | 74 : this.enclosingElement = enclosingElement, |
| 75 super(listener, enclosingElement.getCompilationUnit()); | 75 super(listener, enclosingElement.compilationUnit); |
| 76 | 76 |
| 77 bool isConstructorName(Node nameNode) { | 77 bool isConstructorName(Node nameNode) { |
| 78 if (enclosingElement == null || | 78 if (enclosingElement == null || |
| 79 enclosingElement.kind != ElementKind.CLASS) { | 79 enclosingElement.kind != ElementKind.CLASS) { |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 String name; | 82 String name; |
| 83 if (nameNode.asIdentifier() != null) { | 83 if (nameNode.asIdentifier() != null) { |
| 84 name = nameNode.asIdentifier().source; | 84 name = nameNode.asIdentifier().source; |
| 85 } else { | 85 } else { |
| (...skipping 108 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 |