| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 // Helper to test compilation equivalence between source and .dill based | 5 // Helper to test compilation equivalence between source and .dill based |
| 6 // compilation. | 6 // compilation. |
| 7 library dart2js.kernel.compile_from_dill_test_helper; | 7 library dart2js.kernel.compile_from_dill_test_helper; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 method() {} | 66 method() {} |
| 67 } | 67 } |
| 68 | 68 |
| 69 class SubClass extends Class { | 69 class SubClass extends Class { |
| 70 method() { | 70 method() { |
| 71 super.method(); | 71 super.method(); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 class Generic<T> {} | 75 class Generic<T> { |
| 76 method(o) => o is T; |
| 77 } |
| 76 | 78 |
| 77 var toplevel; | 79 var toplevel; |
| 78 | 80 |
| 79 main() { | 81 main() { |
| 80 foo(); | 82 foo(); |
| 81 bar(true); | 83 bar(true); |
| 82 []; | 84 []; |
| 85 <int>[]; |
| 83 {}; | 86 {}; |
| 84 new Object(); | 87 new Object(); |
| 85 new Class.named(''); | 88 new Class.named(''); |
| 86 new SubClass().method(); | 89 new SubClass().method(); |
| 87 Class.staticField; | 90 Class.staticField; |
| 88 var x = null; | 91 var x = null; |
| 89 var y1 = x == null; | 92 var y1 = x == null; |
| 90 var y2 = null == x; | 93 var y2 = null == x; |
| 91 var z1 = x?.toString(); | 94 var z1 = x?.toString(); |
| 92 var z2 = x ?? y1; | 95 var z2 = x ?? y1; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 120 break; | 123 break; |
| 121 case 1: | 124 case 1: |
| 122 x = 9; | 125 x = 9; |
| 123 break; | 126 break; |
| 124 default: | 127 default: |
| 125 x = 11; | 128 x = 11; |
| 126 break; | 129 break; |
| 127 } | 130 } |
| 128 x = toplevel; | 131 x = toplevel; |
| 129 x = testIs(x); | 132 x = testIs(x); |
| 133 x = new Generic<int>().method(x); |
| 130 x = testAsGeneric(x); | 134 x = testAsGeneric(x); |
| 131 x = testAsFunction(x); | 135 x = testAsFunction(x); |
| 132 print(x); | 136 print(x); |
| 133 return x; | 137 return x; |
| 134 } | 138 } |
| 135 typedef NoArg(); | 139 typedef NoArg(); |
| 136 @NoInline() | 140 @NoInline() |
| 137 testIs(o) => o is Generic<int> || o is NoArg; | 141 testIs(o) => o is Generic<int> || o is NoArg; |
| 138 @NoInline() | 142 @NoInline() |
| 139 testAsGeneric(o) => o as Generic<int>; | 143 testAsGeneric(o) => o as Generic<int>; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType]; | 323 Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType]; |
| 320 checkSets(map1.keys, map2.keys, 'output', equality); | 324 checkSets(map1.keys, map2.keys, 'output', equality); |
| 321 map1.forEach((String name, BufferedOutputSink output1) { | 325 map1.forEach((String name, BufferedOutputSink output1) { |
| 322 BufferedOutputSink output2 = map2[name]; | 326 BufferedOutputSink output2 = map2[name]; |
| 323 Expect.stringEquals(output1.text, output2.text); | 327 Expect.stringEquals(output1.text, output2.text); |
| 324 }); | 328 }); |
| 325 }); | 329 }); |
| 326 } | 330 } |
| 327 return ResultKind.success; | 331 return ResultKind.success; |
| 328 } | 332 } |
| OLD | NEW |