| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |