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

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

Issue 421483002: Remove old frog-style dummy bodies from dart2js native class tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 "dart:_js_helper";
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 // Verify that native fields on classes are not renamed by the minifier. 8 // Verify that native fields on classes are not renamed by the minifier.
9 @Native("A") 9 @Native("A")
10 class A { 10 class A {
(...skipping 22 matching lines...) Expand all
33 writeable: false 33 writeable: false
34 } 34 }
35 }); 35 });
36 a.getValue = 0; 36 a.getValue = 0;
37 return a; 37 return a;
38 } 38 }
39 39
40 makeA = function(){return new A;}; 40 makeA = function(){return new A;};
41 """; 41 """;
42 42
43 A makeA() native { return new A(); } 43 A makeA() native;
44 44
45 main() { 45 main() {
46 setup(); 46 setup();
47 var a = makeA(); 47 var a = makeA();
48 a.myLongPropertyName = 21; 48 a.myLongPropertyName = 21;
49 int gotten = a.myLongPropertyName; 49 int gotten = a.myLongPropertyName;
50 Expect.equals(11, gotten); 50 Expect.equals(11, gotten);
51 51
52 var a2 = makeA(); 52 var a2 = makeA();
53 if (a2 is A) { 53 if (a2 is A) {
54 // Inside this 'if' the compiler knows that a2 is an A, so it is tempted 54 // Inside this 'if' the compiler knows that a2 is an A, so it is tempted
55 // to access myLongPropertyName directly, using its minified name. But 55 // to access myLongPropertyName directly, using its minified name. But
56 // renaming of native properties can only work using getters and setters 56 // renaming of native properties can only work using getters and setters
57 // that access the original name. 57 // that access the original name.
58 a2.myLongPropertyName = 21; 58 a2.myLongPropertyName = 21;
59 int gotten = a2.myLongPropertyName; 59 int gotten = a2.myLongPropertyName;
60 Expect.equals(11, gotten); 60 Expect.equals(11, gotten);
61 } 61 }
62 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698