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 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
9 import 'package:compiler/src/constants/values.dart'; | 9 import 'package:compiler/src/constants/values.dart'; |
10 import 'package:compiler/src/dart_backend/backend_ast_nodes.dart'; | 10 import 'package:compiler/src/dart_backend/backend_ast_nodes.dart'; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 buf.write(', '); | 44 buf.write(', '); |
45 unparse(y); | 45 unparse(y); |
46 } | 46 } |
47 buf.write(']'); | 47 buf.write(']'); |
48 } | 48 } |
49 } | 49 } |
50 unparse(x); | 50 unparse(x); |
51 print("${x.runtimeType}: ${buf.toString()}"); | 51 print("${x.runtimeType}: ${buf.toString()}"); |
52 } | 52 } |
53 | 53 |
54 class PrintDiagnosticListener implements DiagnosticListener { | 54 class PrintDiagnosticListener implements DiagnosticReporter { |
55 void log(message) { | 55 void log(message) { |
56 print(message); | 56 print(message); |
57 } | 57 } |
58 | 58 |
59 void internalError(Spannable spannable, message) { | 59 void internalError(Spannable spannable, message) { |
60 print(message); | 60 print(message); |
61 } | 61 } |
62 | 62 |
63 SourceSpan spanFromSpannable(Spannable node) { | 63 SourceSpan spanFromSpannable(Spannable node) { |
64 return new SourceSpan(null, 0, 0); | 64 return new SourceSpan(null, 0, 0); |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 checkStatement("do while(x); while (y);"); | 979 checkStatement("do while(x); while (y);"); |
980 checkStatement("{do; while(x); while (y);}"); | 980 checkStatement("{do; while(x); while (y);}"); |
981 | 981 |
982 checkStatement('switch(x) { case 1: case 2: return y; }'); | 982 checkStatement('switch(x) { case 1: case 2: return y; }'); |
983 checkStatement('switch(x) { default: return y; }'); | 983 checkStatement('switch(x) { default: return y; }'); |
984 checkStatement('switch(x) { case 1: x=y; default: return y; }'); | 984 checkStatement('switch(x) { case 1: x=y; default: return y; }'); |
985 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); | 985 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); |
986 | 986 |
987 } | 987 } |
988 | 988 |
OLD | NEW |