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

Side by Side Diff: lib/compiler/implementation/tree/unparser.dart

Issue 10543051: Fix unparse for empty initializer or conditionStatement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebasing Created 8 years, 6 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/tests/leg/unparser_test.dart ('k') | no next file » | 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) 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 class Unparser implements Visitor { 5 class Unparser implements Visitor {
6 StringBuffer sb; 6 StringBuffer sb;
7 7
8 Unparser(); 8 Unparser();
9 9
10 String unparse(Node node) { 10 String unparse(Node node) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 visitExpressionStatement(ExpressionStatement node) { 64 visitExpressionStatement(ExpressionStatement node) {
65 visit(node.expression); 65 visit(node.expression);
66 add(node.endToken.value); 66 add(node.endToken.value);
67 } 67 }
68 68
69 visitFor(For node) { 69 visitFor(For node) {
70 add(node.forToken.value); 70 add(node.forToken.value);
71 sb.add('('); 71 sb.add('(');
72 visit(node.initializer); 72 visit(node.initializer);
73 if (node.initializer is !Statement) sb.add(';');
73 visit(node.conditionStatement); 74 visit(node.conditionStatement);
74 visit(node.update); 75 visit(node.update);
75 sb.add(')'); 76 sb.add(')');
76 visit(node.body); 77 visit(node.body);
77 } 78 }
78 79
79 visitFunctionDeclaration(FunctionDeclaration node) { 80 visitFunctionDeclaration(FunctionDeclaration node) {
80 visit(node.function); 81 visit(node.function);
81 } 82 }
82 83
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 sb.add(' '); 432 sb.add(' ');
432 } 433 }
433 visit(node.name); 434 visit(node.name);
434 if (node.typeParameters !== null) { 435 if (node.typeParameters !== null) {
435 visit(node.typeParameters); 436 visit(node.typeParameters);
436 } 437 }
437 visit(node.formals); 438 visit(node.formals);
438 add(node.endToken.value); 439 add(node.endToken.value);
439 } 440 }
440 } 441 }
OLDNEW
« no previous file with comments | « frog/tests/leg/unparser_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698