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