OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library world_test; | 5 library world_test; |
6 | 6 |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'type_test_helper.dart'; | 9 import 'type_test_helper.dart'; |
10 import 'package:compiler/src/common/names.dart'; | 10 import 'package:compiler/src/common/names.dart'; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 new F2(); | 236 new F2(); |
237 new G2(); | 237 new G2(); |
238 new G3(); | 238 new G3(); |
239 new H4(); | 239 new H4(); |
240 } | 240 } |
241 """, | 241 """, |
242 useMockCompiler: false); | 242 useMockCompiler: false); |
243 ClosedWorld closedWorld = env.closedWorld; | 243 ClosedWorld closedWorld = env.closedWorld; |
244 | 244 |
245 check(String name, {bool hasStrictSubtype, bool hasOnlySubclasses}) { | 245 check(String name, {bool hasStrictSubtype, bool hasOnlySubclasses}) { |
246 ClassEntity cls = env.getElement(name); | 246 ClassElement cls = env.getElement(name); |
247 Expect.equals(hasStrictSubtype, closedWorld.hasAnyStrictSubtype(cls), | 247 Expect.equals(hasStrictSubtype, closedWorld.hasAnyStrictSubtype(cls), |
248 "Unexpected hasAnyStrictSubtype property on $cls."); | 248 "Unexpected hasAnyStrictSubtype property on $cls."); |
249 Expect.equals(hasOnlySubclasses, closedWorld.hasOnlySubclasses(cls), | 249 Expect.equals(hasOnlySubclasses, closedWorld.hasOnlySubclasses(cls), |
250 "Unexpected hasOnlySubclasses property on $cls."); | 250 "Unexpected hasOnlySubclasses property on $cls."); |
251 } | 251 } |
252 | 252 |
253 check("Object", hasStrictSubtype: true, hasOnlySubclasses: true); | 253 check("Object", hasStrictSubtype: true, hasOnlySubclasses: true); |
254 | 254 |
255 // No instantiated Ax classes. | 255 // No instantiated Ax classes. |
256 check("A", hasStrictSubtype: false, hasOnlySubclasses: true); | 256 check("A", hasStrictSubtype: false, hasOnlySubclasses: true); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 new F(); | 534 new F(); |
535 new G(); | 535 new G(); |
536 new H(); | 536 new H(); |
537 new I(); | 537 new I(); |
538 new J(); | 538 new J(); |
539 } | 539 } |
540 """, | 540 """, |
541 useMockCompiler: false); | 541 useMockCompiler: false); |
542 ClosedWorld closedWorld = env.closedWorld; | 542 ClosedWorld closedWorld = env.closedWorld; |
543 | 543 |
544 ClassElement Object_ = env.getElement("Object"); | |
545 ClassElement A = env.getElement("A"); | 544 ClassElement A = env.getElement("A"); |
546 ClassElement B = env.getElement("B"); | 545 ClassElement B = env.getElement("B"); |
547 ClassElement C = env.getElement("C"); | 546 ClassElement C = env.getElement("C"); |
548 ClassElement D = env.getElement("D"); | 547 ClassElement D = env.getElement("D"); |
549 ClassElement F = env.getElement("F"); | 548 ClassElement F = env.getElement("F"); |
550 ClassElement G = env.getElement("G"); | 549 ClassElement G = env.getElement("G"); |
551 ClassElement H = env.getElement("H"); | 550 ClassElement H = env.getElement("H"); |
552 ClassElement I = env.getElement("I"); | 551 ClassElement I = env.getElement("I"); |
553 ClassElement J = env.getElement("J"); | 552 ClassElement J = env.getElement("J"); |
554 | 553 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 check(B, ClassQuery.EXACT, C, ClassQuery.EXACT, []); | 599 check(B, ClassQuery.EXACT, C, ClassQuery.EXACT, []); |
601 check(B, ClassQuery.EXACT, C, ClassQuery.SUBCLASS, []); | 600 check(B, ClassQuery.EXACT, C, ClassQuery.SUBCLASS, []); |
602 check(B, ClassQuery.SUBCLASS, C, ClassQuery.EXACT, []); | 601 check(B, ClassQuery.SUBCLASS, C, ClassQuery.EXACT, []); |
603 check(B, ClassQuery.EXACT, C, ClassQuery.SUBTYPE, []); | 602 check(B, ClassQuery.EXACT, C, ClassQuery.SUBTYPE, []); |
604 check(B, ClassQuery.SUBTYPE, C, ClassQuery.EXACT, []); | 603 check(B, ClassQuery.SUBTYPE, C, ClassQuery.EXACT, []); |
605 check(B, ClassQuery.SUBCLASS, C, ClassQuery.SUBCLASS, []); | 604 check(B, ClassQuery.SUBCLASS, C, ClassQuery.SUBCLASS, []); |
606 check(B, ClassQuery.SUBCLASS, C, ClassQuery.SUBTYPE, []); | 605 check(B, ClassQuery.SUBCLASS, C, ClassQuery.SUBTYPE, []); |
607 check(B, ClassQuery.SUBTYPE, C, ClassQuery.SUBCLASS, [G]); | 606 check(B, ClassQuery.SUBTYPE, C, ClassQuery.SUBCLASS, [G]); |
608 check(B, ClassQuery.SUBTYPE, C, ClassQuery.SUBTYPE, [F, G]); | 607 check(B, ClassQuery.SUBTYPE, C, ClassQuery.SUBTYPE, [F, G]); |
609 } | 608 } |
OLD | NEW |