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

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

Issue 675113002: Support async/await in the dart2js frontend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 6 years, 1 month 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 /** 7 /**
8 * Pretty-prints Node tree in XML-like format. 8 * Pretty-prints Node tree in XML-like format.
9 * 9 *
10 * TODO(smok): Add main() to run from command-line to print out tree for given 10 * TODO(smok): Add main() to run from command-line to print out tree for given
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 node.accept(p); 114 node.accept(p);
115 return p.sb.toString(); 115 return p.sb.toString();
116 } 116 }
117 117
118 visitNodeWithChildren(Node node, String type) { 118 visitNodeWithChildren(Node node, String type) {
119 openNode(node, type); 119 openNode(node, type);
120 node.visitChildren(this); 120 node.visitChildren(this);
121 closeNode(); 121 closeNode();
122 } 122 }
123 123
124 visitAsyncModifier(AsyncModifier node) {
125 openAndCloseNode(node, "AsyncModifier",
126 {'asyncToken': node.asyncToken,
127 'starToken': node.starToken});
128 }
129
124 visitBlock(Block node) { 130 visitBlock(Block node) {
125 visitNodeWithChildren(node, "Block"); 131 visitNodeWithChildren(node, "Block");
126 } 132 }
127 133
128 visitBreakStatement(BreakStatement node) { 134 visitBreakStatement(BreakStatement node) {
129 visitNodeWithChildren(node, "BreakStatement"); 135 visitNodeWithChildren(node, "BreakStatement");
130 } 136 }
131 137
132 visitCascade(Cascade node) { 138 visitCascade(Cascade node) {
133 visitNodeWithChildren(node, "Cascade"); 139 visitNodeWithChildren(node, "Cascade");
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 180
175 visitExpressionStatement(ExpressionStatement node) { 181 visitExpressionStatement(ExpressionStatement node) {
176 visitNodeWithChildren(node, "ExpressionStatement"); 182 visitNodeWithChildren(node, "ExpressionStatement");
177 } 183 }
178 184
179 visitFor(For node) { 185 visitFor(For node) {
180 visitNodeWithChildren(node, "For"); 186 visitNodeWithChildren(node, "For");
181 } 187 }
182 188
183 visitForIn(ForIn node) { 189 visitForIn(ForIn node) {
184 visitNodeWithChildren(node, "ForIn"); 190 openNode(node, "ForIn", {'await': node.awaitToken});
191 node.visitChildren(this);
192 closeNode();
185 } 193 }
186 194
187 visitFunctionDeclaration(FunctionDeclaration node) { 195 visitFunctionDeclaration(FunctionDeclaration node) {
188 visitNodeWithChildren(node, "FunctionDeclaration"); 196 visitNodeWithChildren(node, "FunctionDeclaration");
189 } 197 }
190 198
191 visitFunctionExpression(FunctionExpression node) { 199 visitFunctionExpression(FunctionExpression node) {
192 openNode(node, "FunctionExpression", { 200 openNode(node, "FunctionExpression", {
193 "getOrSet" : tokenToStringOrNull(node.getOrSet) 201 "getOrSet" : tokenToStringOrNull(node.getOrSet)
194 }); 202 });
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 visitRethrow(Rethrow node) { 319 visitRethrow(Rethrow node) {
312 visitNodeWithChildren(node, "Rethrow"); 320 visitNodeWithChildren(node, "Rethrow");
313 } 321 }
314 322
315 visitReturn(Return node) { 323 visitReturn(Return node) {
316 openNode(node, "Return"); 324 openNode(node, "Return");
317 visitChildNode(node.expression, "expression"); 325 visitChildNode(node.expression, "expression");
318 closeNode(); 326 closeNode();
319 } 327 }
320 328
329 visitYield(Yield node) {
330 openNode(node, "Yield", {'star': node.starToken});
331 visitChildNode(node.expression, "expression");
332 closeNode();
333 }
334
321 visitChildNode(Node node, String fieldName) { 335 visitChildNode(Node node, String fieldName) {
322 if (node == null) return; 336 if (node == null) return;
323 addCurrentIndent(); 337 addCurrentIndent();
324 sb.write("<$fieldName>\n"); 338 sb.write("<$fieldName>\n");
325 pushTag(fieldName); 339 pushTag(fieldName);
326 node.accept(this); 340 node.accept(this);
327 popTag(); 341 popTag();
328 addCurrentIndent(); 342 addCurrentIndent();
329 sb.write("</$fieldName>\n"); 343 sb.write("</$fieldName>\n");
330 } 344 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 visitLiteralSymbol(LiteralSymbol node) { 388 visitLiteralSymbol(LiteralSymbol node) {
375 openNode(node, "LiteralSymbol"); 389 openNode(node, "LiteralSymbol");
376 visitChildNode(node.identifiers, "identifiers"); 390 visitChildNode(node.identifiers, "identifiers");
377 closeNode(); 391 closeNode();
378 } 392 }
379 393
380 visitThrow(Throw node) { 394 visitThrow(Throw node) {
381 visitNodeWithChildren(node, "Throw"); 395 visitNodeWithChildren(node, "Throw");
382 } 396 }
383 397
398 visitAwait(Await node) {
399 visitNodeWithChildren(node, "Await");
400 }
401
384 visitTryStatement(TryStatement node) { 402 visitTryStatement(TryStatement node) {
385 visitNodeWithChildren(node, "TryStatement"); 403 visitNodeWithChildren(node, "TryStatement");
386 } 404 }
387 405
388 visitTypeAnnotation(TypeAnnotation node) { 406 visitTypeAnnotation(TypeAnnotation node) {
389 openNode(node, "TypeAnnotation"); 407 openNode(node, "TypeAnnotation");
390 visitChildNode(node.typeName, "typeName"); 408 visitChildNode(node.typeName, "typeName");
391 visitChildNode(node.typeArguments, "typeArguments"); 409 visitChildNode(node.typeArguments, "typeArguments");
392 closeNode(); 410 closeNode();
393 } 411 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 } 524 }
507 525
508 visitGotoStatement(GotoStatement node) { 526 visitGotoStatement(GotoStatement node) {
509 unimplemented('visitNode', node: node); 527 unimplemented('visitNode', node: node);
510 } 528 }
511 529
512 unimplemented(String message, {Node node}) { 530 unimplemented(String message, {Node node}) {
513 throw message; 531 throw message;
514 } 532 }
515 } 533 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698