| 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 "dart:_js_helper"; | 5 import "native_testing.dart"; |
| 6 import "package:expect/expect.dart"; | |
| 7 | 6 |
| 8 // 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 |
| 9 // subsequent resolving the subclass's method. This might happen if the | 8 // subsequent resolving the subclass's method. This might happen if the |
| 10 // superclass caches the method in the prototype, so shadowing the dispatcher | 9 // superclass caches the method in the prototype, so shadowing the dispatcher |
| 11 // stored on Object.prototype. | 10 // stored on Object.prototype. |
| 12 | 11 |
| 13 @Native("A") | 12 @Native("A") |
| 14 class A { | 13 class A { |
| 15 foo() => 'A.foo ${bar()}'; | 14 foo() => 'A.foo ${bar()}'; |
| 16 bar() => 'A.bar'; | 15 bar() => 'A.bar'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 inherits(B, A); | 54 inherits(B, A); |
| 56 function C(){} | 55 function C(){} |
| 57 inherits(C, B); | 56 inherits(C, B); |
| 58 function D(){} | 57 function D(){} |
| 59 inherits(D, C); | 58 inherits(D, C); |
| 60 | 59 |
| 61 makeA = function(){return new A}; | 60 makeA = function(){return new A}; |
| 62 makeB = function(){return new B}; | 61 makeB = function(){return new B}; |
| 63 makeC = function(){return new C}; | 62 makeC = function(){return new C}; |
| 64 makeD = function(){return new D}; | 63 makeD = function(){return new D}; |
| 64 |
| 65 self.nativeConstructor(A); |
| 66 self.nativeConstructor(B); |
| 67 self.nativeConstructor(C); |
| 68 self.nativeConstructor(D); |
| 65 """; | 69 """; |
| 66 | 70 |
| 67 main() { | 71 main() { |
| 72 nativeTesting(); |
| 68 setup(); | 73 setup(); |
| 69 | 74 |
| 70 var a = makeA(); | 75 var a = makeA(); |
| 71 var b = makeB(); | 76 var b = makeB(); |
| 72 var c = makeC(); | 77 var c = makeC(); |
| 73 var d = makeD(); | 78 var d = makeD(); |
| 74 | 79 |
| 75 Expect.equals('A.foo A.bar', a.foo()); | 80 Expect.equals('A.foo A.bar', a.foo()); |
| 76 Expect.equals('A.foo B.bar', b.foo()); | 81 Expect.equals('A.foo B.bar', b.foo()); |
| 77 Expect.equals('C.foo; super.foo = A.foo C.bar', c.foo()); | 82 Expect.equals('C.foo; super.foo = A.foo C.bar', c.foo()); |
| 78 Expect.equals('C.foo; super.foo = A.foo D.bar', d.foo()); | 83 Expect.equals('C.foo; super.foo = A.foo D.bar', d.foo()); |
| 79 } | 84 } |
| OLD | NEW |