| 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 // Test to see if resolving a hidden native class's method to noSuchMethod | 7 // Test to see if resolving a hidden native class's method to noSuchMethod |
| 8 // interferes with subsequent resolving of the method. This might happen if the | 8 // interferes with subsequent resolving of the method. This might happen if the |
| 9 // noSuchMethod is cached on Object.prototype. | 9 // noSuchMethod is cached on Object.prototype. |
| 10 | 10 |
| 11 class A1 native "*A1" { | 11 class A1 native "A1" { |
| 12 } | 12 } |
| 13 | 13 |
| 14 class B1 extends A1 native "*B1" { | 14 class B1 extends A1 native "B1" { |
| 15 } | 15 } |
| 16 | 16 |
| 17 makeA1() native; | 17 makeA1() native; |
| 18 makeB1() native; | 18 makeB1() native; |
| 19 | 19 |
| 20 | 20 |
| 21 class A2 native "*A2" { | 21 class A2 native "A2" { |
| 22 foo([a=99]) native; | 22 foo([a=99]) native; |
| 23 } | 23 } |
| 24 | 24 |
| 25 class B2 extends A2 native "*B2" { | 25 class B2 extends A2 native "B2" { |
| 26 } | 26 } |
| 27 | 27 |
| 28 makeA2() native; | 28 makeA2() native; |
| 29 makeB2() native; | 29 makeB2() native; |
| 30 | 30 |
| 31 makeObject() native; | 31 makeObject() native; |
| 32 | 32 |
| 33 void setup() native """ | 33 void setup() native """ |
| 34 // This code is all inside 'setup' and so not accesible from the global scope. | 34 // This code is all inside 'setup' and so not accesible from the global scope. |
| 35 function inherits(child, parent) { | 35 function inherits(child, parent) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 expectNoSuchMethod(action, note) { | 90 expectNoSuchMethod(action, note) { |
| 91 bool caught = false; | 91 bool caught = false; |
| 92 try { | 92 try { |
| 93 action(); | 93 action(); |
| 94 } catch (ex) { | 94 } catch (ex) { |
| 95 caught = true; | 95 caught = true; |
| 96 Expect.isTrue(ex is NoSuchMethodError, note); | 96 Expect.isTrue(ex is NoSuchMethodError, note); |
| 97 } | 97 } |
| 98 Expect.isTrue(caught, note); | 98 Expect.isTrue(caught, note); |
| 99 } | 99 } |
| OLD | NEW |