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

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

Issue 10855073: Fix dart2js tests, unparser initializer with closure. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 // Returns null if no need to rename a node. 5 // Returns null if no need to rename a node.
6 typedef String Renamer(Node node); 6 typedef String Renamer(Node node);
7 7
8 class Unparser implements Visitor { 8 class Unparser implements Visitor {
9 final Renamer rename; 9 Renamer rename;
10 StringBuffer sb; 10 StringBuffer sb;
11 11
12 Unparser() : this.withRenamer((Node) => null); 12 Unparser() {
13 rename = (Node node) => null;
14 }
13 Unparser.withRenamer(this.rename); 15 Unparser.withRenamer(this.rename);
14 16
15 String unparse(Node node) { 17 String unparse(Node node) {
16 sb = new StringBuffer(); 18 sb = new StringBuffer();
17 visit(node); 19 visit(node);
18 return sb.toString(); 20 return sb.toString();
19 } 21 }
20 22
21 void add(SourceString string) { 23 void add(SourceString string) {
22 string.printOn(sb); 24 string.printOn(sb);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 sb.add(' '); 506 sb.add(' ');
505 } 507 }
506 visit(node.name); 508 visit(node.name);
507 if (node.typeParameters !== null) { 509 if (node.typeParameters !== null) {
508 visit(node.typeParameters); 510 visit(node.typeParameters);
509 } 511 }
510 visit(node.formals); 512 visit(node.formals);
511 add(node.endToken.value); 513 add(node.endToken.value);
512 } 514 }
513 } 515 }
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