| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // This test uses the multi-test "ok" feature to create two positive tests from | 5 // This test uses the multi-test "ok" feature to create two positive tests from |
| 6 // one file. One of these tests fail on dart2js, but pass on the VM, or vice | 6 // one file. One of these tests fail on dart2js, but pass on the VM, or vice |
| 7 // versa. | 7 // versa. |
| 8 // TODO(ahe): When both implementations agree, remove the multi-test parts. | 8 // TODO(ahe): When both implementations agree, remove the multi-test parts. |
| 9 | 9 |
| 10 library test.mixin_application_test; | 10 library test.mixin_application_test; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 class SubclassA extends C with Mixin, Mixin2 { | 42 class SubclassA extends C with Mixin, Mixin2 { |
| 43 fa() {} | 43 fa() {} |
| 44 } | 44 } |
| 45 | 45 |
| 46 class Subclass2A extends MixinApplicationA { | 46 class Subclass2A extends MixinApplicationA { |
| 47 ga() {} | 47 ga() {} |
| 48 } | 48 } |
| 49 | 49 |
| 50 membersOf(ClassMirror cm) { | |
| 51 var result = new Map(); | |
| 52 cm.declarations.forEach((k,v) { | |
| 53 if(v is MethodMirror && !v.isConstructor) result[k] = v; | |
| 54 if(v is VariableMirror) result[k] = v; | |
| 55 }); | |
| 56 return result; | |
| 57 } | |
| 58 | |
| 59 constructorsOf(ClassMirror cm) { | |
| 60 var result = new Map(); | |
| 61 cm.declarations.forEach((k,v) { | |
| 62 if(v is MethodMirror && v.isConstructor) result[k] = v; | |
| 63 }); | |
| 64 return result; | |
| 65 } | |
| 66 | |
| 67 checkClass(Type type, List<String> expectedSuperclasses) { | 50 checkClass(Type type, List<String> expectedSuperclasses) { |
| 68 int i = 0; | 51 int i = 0; |
| 69 for (var cls = reflectClass(type); cls != null; cls = cls.superclass) { | 52 for (var cls = reflectClass(type); cls != null; cls = cls.superclass) { |
| 70 expect(expectedSuperclasses[i++], cls); | 53 expect(expectedSuperclasses[i++], cls); |
| 71 } | 54 } |
| 72 Expect.equals(i, expectedSuperclasses.length, '$type'); | 55 Expect.equals(i, expectedSuperclasses.length, '$type'); |
| 73 } | 56 } |
| 74 | 57 |
| 75 expectSame(ClassMirror a, ClassMirror b) { | 58 expectSame(ClassMirror a, ClassMirror b) { |
| 76 Expect.equals(a, b); | 59 Expect.equals(a, b); |
| 77 expect(stringify(a), b); | 60 expect(stringify(a), b); |
| 78 expect(stringify(b), a); | 61 expect(stringify(b), a); |
| 79 } | 62 } |
| 80 | 63 |
| 81 testMixin() { | 64 testMixin() { |
| 82 checkClass(Mixin, [ | 65 checkClass(Mixin, [ |
| 83 'Class(s(Mixin) in s(test.mixin_application_test), top-level)', | 66 'Class(s(Mixin) in s(test.mixin_application_test), top-level)', |
| 84 'Class(s(Object) in s(dart.core), top-level)', | 67 'Class(s(Object) in s(dart.core), top-level)', |
| 85 ]); | 68 ]); |
| 86 | 69 |
| 87 expect( | 70 expect( |
| 88 '{i: Variable(s(i) in s(Mixin)),' | 71 '{i: Variable(s(i) in s(Mixin)),' |
| 89 ' m: Method(s(m) in s(Mixin))}', | 72 ' m: Method(s(m) in s(Mixin))}', |
| 90 membersOf(reflectClass(Mixin))); | 73 reflectClass(Mixin).members); |
| 91 | 74 |
| 92 expect('{Mixin: Method(s(Mixin) in s(Mixin), constructor)}', | 75 expect('{Mixin: Method(s(Mixin) in s(Mixin), constructor)}', |
| 93 constructorsOf(reflectClass(Mixin))); | 76 reflectClass(Mixin).constructors); |
| 94 } | 77 } |
| 95 | 78 |
| 96 testMixin2() { | 79 testMixin2() { |
| 97 checkClass(Mixin2, [ | 80 checkClass(Mixin2, [ |
| 98 'Class(s(Mixin2) in s(test.mixin_application_test), top-level)', | 81 'Class(s(Mixin2) in s(test.mixin_application_test), top-level)', |
| 99 'Class(s(Object) in s(dart.core), top-level)', | 82 'Class(s(Object) in s(dart.core), top-level)', |
| 100 ]); | 83 ]); |
| 101 | 84 |
| 102 expect( | 85 expect( |
| 103 '{i2: Variable(s(i2) in s(Mixin2)),' | 86 '{i2: Variable(s(i2) in s(Mixin2)),' |
| 104 ' m2: Method(s(m2) in s(Mixin2))}', | 87 ' m2: Method(s(m2) in s(Mixin2))}', |
| 105 membersOf(reflectClass(Mixin2))); | 88 reflectClass(Mixin2).members); |
| 106 | 89 |
| 107 expect('{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}', | 90 expect('{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}', |
| 108 constructorsOf(reflectClass(Mixin2))); | 91 reflectClass(Mixin2).constructors); |
| 109 } | 92 } |
| 110 | 93 |
| 111 testMixinApplication() { | 94 testMixinApplication() { |
| 112 checkClass(MixinApplication, [ | 95 checkClass(MixinApplication, [ |
| 113 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', | 96 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', |
| 114 'Class(s(C) in s(test.model), top-level)', | 97 'Class(s(C) in s(test.model), top-level)', |
| 115 'Class(s(B) in s(test.model), top-level)', | 98 'Class(s(B) in s(test.model), top-level)', |
| 116 'Class(s(A) in s(test.model), top-level)', | 99 'Class(s(A) in s(test.model), top-level)', |
| 117 'Class(s(Object) in s(dart.core), top-level)', | 100 'Class(s(Object) in s(dart.core), top-level)', |
| 118 ]); | 101 ]); |
| 119 | 102 |
| 120 String owner = 'Mixin'; | 103 String owner = 'Mixin'; |
| 121 owner = 'MixinApplication'; /// 01: ok | 104 owner = 'MixinApplication'; /// 01: ok |
| 122 expect( | 105 expect( |
| 123 '{i: Variable(s(i) in s($owner)),' | 106 '{i: Variable(s(i) in s($owner)),' |
| 124 ' m: Method(s(m) in s($owner))}', | 107 ' m: Method(s(m) in s($owner))}', |
| 125 membersOf(reflectClass(MixinApplication))); | 108 reflectClass(MixinApplication).members); |
| 126 | 109 |
| 127 expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),' | 110 expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),' |
| 128 ' constructor)}', | 111 ' constructor)}', |
| 129 constructorsOf(reflectClass(MixinApplication))); | 112 reflectClass(MixinApplication).constructors); |
| 130 | 113 |
| 131 expectSame(reflectClass(C), reflectClass(MixinApplication).superclass); | 114 expectSame(reflectClass(C), reflectClass(MixinApplication).superclass); |
| 132 } | 115 } |
| 133 | 116 |
| 134 testMixinApplicationA() { | 117 testMixinApplicationA() { |
| 135 // TODO(ahe): I don't think an anonymous mixin has an owner. | 118 // TODO(ahe): I don't think an anonymous mixin has an owner. |
| 136 String owner = ' in s(test.mixin_application_test)'; | 119 String owner = ' in s(test.mixin_application_test)'; |
| 137 owner = ''; /// 01: ok | 120 owner = ''; /// 01: ok |
| 138 checkClass(MixinApplicationA, [ | 121 checkClass(MixinApplicationA, [ |
| 139 'Class(s(MixinApplicationA)' | 122 'Class(s(MixinApplicationA)' |
| 140 ' in s(test.mixin_application_test), top-level)', | 123 ' in s(test.mixin_application_test), top-level)', |
| 141 'Class(s(test.model.C with test.mixin_application_test.Mixin)' | 124 'Class(s(test.model.C with test.mixin_application_test.Mixin)' |
| 142 '$owner, top-level)', | 125 '$owner, top-level)', |
| 143 'Class(s(C) in s(test.model), top-level)', | 126 'Class(s(C) in s(test.model), top-level)', |
| 144 'Class(s(B) in s(test.model), top-level)', | 127 'Class(s(B) in s(test.model), top-level)', |
| 145 'Class(s(A) in s(test.model), top-level)', | 128 'Class(s(A) in s(test.model), top-level)', |
| 146 'Class(s(Object) in s(dart.core), top-level)', | 129 'Class(s(Object) in s(dart.core), top-level)', |
| 147 ]); | 130 ]); |
| 148 | 131 |
| 149 owner = 'Mixin2'; | 132 owner = 'Mixin2'; |
| 150 owner = 'MixinApplicationA'; /// 01: ok | 133 owner = 'MixinApplicationA'; /// 01: ok |
| 151 expect( | 134 expect( |
| 152 '{i2: Variable(s(i2) in s($owner)),' | 135 '{i2: Variable(s(i2) in s($owner)),' |
| 153 ' m2: Method(s(m2) in s($owner))}', | 136 ' m2: Method(s(m2) in s($owner))}', |
| 154 membersOf(reflectClass(MixinApplicationA))); | 137 reflectClass(MixinApplicationA).members); |
| 155 | 138 |
| 156 expect( | 139 expect( |
| 157 '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),' | 140 '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),' |
| 158 ' constructor)}', | 141 ' constructor)}', |
| 159 constructorsOf(reflectClass(MixinApplicationA))); | 142 reflectClass(MixinApplicationA).constructors); |
| 160 | 143 |
| 161 expect( | 144 expect( |
| 162 '{i: Variable(s(i) in s(Mixin)),' | 145 '{i: Variable(s(i) in s(Mixin)),' |
| 163 ' m: Method(s(m) in s(Mixin))}', | 146 ' m: Method(s(m) in s(Mixin))}', |
| 164 membersOf(reflectClass(MixinApplicationA).superclass)); | 147 reflectClass(MixinApplicationA).superclass.members); |
| 165 | 148 |
| 166 String name = 'test.model.C with test.mixin_application_test.Mixin'; | 149 String name = 'test.model.C with test.mixin_application_test.Mixin'; |
| 167 name = 'Mixin'; /// 01: ok | 150 name = 'Mixin'; /// 01: ok |
| 168 expect( | 151 expect( |
| 169 '{$name:' | 152 '{$name:' |
| 170 ' Method(s($name)' | 153 ' Method(s($name)' |
| 171 ' in s($name), constructor)}', | 154 ' in s($name), constructor)}', |
| 172 constructorsOf(reflectClass(MixinApplicationA).superclass)); | 155 reflectClass(MixinApplicationA).superclass.constructors); |
| 173 | 156 |
| 174 expectSame( | 157 expectSame( |
| 175 reflectClass(C), | 158 reflectClass(C), |
| 176 reflectClass(MixinApplicationA).superclass.superclass); | 159 reflectClass(MixinApplicationA).superclass.superclass); |
| 177 } | 160 } |
| 178 | 161 |
| 179 testUnusedMixinApplication() { | 162 testUnusedMixinApplication() { |
| 180 checkClass(UnusedMixinApplication, [ | 163 checkClass(UnusedMixinApplication, [ |
| 181 'Class(s(UnusedMixinApplication) in s(test.mixin_application_test),' | 164 'Class(s(UnusedMixinApplication) in s(test.mixin_application_test),' |
| 182 ' top-level)', | 165 ' top-level)', |
| 183 'Class(s(C) in s(test.model), top-level)', | 166 'Class(s(C) in s(test.model), top-level)', |
| 184 'Class(s(B) in s(test.model), top-level)', | 167 'Class(s(B) in s(test.model), top-level)', |
| 185 'Class(s(A) in s(test.model), top-level)', | 168 'Class(s(A) in s(test.model), top-level)', |
| 186 'Class(s(Object) in s(dart.core), top-level)', | 169 'Class(s(Object) in s(dart.core), top-level)', |
| 187 ]); | 170 ]); |
| 188 | 171 |
| 189 String owner = 'Mixin'; | 172 String owner = 'Mixin'; |
| 190 owner = 'UnusedMixinApplication'; /// 01: ok | 173 owner = 'UnusedMixinApplication'; /// 01: ok |
| 191 expect( | 174 expect( |
| 192 '{i: Variable(s(i) in s($owner)),' | 175 '{i: Variable(s(i) in s($owner)),' |
| 193 ' m: Method(s(m) in s($owner))}', | 176 ' m: Method(s(m) in s($owner))}', |
| 194 membersOf(reflectClass(UnusedMixinApplication))); | 177 reflectClass(UnusedMixinApplication).members); |
| 195 | 178 |
| 196 expect( | 179 expect( |
| 197 '{UnusedMixinApplication: Method(s(UnusedMixinApplication)' | 180 '{UnusedMixinApplication: Method(s(UnusedMixinApplication)' |
| 198 ' in s(UnusedMixinApplication), constructor)}', | 181 ' in s(UnusedMixinApplication), constructor)}', |
| 199 constructorsOf(reflectClass(UnusedMixinApplication))); | 182 reflectClass(UnusedMixinApplication).constructors); |
| 200 | 183 |
| 201 expectSame(reflectClass(C), reflectClass(UnusedMixinApplication).superclass); | 184 expectSame(reflectClass(C), reflectClass(UnusedMixinApplication).superclass); |
| 202 } | 185 } |
| 203 | 186 |
| 204 testSubclass() { | 187 testSubclass() { |
| 205 String owner = ' in s(test.mixin_application_test)'; | 188 String owner = ' in s(test.mixin_application_test)'; |
| 206 owner = ''; /// 01: ok | 189 owner = ''; /// 01: ok |
| 207 checkClass(Subclass, [ | 190 checkClass(Subclass, [ |
| 208 'Class(s(Subclass) in s(test.mixin_application_test), top-level)', | 191 'Class(s(Subclass) in s(test.mixin_application_test), top-level)', |
| 209 'Class(s(test.model.C with test.mixin_application_test.Mixin)' | 192 'Class(s(test.model.C with test.mixin_application_test.Mixin)' |
| 210 '$owner, top-level)', | 193 '$owner, top-level)', |
| 211 'Class(s(C) in s(test.model), top-level)', | 194 'Class(s(C) in s(test.model), top-level)', |
| 212 'Class(s(B) in s(test.model), top-level)', | 195 'Class(s(B) in s(test.model), top-level)', |
| 213 'Class(s(A) in s(test.model), top-level)', | 196 'Class(s(A) in s(test.model), top-level)', |
| 214 'Class(s(Object) in s(dart.core), top-level)', | 197 'Class(s(Object) in s(dart.core), top-level)', |
| 215 ]); | 198 ]); |
| 216 | 199 |
| 217 expect( | 200 expect( |
| 218 '{f: Method(s(f) in s(Subclass))}', | 201 '{f: Method(s(f) in s(Subclass))}', |
| 219 membersOf(reflectClass(Subclass))); | 202 reflectClass(Subclass).members); |
| 220 | 203 |
| 221 expect( | 204 expect( |
| 222 '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}', | 205 '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}', |
| 223 constructorsOf(reflectClass(Subclass))); | 206 reflectClass(Subclass).constructors); |
| 224 | 207 |
| 225 expect( | 208 expect( |
| 226 '{i: Variable(s(i) in s(Mixin)),' | 209 '{i: Variable(s(i) in s(Mixin)),' |
| 227 ' m: Method(s(m) in s(Mixin))}', | 210 ' m: Method(s(m) in s(Mixin))}', |
| 228 membersOf(reflectClass(Subclass).superclass)); | 211 reflectClass(Subclass).superclass.members); |
| 229 | 212 |
| 230 String name = 'test.model.C with test.mixin_application_test.Mixin'; | 213 String name = 'test.model.C with test.mixin_application_test.Mixin'; |
| 231 name = 'Mixin'; /// 01: ok | 214 name = 'Mixin'; /// 01: ok |
| 232 expect( | 215 expect( |
| 233 '{$name:' | 216 '{$name:' |
| 234 ' Method(s($name)' | 217 ' Method(s($name)' |
| 235 ' in s($name), constructor)}', | 218 ' in s($name), constructor)}', |
| 236 constructorsOf(reflectClass(Subclass).superclass)); | 219 reflectClass(Subclass).superclass.constructors); |
| 237 | 220 |
| 238 expectSame( | 221 expectSame( |
| 239 reflectClass(C), | 222 reflectClass(C), |
| 240 reflectClass(Subclass).superclass.superclass); | 223 reflectClass(Subclass).superclass.superclass); |
| 241 } | 224 } |
| 242 | 225 |
| 243 testSubclass2() { | 226 testSubclass2() { |
| 244 checkClass(Subclass2, [ | 227 checkClass(Subclass2, [ |
| 245 'Class(s(Subclass2) in s(test.mixin_application_test), top-level)', | 228 'Class(s(Subclass2) in s(test.mixin_application_test), top-level)', |
| 246 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', | 229 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', |
| 247 'Class(s(C) in s(test.model), top-level)', | 230 'Class(s(C) in s(test.model), top-level)', |
| 248 'Class(s(B) in s(test.model), top-level)', | 231 'Class(s(B) in s(test.model), top-level)', |
| 249 'Class(s(A) in s(test.model), top-level)', | 232 'Class(s(A) in s(test.model), top-level)', |
| 250 'Class(s(Object) in s(dart.core), top-level)', | 233 'Class(s(Object) in s(dart.core), top-level)', |
| 251 ]); | 234 ]); |
| 252 | 235 |
| 253 expect( | 236 expect( |
| 254 '{g: Method(s(g) in s(Subclass2))}', | 237 '{g: Method(s(g) in s(Subclass2))}', |
| 255 membersOf(reflectClass(Subclass2))); | 238 reflectClass(Subclass2).members); |
| 256 | 239 |
| 257 expect( | 240 expect( |
| 258 '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}', | 241 '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}', |
| 259 constructorsOf(reflectClass(Subclass2))); | 242 reflectClass(Subclass2).constructors); |
| 260 | 243 |
| 261 expectSame( | 244 expectSame( |
| 262 reflectClass(MixinApplication), | 245 reflectClass(MixinApplication), |
| 263 reflectClass(Subclass2).superclass); | 246 reflectClass(Subclass2).superclass); |
| 264 } | 247 } |
| 265 | 248 |
| 266 testSubclassA() { | 249 testSubclassA() { |
| 267 // TODO(ahe): I don't think an anonymous mixin has an owner. | 250 // TODO(ahe): I don't think an anonymous mixin has an owner. |
| 268 String owner = ' in s(test.mixin_application_test)'; | 251 String owner = ' in s(test.mixin_application_test)'; |
| 269 owner = ''; /// 01: ok | 252 owner = ''; /// 01: ok |
| 270 checkClass(SubclassA, [ | 253 checkClass(SubclassA, [ |
| 271 'Class(s(SubclassA) in s(test.mixin_application_test), top-level)', | 254 'Class(s(SubclassA) in s(test.mixin_application_test), top-level)', |
| 272 'Class(s(test.model.C with test.mixin_application_test.Mixin,' | 255 'Class(s(test.model.C with test.mixin_application_test.Mixin,' |
| 273 ' test.mixin_application_test.Mixin2)$owner, top-level)', | 256 ' test.mixin_application_test.Mixin2)$owner, top-level)', |
| 274 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' | 257 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' |
| 275 ' top-level)', | 258 ' top-level)', |
| 276 'Class(s(C) in s(test.model), top-level)', | 259 'Class(s(C) in s(test.model), top-level)', |
| 277 'Class(s(B) in s(test.model), top-level)', | 260 'Class(s(B) in s(test.model), top-level)', |
| 278 'Class(s(A) in s(test.model), top-level)', | 261 'Class(s(A) in s(test.model), top-level)', |
| 279 'Class(s(Object) in s(dart.core), top-level)', | 262 'Class(s(Object) in s(dart.core), top-level)', |
| 280 ]); | 263 ]); |
| 281 | 264 |
| 282 expect( | 265 expect( |
| 283 '{fa: Method(s(fa) in s(SubclassA))}', | 266 '{fa: Method(s(fa) in s(SubclassA))}', |
| 284 membersOf(reflectClass(SubclassA))); | 267 reflectClass(SubclassA).members); |
| 285 | 268 |
| 286 expect( | 269 expect( |
| 287 '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}', | 270 '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}', |
| 288 constructorsOf(reflectClass(SubclassA))); | 271 reflectClass(SubclassA).constructors); |
| 289 | 272 |
| 290 expect( | 273 expect( |
| 291 '{i2: Variable(s(i2) in s(Mixin2)),' | 274 '{i2: Variable(s(i2) in s(Mixin2)),' |
| 292 ' m2: Method(s(m2) in s(Mixin2))}', | 275 ' m2: Method(s(m2) in s(Mixin2))}', |
| 293 membersOf(reflectClass(SubclassA).superclass)); | 276 reflectClass(SubclassA).superclass.members); |
| 294 | 277 |
| 295 String name = | 278 String name = |
| 296 'test.model.C with test.mixin_application_test.Mixin,' | 279 'test.model.C with test.mixin_application_test.Mixin,' |
| 297 ' test.mixin_application_test.Mixin2'; | 280 ' test.mixin_application_test.Mixin2'; |
| 298 name = 'Mixin2'; /// 01: ok | 281 name = 'Mixin2'; /// 01: ok |
| 299 expect( | 282 expect( |
| 300 '{$name: Method(s($name) in s($name), constructor)}', | 283 '{$name: Method(s($name) in s($name), constructor)}', |
| 301 constructorsOf(reflectClass(SubclassA).superclass)); | 284 reflectClass(SubclassA).superclass.constructors); |
| 302 | 285 |
| 303 expect( | 286 expect( |
| 304 '{i: Variable(s(i) in s(Mixin)),' | 287 '{i: Variable(s(i) in s(Mixin)),' |
| 305 ' m: Method(s(m) in s(Mixin))}', | 288 ' m: Method(s(m) in s(Mixin))}', |
| 306 membersOf(reflectClass(SubclassA).superclass.superclass)); | 289 reflectClass(SubclassA).superclass.superclass.members); |
| 307 | 290 |
| 308 name = 'test.model.C with test.mixin_application_test.Mixin'; | 291 name = 'test.model.C with test.mixin_application_test.Mixin'; |
| 309 name = 'Mixin'; /// 01: ok | 292 name = 'Mixin'; /// 01: ok |
| 310 expect( | 293 expect( |
| 311 '{$name:' | 294 '{$name:' |
| 312 ' Method(s($name)' | 295 ' Method(s($name)' |
| 313 ' in s($name), constructor)}', | 296 ' in s($name), constructor)}', |
| 314 constructorsOf(reflectClass(SubclassA).superclass.superclass)); | 297 reflectClass(SubclassA).superclass.superclass.constructors); |
| 315 | 298 |
| 316 expectSame( | 299 expectSame( |
| 317 reflectClass(C), | 300 reflectClass(C), |
| 318 reflectClass(SubclassA).superclass.superclass.superclass); | 301 reflectClass(SubclassA).superclass.superclass.superclass); |
| 319 } | 302 } |
| 320 | 303 |
| 321 testSubclass2A() { | 304 testSubclass2A() { |
| 322 // TODO(ahe): I don't think an anonymous mixin has an owner. | 305 // TODO(ahe): I don't think an anonymous mixin has an owner. |
| 323 String owner = ' in s(test.mixin_application_test)'; | 306 String owner = ' in s(test.mixin_application_test)'; |
| 324 owner = ''; /// 01: ok | 307 owner = ''; /// 01: ok |
| 325 checkClass(Subclass2A, [ | 308 checkClass(Subclass2A, [ |
| 326 'Class(s(Subclass2A) in s(test.mixin_application_test), top-level)', | 309 'Class(s(Subclass2A) in s(test.mixin_application_test), top-level)', |
| 327 'Class(s(MixinApplicationA) in s(test.mixin_application_test),' | 310 'Class(s(MixinApplicationA) in s(test.mixin_application_test),' |
| 328 ' top-level)', | 311 ' top-level)', |
| 329 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' | 312 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' |
| 330 ' top-level)', | 313 ' top-level)', |
| 331 'Class(s(C) in s(test.model), top-level)', | 314 'Class(s(C) in s(test.model), top-level)', |
| 332 'Class(s(B) in s(test.model), top-level)', | 315 'Class(s(B) in s(test.model), top-level)', |
| 333 'Class(s(A) in s(test.model), top-level)', | 316 'Class(s(A) in s(test.model), top-level)', |
| 334 'Class(s(Object) in s(dart.core), top-level)', | 317 'Class(s(Object) in s(dart.core), top-level)', |
| 335 ]); | 318 ]); |
| 336 | 319 |
| 337 expect( | 320 expect( |
| 338 '{ga: Method(s(ga) in s(Subclass2A))}', | 321 '{ga: Method(s(ga) in s(Subclass2A))}', |
| 339 membersOf(reflectClass(Subclass2A))); | 322 reflectClass(Subclass2A).members); |
| 340 | 323 |
| 341 expect( | 324 expect( |
| 342 '{Subclass2A: Method(s(Subclass2A) in s(Subclass2A), constructor)}', | 325 '{Subclass2A: Method(s(Subclass2A) in s(Subclass2A), constructor)}', |
| 343 constructorsOf(reflectClass(Subclass2A))); | 326 reflectClass(Subclass2A).constructors); |
| 344 | 327 |
| 345 expectSame(reflectClass(MixinApplicationA), | 328 expectSame(reflectClass(MixinApplicationA), |
| 346 reflectClass(Subclass2A).superclass); | 329 reflectClass(Subclass2A).superclass); |
| 347 } | 330 } |
| 348 | 331 |
| 349 main() { | 332 main() { |
| 350 testMixin(); | 333 testMixin(); |
| 351 testMixin2(); | 334 testMixin2(); |
| 352 testMixinApplication(); | 335 testMixinApplication(); |
| 353 testMixinApplicationA(); | 336 testMixinApplicationA(); |
| 354 testUnusedMixinApplication(); | 337 testUnusedMixinApplication(); |
| 355 testSubclass(); | 338 testSubclass(); |
| 356 testSubclass2(); | 339 testSubclass2(); |
| 357 testSubclassA(); | 340 testSubclassA(); |
| 358 testSubclass2A(); | 341 testSubclass2A(); |
| 359 } | 342 } |
| OLD | NEW |