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

Side by Side Diff: frog/leg/tree/unparser.dart

Issue 9632018: Switch-implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missing handling of default in unparser. Created 8 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 class Unparser implements Visitor { 5 class Unparser implements Visitor {
6 StringBuffer sb; 6 StringBuffer sb;
7 final bool printDebugInfo; 7 final bool printDebugInfo;
8 8
9 Unparser([this.printDebugInfo = false]); 9 Unparser([this.printDebugInfo = false]);
10 10
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 visit(node.parenthesizedExpression); 326 visit(node.parenthesizedExpression);
327 sb.add(' '); 327 sb.add(' ');
328 visit(node.cases); 328 visit(node.cases);
329 } 329 }
330 330
331 visitSwitchCase(SwitchCase node) { 331 visitSwitchCase(SwitchCase node) {
332 if (node.label !== null) { 332 if (node.label !== null) {
333 visit(node.label); 333 visit(node.label);
334 sb.add(': '); 334 sb.add(': ');
335 } 335 }
336 node.caseKeyword.value.printOn(sb); 336 for (Expression expression in node.expressions) {
337 sb.add(' '); 337 sb.add('case ');
338 visit(node.expression); 338 visit(expression);
339 sb.add(': '); 339 sb.add(': ');
340 }
341 if (node.isDefaultCase) {
342 sb.add('default:');
343 }
340 visit(node.statements); 344 visit(node.statements);
341 } 345 }
342 346
343 visitDefaultCase(DefaultCase node) {
344 if (node.label !== null) {
345 visit(node.label);
346 sb.add(': ');
347 }
348 node.defaultKeyword.value.printOn(sb);
349 sb.add(': ');
350 visit(node.statements);
351 }
352
353 visitScriptTag(ScriptTag node) { 347 visitScriptTag(ScriptTag node) {
354 add(node.beginToken.value); 348 add(node.beginToken.value);
355 visit(node.tag); 349 visit(node.tag);
356 sb.add('('); 350 sb.add('(');
357 visit(node.argument); 351 visit(node.argument);
358 if (node.prefixIdentifier !== null) { 352 if (node.prefixIdentifier !== null) {
359 visit(node.prefixIdentifier); 353 visit(node.prefixIdentifier);
360 sb.add(': '); 354 sb.add(': ');
361 visit(node.prefix); 355 visit(node.prefix);
362 } 356 }
(...skipping 30 matching lines...) Expand all
393 sb.add(' '); 387 sb.add(' ');
394 } 388 }
395 visit(node.name); 389 visit(node.name);
396 if (node.typeParameters !== null) { 390 if (node.typeParameters !== null) {
397 visit(node.typeParameters); 391 visit(node.typeParameters);
398 } 392 }
399 visit(node.formals); 393 visit(node.formals);
400 add(node.endToken.value); 394 add(node.endToken.value);
401 } 395 }
402 } 396 }
OLDNEW
« frog/leg/tree/nodes.dart ('K') | « frog/leg/tree/nodes.dart ('k') | frog/leg/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698