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

Side by Side Diff: dart/lib/compiler/implementation/tree/prettyprint.dart

Issue 10982089: Remove AbstractVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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) 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 /** 5 /**
6 * Pretty-prints Node tree in XML-like format. 6 * Pretty-prints Node tree in XML-like format.
7 * 7 *
8 * TODO(smok): Add main() to run from command-line to print out tree for given 8 * TODO(smok): Add main() to run from command-line to print out tree for given
9 * .dart file. 9 * .dart file.
10 */ 10 */
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 visitLabel(Label node) { 210 visitLabel(Label node) {
211 visitNodeWithChildren(node, "Label"); 211 visitNodeWithChildren(node, "Label");
212 } 212 }
213 213
214 visitLabeledStatement(LabeledStatement node) { 214 visitLabeledStatement(LabeledStatement node) {
215 visitNodeWithChildren(node, "LabeledStatement"); 215 visitNodeWithChildren(node, "LabeledStatement");
216 } 216 }
217 217
218 // Custom. 218 // Custom.
219 visitLiteral(Literal node, String type) { 219 printLiteral(Literal node, String type) {
220 openAndCloseNode(node, type, {"value" : node.value.toString()}); 220 openAndCloseNode(node, type, {"value" : node.value.toString()});
221 } 221 }
222 222
223 visitLiteralBool(LiteralBool node) { 223 visitLiteralBool(LiteralBool node) {
224 visitLiteral(node, "LiteralBool"); 224 printLiteral(node, "LiteralBool");
225 } 225 }
226 226
227 visitLiteralDouble(LiteralDouble node) { 227 visitLiteralDouble(LiteralDouble node) {
228 visitLiteral(node, "LiteralDouble"); 228 printLiteral(node, "LiteralDouble");
229 } 229 }
230 230
231 visitLiteralInt(LiteralInt node) { 231 visitLiteralInt(LiteralInt node) {
232 visitLiteral(node, "LiteralInt"); 232 printLiteral(node, "LiteralInt");
233 } 233 }
234 234
235 /** Returns token string value or [null] if token is [null]. */ 235 /** Returns token string value or [null] if token is [null]. */
236 tokenToStringOrNull(Token token) => token === null ? null : token.stringValue; 236 tokenToStringOrNull(Token token) => token === null ? null : token.stringValue;
237 237
238 visitLiteralList(LiteralList node) { 238 visitLiteralList(LiteralList node) {
239 openNode(node, "LiteralList", { 239 openNode(node, "LiteralList", {
240 "constKeyword" : tokenToStringOrNull(node.constKeyword) 240 "constKeyword" : tokenToStringOrNull(node.constKeyword)
241 }); 241 });
242 visitChildNode(node.typeArguments, "typeArguments"); 242 visitChildNode(node.typeArguments, "typeArguments");
243 visitChildNode(node.elements, "elements"); 243 visitChildNode(node.elements, "elements");
244 closeNode(); 244 closeNode();
245 } 245 }
246 246
247 visitLiteralMap(LiteralMap node) { 247 visitLiteralMap(LiteralMap node) {
248 visitNodeWithChildren(node, "LiteralMap"); 248 visitNodeWithChildren(node, "LiteralMap");
249 } 249 }
250 250
251 visitLiteralMapEntry(LiteralMapEntry node) { 251 visitLiteralMapEntry(LiteralMapEntry node) {
252 visitNodeWithChildren(node, "LiteralMapEntry"); 252 visitNodeWithChildren(node, "LiteralMapEntry");
253 } 253 }
254 254
255 visitLiteralNull(LiteralNull node) { 255 visitLiteralNull(LiteralNull node) {
256 visitLiteral(node, "LiteralNull"); 256 printLiteral(node, "LiteralNull");
257 } 257 }
258 258
259 visitLiteralString(LiteralString node) { 259 visitLiteralString(LiteralString node) {
260 openAndCloseNode(node, "LiteralString", 260 openAndCloseNode(node, "LiteralString",
261 {"value" : node.token.slowToString()}); 261 {"value" : node.token.slowToString()});
262 } 262 }
263 263
264 visitModifiers(Modifiers node) { 264 visitModifiers(Modifiers node) {
265 visitNodeWithChildren(node, "Modifiers"); 265 visitNodeWithChildren(node, "Modifiers");
266 } 266 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 visitChildNode(node.type, "type"); 389 visitChildNode(node.type, "type");
390 visitChildNode(node.modifiers, "modifiers"); 390 visitChildNode(node.modifiers, "modifiers");
391 visitChildNode(node.definitions, "definitions"); 391 visitChildNode(node.definitions, "definitions");
392 closeNode(); 392 closeNode();
393 } 393 }
394 394
395 visitWhile(While node) { 395 visitWhile(While node) {
396 visitNodeWithChildren(node, "While"); 396 visitNodeWithChildren(node, "While");
397 } 397 }
398 } 398 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/tree/nodes.dart ('k') | dart/lib/compiler/implementation/tree/visitors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698