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

Side by Side Diff: dart/tests/compiler/dart2js_foreign/native_class_inheritance4_test.dart

Issue 11293272: Update dart2js_foreign suite as we now validate annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 // Additional Dart code may be 'placed on' hidden native classes. With 5 // Additional Dart code may be 'placed on' hidden native classes. With
6 // inheritance, the superclass method must not be reached by a call on the 6 // inheritance, the superclass method must not be reached by a call on the
7 // subclass. 7 // subclass.
8 8
9 @native("*A") 9 import 'native_metadata.dart';
10
11 @Native("*A")
10 class A { 12 class A {
11 var _field; 13 var _field;
12 14
13 int get X => _field; 15 int get X => _field;
14 void set X(int x) { _field = x; } 16 void set X(int x) { _field = x; }
15 17
16 int method(int z) => _field + z; 18 int method(int z) => _field + z;
17 } 19 }
18 20
19 @native("*B") 21 @Native("*B")
20 class B extends A { 22 class B extends A {
21 var _field2; 23 var _field2;
22 24
23 int get X => _field2; 25 int get X => _field2;
24 void set X(int x) { _field2 = x; } 26 void set X(int x) { _field2 = x; }
25 27
26 int method(int z) => _field2 + z; 28 int method(int z) => _field2 + z;
27 } 29 }
28 30
29 @native A makeA() { return new A(); } 31 @native A makeA() { return new A(); }
30 @native B makeB() { return new B(); } 32 @native B makeB() { return new B(); }
31 33
32 @native(r""" 34 @Native(r"""
33 function inherits(child, parent) { 35 function inherits(child, parent) {
34 if (child.prototype.__proto__) { 36 if (child.prototype.__proto__) {
35 child.prototype.__proto__ = parent.prototype; 37 child.prototype.__proto__ = parent.prototype;
36 } else { 38 } else {
37 function tmp() {}; 39 function tmp() {};
38 tmp.prototype = parent.prototype; 40 tmp.prototype = parent.prototype;
39 child.prototype = new tmp(); 41 child.prototype = new tmp();
40 child.prototype.constructor = child; 42 child.prototype.constructor = child;
41 } 43 }
42 } 44 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 141 }
140 142
141 main() { 143 main() {
142 testBasicA_dynamic(); 144 testBasicA_dynamic();
143 testBasicA_typed(); 145 testBasicA_typed();
144 testBasicB_dynamic(); 146 testBasicB_dynamic();
145 testBasicB_typed(); 147 testBasicB_typed();
146 testAB_dynamic(); 148 testAB_dynamic();
147 testAB_typed(); 149 testAB_typed();
148 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698