| OLD | NEW |
| 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 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 visitSwitchStatement(SwitchStatement node) { | 341 visitSwitchStatement(SwitchStatement node) { |
| 342 add(node.switchKeyword.value); | 342 add(node.switchKeyword.value); |
| 343 sb.add(' '); | 343 sb.add(' '); |
| 344 visit(node.parenthesizedExpression); | 344 visit(node.parenthesizedExpression); |
| 345 sb.add(' '); | 345 sb.add(' '); |
| 346 visit(node.cases); | 346 visit(node.cases); |
| 347 } | 347 } |
| 348 | 348 |
| 349 visitSwitchCase(SwitchCase node) { | 349 visitSwitchCase(SwitchCase node) { |
| 350 if (node.label !== null) { | 350 visit(node.labelsAndCases); |
| 351 visit(node.label); | |
| 352 sb.add(': '); | |
| 353 } | |
| 354 for (Expression expression in node.expressions) { | |
| 355 sb.add('case '); | |
| 356 visit(expression); | |
| 357 sb.add(': '); | |
| 358 } | |
| 359 if (node.isDefaultCase) { | 351 if (node.isDefaultCase) { |
| 360 sb.add('default:'); | 352 sb.add('default:'); |
| 361 } | 353 } |
| 362 visit(node.statements); | 354 visit(node.statements); |
| 363 } | 355 } |
| 364 | 356 |
| 365 visitScriptTag(ScriptTag node) { | 357 visitScriptTag(ScriptTag node) { |
| 366 add(node.beginToken.value); | 358 add(node.beginToken.value); |
| 367 visit(node.tag); | 359 visit(node.tag); |
| 368 sb.add('('); | 360 sb.add('('); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 382 visit(node.tryBlock); | 374 visit(node.tryBlock); |
| 383 visit(node.catchBlocks); | 375 visit(node.catchBlocks); |
| 384 if (node.finallyKeyword !== null) { | 376 if (node.finallyKeyword !== null) { |
| 385 sb.add(' '); | 377 sb.add(' '); |
| 386 add(node.finallyKeyword.value); | 378 add(node.finallyKeyword.value); |
| 387 sb.add(' '); | 379 sb.add(' '); |
| 388 visit(node.finallyBlock); | 380 visit(node.finallyBlock); |
| 389 } | 381 } |
| 390 } | 382 } |
| 391 | 383 |
| 384 visitCaseMatch(CaseMatch node) { |
| 385 add(node.caseKeyword.value); |
| 386 sb.add(" "); |
| 387 visit(node.expression); |
| 388 add(node.colonToken.value); |
| 389 } |
| 390 |
| 392 visitCatchBlock(CatchBlock node) { | 391 visitCatchBlock(CatchBlock node) { |
| 393 add(node.catchKeyword.value); | 392 add(node.catchKeyword.value); |
| 394 sb.add(' '); | 393 sb.add(' '); |
| 395 visit(node.formals); | 394 visit(node.formals); |
| 396 sb.add(' '); | 395 sb.add(' '); |
| 397 visit(node.block); | 396 visit(node.block); |
| 398 } | 397 } |
| 399 | 398 |
| 400 visitTypedef(Typedef node) { | 399 visitTypedef(Typedef node) { |
| 401 add(node.typedefKeyword.value); | 400 add(node.typedefKeyword.value); |
| 402 sb.add(' '); | 401 sb.add(' '); |
| 403 if (node.returnType !== null) { | 402 if (node.returnType !== null) { |
| 404 visit(node.returnType); | 403 visit(node.returnType); |
| 405 sb.add(' '); | 404 sb.add(' '); |
| 406 } | 405 } |
| 407 visit(node.name); | 406 visit(node.name); |
| 408 if (node.typeParameters !== null) { | 407 if (node.typeParameters !== null) { |
| 409 visit(node.typeParameters); | 408 visit(node.typeParameters); |
| 410 } | 409 } |
| 411 visit(node.formals); | 410 visit(node.formals); |
| 412 add(node.endToken.value); | 411 add(node.endToken.value); |
| 413 } | 412 } |
| 414 } | 413 } |
| OLD | NEW |