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

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

Issue 2841543002: Spelling a (Closed)
Patch Set: Created 3 years, 8 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
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 "native_testing.dart"; 5 import "native_testing.dart";
6 6
7 // Test that hidden native class names are not used by generated code. 7 // Test that hidden native class names are not used by generated code.
8 8
9 @Native("BB") 9 @Native("BB")
10 class AA { 10 class AA {
(...skipping 11 matching lines...) Expand all
22 // Ordinary class with name clashing with native class. 22 // Ordinary class with name clashing with native class.
23 get name => 'CC'; 23 get name => 'CC';
24 static CC create() => new CC(); 24 static CC create() => new CC();
25 } 25 }
26 26
27 makeA() native; 27 makeA() native;
28 makeB() native; 28 makeB() native;
29 29
30 void setup1() native """ 30 void setup1() native """
31 // Poison hidden native names 'BB' and 'CC' to prove the compiler didn't place 31 // Poison hidden native names 'BB' and 'CC' to prove the compiler didn't place
32 // anthing on the hidden native class. 32 // anything on the hidden native class.
33 BB = null; 33 BB = null;
34 CC = null; 34 CC = null;
35 """; 35 """;
36 36
37 void setup2() native """ 37 void setup2() native """
38 // This code is all inside 'setup' and so not accesible from the global scope. 38 // This code is all inside 'setup' and so not accessible from the global scope.
39 function BB(){} 39 function BB(){}
40 function CC(){} 40 function CC(){}
41 makeA = function(){return new BB}; // AA is native "BB" 41 makeA = function(){return new BB}; // AA is native "BB"
42 makeB = function(){return new CC}; // BB is native "CC" 42 makeB = function(){return new CC}; // BB is native "CC"
43 self.nativeConstructor(BB); 43 self.nativeConstructor(BB);
44 self.nativeConstructor(CC); 44 self.nativeConstructor(CC);
45 """; 45 """;
46 46
47 main() { 47 main() {
48 nativeTesting(); 48 nativeTesting();
49 setup1(); 49 setup1();
50 setup2(); 50 setup2();
51 51
52 var a = confuse(AA.create()); 52 var a = confuse(AA.create());
53 var b = confuse(BB.create()); 53 var b = confuse(BB.create());
54 var c = confuse(CC.create()); 54 var c = confuse(CC.create());
55 55
56 Expect.equals('AA', a.name); 56 Expect.equals('AA', a.name);
57 Expect.equals('BB', b.name); 57 Expect.equals('BB', b.name);
58 Expect.equals('CC', c.name); 58 Expect.equals('CC', c.name);
59 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698