| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "dart:_js_helper"; |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 | 7 |
| 8 @Native("A") | 8 @Native("A") |
| 9 class A { | 9 class A {} |
| 10 } | |
| 11 | 10 |
| 12 @Native("B") | 11 @Native("B") |
| 13 class B extends A { | 12 class B extends A { |
| 14 foo() native; | 13 foo() native ; |
| 15 } | 14 } |
| 16 | 15 |
| 17 makeA() native; | 16 makeA() native ; |
| 18 makeB() native; | 17 makeB() native ; |
| 19 | 18 |
| 20 setup() native """ | 19 setup() native """ |
| 21 function inherits(child, parent) { | 20 function inherits(child, parent) { |
| 22 if (child.prototype.__proto__) { | 21 if (child.prototype.__proto__) { |
| 23 child.prototype.__proto__ = parent.prototype; | 22 child.prototype.__proto__ = parent.prototype; |
| 24 } else { | 23 } else { |
| 25 function tmp() {}; | 24 function tmp() {}; |
| 26 tmp.prototype = parent.prototype; | 25 tmp.prototype = parent.prototype; |
| 27 child.prototype = new tmp(); | 26 child.prototype = new tmp(); |
| 28 child.prototype.constructor = child; | 27 child.prototype.constructor = child; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 43 try { | 42 try { |
| 44 a.foo(); | 43 a.foo(); |
| 45 } on NoSuchMethodError catch (e) { | 44 } on NoSuchMethodError catch (e) { |
| 46 exception = e; | 45 exception = e; |
| 47 } | 46 } |
| 48 Expect.isNotNull(exception); | 47 Expect.isNotNull(exception); |
| 49 | 48 |
| 50 var b = makeB(); | 49 var b = makeB(); |
| 51 Expect.equals(42, b.foo()); | 50 Expect.equals(42, b.foo()); |
| 52 } | 51 } |
| OLD | NEW |