| Index: lib/compiler/implementation/tree/unparser.dart
|
| diff --git a/lib/compiler/implementation/tree/unparser.dart b/lib/compiler/implementation/tree/unparser.dart
|
| index fe6a4935ff48e0803ebcb9ca0d85f2a0f394c300..7adb555d246ce6089e8c489fb2b3d0a7e608c091 100644
|
| --- a/lib/compiler/implementation/tree/unparser.dart
|
| +++ b/lib/compiler/implementation/tree/unparser.dart
|
| @@ -5,21 +5,28 @@
|
| // Returns null if no need to rename a node.
|
| typedef String Renamer(Node node);
|
|
|
| +String unparse(Node node) {
|
| + Unparser unparser = new Unparser();
|
| + unparser.visit(node);
|
| + return unparser.result;
|
| +}
|
| +
|
| class Unparser implements Visitor {
|
| Renamer rename;
|
| - StringBuffer sb;
|
| + final StringBuffer sb;
|
| +
|
| + String get result => sb.toString();
|
|
|
| - Unparser() {
|
| + Unparser() : sb = new StringBuffer() {
|
| // TODO(smok): Move this to initializer once dart2js stops complaining
|
| // about closures in initializers.
|
| rename = (Node node) => null;
|
| }
|
| - Unparser.withRenamer(this.rename);
|
| + Unparser.withRenamer(this.rename) : sb = new StringBuffer();
|
|
|
| - String unparse(Node node) {
|
| - sb = new StringBuffer();
|
| - visit(node);
|
| - return sb.toString();
|
| + // TODO(antonm): will go away soon.
|
| + void addString(String s) {
|
| + sb.add(s);
|
| }
|
|
|
| void add(SourceString string) {
|
|
|