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 '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_pri
nter.dart'; | 8 import 'package:compiler/implementation/dart_backend/dart_printer.dart'; |
9 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da
rt'; | 9 import 'package:compiler/implementation/scanner/scannerlib.dart'; |
10 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; | 10 import 'package:compiler/implementation/source_file.dart'; |
11 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'; | 11 import 'package:compiler/implementation/dart2jslib.dart'; |
12 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart' show
DartString; | 12 import 'package:compiler/implementation/tree/tree.dart' show DartString; |
13 import 'dart:mirrors'; | 13 import 'dart:mirrors'; |
14 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart' as tr
ee; | 14 import 'package:compiler/implementation/tree/tree.dart' as tree; |
15 import '../../../sdk/lib/_internal/compiler/implementation/string_validator.dart
'; | 15 import 'package:compiler/implementation/string_validator.dart'; |
16 import '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_tre
e_printer.dart' show TreePrinter; | 16 import 'package:compiler/implementation/dart_backend/dart_tree_printer.dart' sho
w TreePrinter; |
17 | 17 |
18 /// For debugging the [AstBuilder] stack. Prints information about [x]. | 18 /// For debugging the [AstBuilder] stack. Prints information about [x]. |
19 void show(x) { | 19 void show(x) { |
20 StringBuffer buf = new StringBuffer(); | 20 StringBuffer buf = new StringBuffer(); |
21 Unparser unparser = new Unparser(buf); | 21 Unparser unparser = new Unparser(buf); |
22 void unparse(x) { | 22 void unparse(x) { |
23 if (x is Expression) | 23 if (x is Expression) |
24 unparser.writeExpression(x); | 24 unparser.writeExpression(x); |
25 else if (x is TypeAnnotation) | 25 else if (x is TypeAnnotation) |
26 unparser.writeType(x); | 26 unparser.writeType(x); |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 checkStatement("do while(x); while (y);"); | 962 checkStatement("do while(x); while (y);"); |
963 checkStatement("{do; while(x); while (y);}"); | 963 checkStatement("{do; while(x); while (y);}"); |
964 | 964 |
965 checkStatement('switch(x) { case 1: case 2: return y; }'); | 965 checkStatement('switch(x) { case 1: case 2: return y; }'); |
966 checkStatement('switch(x) { default: return y; }'); | 966 checkStatement('switch(x) { default: return y; }'); |
967 checkStatement('switch(x) { case 1: x=y; default: return y; }'); | 967 checkStatement('switch(x) { case 1: x=y; default: return y; }'); |
968 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); | 968 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); |
969 | 969 |
970 } | 970 } |
971 | 971 |
OLD | NEW |