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

Side by Side Diff: pkg/compiler/lib/src/tree/unparser.dart

Issue 880973005: Support async/await in dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comment + status for new_backend Created 5 years, 10 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 String unparse(Node node, {minify: true}) { 7 String unparse(Node node, {minify: true}) {
8 Unparser unparser = new Unparser(minify: minify); 8 Unparser unparser = new Unparser(minify: minify);
9 unparser.unparse(node); 9 unparser.unparse(node);
10 return unparser.result; 10 return unparser.result;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 unparseFunctionName(node.name); 247 unparseFunctionName(node.name);
248 visit(node.parameters); 248 visit(node.parameters);
249 if (node.initializers != null) { 249 if (node.initializers != null) {
250 space(); 250 space();
251 write(':'); 251 write(':');
252 space(); 252 space();
253 unparseNodeListFrom(node.initializers, node.initializers.nodes, 253 unparseNodeListFrom(node.initializers, node.initializers.nodes,
254 spaces: true); 254 spaces: true);
255 } 255 }
256 visit(node.asyncModifier); 256 if (node.asyncModifier != null) {
257 if (node.body != null && node.body is! EmptyStatement) space(); 257 if (node.getOrSet != null) {
258 write(' ');
259 } else {
260 // Space is optional if this is not a getter.
261 space();
262 }
263 visit(node.asyncModifier);
264 }
265 if (node.body != null && node.body is! EmptyStatement) {
266 space();
267 }
258 visit(node.body); 268 visit(node.body);
259 } 269 }
260 270
261 visitIdentifier(Identifier node) { 271 visitIdentifier(Identifier node) {
262 write(node.token.value); 272 write(node.token.value);
263 } 273 }
264 274
265 visitIf(If node) { 275 visitIf(If node) {
266 write(node.ifToken.value); 276 write(node.ifToken.value);
267 space(); 277 space();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 write(node.beginToken.value); 397 write(node.beginToken.value);
388 if (node.hasExpression && node.beginToken.stringValue != '=>') { 398 if (node.hasExpression && node.beginToken.stringValue != '=>') {
389 write(' '); 399 write(' ');
390 } 400 }
391 if (node.beginToken.stringValue == '=>') space(); 401 if (node.beginToken.stringValue == '=>') space();
392 visit(node.expression); 402 visit(node.expression);
393 if (node.endToken != null) write(node.endToken.value); 403 if (node.endToken != null) write(node.endToken.value);
394 } 404 }
395 405
396 visitYield(Yield node) { 406 visitYield(Yield node) {
397 write(node.yieldToken); 407 write(node.yieldToken.value);
398 write(node.starToken); 408 if (node.starToken != null) {
409 write(node.starToken.value);
410 }
399 space(); 411 space();
400 visit(node.expression); 412 visit(node.expression);
401 write(node.endToken); 413 write(node.endToken.value);
402 } 414 }
403 415
404 416
405 unparseSendReceiver(Send node, {bool spacesNeeded: false}) { 417 unparseSendReceiver(Send node, {bool spacesNeeded: false}) {
406 if (node.receiver == null) return; 418 if (node.receiver == null) return;
407 visit(node.receiver); 419 visit(node.receiver);
408 CascadeReceiver asCascadeReceiver = node.receiver.asCascadeReceiver(); 420 CascadeReceiver asCascadeReceiver = node.receiver.asCascadeReceiver();
409 if (asCascadeReceiver != null) { 421 if (asCascadeReceiver != null) {
410 newline(); 422 newline();
411 indentMore(); 423 indentMore();
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 } 840 }
829 841
830 visitStatement(Statement node) { 842 visitStatement(Statement node) {
831 throw 'internal error'; // Should not be called. 843 throw 'internal error'; // Should not be called.
832 } 844 }
833 845
834 visitStringNode(StringNode node) { 846 visitStringNode(StringNode node) {
835 throw 'internal error'; // Should not be called. 847 throw 'internal error'; // Should not be called.
836 } 848 }
837 } 849 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698