Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Renamer rename; | 9 Renamer rename; |
| 10 StringBuffer sb; | 10 StringBuffer sb; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 addToken(node.extendsKeyword); | 65 addToken(node.extendsKeyword); |
| 66 visit(node.superclass); | 66 visit(node.superclass); |
| 67 sb.add(' '); | 67 sb.add(' '); |
| 68 } | 68 } |
| 69 visit(node.interfaces); | 69 visit(node.interfaces); |
| 70 if (node.defaultClause !== null) { | 70 if (node.defaultClause !== null) { |
| 71 visit(node.defaultClause); | 71 visit(node.defaultClause); |
| 72 sb.add(' '); | 72 sb.add(' '); |
| 73 } | 73 } |
| 74 sb.add('{\n'); | 74 sb.add('{\n'); |
| 75 NodeList body = node.body; | |
| 76 if (body != null) { | |
| 77 String indent = " "; | |
| 78 for (Node node in body) { | |
|
ahe
2012/08/17 06:43:37
Please use the form of for as you see on line 223.
messick
2012/08/17 17:16:40
Done.
| |
| 79 sb.add(indent); | |
| 80 visit(node); | |
| 81 sb.add("\n"); | |
| 82 } | |
| 83 } | |
| 75 sb.add('}\n'); | 84 sb.add('}\n'); |
| 76 } | 85 } |
| 77 | 86 |
| 78 visitConditional(Conditional node) { | 87 visitConditional(Conditional node) { |
| 79 visit(node.condition); | 88 visit(node.condition); |
| 80 add(node.questionToken.value); | 89 add(node.questionToken.value); |
| 81 visit(node.thenExpression); | 90 visit(node.thenExpression); |
| 82 add(node.colonToken.value); | 91 add(node.colonToken.value); |
| 83 visit(node.elseExpression); | 92 visit(node.elseExpression); |
| 84 } | 93 } |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 sb.add(' '); | 497 sb.add(' '); |
| 489 } | 498 } |
| 490 visit(node.name); | 499 visit(node.name); |
| 491 if (node.typeParameters !== null) { | 500 if (node.typeParameters !== null) { |
| 492 visit(node.typeParameters); | 501 visit(node.typeParameters); |
| 493 } | 502 } |
| 494 visit(node.formals); | 503 visit(node.formals); |
| 495 add(node.endToken.value); | 504 add(node.endToken.value); |
| 496 } | 505 } |
| 497 } | 506 } |
| OLD | NEW |