OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 'package:async_helper/async_helper.dart'; | 5 import 'package:async_helper/async_helper.dart'; |
6 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
7 import 'package:compiler/src/js_backend/backend_helpers.dart'; | 7 import 'package:compiler/src/js_backend/backend_helpers.dart'; |
8 import 'package:compiler/src/js_backend/js_backend.dart'; | 8 import 'package:compiler/src/js_backend/js_backend.dart'; |
9 import 'package:compiler/src/types/types.dart'; | 9 import 'package:compiler/src/types/types.dart'; |
10 import 'package:compiler/src/world.dart'; | 10 import 'package:compiler/src/world.dart'; |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 } | 729 } |
730 | 730 |
731 void main() { | 731 void main() { |
732 asyncTest(() async { | 732 asyncTest(() async { |
733 MockCompiler compiler = new MockCompiler.internal(); | 733 MockCompiler compiler = new MockCompiler.internal(); |
734 await compiler.init(""" | 734 await compiler.init(""" |
735 class PatternImpl implements Pattern {} | 735 class PatternImpl implements Pattern {} |
736 """); | 736 """); |
737 JavaScriptBackend backend = compiler.backend; | 737 JavaScriptBackend backend = compiler.backend; |
738 BackendHelpers helpers = backend.helpers; | 738 BackendHelpers helpers = backend.helpers; |
739 ClosedWorld world = compiler.openWorld.closeWorld(); | 739 ClosedWorld world = compiler.openWorld.closeWorld(compiler.reporter); |
740 helpers.interceptorsLibrary.forEachLocalMember((element) { | 740 helpers.interceptorsLibrary.forEachLocalMember((element) { |
741 if (element.isClass) { | 741 if (element.isClass) { |
742 element.ensureResolved(compiler.resolution); | 742 element.ensureResolved(compiler.resolution); |
743 compiler.enqueuer.resolution.registerInstantiatedType(element.rawType); | 743 compiler.enqueuer.resolution.registerInstantiatedType(element.rawType); |
744 } | 744 } |
745 }); | 745 }); |
746 ClassElement patternImplClass = compiler.mainApp.find('PatternImpl'); | 746 ClassElement patternImplClass = compiler.mainApp.find('PatternImpl'); |
747 patternImplClass.ensureResolved(compiler.resolution); | 747 patternImplClass.ensureResolved(compiler.resolution); |
748 | 748 |
749 compiler.enqueuer.resolution | 749 compiler.enqueuer.resolution |
750 .registerInstantiatedType(compiler.coreTypes.mapType()); | 750 .registerInstantiatedType(compiler.coreTypes.mapType()); |
751 compiler.enqueuer.resolution | 751 compiler.enqueuer.resolution |
752 .registerInstantiatedType(compiler.coreTypes.functionType); | 752 .registerInstantiatedType(compiler.coreTypes.functionType); |
753 compiler.enqueuer.resolution | 753 compiler.enqueuer.resolution |
754 .registerInstantiatedType(patternImplClass.rawType); | 754 .registerInstantiatedType(patternImplClass.rawType); |
755 compiler.openWorld.closeWorld(); | 755 compiler.openWorld.closeWorld(compiler.reporter); |
756 | 756 |
757 // Grab hold of a supertype for String so we can produce potential | 757 // Grab hold of a supertype for String so we can produce potential |
758 // string types. | 758 // string types. |
759 patternClass = compiler.commonElements.coreLibrary.find('Pattern'); | 759 patternClass = compiler.commonElements.coreLibrary.find('Pattern'); |
760 | 760 |
761 nonPrimitive1 = | 761 nonPrimitive1 = |
762 new TypeMask.nonNullSubtype(compiler.coreClasses.mapClass, world); | 762 new TypeMask.nonNullSubtype(compiler.coreClasses.mapClass, world); |
763 nonPrimitive2 = | 763 nonPrimitive2 = |
764 new TypeMask.nonNullSubtype(compiler.coreClasses.functionClass, world); | 764 new TypeMask.nonNullSubtype(compiler.coreClasses.functionClass, world); |
765 potentialArray = | 765 potentialArray = |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 Expect.notEquals(jsStringOrNull, potentialString, | 809 Expect.notEquals(jsStringOrNull, potentialString, |
810 "potentialString expected not to be exact JSString"); | 810 "potentialString expected not to be exact JSString"); |
811 Expect.notEquals(jsArrayOrNull, potentialArray, | 811 Expect.notEquals(jsArrayOrNull, potentialArray, |
812 "potentialArray expected not to be JSArray subclass"); | 812 "potentialArray expected not to be JSArray subclass"); |
813 | 813 |
814 testUnion(compiler); | 814 testUnion(compiler); |
815 testIntersection(compiler); | 815 testIntersection(compiler); |
816 testRegressions(compiler); | 816 testRegressions(compiler); |
817 }); | 817 }); |
818 } | 818 } |
OLD | NEW |