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

Side by Side Diff: tests/compiler/dart2js/simple_inferrer_test.dart

Issue 24952003: Change TypeMask.base to be a ClassElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moar declaration. Created 7 years, 2 months 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) 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 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 import "package:async_helper/async_helper.dart"; 6 import "package:async_helper/async_helper.dart";
7 import 7 import
8 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' 8 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
9 show TypeMask; 9 show TypeMask;
10 10
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 checkReturn('returnInt5', typesTask.intType); 685 checkReturn('returnInt5', typesTask.intType);
686 checkReturn('returnInt6', typesTask.intType); 686 checkReturn('returnInt6', typesTask.intType);
687 checkReturn('returnIntOrNull', typesTask.intType.nullable()); 687 checkReturn('returnIntOrNull', typesTask.intType.nullable());
688 checkReturn('returnInt3', typesTask.intType); 688 checkReturn('returnInt3', typesTask.intType);
689 checkReturn('returnDynamic', typesTask.dynamicType); 689 checkReturn('returnDynamic', typesTask.dynamicType);
690 checkReturn('returnInt4', typesTask.intType); 690 checkReturn('returnInt4', typesTask.intType);
691 checkReturn('returnInt7', typesTask.intType); 691 checkReturn('returnInt7', typesTask.intType);
692 checkReturn('returnInt8', typesTask.intType); 692 checkReturn('returnInt8', typesTask.intType);
693 checkReturn('returnEmpty1', const TypeMask.nonNullEmpty()); 693 checkReturn('returnEmpty1', const TypeMask.nonNullEmpty());
694 checkReturn('returnEmpty2', const TypeMask.nonNullEmpty()); 694 checkReturn('returnEmpty2', const TypeMask.nonNullEmpty());
695 TypeMask intType = new TypeMask.nonNullSubtype(compiler.intClass.rawType); 695 TypeMask intType = new TypeMask.nonNullSubtype(compiler.intClass);
696 checkReturn('testIsCheck1', intType); 696 checkReturn('testIsCheck1', intType);
697 checkReturn('testIsCheck2', intType); 697 checkReturn('testIsCheck2', intType);
698 checkReturn('testIsCheck3', intType.nullable()); 698 checkReturn('testIsCheck3', intType.nullable());
699 checkReturn('testIsCheck4', intType); 699 checkReturn('testIsCheck4', intType);
700 checkReturn('testIsCheck5', intType); 700 checkReturn('testIsCheck5', intType);
701 checkReturn('testIsCheck6', typesTask.dynamicType); 701 checkReturn('testIsCheck6', typesTask.dynamicType);
702 checkReturn('testIsCheck7', intType); 702 checkReturn('testIsCheck7', intType);
703 checkReturn('testIsCheck8', typesTask.dynamicType); 703 checkReturn('testIsCheck8', typesTask.dynamicType);
704 checkReturn('testIsCheck9', intType); 704 checkReturn('testIsCheck9', intType);
705 checkReturn('testIsCheck10', typesTask.dynamicType); 705 checkReturn('testIsCheck10', typesTask.dynamicType);
(...skipping 12 matching lines...) Expand all
718 checkReturn('testIsCheck23', intType); 718 checkReturn('testIsCheck23', intType);
719 checkReturn('testIsCheck24', intType); 719 checkReturn('testIsCheck24', intType);
720 checkReturn('testIsCheck25', typesTask.dynamicType); 720 checkReturn('testIsCheck25', typesTask.dynamicType);
721 checkReturn('testIsCheck26', intType); 721 checkReturn('testIsCheck26', intType);
722 checkReturn('testIsCheck27', intType); 722 checkReturn('testIsCheck27', intType);
723 checkReturn('testIsCheck28', typesTask.dynamicType); 723 checkReturn('testIsCheck28', typesTask.dynamicType);
724 checkReturn('testIsCheck29', typesTask.dynamicType); 724 checkReturn('testIsCheck29', typesTask.dynamicType);
725 checkReturn('testIf1', typesTask.intType.nullable()); 725 checkReturn('testIf1', typesTask.intType.nullable());
726 checkReturn('testIf2', typesTask.intType.nullable()); 726 checkReturn('testIf2', typesTask.intType.nullable());
727 checkReturn('returnAsString', 727 checkReturn('returnAsString',
728 new TypeMask.subtype(compiler.stringClass.computeType(compiler))); 728 new TypeMask.subtype(compiler.stringClass));
729 checkReturn('returnIntAsNum', typesTask.intType); 729 checkReturn('returnIntAsNum', typesTask.intType);
730 checkReturn('returnAsTypedef', typesTask.functionType.nullable()); 730 checkReturn('returnAsTypedef', typesTask.functionType.nullable());
731 checkReturn('returnTopLevelGetter', typesTask.intType); 731 checkReturn('returnTopLevelGetter', typesTask.intType);
732 checkReturn('testDeadCode', typesTask.intType); 732 checkReturn('testDeadCode', typesTask.intType);
733 checkReturn('testLabeledIf', typesTask.intType.nullable()); 733 checkReturn('testLabeledIf', typesTask.intType.nullable());
734 checkReturn('testSwitch1', typesTask.intType 734 checkReturn('testSwitch1', typesTask.intType
735 .union(typesTask.doubleType, compiler) 735 .union(typesTask.doubleType, compiler)
736 .nullable().simplify(compiler)); 736 .nullable().simplify(compiler));
737 checkReturn('testSwitch2', typesTask.intType); 737 checkReturn('testSwitch2', typesTask.intType);
738 checkReturn('testSwitch3', interceptorType.nullable()); 738 checkReturn('testSwitch3', interceptorType.nullable());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 checkReturnInClass('B', 'returnInt4', typesTask.intType); 773 checkReturnInClass('B', 'returnInt4', typesTask.intType);
774 checkReturnInClass('B', 'returnInt5', typesTask.intType); 774 checkReturnInClass('B', 'returnInt5', typesTask.intType);
775 checkReturnInClass('B', 'returnInt6', typesTask.intType); 775 checkReturnInClass('B', 'returnInt6', typesTask.intType);
776 checkReturnInClass('B', 'returnInt7', typesTask.intType); 776 checkReturnInClass('B', 'returnInt7', typesTask.intType);
777 checkReturnInClass('B', 'returnInt8', typesTask.intType); 777 checkReturnInClass('B', 'returnInt8', typesTask.intType);
778 checkReturnInClass('B', 'returnInt9', typesTask.intType); 778 checkReturnInClass('B', 'returnInt9', typesTask.intType);
779 779
780 checkFactoryConstructor(String className, String factoryName) { 780 checkFactoryConstructor(String className, String factoryName) {
781 var cls = findElement(compiler, className); 781 var cls = findElement(compiler, className);
782 var element = cls.localLookup(buildSourceString(factoryName)); 782 var element = cls.localLookup(buildSourceString(factoryName));
783 Expect.equals(new TypeMask.nonNullExact(cls.rawType), 783 Expect.equals(new TypeMask.nonNullExact(cls),
784 typesInferrer.getReturnTypeOfElement(element)); 784 typesInferrer.getReturnTypeOfElement(element));
785 } 785 }
786 checkFactoryConstructor('A', ''); 786 checkFactoryConstructor('A', '');
787 787
788 checkReturn('testCascade1', typesTask.growableListType); 788 checkReturn('testCascade1', typesTask.growableListType);
789 checkReturn('testCascade2', new TypeMask.nonNullExact( 789 checkReturn('testCascade2', new TypeMask.nonNullExact(
790 findElement(compiler, 'CascadeHelper').rawType)); 790 findElement(compiler, 'CascadeHelper')));
791 checkReturn('testSpecialization1', typesTask.numType); 791 checkReturn('testSpecialization1', typesTask.numType);
792 checkReturn('testSpecialization2', typesTask.dynamicType); 792 checkReturn('testSpecialization2', typesTask.dynamicType);
793 checkReturn('testSpecialization3', typesTask.intType.nullable()); 793 checkReturn('testSpecialization3', typesTask.intType.nullable());
794 })); 794 }));
795 } 795 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/simple_inferrer_closure_test.dart ('k') | tests/compiler/dart2js/simple_inferrer_try_catch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698