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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/tree/nodes.dart

Issue 11878043: Start adding support for mixin application syntax. We now parse the typedef variant of mixin applic… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 tree; 5 part of tree;
6 6
7 abstract class Visitor<R> { 7 abstract class Visitor<R> {
8 const Visitor(); 8 const Visitor();
9 9
10 R visitNode(Node node); 10 R visitNode(Node node);
(...skipping 30 matching lines...) Expand all
41 R visitLiteralBool(LiteralBool node) => visitLiteral(node); 41 R visitLiteralBool(LiteralBool node) => visitLiteral(node);
42 R visitLiteralDouble(LiteralDouble node) => visitLiteral(node); 42 R visitLiteralDouble(LiteralDouble node) => visitLiteral(node);
43 R visitLiteralInt(LiteralInt node) => visitLiteral(node); 43 R visitLiteralInt(LiteralInt node) => visitLiteral(node);
44 R visitLiteralList(LiteralList node) => visitExpression(node); 44 R visitLiteralList(LiteralList node) => visitExpression(node);
45 R visitLiteralMap(LiteralMap node) => visitExpression(node); 45 R visitLiteralMap(LiteralMap node) => visitExpression(node);
46 R visitLiteralMapEntry(LiteralMapEntry node) => visitNode(node); 46 R visitLiteralMapEntry(LiteralMapEntry node) => visitNode(node);
47 R visitLiteralNull(LiteralNull node) => visitLiteral(node); 47 R visitLiteralNull(LiteralNull node) => visitLiteral(node);
48 R visitLiteralString(LiteralString node) => visitStringNode(node); 48 R visitLiteralString(LiteralString node) => visitStringNode(node);
49 R visitStringJuxtaposition(StringJuxtaposition node) => visitStringNode(node); 49 R visitStringJuxtaposition(StringJuxtaposition node) => visitStringNode(node);
50 R visitLoop(Loop node) => visitStatement(node); 50 R visitLoop(Loop node) => visitStatement(node);
51 R visitMixinApplication(MixinApplication node) => visitNode(node);
51 R visitModifiers(Modifiers node) => visitNode(node); 52 R visitModifiers(Modifiers node) => visitNode(node);
52 R visitNamedArgument(NamedArgument node) => visitExpression(node); 53 R visitNamedArgument(NamedArgument node) => visitExpression(node);
53 R visitNewExpression(NewExpression node) => visitExpression(node); 54 R visitNewExpression(NewExpression node) => visitExpression(node);
54 R visitNodeList(NodeList node) => visitNode(node); 55 R visitNodeList(NodeList node) => visitNode(node);
55 R visitOperator(Operator node) => visitIdentifier(node); 56 R visitOperator(Operator node) => visitIdentifier(node);
56 R visitParenthesizedExpression(ParenthesizedExpression node) { 57 R visitParenthesizedExpression(ParenthesizedExpression node) {
57 return visitExpression(node); 58 return visitExpression(node);
58 } 59 }
59 R visitPart(Part node) => visitLibraryTag(node); 60 R visitPart(Part node) => visitLibraryTag(node);
60 R visitPartOf(PartOf node) => visitNode(node); 61 R visitPartOf(PartOf node) => visitNode(node);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 Cascade asCascade() => null; 138 Cascade asCascade() => null;
138 CascadeReceiver asCascadeReceiver() => null; 139 CascadeReceiver asCascadeReceiver() => null;
139 CaseMatch asCaseMatch() => null; 140 CaseMatch asCaseMatch() => null;
140 CatchBlock asCatchBlock() => null; 141 CatchBlock asCatchBlock() => null;
141 ClassNode asClassNode() => null; 142 ClassNode asClassNode() => null;
142 Combinator asCombinator() => null; 143 Combinator asCombinator() => null;
143 Conditional asConditional() => null; 144 Conditional asConditional() => null;
144 ContinueStatement asContinueStatement() => null; 145 ContinueStatement asContinueStatement() => null;
145 DoWhile asDoWhile() => null; 146 DoWhile asDoWhile() => null;
146 EmptyStatement asEmptyStatement() => null; 147 EmptyStatement asEmptyStatement() => null;
147 Export AsExport() => null; 148 Export asExport() => null;
148 Expression asExpression() => null; 149 Expression asExpression() => null;
149 ExpressionStatement asExpressionStatement() => null; 150 ExpressionStatement asExpressionStatement() => null;
150 For asFor() => null; 151 For asFor() => null;
151 ForIn asForIn() => null; 152 ForIn asForIn() => null;
152 FunctionDeclaration asFunctionDeclaration() => null; 153 FunctionDeclaration asFunctionDeclaration() => null;
153 FunctionExpression asFunctionExpression() => null; 154 FunctionExpression asFunctionExpression() => null;
154 Identifier asIdentifier() => null; 155 Identifier asIdentifier() => null;
155 If asIf() => null; 156 If asIf() => null;
156 Import AsImport() => null; 157 Import asImport() => null;
157 Label asLabel() => null; 158 Label asLabel() => null;
158 LabeledStatement asLabeledStatement() => null; 159 LabeledStatement asLabeledStatement() => null;
159 LibraryName AsLibraryName() => null; 160 LibraryName asLibraryName() => null;
160 LiteralBool asLiteralBool() => null; 161 LiteralBool asLiteralBool() => null;
161 LiteralDouble asLiteralDouble() => null; 162 LiteralDouble asLiteralDouble() => null;
162 LiteralInt asLiteralInt() => null; 163 LiteralInt asLiteralInt() => null;
163 LiteralList asLiteralList() => null; 164 LiteralList asLiteralList() => null;
164 LiteralMap asLiteralMap() => null; 165 LiteralMap asLiteralMap() => null;
165 LiteralMapEntry asLiteralMapEntry() => null; 166 LiteralMapEntry asLiteralMapEntry() => null;
166 LiteralNull asLiteralNull() => null; 167 LiteralNull asLiteralNull() => null;
167 LiteralString asLiteralString() => null; 168 LiteralString asLiteralString() => null;
169 MixinApplication asMixinApplication() => null;
168 Modifiers asModifiers() => null; 170 Modifiers asModifiers() => null;
169 NamedArgument asNamedArgument() => null; 171 NamedArgument asNamedArgument() => null;
170 NodeList asNodeList() => null; 172 NodeList asNodeList() => null;
171 Operator asOperator() => null; 173 Operator asOperator() => null;
172 ParenthesizedExpression asParenthesizedExpression() => null; 174 ParenthesizedExpression asParenthesizedExpression() => null;
173 Part AsPart() => null; 175 Part asPart() => null;
174 PartOf AsPartOf() => null; 176 PartOf asPartOf() => null;
175 Return asReturn() => null; 177 Return asReturn() => null;
176 ScriptTag asScriptTag() => null; 178 ScriptTag asScriptTag() => null;
177 Send asSend() => null; 179 Send asSend() => null;
178 SendSet asSendSet() => null; 180 SendSet asSendSet() => null;
179 Statement asStatement() => null; 181 Statement asStatement() => null;
180 StringInterpolation asStringInterpolation() => null; 182 StringInterpolation asStringInterpolation() => null;
181 StringInterpolationPart asStringInterpolationPart() => null; 183 StringInterpolationPart asStringInterpolationPart() => null;
182 StringJuxtaposition asStringJuxtaposition() => null; 184 StringJuxtaposition asStringJuxtaposition() => null;
183 StringNode asStringNode() => null; 185 StringNode asStringNode() => null;
184 SwitchCase asSwitchCase() => null; 186 SwitchCase asSwitchCase() => null;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 230
229 bool get isInterface => identical(beginToken.stringValue, 'interface'); 231 bool get isInterface => identical(beginToken.stringValue, 'interface');
230 232
231 bool get isClass => !isInterface; 233 bool get isClass => !isInterface;
232 234
233 Token getBeginToken() => beginToken; 235 Token getBeginToken() => beginToken;
234 236
235 Token getEndToken() => endToken; 237 Token getEndToken() => endToken;
236 } 238 }
237 239
240 class MixinApplication extends Node {
241 final Modifiers modifiers;
242 final TypeAnnotation superclass;
243 final NodeList mixins;
244 final Token beginToken;
ahe 2013/01/15 15:35:04 typedefKeyword?
kasperl 2013/01/15 15:58:18 The mixin application itself doesn't start with ty
245 final Token endToken;
ahe 2013/01/15 15:35:04 This is not necessary.
246
247 MixinApplication(this.modifiers, this.superclass, this.mixins,
248 this.beginToken, this.endToken);
249
250 MixinApplication asMixinApplication() => this;
251
252 accept(Visitor visitor) => visitor.visitMixinApplication(this);
253
254 visitChildren(Visitor visitor) {
255 if (modifiers != null) modifiers.accept(visitor);
256 if (superclass != null) superclass.accept(visitor);
257 if (mixins != null) mixins.accept(visitor);
258 }
259
260 Token getBeginToken() => beginToken;
261
262 Token getEndToken() => endToken;
ahe 2013/01/15 15:35:04 mixins.getEndToken();
kasperl 2013/01/15 15:58:18 Unfortunately, the node list produced from parseTy
ahe 2013/01/15 16:03:40 I think NodeList.getEndToken() should do what you
kasperl 2013/01/16 07:00:03 Thanks. That looks exactly right.
263 }
264
238 abstract class Expression extends Node { 265 abstract class Expression extends Node {
239 Expression(); 266 Expression();
240 267
241 Expression asExpression() => this; 268 Expression asExpression() => this;
242 269
243 // TODO(ahe): make class abstract instead of adding an abstract method. 270 // TODO(ahe): make class abstract instead of adding an abstract method.
244 accept(Visitor visitor); 271 accept(Visitor visitor);
245 } 272 }
246 273
247 abstract class Statement extends Node { 274 abstract class Statement extends Node {
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2000 * argument). 2027 * argument).
2001 * 2028 *
2002 * TODO(ahe): This method is controversial, the team needs to discuss 2029 * TODO(ahe): This method is controversial, the team needs to discuss
2003 * if top-level methods are acceptable and what naming conventions to 2030 * if top-level methods are acceptable and what naming conventions to
2004 * use. 2031 * use.
2005 */ 2032 */
2006 initializerDo(Node node, f(Node node)) { 2033 initializerDo(Node node, f(Node node)) {
2007 SendSet send = node.asSendSet(); 2034 SendSet send = node.asSendSet();
2008 if (send != null) return f(send.arguments.head); 2035 if (send != null) return f(send.arguments.head);
2009 } 2036 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698