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 1e551faaf03ea6e41558011395d0ac20ac840383..7bd68bb71b4550584a9924ed269012a66a3cc7ad 100644 |
| --- a/lib/compiler/implementation/tree/unparser.dart |
| +++ b/lib/compiler/implementation/tree/unparser.dart |
| @@ -66,34 +66,47 @@ class Unparser implements Visitor { |
| visit(node.expression); |
| } |
| - visitClassNode(ClassNode node) { |
| + unparseClassWithBody(ClassNode node, classBodyEmitter) { |
|
Roman
2012/09/03 09:43:23
did we agree on 'void classBodyEmitter()' ?
Anton Muhin
2012/09/03 09:52:03
Done.
|
| 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) { |
| + 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'); |
| + }); |
| + sb.add('\n'); |
| } |
| visitConditional(Conditional node) { |