| 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:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; | 6 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; |
| 7 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; | 7 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; |
| 8 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; | 8 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; |
| 9 import "../../../sdk/lib/_internal/compiler/implementation/util/util.dart"; | 9 import "../../../sdk/lib/_internal/compiler/implementation/util/util.dart"; |
| 10 import "mock_compiler.dart"; | 10 import "mock_compiler.dart"; |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 // Check that the declaration method in the declaration class is a target | 712 // Check that the declaration method in the declaration class is a target |
| 713 // for a typed selector on a subclass. | 713 // for a typed selector on a subclass. |
| 714 cls = ensure(compiler, "B", compiler.coreLibrary.find); | 714 cls = ensure(compiler, "B", compiler.coreLibrary.find); |
| 715 cls.ensureResolved(compiler); | 715 cls.ensureResolved(compiler); |
| 716 typedSelector = new TypedSelector.exact(cls.rawType, selector); | 716 typedSelector = new TypedSelector.exact(cls.rawType, selector); |
| 717 Expect.isTrue(selector.applies(method, compiler)); | 717 Expect.isTrue(selector.applies(method, compiler)); |
| 718 Expect.isTrue(typedSelector.applies(method, compiler)); | 718 Expect.isTrue(typedSelector.applies(method, compiler)); |
| 719 } | 719 } |
| 720 | 720 |
| 721 void testAnalyzeAllInjectedMembers() { | 721 void testAnalyzeAllInjectedMembers() { |
| 722 String patchText = """ | 722 void expect(String patchText, [expectedWarnings]) { |
| 723 void method() { | 723 if (expectedWarnings == null) expectedWarnings = []; |
| 724 String s = 0; | 724 if (expectedWarnings is! List) expectedWarnings = [expectedWarnings]; |
| 725 } | 725 |
| 726 """; | 726 var compiler = applyPatch('', patchText, |
| 727 var compiler = applyPatch('', patchText, analyzeAll: true, analyzeOnly: true); | 727 analyzeAll: true, analyzeOnly: true); |
| 728 compiler.librariesToAnalyzeWhenRun = [Uri.parse('dart:core')]; | 728 compiler.librariesToAnalyzeWhenRun = [Uri.parse('dart:core')]; |
| 729 compiler.runCompiler(null); | 729 compiler.runCompiler(null); |
| 730 compareWarningKinds(patchText, | 730 compareWarningKinds(patchText, expectedWarnings, compiler.warnings); |
| 731 [MessageKind.NOT_ASSIGNABLE], compiler.warnings); | 731 } |
| 732 |
| 733 expect('String s = 0;', MessageKind.NOT_ASSIGNABLE); |
| 734 expect('void method() { String s = 0; }', MessageKind.NOT_ASSIGNABLE); |
| 735 expect(''' |
| 736 class Class { |
| 737 String s = 0; |
| 738 } |
| 739 ''', |
| 740 MessageKind.NOT_ASSIGNABLE); |
| 741 expect(''' |
| 742 class Class { |
| 743 void method() { |
| 744 String s = 0; |
| 745 } |
| 746 } |
| 747 ''', |
| 748 MessageKind.NOT_ASSIGNABLE); |
| 732 } | 749 } |
| 733 | 750 |
| 734 void testTypecheckPatchedMembers() { | 751 void testTypecheckPatchedMembers() { |
| 735 String originText = "external void method();"; | 752 String originText = "external void method();"; |
| 736 String patchText = """ | 753 String patchText = """ |
| 737 patch void method() { | 754 patch void method() { |
| 738 String s = 0; | 755 String s = 0; |
| 739 } | 756 } |
| 740 """; | 757 """; |
| 741 var compiler = applyPatch(originText, patchText, | 758 var compiler = applyPatch(originText, patchText, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 772 testPatchNoGetter(); | 789 testPatchNoGetter(); |
| 773 testPatchNonSetter(); | 790 testPatchNonSetter(); |
| 774 testPatchNoSetter(); | 791 testPatchNoSetter(); |
| 775 testPatchNonFunction(); | 792 testPatchNonFunction(); |
| 776 | 793 |
| 777 testPatchAndSelector(); | 794 testPatchAndSelector(); |
| 778 | 795 |
| 779 testAnalyzeAllInjectedMembers(); | 796 testAnalyzeAllInjectedMembers(); |
| 780 testTypecheckPatchedMembers(); | 797 testTypecheckPatchedMembers(); |
| 781 } | 798 } |
| OLD | NEW |