Chromium Code Reviews| Index: lib/compiler/implementation/tree/unparser.dart |
| diff --git a/lib/compiler/implementation/tree/unparser.dart b/lib/compiler/implementation/tree/unparser.dart |
| index aabd65f369178d9c71f5494c63510c495f878723..e16c57b9a9f33c232acab4d84c5bc44b77465b21 100644 |
| --- a/lib/compiler/implementation/tree/unparser.dart |
| +++ b/lib/compiler/implementation/tree/unparser.dart |
| @@ -61,7 +61,7 @@ class Unparser implements Visitor { |
| visit(node.expression); |
| } |
| - unparseClassWithBody(ClassNode node, void classBodyEmitter()) { |
| + unparseClassWithBody(ClassNode node, Iterable<Node> members) { |
|
Roman
2012/09/04 17:12:15
thank you for specifying type :)
Anton Muhin
2012/09/04 18:00:40
My pleasure
|
| addToken(node.beginToken); |
| if (node.beginToken.stringValue == 'abstract') { |
| addToken(node.beginToken.next); |
| @@ -84,24 +84,14 @@ class Unparser implements Visitor { |
| visit(node.defaultClause); |
| } |
| sb.add('{'); |
| - classBodyEmitter(); |
| + for (final member in members) { |
| + visit(member); |
| + } |
| sb.add('}'); |
| } |
| visitClassNode(ClassNode node) { |
| - unparseClassWithBody(node, () { |
| - NodeList body = node.body; |
| - if (body !== null) { |
| - sb.add('\n'); |
| - Link nodes = body.nodes; |
| - if (!nodes.isEmpty()) { |
| - sb.add(' '); |
| - nodes.printOn(sb, '\n '); |
| - sb.add('\n'); |
| - } |
| - } |
| - }); |
| - sb.add('\n'); |
| + unparseClassWithBody(node, node.body.nodes); |
|
Roman
2012/09/04 17:12:15
original code performed null check on body. Are yo
Anton Muhin
2012/09/04 18:00:40
Not quite, but so far tests revealed no such cases
|
| } |
| visitConditional(Conditional node) { |