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

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: Finished implementation 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 }
340 visit(node.statements); 341 visit(node.statements);
341 } 342 }
342 343
343 visitDefaultCase(DefaultCase node) {
floitsch 2012/03/09 16:52:15 Where is the default: case now handled?
Lasse Reichstein Nielsen 2012/03/12 13:05:23 A switch case now contains more than one expressio
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) { 344 visitScriptTag(ScriptTag node) {
354 add(node.beginToken.value); 345 add(node.beginToken.value);
355 visit(node.tag); 346 visit(node.tag);
356 sb.add('('); 347 sb.add('(');
357 visit(node.argument); 348 visit(node.argument);
358 if (node.prefixIdentifier !== null) { 349 if (node.prefixIdentifier !== null) {
359 visit(node.prefixIdentifier); 350 visit(node.prefixIdentifier);
360 sb.add(': '); 351 sb.add(': ');
361 visit(node.prefix); 352 visit(node.prefix);
362 } 353 }
(...skipping 30 matching lines...) Expand all
393 sb.add(' '); 384 sb.add(' ');
394 } 385 }
395 visit(node.name); 386 visit(node.name);
396 if (node.typeParameters !== null) { 387 if (node.typeParameters !== null) {
397 visit(node.typeParameters); 388 visit(node.typeParameters);
398 } 389 }
399 visit(node.formals); 390 visit(node.formals);
400 add(node.endToken.value); 391 add(node.endToken.value);
401 } 392 }
402 } 393 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698