Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(940)

Side by Side Diff: pkg/compiler/lib/src/kernel/kernel_debug.dart

Issue 2329403003: More features handled in kernel impact. (Closed)
Patch Set: Fix analyze_test_test. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Helper for debug Kernel nodes.
6
7 library kernel.debug;
8
9 import 'package:kernel/kernel.dart';
10 import 'package:kernel/visitor.dart';
11
12 import '../util/util.dart' show Indentation, Tagging;
13
14 class DebugPrinter extends Visitor with Indentation, Tagging<Node> {
15 StringBuffer sb = new StringBuffer();
16
17 void visitNodeWithChildren(Node node, String type, [Map params]) {
18 openNode(node, type, params);
19 node.visitChildren(this);
20 closeNode();
21 }
22
23 @override
24 void defaultNode(Node node) {
25 visitNodeWithChildren(node, '${node.runtimeType}');
26 }
27
28 @override
29 void visitName(Name node) {
30 openAndCloseNode(node, '${node.runtimeType}',
31 {'name': node.name, 'library': node.library?.name});
32 }
33
34 @override
35 void visitIntLiteral(IntLiteral node) {
36 openAndCloseNode(node, '${node.runtimeType}', {'value': '${node.value}'});
37 }
38
39 /// Pretty-prints given node tree into string.
40 static String prettyPrint(Node node) {
41 var p = new DebugPrinter();
42 node.accept(p);
43 return p.sb.toString();
44 }
45 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend_impact.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698