Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: tests/compiler/dart2js_native/native_class_avoids_hidden_name_frog_test.dart

Issue 383413003: Add @Native(...) annotation for native class names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698