| 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 the feature where the native string declares the native method's name. | 5 // Test the feature where the native string declares the native method's name. |
| 6 | 6 |
| 7 class A native "*A" { | 7 class A native "*A" { |
| 8 int foo() native 'fooA'; | 8 @JSName('fooA') |
| 9 int foo() native; |
| 9 } | 10 } |
| 10 | 11 |
| 11 class B extends A native "*B" { | 12 class B extends A native "*B" { |
| 12 int foo() native 'fooB'; | 13 @JSName('fooB') |
| 14 int foo() native; |
| 13 } | 15 } |
| 14 | 16 |
| 15 makeA() native; | 17 makeA() native; |
| 16 makeB() native; | 18 makeB() native; |
| 17 | 19 |
| 18 void setup() native """ | 20 void setup() native """ |
| 19 // This code is all inside 'setup' and so not accesible from the global scope. | 21 // This code is all inside 'setup' and so not accesible from the global scope. |
| 20 function inherits(child, parent) { | 22 function inherits(child, parent) { |
| 21 if (child.prototype.__proto__) { | 23 if (child.prototype.__proto__) { |
| 22 child.prototype.__proto__ = parent.prototype; | 24 child.prototype.__proto__ = parent.prototype; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 expectNoSuchMethod(action, note) { | 72 expectNoSuchMethod(action, note) { |
| 71 bool caught = false; | 73 bool caught = false; |
| 72 try { | 74 try { |
| 73 action(); | 75 action(); |
| 74 } catch (ex) { | 76 } catch (ex) { |
| 75 caught = true; | 77 caught = true; |
| 76 Expect.isTrue(ex is NoSuchMethodError, note); | 78 Expect.isTrue(ex is NoSuchMethodError, note); |
| 77 } | 79 } |
| 78 Expect.isTrue(caught, note); | 80 Expect.isTrue(caught, note); |
| 79 } | 81 } |
| OLD | NEW |