| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 // The multitest framework does not support import paths that contain '..', |
| 6 // therefore it's not used in this file. |
| 7 import '../dart2js_native/compiler_test_internals.dart'; |
| 8 |
| 9 /** |
| 10 * This test verifies that the @IrRepresentation annotation works as expected. |
| 11 * It might fail when extending the IR to express more of Dart. |
| 12 */ |
| 13 |
| 14 // closure |
| 15 @IrRepresentation(true) |
| 16 test1() { |
| 17 var f = () => 42; |
| 18 return 1; |
| 19 } |
| 20 |
| 21 // parameter |
| 22 @IrRepresentation(true) |
| 23 test2(x) { |
| 24 return x; |
| 25 } |
| 26 |
| 27 // dynamic invocation, construction |
| 28 @IrRepresentation(true) |
| 29 test3() { |
| 30 new Object().hashCode; |
| 31 } |
| 32 |
| 33 // exceptions |
| 34 @IrRepresentation(true) |
| 35 test4() { |
| 36 try { |
| 37 throw "possum"; |
| 38 } catch (e) { |
| 39 return e; |
| 40 } |
| 41 } |
| 42 |
| 43 // control flow, loops |
| 44 @IrRepresentation(true) |
| 45 test5(x) { |
| 46 while (x < 100) { |
| 47 x += x; |
| 48 } |
| 49 if (x % 2 == 0) { |
| 50 return 1; |
| 51 } else { |
| 52 return 2; |
| 53 } |
| 54 } |
| 55 |
| 56 main() { |
| 57 print(test1()); |
| 58 print(test2(1)); |
| 59 print(test3()); |
| 60 print(test4()); |
| 61 print(test5(2)); |
| 62 } |
| OLD | NEW |