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 // Test to see if resolving a hidden native class's method interferes with | 5 // 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 | 6 // subsequent resolving the subclass's method. This might happen if the |
7 // superclass caches the method in the prototype, so shadowing the dispatcher | 7 // superclass caches the method in the prototype, so shadowing the dispatcher |
8 // stored on Object.prototype. | 8 // stored on Object.prototype. |
9 | 9 |
10 @native("*A") | 10 @native("*A") |
11 class A { | 11 class A { |
12 @native foo([a=100]); | 12 @native foo([a=100]); |
13 } | 13 } |
14 | 14 |
15 @native("*B") | 15 @native("*B") |
16 class B extends A { | 16 class B extends A { |
17 } | 17 } |
18 | 18 |
19 @native("*C") | 19 @native("*C") |
20 class C extends B { | 20 class C extends B { |
21 @native foo([z=300]); | 21 @native foo([z=300]); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 Expect.equals('C.foo(300)', d.foo()); | 74 Expect.equals('C.foo(300)', d.foo()); |
75 // If the above line fails with C.foo(100) then the dispatch to fill in the | 75 // If the above line fails with C.foo(100) then the dispatch to fill in the |
76 // default got the wrong one, followed by a second dispatch that resolved to | 76 // default got the wrong one, followed by a second dispatch that resolved to |
77 // the correct native method. | 77 // the correct native method. |
78 | 78 |
79 Expect.equals('A.foo(1)', a.foo(1)); | 79 Expect.equals('A.foo(1)', a.foo(1)); |
80 Expect.equals('A.foo(2)', b.foo(2)); | 80 Expect.equals('A.foo(2)', b.foo(2)); |
81 Expect.equals('C.foo(3)', c.foo(3)); | 81 Expect.equals('C.foo(3)', c.foo(3)); |
82 Expect.equals('C.foo(4)', d.foo(4)); | 82 Expect.equals('C.foo(4)', d.foo(4)); |
83 } | 83 } |
OLD | NEW |