| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// Helper for debug Kernel nodes. | 5 /// Helper for debug Kernel nodes. |
| 6 | 6 |
| 7 library kernel.debug; | 7 library kernel.debug; |
| 8 | 8 |
| 9 import 'package:kernel/kernel.dart'; | 9 import 'package:kernel/ast.dart'; |
| 10 import 'package:kernel/visitor.dart'; | 10 import 'package:kernel/visitor.dart'; |
| 11 | 11 |
| 12 import '../util/util.dart' show Indentation, Tagging; | 12 import '../util/util.dart' show Indentation, Tagging; |
| 13 | 13 |
| 14 class DebugPrinter extends Visitor with Indentation, Tagging<Node> { | 14 class DebugPrinter extends Visitor with Indentation, Tagging<Node> { |
| 15 StringBuffer sb = new StringBuffer(); | 15 StringBuffer sb = new StringBuffer(); |
| 16 | 16 |
| 17 void visitNodeWithChildren(Node node, String type, [Map params]) { | 17 void visitNodeWithChildren(Node node, String type, [Map params]) { |
| 18 openNode(node, type, params); | 18 openNode(node, type, params); |
| 19 node.visitChildren(this); | 19 node.visitChildren(this); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 closeNode(); | 67 closeNode(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 /// Pretty-prints given node tree into string. | 70 /// Pretty-prints given node tree into string. |
| 71 static String prettyPrint(Node node) { | 71 static String prettyPrint(Node node) { |
| 72 var p = new DebugPrinter(); | 72 var p = new DebugPrinter(); |
| 73 node.accept(p); | 73 node.accept(p); |
| 74 return p.sb.toString(); | 74 return p.sb.toString(); |
| 75 } | 75 } |
| 76 } | 76 } |
| OLD | NEW |