| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart_printer_test; | 5 library dart_printer_test; |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'package:compiler/src/constants/values.dart'; | 8 import 'package:compiler/src/constants/values.dart'; |
| 9 import 'package:compiler/src/dart_backend/backend_ast_nodes.dart'; | 9 import 'package:compiler/src/dart_backend/backend_ast_nodes.dart'; |
| 10 import 'package:compiler/src/scanner/scannerlib.dart'; | 10 import 'package:compiler/src/scanner/scannerlib.dart'; |
| 11 import 'package:compiler/src/io/source_file.dart'; | 11 import 'package:compiler/src/io/source_file.dart'; |
| 12 import 'package:compiler/src/dart2jslib.dart'; | |
| 13 import 'package:compiler/src/diagnostic_listener.dart'; | 12 import 'package:compiler/src/diagnostic_listener.dart'; |
| 14 import "package:compiler/src/messages.dart"; | 13 import "package:compiler/src/messages.dart"; |
| 15 import 'package:compiler/src/tree/tree.dart' show DartString; | 14 import 'package:compiler/src/tree/tree.dart' show DartString; |
| 16 import 'dart:mirrors'; | 15 import 'dart:mirrors'; |
| 17 import 'package:compiler/src/tree/tree.dart' as tree; | 16 import 'package:compiler/src/tree/tree.dart' as tree; |
| 18 import 'package:compiler/src/string_validator.dart'; | 17 import 'package:compiler/src/string_validator.dart'; |
| 19 import 'package:compiler/src/dart_backend/backend_ast_to_frontend_ast.dart' | 18 import 'package:compiler/src/dart_backend/backend_ast_to_frontend_ast.dart' |
| 20 show TreePrinter; | 19 show TreePrinter; |
| 21 import 'package:compiler/src/util/util.dart' show Spannable; | 20 import 'package:compiler/src/diagnostics/spannable.dart' show Spannable; |
| 22 | 21 |
| 23 /// For debugging the [AstBuilder] stack. Prints information about [x]. | 22 /// For debugging the [AstBuilder] stack. Prints information about [x]. |
| 24 void show(x) { | 23 void show(x) { |
| 25 StringBuffer buf = new StringBuffer(); | 24 StringBuffer buf = new StringBuffer(); |
| 26 Unparser unparser = new Unparser(buf); | 25 Unparser unparser = new Unparser(buf); |
| 27 void unparse(x) { | 26 void unparse(x) { |
| 28 if (x is Expression) | 27 if (x is Expression) |
| 29 unparser.writeExpression(x); | 28 unparser.writeExpression(x); |
| 30 else if (x is TypeAnnotation) | 29 else if (x is TypeAnnotation) |
| 31 unparser.writeType(x); | 30 unparser.writeType(x); |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 checkStatement("do while(x); while (y);"); | 970 checkStatement("do while(x); while (y);"); |
| 972 checkStatement("{do; while(x); while (y);}"); | 971 checkStatement("{do; while(x); while (y);}"); |
| 973 | 972 |
| 974 checkStatement('switch(x) { case 1: case 2: return y; }'); | 973 checkStatement('switch(x) { case 1: case 2: return y; }'); |
| 975 checkStatement('switch(x) { default: return y; }'); | 974 checkStatement('switch(x) { default: return y; }'); |
| 976 checkStatement('switch(x) { case 1: x=y; default: return y; }'); | 975 checkStatement('switch(x) { case 1: x=y; default: return y; }'); |
| 977 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); | 976 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); |
| 978 | 977 |
| 979 } | 978 } |
| 980 | 979 |
| OLD | NEW |