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 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 'package:compiler/src/types/types.dart' show TypeMask; | 7 import 'package:compiler/src/types/types.dart' show TypeMask; |
8 import 'type_mask_test_helper.dart'; | 8 import 'type_mask_test_helper.dart'; |
9 | 9 |
10 import 'compiler_helper.dart'; | 10 import 'compiler_helper.dart'; |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 var a, b; | 611 var a, b; |
612 var i = 0; | 612 var i = 0; |
613 } | 613 } |
614 | 614 |
615 main() { | 615 main() { |
616 // Ensure a function class is being instantiated. | 616 // Ensure a function class is being instantiated. |
617 () => 42; | 617 () => 42; |
618 returnNum1(true); | 618 returnNum1(true); |
619 returnNum2(true); | 619 returnNum2(true); |
620 returnInt1(true); | 620 returnInt1(true); |
621 returnInt2(); | 621 returnInt2(true); |
622 returnInt3(true); | 622 returnInt3(true); |
623 returnInt4(); | 623 returnInt4(); |
624 returnDouble(true); | 624 returnDouble(true); |
625 returnGiveUp(true); | 625 returnGiveUp(true); |
626 returnInt5(); | 626 returnInt5(); |
627 returnInt6(); | 627 returnInt6(); |
628 returnInt7(); | 628 returnInt7(); |
629 returnInt8(); | 629 returnInt8(); |
630 returnIntOrNull(true); | 630 returnIntOrNull(true); |
631 returnDynamic(); | 631 returnDynamic(); |
(...skipping 28 matching lines...) Expand all Loading... |
660 testIsCheck27(topLevelGetter()); | 660 testIsCheck27(topLevelGetter()); |
661 testIsCheck28(topLevelGetter()); | 661 testIsCheck28(topLevelGetter()); |
662 testIsCheck29(topLevelGetter()); | 662 testIsCheck29(topLevelGetter()); |
663 testIf1(topLevelGetter()); | 663 testIf1(topLevelGetter()); |
664 testIf2(topLevelGetter()); | 664 testIf2(topLevelGetter()); |
665 returnAsString(); | 665 returnAsString(); |
666 returnIntAsNum(); | 666 returnIntAsNum(); |
667 returnAsTypedef(); | 667 returnAsTypedef(); |
668 returnTopLevelGetter(); | 668 returnTopLevelGetter(); |
669 testDeadCode(); | 669 testDeadCode(); |
670 testLabeledIf(true); | 670 testLabeledIf(); |
671 testSwitch1(); | 671 testSwitch1(); |
672 testSwitch2(); | 672 testSwitch2(); |
673 testSwitch3(); | 673 testSwitch3(); |
674 testSwitch4(); | 674 testSwitch4(); |
675 testSwitch5(); | 675 testSwitch5(); |
676 testContinue1(); | 676 testContinue1(); |
677 testBreak1(); | 677 testBreak1(); |
678 testContinue2(); | 678 testContinue2(); |
679 testBreak2(); | 679 testBreak2(); |
680 testDoWhile1(); | 680 testDoWhile1(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 testReturnNull4(); | 720 testReturnNull4(); |
721 testReturnNull5(); | 721 testReturnNull5(); |
722 testReturnNull6(); | 722 testReturnNull6(); |
723 testReturnNotEquals(); | 723 testReturnNotEquals(); |
724 } | 724 } |
725 """; | 725 """; |
726 | 726 |
727 void main() { | 727 void main() { |
728 Uri uri = new Uri(scheme: 'source'); | 728 Uri uri = new Uri(scheme: 'source'); |
729 var compiler = compilerFor(TEST, uri); | 729 var compiler = compilerFor(TEST, uri); |
730 compiler.diagnosticHandler = createHandler(compiler, TEST); | |
731 asyncTest(() => compiler.runCompiler(uri).then((_) { | 730 asyncTest(() => compiler.runCompiler(uri).then((_) { |
732 var typesTask = compiler.typesTask; | 731 var typesTask = compiler.typesTask; |
733 var typesInferrer = typesTask.typesInferrer; | 732 var typesInferrer = typesTask.typesInferrer; |
734 var world = compiler.world; | 733 var world = compiler.world; |
735 | 734 |
736 checkReturn(String name, type) { | 735 checkReturn(String name, type) { |
737 var element = findElement(compiler, name); | 736 var element = findElement(compiler, name); |
738 Expect.equals( | 737 Expect.equals( |
739 type, | 738 type, |
740 simplify(typesInferrer.getReturnTypeOfElement(element), compiler), | 739 simplify(typesInferrer.getReturnTypeOfElement(element), compiler), |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 checkReturn('testSpecialization3', typesTask.uint31Type.nullable()); | 870 checkReturn('testSpecialization3', typesTask.uint31Type.nullable()); |
872 checkReturn('testReturnNull1', typesTask.nullType); | 871 checkReturn('testReturnNull1', typesTask.nullType); |
873 checkReturn('testReturnNull2', typesTask.nullType); | 872 checkReturn('testReturnNull2', typesTask.nullType); |
874 checkReturn('testReturnNull3', typesTask.dynamicType); | 873 checkReturn('testReturnNull3', typesTask.dynamicType); |
875 checkReturn('testReturnNull4', typesTask.nullType); | 874 checkReturn('testReturnNull4', typesTask.nullType); |
876 checkReturn('testReturnNull5', typesTask.nullType); | 875 checkReturn('testReturnNull5', typesTask.nullType); |
877 checkReturn('testReturnNull6', typesTask.dynamicType); | 876 checkReturn('testReturnNull6', typesTask.dynamicType); |
878 checkReturn('testReturnNotEquals', typesTask.boolType); | 877 checkReturn('testReturnNotEquals', typesTask.boolType); |
879 })); | 878 })); |
880 } | 879 } |
OLD | NEW |