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

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: Better version 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 | « no previous file | 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 final bool printDebugInfo; 7 final bool printDebugInfo;
8 8
9 Unparser([this.printDebugInfo = false]); 9 Unparser([this.printDebugInfo = false]);
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 visitExpressionStatement(ExpressionStatement node) { 71 visitExpressionStatement(ExpressionStatement node) {
72 visit(node.expression); 72 visit(node.expression);
73 add(node.endToken.value); 73 add(node.endToken.value);
74 } 74 }
75 75
76 visitFor(For node) { 76 visitFor(For node) {
77 add(node.forToken.value); 77 add(node.forToken.value);
78 sb.add('('); 78 sb.add('(');
79 visit(node.initializer); 79 visit(node.initializer);
80 if (node.initializer is !Statement) sb.add(';');
Anton Muhin 2012/06/07 15:40:21 I think it's the best variant. node.initializer c
80 visit(node.conditionStatement); 81 visit(node.conditionStatement);
81 visit(node.update); 82 visit(node.update);
82 sb.add(')'); 83 sb.add(')');
83 visit(node.body); 84 visit(node.body);
84 } 85 }
85 86
86 visitFunctionDeclaration(FunctionDeclaration node) { 87 visitFunctionDeclaration(FunctionDeclaration node) {
87 visit(node.function); 88 visit(node.function);
88 } 89 }
89 90
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 sb.add(' '); 439 sb.add(' ');
439 } 440 }
440 visit(node.name); 441 visit(node.name);
441 if (node.typeParameters !== null) { 442 if (node.typeParameters !== null) {
442 visit(node.typeParameters); 443 visit(node.typeParameters);
443 } 444 }
444 visit(node.formals); 445 visit(node.formals);
445 add(node.endToken.value); 446 add(node.endToken.value);
446 } 447 }
447 } 448 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698