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 fe6a4935ff48e0803ebcb9ca0d85f2a0f394c300..37dcbf13573c4e8d6cf6a687837808b0b7e5b430 100644 |
| --- a/lib/compiler/implementation/tree/unparser.dart |
| +++ b/lib/compiler/implementation/tree/unparser.dart |
| @@ -57,34 +57,47 @@ class Unparser implements Visitor { |
| visit(node.expression); |
| } |
| - visitClassNode(ClassNode node) { |
| + emitClassWithBody(ClassNode node, classBodyEmitter) { |
|
Roman
2012/08/31 13:52:15
Can you please specify the full signature for 'cla
Anton Muhin
2012/08/31 14:01:09
If emitClassWithBody(ClassNode node, void classBod
|
| addToken(node.beginToken); |
| + if (node.beginToken.stringValue == 'abstract') { |
| + addToken(node.beginToken.next); |
| + } |
| visit(node.name); |
| if (node.typeParameters !== null) { |
| visit(node.typeParameters); |
| } |
| - sb.add(' '); |
| if (node.extendsKeyword !== null) { |
| + sb.add(' '); |
| addToken(node.extendsKeyword); |
| visit(node.superclass); |
| + } |
| + if (!node.interfaces.isEmpty()) { |
| sb.add(' '); |
| + visit(node.interfaces); |
| } |
| - visit(node.interfaces); |
| if (node.defaultClause !== null) { |
| + sb.add(' default '); |
| visit(node.defaultClause); |
| - sb.add(' '); |
| } |
| - sb.add('{\n'); |
| - NodeList body = node.body; |
| - if (body !== null) { |
| - Link nodes = body.nodes; |
| - if (!nodes.isEmpty()) { |
| - sb.add(' '); |
| - nodes.printOn(sb, '\n '); |
| + sb.add('{'); |
| + classBodyEmitter(); |
| + sb.add('}'); |
| + } |
| + |
| + visitClassNode(ClassNode node) { |
| + emitClassWithBody(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'); |
| + }); |
| + sb.add('\n'); |
| } |
| visitConditional(Conditional node) { |