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

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

Issue 10689104: Fix const unparse. Example: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add tests 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
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 visitNewExpression(NewExpression node) { 146 visitNewExpression(NewExpression node) {
147 // TODO(ahe): handle 'const'. 147 // TODO(ahe): handle 'const'.
148 add(node.newToken.value); 148 add(node.newToken.value);
149 sb.add(' '); 149 sb.add(' ');
150 visit(node.send); 150 visit(node.send);
151 } 151 }
152 152
153 visitLiteralList(LiteralList node) { 153 visitLiteralList(LiteralList node) {
154 // TODO(ahe): handle 'const'. 154 if (node.constKeyword !== null) {
155 add(node.constKeyword.value);
156 }
155 if (node.type !== null) { 157 if (node.type !== null) {
156 sb.add('<'); 158 sb.add('<');
157 visit(node.type); 159 visit(node.type);
158 sb.add('>'); 160 sb.add('>');
159 } 161 }
160 sb.add(' '); 162 sb.add(' ');
161 visit(node.elements); 163 visit(node.elements);
162 } 164 }
163 165
164 visitModifiers(Modifiers node) => node.visitChildren(this); 166 visitModifiers(Modifiers node) => node.visitChildren(this);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 visit(node.identifier); 363 visit(node.identifier);
362 add(node.colonToken.value); 364 add(node.colonToken.value);
363 } 365 }
364 366
365 visitLabeledStatement(LabeledStatement node) { 367 visitLabeledStatement(LabeledStatement node) {
366 visit(node.labels); 368 visit(node.labels);
367 visit(node.statement); 369 visit(node.statement);
368 } 370 }
369 371
370 visitLiteralMap(LiteralMap node) { 372 visitLiteralMap(LiteralMap node) {
371 // TODO(ahe): handle 'const'. 373 if (node.constKeyword !== null) {
374 add(node.constKeyword.value);
375 }
372 if (node.typeArguments !== null) visit(node.typeArguments); 376 if (node.typeArguments !== null) visit(node.typeArguments);
373 visit(node.entries); 377 visit(node.entries);
374 } 378 }
375 379
376 visitLiteralMapEntry(LiteralMapEntry node) { 380 visitLiteralMapEntry(LiteralMapEntry node) {
377 visit(node.key); 381 visit(node.key);
378 add(node.colonToken.value); 382 add(node.colonToken.value);
379 sb.add(' '); 383 sb.add(' ');
380 visit(node.value); 384 visit(node.value);
381 } 385 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 sb.add(' '); 457 sb.add(' ');
454 } 458 }
455 visit(node.name); 459 visit(node.name);
456 if (node.typeParameters !== null) { 460 if (node.typeParameters !== null) {
457 visit(node.typeParameters); 461 visit(node.typeParameters);
458 } 462 }
459 visit(node.formals); 463 visit(node.formals);
460 add(node.endToken.value); 464 add(node.endToken.value);
461 } 465 }
462 } 466 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | tests/compiler/dart2js/unparser_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698