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

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

Issue 10735053: Fix unparsing of variable definitions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | tests/compiler/dart2js/unparser_test.dart » ('j') | 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 visitTypeVariable(TypeVariable node) { 270 visitTypeVariable(TypeVariable node) {
271 visit(node.name); 271 visit(node.name);
272 if (node.bound !== null) { 272 if (node.bound !== null) {
273 sb.add(' extends '); 273 sb.add(' extends ');
274 visit(node.bound); 274 visit(node.bound);
275 } 275 }
276 } 276 }
277 277
278 visitVariableDefinitions(VariableDefinitions node) { 278 visitVariableDefinitions(VariableDefinitions node) {
279 visit(node.modifiers);
280 if (node.modifiers.nodes.length() > 0) {
281 sb.add(' ');
282 }
279 if (node.type !== null) { 283 if (node.type !== null) {
280 visit(node.type); 284 visit(node.type);
281 } else { 285 sb.add(' ');
282 sb.add('var');
283 } 286 }
284 sb.add(' ');
285 // TODO(karlklose): print modifiers.
286 visit(node.definitions); 287 visit(node.definitions);
287 if (node.endToken.value == const SourceString(';')) { 288 if (node.endToken.value == const SourceString(';')) {
288 add(node.endToken.value); 289 add(node.endToken.value);
289 } 290 }
290 } 291 }
291 292
292 visitDoWhile(DoWhile node) { 293 visitDoWhile(DoWhile node) {
293 add(node.doKeyword.value); 294 add(node.doKeyword.value);
294 sb.add(' '); 295 sb.add(' ');
295 visit(node.body); 296 visit(node.body);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 sb.add(' '); 458 sb.add(' ');
458 } 459 }
459 visit(node.name); 460 visit(node.name);
460 if (node.typeParameters !== null) { 461 if (node.typeParameters !== null) {
461 visit(node.typeParameters); 462 visit(node.typeParameters);
462 } 463 }
463 visit(node.formals); 464 visit(node.formals);
464 add(node.endToken.value); 465 add(node.endToken.value);
465 } 466 }
466 } 467 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698