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

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

Issue 9599013: Complete AST nodes for switch statement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 visit(node.name); 317 visit(node.name);
318 add(node.colonToken.value); 318 add(node.colonToken.value);
319 sb.add(' '); 319 sb.add(' ');
320 visit(node.expression); 320 visit(node.expression);
321 } 321 }
322 322
323 visitSwitchStatement(SwitchStatement node) { 323 visitSwitchStatement(SwitchStatement node) {
324 add(node.switchKeyword.value); 324 add(node.switchKeyword.value);
325 sb.add(' '); 325 sb.add(' ');
326 visit(node.parenthesizedExpression); 326 visit(node.parenthesizedExpression);
327 sb.add(' { /* NOT IMPLEMENTED YET */ }'); 327 sb.add(' ');
328 // TODO(ahe): More to come... 328 visit(node.cases);
329 }
330
331 visitSwitchCase(SwitchCase node) {
332 if (node.label !== null) {
333 visit(node.label);
334 sb.add(': ');
335 }
336 node.caseKeyword.value.printOn(sb);
337 sb.add(' ');
338 visit(node.expression);
339 sb.add(': ');
340 visit(node.statements);
341 }
342
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);
329 } 351 }
330 352
331 visitScriptTag(ScriptTag node) { 353 visitScriptTag(ScriptTag node) {
332 add(node.beginToken.value); 354 add(node.beginToken.value);
333 visit(node.tag); 355 visit(node.tag);
334 sb.add('('); 356 sb.add('(');
335 visit(node.argument); 357 visit(node.argument);
336 if (node.prefixIdentifier !== null) { 358 if (node.prefixIdentifier !== null) {
337 visit(node.prefixIdentifier); 359 visit(node.prefixIdentifier);
338 sb.add(': '); 360 sb.add(': ');
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 sb.add(' '); 393 sb.add(' ');
372 } 394 }
373 visit(node.name); 395 visit(node.name);
374 if (node.typeParameters !== null) { 396 if (node.typeParameters !== null) {
375 visit(node.typeParameters); 397 visit(node.typeParameters);
376 } 398 }
377 visit(node.formals); 399 visit(node.formals);
378 add(node.endToken.value); 400 add(node.endToken.value);
379 } 401 }
380 } 402 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698