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

Side by Side Diff: utils/template/htmltree.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 // Generated by scripts/tree_gen.py. 4 // Generated by scripts/tree_gen.py.
5 5
6 ///////////////////////////////////////////////////////////////////////// 6 /////////////////////////////////////////////////////////////////////////
7 // CSS specific types: 7 // CSS specific types:
8 ///////////////////////////////////////////////////////////////////////// 8 /////////////////////////////////////////////////////////////////////////
9 9
10 class Identifier extends ASTNode { 10 class Identifier extends ASTNode {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 TemplateSignature(this.name, this.params, SourceSpan span): super(span); 57 TemplateSignature(this.name, this.params, SourceSpan span): super(span);
58 58
59 visit(TreeVisitor visitor) => visitor.visitTemplateSignature(this); 59 visit(TreeVisitor visitor) => visitor.visitTemplateSignature(this);
60 60
61 String paramsAsString() { 61 String paramsAsString() {
62 StringBuffer buff = new StringBuffer(); 62 StringBuffer buff = new StringBuffer();
63 bool first = true; 63 bool first = true;
64 for (final param in params) { 64 for (final param in params) {
65 if (!first) { 65 if (!first) {
66 buff.add(", "); 66 buff.write(", ");
67 } 67 }
68 if (param['type'] != null) { 68 if (param['type'] != null) {
69 buff.add(param['type']); 69 buff.write(param['type']);
70 buff.add(' '); 70 buff.write(' ');
71 } 71 }
72 buff.add(param['name']); 72 buff.write(param['name']);
73 first = false; 73 first = false;
74 } 74 }
75 75
76 return buff.toString(); 76 return buff.toString();
77 } 77 }
78 78
79 String toString() => "template ${name}(${paramsAsString()})"; 79 String toString() => "template ${name}(${paramsAsString()})";
80 } 80 }
81 81
82 class TemplateChildren extends ASTNode { 82 class TemplateChildren extends ASTNode {
(...skipping 12 matching lines...) Expand all
95 ASTNode get last => children.last; 95 ASTNode get last => children.last;
96 ASTNode removeLast() => children.removeLast(); 96 ASTNode removeLast() => children.removeLast();
97 bool get anyChildren => children != null && children.length > 0; 97 bool get anyChildren => children != null && children.length > 0;
98 98
99 visit(TreeVisitor visitor) => visitor.visitTemplateChildren(this); 99 visit(TreeVisitor visitor) => visitor.visitTemplateChildren(this);
100 100
101 String toString() { 101 String toString() {
102 StringBuffer buff = new StringBuffer(); 102 StringBuffer buff = new StringBuffer();
103 if (children != null) { 103 if (children != null) {
104 for (final child in children) { 104 for (final child in children) {
105 buff.add(child.toString()); 105 buff.write(child.toString());
106 } 106 }
107 } 107 }
108 108
109 return buff.toString(); 109 return buff.toString();
110 } 110 }
111 } 111 }
112 112
113 class TemplateGetter extends ASTNode { 113 class TemplateGetter extends ASTNode {
114 String name; 114 String name;
115 List<Map<Identifier, Identifier>> params; 115 List<Map<Identifier, Identifier>> params;
116 TemplateDocument docFrag; 116 TemplateDocument docFrag;
117 117
118 TemplateGetter(this.name, this.params, this.docFrag, SourceSpan span) : 118 TemplateGetter(this.name, this.params, this.docFrag, SourceSpan span) :
119 super(span); 119 super(span);
120 120
121 visit(TreeVisitor visitor) => visitor.visitTemplateGetter(this); 121 visit(TreeVisitor visitor) => visitor.visitTemplateGetter(this);
122 122
123 String paramsAsString() { 123 String paramsAsString() {
124 StringBuffer buff = new StringBuffer(); 124 StringBuffer buff = new StringBuffer();
125 bool first = true; 125 bool first = true;
126 for (final param in params) { 126 for (final param in params) {
127 if (!first) { 127 if (!first) {
128 buff.add(", "); 128 buff.write(", ");
129 } 129 }
130 if (param['type'] != null && param['type'].length > 0) { 130 if (param['type'] != null && param['type'].length > 0) {
131 buff.add(param['type']); 131 buff.write(param['type']);
132 buff.add(' '); 132 buff.write(' ');
133 } 133 }
134 buff.add(param['name']); 134 buff.write(param['name']);
135 first = false; 135 first = false;
136 } 136 }
137 137
138 return buff.toString(); 138 return buff.toString();
139 } 139 }
140 140
141 String getterSignatureAsString() => "${name}(${paramsAsString()})"; 141 String getterSignatureAsString() => "${name}(${paramsAsString()})";
142 } 142 }
143 143
144 class TemplateContent extends ASTNode { 144 class TemplateContent extends ASTNode {
(...skipping 30 matching lines...) Expand all
175 visit(TreeVisitor visitor) => visitor.visitTemplateElement(this); 175 visit(TreeVisitor visitor) => visitor.visitTemplateElement(this);
176 176
177 bool get hasVar => _varName != null; 177 bool get hasVar => _varName != null;
178 String get varName => hasVar ? _varName.value : null; 178 String get varName => hasVar ? _varName.value : null;
179 179
180 String attributesToString() { 180 String attributesToString() {
181 StringBuffer buff = new StringBuffer(); 181 StringBuffer buff = new StringBuffer();
182 182
183 if (attributes != null) { 183 if (attributes != null) {
184 for (final attr in attributes) { 184 for (final attr in attributes) {
185 buff.add(' ${attr.toString()}'); 185 buff.write(' ${attr.toString()}');
186 } 186 }
187 } 187 }
188 188
189 return buff.toString(); 189 return buff.toString();
190 } 190 }
191 191
192 String get tagName => isFragment ? 192 String get tagName => isFragment ?
193 'root' : TokenKind.tagNameFromTokenId(tagTokenId); 193 'root' : TokenKind.tagNameFromTokenId(tagTokenId);
194 194
195 bool get scoped => !TokenKind.unscopedTag(tagTokenId); 195 bool get scoped => !TokenKind.unscopedTag(tagTokenId);
196 196
197 String tagStartToString() => "<${tagName}${attributesToString()}>"; 197 String tagStartToString() => "<${tagName}${attributesToString()}>";
198 198
199 String tagEndToString() => "</${tagName}>"; 199 String tagEndToString() => "</${tagName}>";
200 200
201 String toString() { 201 String toString() {
202 StringBuffer buff = new StringBuffer(tagStartToString()); 202 StringBuffer buff = new StringBuffer(tagStartToString());
203 203
204 if (children != null) { 204 if (children != null) {
205 for (final child in children) { 205 for (final child in children) {
206 buff.add(child.toString()); 206 buff.write(child.toString());
207 } 207 }
208 208
209 buff.add(tagEndToString()); 209 buff.write(tagEndToString());
210 } 210 }
211 211
212 return buff.toString(); 212 return buff.toString();
213 } 213 }
214 } 214 }
215 215
216 class TemplateAttribute extends ASTNode { 216 class TemplateAttribute extends ASTNode {
217 String name; 217 String name;
218 String value; 218 String value;
219 219
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 output.writeValue('params', node.params); 416 output.writeValue('params', node.params);
417 } 417 }
418 418
419 void visitTemplateGetter(TemplateGetter node) { 419 void visitTemplateGetter(TemplateGetter node) {
420 output.heading('template getter', node.span); 420 output.heading('template getter', node.span);
421 output.writeValue('getter Signature', node.getterSignatureAsString()); 421 output.writeValue('getter Signature', node.getterSignatureAsString());
422 visitTemplateDocument(node.docFrag); 422 visitTemplateDocument(node.docFrag);
423 } 423 }
424 } 424 }
425 425
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698