OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 import "package:expect/expect.dart"; |
| 6 |
5 // Test to see if resolving a hidden native class's method interferes with | 7 // Test to see if resolving a hidden native class's method interferes with |
6 // subsequent resolving the subclass's method. This might happen if the | 8 // subsequent resolving the subclass's method. This might happen if the |
7 // superclass caches the method in the prototype, so shadowing the dispatcher | 9 // superclass caches the method in the prototype, so shadowing the dispatcher |
8 // stored on Object.prototype. | 10 // stored on Object.prototype. |
9 | 11 |
10 // Version 1: It might be possible to call foo directly. | 12 // Version 1: It might be possible to call foo directly. |
11 class A1 native "*A1" { | 13 class A1 native "*A1" { |
12 foo() native; | 14 foo() native; |
13 } | 15 } |
14 | 16 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 caught = false; | 94 caught = false; |
93 try { | 95 try { |
94 var x = 123; | 96 var x = 123; |
95 x.foo(20); | 97 x.foo(20); |
96 } catch (ex) { | 98 } catch (ex) { |
97 caught = true; | 99 caught = true; |
98 Expect.isTrue(ex is NoSuchMethodError); | 100 Expect.isTrue(ex is NoSuchMethodError); |
99 } | 101 } |
100 Expect.isTrue(caught, "x.foo(20) should throw"); | 102 Expect.isTrue(caught, "x.foo(20) should throw"); |
101 } | 103 } |
OLD | NEW |