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

Side by Side Diff: frog/leg/scanner/class_element_parser.dart

Issue 9284022: Operators. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « frog/leg/resolver.dart ('k') | frog/leg/scanner/parser.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 void endMethod(Token getOrSet, Token beginToken, Token endToken) { 58 void endMethod(Token getOrSet, Token beginToken, Token endToken) {
59 super.endMethod(getOrSet, beginToken, endToken); 59 super.endMethod(getOrSet, beginToken, endToken);
60 FunctionExpression method = popNode(); 60 FunctionExpression method = popNode();
61 pushNode(null); 61 pushNode(null);
62 bool isConstructor = isConstructorName(method.name); 62 bool isConstructor = isConstructorName(method.name);
63 SourceString name; 63 SourceString name;
64 Node methodName = method.name; 64 Node methodName = method.name;
65 if (methodName.asSend() != null) { 65 if (methodName.asSend() != null) {
66 Send send = methodName.asSend(); 66 Send send = methodName.asSend();
67 // TODO(karlklose): find a better place for the construction of the name.
68 Identifier receiver = send.receiver.asIdentifier(); 67 Identifier receiver = send.receiver.asIdentifier();
69 Identifier selector = send.selector.asIdentifier(); 68 Identifier selector = send.selector.asIdentifier();
70 SourceString className = receiver.source; 69 if (selector.asOperator() != null) {
71 SourceString constructorName = selector.source; 70 name = Elements.constructOperatorName(
72 name = new SourceString('$className.$constructorName'); 71 receiver.source, selector.source);
72 } else {
73 name = Elements.constructConstructorName(
74 receiver.source, selector.source);
75 }
73 } else { 76 } else {
74 name = methodName.asIdentifier().source; 77 name = methodName.asIdentifier().source;
75 } 78 }
76 ElementKind kind = ElementKind.FUNCTION; 79 ElementKind kind = ElementKind.FUNCTION;
77 if (isConstructor) { 80 if (isConstructor) {
78 if (getOrSet !== null) { 81 if (getOrSet !== null) {
79 recoverableError('illegal modifier', token: getOrSet); 82 recoverableError('illegal modifier', token: getOrSet);
80 } 83 }
81 kind = ElementKind.GENERATIVE_CONSTRUCTOR; 84 kind = ElementKind.GENERATIVE_CONSTRUCTOR;
82 } else if (getOrSet !== null) { 85 } else if (getOrSet !== null) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void endInitializer(Token assignmentOperator) { 126 void endInitializer(Token assignmentOperator) {
124 pushNode(null); // Super expects an expression, but 127 pushNode(null); // Super expects an expression, but
125 // ClassElementParser just skips expressions. 128 // ClassElementParser just skips expressions.
126 super.endInitializer(assignmentOperator); 129 super.endInitializer(assignmentOperator);
127 } 130 }
128 131
129 void endInitializers(int count, Token beginToken, Token endToken) { 132 void endInitializers(int count, Token beginToken, Token endToken) {
130 pushNode(null); 133 pushNode(null);
131 } 134 }
132 } 135 }
OLDNEW
« no previous file with comments | « frog/leg/resolver.dart ('k') | frog/leg/scanner/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698