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

Side by Side Diff: utils/css/treebase.dart

Issue 12473003: Remove deprecated StringBuffer.add, addAll and addCharCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 * The base type for all nodes in a dart abstract syntax tree. 5 * The base type for all nodes in a dart abstract syntax tree.
6 */ 6 */
7 class ASTNode { 7 class ASTNode {
8 /** The source code this [ASTNode] represents. */ 8 /** The source code this [ASTNode] represents. */
9 SourceSpan span; 9 SourceSpan span;
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 var o = new TreeOutput(); 50 var o = new TreeOutput();
51 node.visit(new TreePrinter(o)); 51 node.visit(new TreePrinter(o));
52 print(o.buf); 52 print(o.buf);
53 } 53 }
54 54
55 TreeOutput(): this.depth = 0, this.buf = new StringBuffer() { 55 TreeOutput(): this.depth = 0, this.buf = new StringBuffer() {
56 } 56 }
57 57
58 void write(String s) { 58 void write(String s) {
59 for (int i=0; i < depth; i++) { 59 for (int i=0; i < depth; i++) {
60 buf.add(' '); 60 buf.write(' ');
61 } 61 }
62 buf.add(s); 62 buf.write(s);
63 } 63 }
64 64
65 void writeln(String s) { 65 void writeln(String s) {
66 write(s); 66 write(s);
67 buf.add('\n'); 67 buf.write('\n');
68 } 68 }
69 69
70 void heading(String name, span) { 70 void heading(String name, span) {
71 write(name); 71 write(name);
72 buf.add(' (${span.locationText})'); 72 buf.write(' (${span.locationText})');
73 buf.add('\n'); 73 buf.write('\n');
74 } 74 }
75 75
76 String toValue(value) { 76 String toValue(value) {
77 if (value == null) return 'null'; 77 if (value == null) return 'null';
78 else if (value is Identifier) return value.name; 78 else if (value is Identifier) return value.name;
79 else return value.toString(); 79 else return value.toString();
80 } 80 }
81 81
82 void writeNode(String label, ASTNode node) { 82 void writeNode(String label, ASTNode node) {
83 write(label + ': '); 83 write(label + ': ');
84 depth += 1; 84 depth += 1;
85 if (node != null) node.visit(printer); 85 if (node != null) node.visit(printer);
86 else writeln('null'); 86 else writeln('null');
87 depth -= 1; 87 depth -= 1;
88 } 88 }
89 89
90 void writeValue(String label, value) { 90 void writeValue(String label, value) {
91 var v = toValue(value); 91 var v = toValue(value);
92 writeln('${label}: ${v}'); 92 writeln('${label}: ${v}');
93 } 93 }
94 94
95 void writeList(String label, List list) { 95 void writeList(String label, List list) {
96 write(label + ': '); 96 write(label + ': ');
97 if (list == null) { 97 if (list == null) {
98 buf.add('null'); 98 buf.write('null');
99 buf.add('\n'); 99 buf.write('\n');
100 } else { 100 } else {
101 for (var item in list) { 101 for (var item in list) {
102 buf.add(item.toString()); 102 buf.write(item.toString());
103 buf.add(', '); 103 buf.write(', ');
104 } 104 }
105 buf.add('\n'); 105 buf.write('\n');
106 } 106 }
107 } 107 }
108 108
109 void writeNodeList(String label, List list) { 109 void writeNodeList(String label, List list) {
110 writeln('${label} ['); 110 writeln('${label} [');
111 if (list != null) { 111 if (list != null) {
112 depth += 1; 112 depth += 1;
113 for (var node in list) { 113 for (var node in list) {
114 if (node != null) { 114 if (node != null) {
115 node.visit(printer); 115 node.visit(printer);
116 } else { 116 } else {
117 writeln('null'); 117 writeln('null');
118 } 118 }
119 } 119 }
120 depth -= 1; 120 depth -= 1;
121 writeln(']'); 121 writeln(']');
122 } 122 }
123 } 123 }
124 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698