| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Test that the right exception for dart2js is thrown in the presence of |
| 6 // bailouts. |
| 7 |
| 5 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 6 | 9 |
| 7 var a; | 10 var a; |
| 8 var b; | 11 var b; |
| 9 | 12 |
| 10 bar() { | 13 bar() { |
| 11 a = a == null ? 42 : new Object(); | 14 a = a == null ? 42 : new Object(); |
| 12 a += b; | 15 a += b; |
| 13 } | 16 } |
| 14 | 17 |
| 15 foo() { | 18 foo() { |
| 16 a = a == null ? new Object() : 42; | 19 a = a == null ? new Object() : 42; |
| 17 a--; | 20 a--; |
| 18 } | 21 } |
| 19 | 22 |
| 20 main() { | 23 main() { |
| 21 for (int i = 0; i < 10; i++) { | 24 for (int i = 0; i < 10; i++) { |
| 22 a = null; | 25 a = null; |
| 23 Expect.throws(foo, (e) => e is NoSuchMethodError); | 26 Expect.throws(foo, (e) => e is NoSuchMethodError); |
| 24 a = null; | 27 a = null; |
| 28 // dart2js throws [ArgumentError], VM throws [NoSuchMethodError]. |
| 25 Expect.throws(bar, (e) => e is ArgumentError); | 29 Expect.throws(bar, (e) => e is ArgumentError); |
| 26 } | 30 } |
| 27 } | 31 } |
| OLD | NEW |