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 // 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 class A native "*A" { | 9 class A native "*A" { |
10 var _field; | 10 var _field; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 Expect.equals(1, b._field); | 112 Expect.equals(1, b._field); |
113 Expect.equals(123, b._field2); | 113 Expect.equals(123, b._field2); |
114 Expect.equals(123, b.X); | 114 Expect.equals(123, b.X); |
115 Expect.equals(200, b.method(77)); | 115 Expect.equals(200, b.method(77)); |
116 } | 116 } |
117 | 117 |
118 testAB_typed() { | 118 testAB_typed() { |
119 setup(); // Fresh constructors. | 119 setup(); // Fresh constructors. |
120 | 120 |
121 A a = makeA(); | 121 A a = makeA(); |
122 B b = makeA(); | 122 B b = makeB(); |
123 | 123 |
124 a.X = 100; | 124 a.X = 100; |
125 Expect.equals(100, a._field); | 125 Expect.equals(100, a._field); |
126 Expect.equals(100, a.X); | 126 Expect.equals(100, a.X); |
127 Expect.equals(150, a.method(50)); | 127 Expect.equals(150, a.method(50)); |
128 | 128 |
129 b._field = 1; | 129 b._field = 1; |
130 b._field2 = 2; | 130 b._field2 = 2; |
131 b.X = 123; | 131 b.X = 123; |
132 Expect.equals(1, b._field); | 132 Expect.equals(1, b._field); |
133 Expect.equals(123, b._field2); | 133 Expect.equals(123, b._field2); |
134 Expect.equals(123, b.X); | 134 Expect.equals(123, b.X); |
135 Expect.equals(200, b.method(77)); | 135 Expect.equals(200, b.method(77)); |
136 } | 136 } |
137 | 137 |
138 main() { | 138 main() { |
139 testBasicA_dynamic(); | 139 testBasicA_dynamic(); |
140 testBasicA_typed(); | 140 testBasicA_typed(); |
141 testBasicB_dynamic(); | 141 testBasicB_dynamic(); |
142 testBasicB_typed(); | 142 testBasicB_typed(); |
143 testAB_dynamic(); | 143 testAB_dynamic(); |
144 testAB_typed(); | 144 testAB_typed(); |
145 } | 145 } |
OLD | NEW |