Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: dart/lib/compiler/implementation/scanner/class_element_parser.dart

Issue 11117022: Fix a crash related to obsolete factory syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 ClassElementParser extends PartialParser { 5 class ClassElementParser extends PartialParser {
6 ClassElementParser(Listener listener) : super(listener); 6 ClassElementParser(Listener listener) : super(listener);
7 7
8 Token parseClassBody(Token token) => fullParseClassBody(token); 8 Token parseClassBody(Token token) => fullParseClassBody(token);
9 } 9 }
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 SourceString name; 79 SourceString name;
80 if (nameNode.asIdentifier() !== null) { 80 if (nameNode.asIdentifier() !== null) {
81 name = nameNode.asIdentifier().source; 81 name = nameNode.asIdentifier().source;
82 } else { 82 } else {
83 Send send = nameNode.asSend(); 83 Send send = nameNode.asSend();
84 name = send.receiver.asIdentifier().source; 84 name = send.receiver.asIdentifier().source;
85 } 85 }
86 return enclosingElement.name == name; 86 return enclosingElement.name == name;
87 } 87 }
88 88
89 SourceString getMethodNameHack(Node methodName) { 89 SourceString getMethodNameHack(Node methodName) {
Lasse Reichstein Nielsen 2012/10/15 08:34:37 A method with a name like this *needs* documentati
ahe 2012/10/15 20:39:15 I have been focused on removing this method. This
90 Send send = methodName.asSend(); 90 Send send = methodName.asSend();
91 if (send === null) return methodName.asIdentifier().source; 91 if (send === null) return methodName.asIdentifier().source;
92 Identifier receiver = send.receiver.asIdentifier(); 92 Identifier receiver = send.receiver.asIdentifier();
93 Identifier selector = send.selector.asIdentifier(); 93 Identifier selector = send.selector.asIdentifier();
94 Operator operator = selector.asOperator(); 94 Operator operator = selector.asOperator();
95 if (operator !== null) { 95 if (operator !== null) {
96 assert(receiver.source.stringValue === 'operator'); 96 assert(receiver.source.stringValue === 'operator');
97 // TODO(ahe): It is a hack to compare to ')', but it beats 97 // TODO(ahe): It is a hack to compare to ')', but it beats
98 // parsing the node. 98 // parsing the node.
99 bool isUnary = operator.token.next.next.stringValue === ')'; 99 bool isUnary = operator.token.next.next.stringValue === ')';
100 return Elements.constructOperatorName(operator.source, isUnary); 100 return Elements.constructOperatorName(operator.source, isUnary);
101 } else { 101 } else {
102 if (receiver == null) {
Lasse Reichstein Nielsen 2012/10/15 08:34:37 What is it that isn't implemented?
ahe 2012/10/15 20:39:15 Library prefixes in factory names. The error messa
103 listener.cancel('not implemented', node: send.receiver);
104 }
102 return Elements.constructConstructorName(receiver.source, 105 return Elements.constructConstructorName(receiver.source,
103 selector.source); 106 selector.source);
104 } 107 }
105 } 108 }
106 109
107 void endMethod(Token getOrSet, Token beginToken, Token endToken) { 110 void endMethod(Token getOrSet, Token beginToken, Token endToken) {
108 super.endMethod(getOrSet, beginToken, endToken); 111 super.endMethod(getOrSet, beginToken, endToken);
109 FunctionExpression method = popNode(); 112 FunctionExpression method = popNode();
110 pushNode(null); 113 pushNode(null);
111 bool isConstructor = isConstructorName(method.name); 114 bool isConstructor = isConstructorName(method.name);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 168 }
166 169
167 void addMember(Element memberElement) { 170 void addMember(Element memberElement) {
168 for (Link link = metadata; !link.isEmpty(); link = link.tail) { 171 for (Link link = metadata; !link.isEmpty(); link = link.tail) {
169 memberElement.addMetadata(link.head); 172 memberElement.addMetadata(link.head);
170 } 173 }
171 metadata = const Link<MetadataAnnotation>(); 174 metadata = const Link<MetadataAnnotation>();
172 enclosingElement.addMember(memberElement, listener); 175 enclosingElement.addMember(memberElement, listener);
173 } 176 }
174 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698