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