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 that hidden native class names are not used by generated code. | 8 // Test that hidden native class names are not used by generated code. |
8 | 9 |
9 class AA native "BB" { | 10 @Native("BB") |
| 11 class AA { |
10 get name => 'AA'; | 12 get name => 'AA'; |
11 static AA create() => makeA(); | 13 static AA create() => makeA(); |
12 } | 14 } |
13 | 15 |
14 class BB native "CC" { | 16 @Native("CC") |
| 17 class BB { |
15 get name => 'BB'; | 18 get name => 'BB'; |
16 static BB create() => makeB(); | 19 static BB create() => makeB(); |
17 } | 20 } |
18 | 21 |
19 class CC { // Ordinary class with name clashing with native class. | 22 class CC { // Ordinary class with name clashing with native class. |
20 get name => 'CC'; | 23 get name => 'CC'; |
21 static CC create() => new CC(); | 24 static CC create() => new CC(); |
22 } | 25 } |
23 | 26 |
24 makeA() native; | 27 makeA() native; |
(...skipping 22 matching lines...) Expand all Loading... |
47 | 50 |
48 var things = [AA.create(), BB.create(), CC.create()]; | 51 var things = [AA.create(), BB.create(), CC.create()]; |
49 var a = things[inscrutable(0)]; | 52 var a = things[inscrutable(0)]; |
50 var b = things[inscrutable(1)]; | 53 var b = things[inscrutable(1)]; |
51 var c = things[inscrutable(2)]; | 54 var c = things[inscrutable(2)]; |
52 | 55 |
53 Expect.equals('AA', a.name); | 56 Expect.equals('AA', a.name); |
54 Expect.equals('BB', b.name); | 57 Expect.equals('BB', b.name); |
55 Expect.equals('CC', c.name); | 58 Expect.equals('CC', c.name); |
56 } | 59 } |
OLD | NEW |