| 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 "native_testing.dart"; | 5 import "native_testing.dart"; |
| 6 | 6 |
| 7 // 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 |
| 8 // subsequent resolving the subclass's method. This might happen if the | 8 // subsequent resolving the subclass's method. This might happen if the |
| 9 // superclass caches the method in the prototype, so shadowing the dispatcher | 9 // superclass caches the method in the prototype, so shadowing the dispatcher |
| 10 // stored on Object.prototype. | 10 // stored on Object.prototype. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class C extends B { | 24 class C extends B { |
| 25 foo() => 'C.foo; super.foo = ${super.foo()}'; | 25 foo() => 'C.foo; super.foo = ${super.foo()}'; |
| 26 bar() => 'C.bar'; | 26 bar() => 'C.bar'; |
| 27 } | 27 } |
| 28 | 28 |
| 29 @Native("D") | 29 @Native("D") |
| 30 class D extends C { | 30 class D extends C { |
| 31 bar() => 'D.bar'; | 31 bar() => 'D.bar'; |
| 32 } | 32 } |
| 33 | 33 |
| 34 makeA() native ; | 34 makeA() native; |
| 35 makeB() native ; | 35 makeB() native; |
| 36 makeC() native ; | 36 makeC() native; |
| 37 makeD() native ; | 37 makeD() native; |
| 38 | 38 |
| 39 void setup() native """ | 39 void setup() native """ |
| 40 // This code is all inside 'setup' and so not accesible from the global scope. | 40 // This code is all inside 'setup' and so not accesible from the global scope. |
| 41 function inherits(child, parent) { | 41 function inherits(child, parent) { |
| 42 if (child.prototype.__proto__) { | 42 if (child.prototype.__proto__) { |
| 43 child.prototype.__proto__ = parent.prototype; | 43 child.prototype.__proto__ = parent.prototype; |
| 44 } else { | 44 } else { |
| 45 function tmp() {}; | 45 function tmp() {}; |
| 46 tmp.prototype = parent.prototype; | 46 tmp.prototype = parent.prototype; |
| 47 child.prototype = new tmp(); | 47 child.prototype = new tmp(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 75 var a = makeA(); | 75 var a = makeA(); |
| 76 var b = makeB(); | 76 var b = makeB(); |
| 77 var c = makeC(); | 77 var c = makeC(); |
| 78 var d = makeD(); | 78 var d = makeD(); |
| 79 | 79 |
| 80 Expect.equals('A.foo A.bar', a.foo()); | 80 Expect.equals('A.foo A.bar', a.foo()); |
| 81 Expect.equals('A.foo B.bar', b.foo()); | 81 Expect.equals('A.foo B.bar', b.foo()); |
| 82 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()); |
| 83 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()); |
| 84 } | 84 } |
| OLD | NEW |