| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
| 8 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; | 8 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; |
| 9 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; | 9 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; |
| 10 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; | 10 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 ensure(compiler, "method", cls.patch.lookupLocalMember, | 729 ensure(compiler, "method", cls.patch.lookupLocalMember, |
| 730 checkHasBody: true, expectIsRegular: true); | 730 checkHasBody: true, expectIsRegular: true); |
| 731 | 731 |
| 732 ensure(compiler, "clear", cls.lookupLocalMember, | 732 ensure(compiler, "clear", cls.lookupLocalMember, |
| 733 checkHasBody: true, expectIsPatched: true); | 733 checkHasBody: true, expectIsPatched: true); |
| 734 | 734 |
| 735 compiler.phase = Compiler.PHASE_DONE_RESOLVING; | 735 compiler.phase = Compiler.PHASE_DONE_RESOLVING; |
| 736 | 736 |
| 737 // Check that a method just in the patch class is a target for a | 737 // Check that a method just in the patch class is a target for a |
| 738 // typed selector. | 738 // typed selector. |
| 739 var selector = new Selector.call( | 739 var selector = new Selector.call('method', compiler.coreLibrary, 0); |
| 740 'method', compiler.coreLibrary, 0); | |
| 741 var typedSelector = new TypedSelector.exact(cls, selector); | 740 var typedSelector = new TypedSelector.exact(cls, selector); |
| 742 Element method = | 741 Element method = cls.implementation.lookupLocalMember('method'); |
| 743 cls.implementation.lookupLocalMember('method'); | |
| 744 Expect.isTrue(selector.applies(method, compiler)); | 742 Expect.isTrue(selector.applies(method, compiler)); |
| 745 Expect.isTrue(typedSelector.applies(method, compiler)); | 743 Expect.isTrue(typedSelector.applies(method, compiler)); |
| 746 | 744 |
| 747 // Check that the declaration method in the declaration class is a target | 745 // Check that the declaration method in the declaration class is a target |
| 748 // for a typed selector. | 746 // for a typed selector. |
| 749 selector = new Selector.call( | 747 selector = new Selector.call('clear', compiler.coreLibrary, 0); |
| 750 'clear', compiler.coreLibrary, 0); | |
| 751 typedSelector = new TypedSelector.exact(cls, selector); | 748 typedSelector = new TypedSelector.exact(cls, selector); |
| 752 method = cls.lookupLocalMember('clear'); | 749 method = cls.lookupLocalMember('clear'); |
| 753 Expect.isTrue(selector.applies(method, compiler)); | 750 Expect.isTrue(selector.applies(method, compiler)); |
| 754 Expect.isTrue(typedSelector.applies(method, compiler)); | 751 Expect.isTrue(typedSelector.applies(method, compiler)); |
| 755 | 752 |
| 756 // Check that the declaration method in the declaration class is a target | 753 // Check that the declaration method in the declaration class is a target |
| 757 // for a typed selector on a subclass. | 754 // for a typed selector on a subclass. |
| 758 cls = ensure(compiler, "B", compiler.coreLibrary.find); | 755 cls = ensure(compiler, "B", compiler.coreLibrary.find); |
| 759 cls.ensureResolved(compiler); | 756 cls.ensureResolved(compiler); |
| 760 typedSelector = new TypedSelector.exact(cls, selector); | 757 typedSelector = new TypedSelector.exact(cls, selector); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 testPatchNoGetter(); | 837 testPatchNoGetter(); |
| 841 testPatchNonSetter(); | 838 testPatchNonSetter(); |
| 842 testPatchNoSetter(); | 839 testPatchNoSetter(); |
| 843 testPatchNonFunction(); | 840 testPatchNonFunction(); |
| 844 | 841 |
| 845 testPatchAndSelector(); | 842 testPatchAndSelector(); |
| 846 | 843 |
| 847 testAnalyzeAllInjectedMembers(); | 844 testAnalyzeAllInjectedMembers(); |
| 848 testTypecheckPatchedMembers(); | 845 testTypecheckPatchedMembers(); |
| 849 } | 846 } |
| OLD | NEW |