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 import "package:expect/expect.dart"; |
10 import 'native_metadata.dart'; | 11 import 'native_metadata.dart'; |
11 | 12 |
12 @Native("*A") | 13 @Native("*A") |
13 class A { | 14 class A { |
14 @native foo([a=100]); | 15 @native foo([a=100]); |
15 } | 16 } |
16 | 17 |
17 @Native("*B") | 18 @Native("*B") |
18 class B extends A { | 19 class B extends A { |
19 } | 20 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 Expect.equals('C.foo(300)', d.foo()); | 77 Expect.equals('C.foo(300)', d.foo()); |
77 // If the above line fails with C.foo(100) then the dispatch to fill in the | 78 // If the above line fails with C.foo(100) then the dispatch to fill in the |
78 // default got the wrong one, followed by a second dispatch that resolved to | 79 // default got the wrong one, followed by a second dispatch that resolved to |
79 // the correct native method. | 80 // the correct native method. |
80 | 81 |
81 Expect.equals('A.foo(1)', a.foo(1)); | 82 Expect.equals('A.foo(1)', a.foo(1)); |
82 Expect.equals('A.foo(2)', b.foo(2)); | 83 Expect.equals('A.foo(2)', b.foo(2)); |
83 Expect.equals('C.foo(3)', c.foo(3)); | 84 Expect.equals('C.foo(3)', c.foo(3)); |
84 Expect.equals('C.foo(4)', d.foo(4)); | 85 Expect.equals('C.foo(4)', d.foo(4)); |
85 } | 86 } |
OLD | NEW |