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

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

Issue 11148014: Land 'Fix a crash related to obsolete factory syntax.'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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
« no previous file with comments | « no previous file | lib/compiler/implementation/scanner/listener.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
103 listener.cancel('library prefix in named factory constructor not '
104 'implemented', node: send.receiver);
105 }
102 return Elements.constructConstructorName(receiver.source, 106 return Elements.constructConstructorName(receiver.source,
103 selector.source); 107 selector.source);
104 } 108 }
105 } 109 }
106 110
107 void endMethod(Token getOrSet, Token beginToken, Token endToken) { 111 void endMethod(Token getOrSet, Token beginToken, Token endToken) {
108 super.endMethod(getOrSet, beginToken, endToken); 112 super.endMethod(getOrSet, beginToken, endToken);
109 FunctionExpression method = popNode(); 113 FunctionExpression method = popNode();
110 pushNode(null); 114 pushNode(null);
111 bool isConstructor = isConstructorName(method.name); 115 bool isConstructor = isConstructorName(method.name);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 169 }
166 170
167 void addMember(Element memberElement) { 171 void addMember(Element memberElement) {
168 for (Link link = metadata; !link.isEmpty(); link = link.tail) { 172 for (Link link = metadata; !link.isEmpty(); link = link.tail) {
169 memberElement.addMetadata(link.head); 173 memberElement.addMetadata(link.head);
170 } 174 }
171 metadata = const Link<MetadataAnnotation>(); 175 metadata = const Link<MetadataAnnotation>();
172 enclosingElement.addMember(memberElement, listener); 176 enclosingElement.addMember(memberElement, listener);
173 } 177 }
174 } 178 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/scanner/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698