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

Side by Side Diff: tests/compiler/dart2js/patch_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) 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 723
724 ensure(compiler, "clear", cls.lookupLocalMember, 724 ensure(compiler, "clear", cls.lookupLocalMember,
725 checkHasBody: true, expectIsPatched: true); 725 checkHasBody: true, expectIsPatched: true);
726 726
727 compiler.phase = Compiler.PHASE_DONE_RESOLVING; 727 compiler.phase = Compiler.PHASE_DONE_RESOLVING;
728 728
729 // Check that a method just in the patch class is a target for a 729 // Check that a method just in the patch class is a target for a
730 // typed selector. 730 // typed selector.
731 var selector = new Selector.call( 731 var selector = new Selector.call(
732 buildSourceString('method'), compiler.coreLibrary, 0); 732 buildSourceString('method'), compiler.coreLibrary, 0);
733 var typedSelector = new TypedSelector.exact(cls.rawType, selector); 733 var typedSelector = new TypedSelector.exact(cls, selector);
734 Element method = 734 Element method =
735 cls.implementation.lookupLocalMember(buildSourceString('method')); 735 cls.implementation.lookupLocalMember(buildSourceString('method'));
736 Expect.isTrue(selector.applies(method, compiler)); 736 Expect.isTrue(selector.applies(method, compiler));
737 Expect.isTrue(typedSelector.applies(method, compiler)); 737 Expect.isTrue(typedSelector.applies(method, compiler));
738 738
739 // Check that the declaration method in the declaration class is a target 739 // Check that the declaration method in the declaration class is a target
740 // for a typed selector. 740 // for a typed selector.
741 selector = new Selector.call( 741 selector = new Selector.call(
742 buildSourceString('clear'), compiler.coreLibrary, 0); 742 buildSourceString('clear'), compiler.coreLibrary, 0);
743 typedSelector = new TypedSelector.exact(cls.rawType, selector); 743 typedSelector = new TypedSelector.exact(cls, selector);
744 method = cls.lookupLocalMember(buildSourceString('clear')); 744 method = cls.lookupLocalMember(buildSourceString('clear'));
745 Expect.isTrue(selector.applies(method, compiler)); 745 Expect.isTrue(selector.applies(method, compiler));
746 Expect.isTrue(typedSelector.applies(method, compiler)); 746 Expect.isTrue(typedSelector.applies(method, compiler));
747 747
748 // Check that the declaration method in the declaration class is a target 748 // Check that the declaration method in the declaration class is a target
749 // for a typed selector on a subclass. 749 // for a typed selector on a subclass.
750 cls = ensure(compiler, "B", compiler.coreLibrary.find); 750 cls = ensure(compiler, "B", compiler.coreLibrary.find);
751 cls.ensureResolved(compiler); 751 cls.ensureResolved(compiler);
752 typedSelector = new TypedSelector.exact(cls.rawType, selector); 752 typedSelector = new TypedSelector.exact(cls, selector);
753 Expect.isTrue(selector.applies(method, compiler)); 753 Expect.isTrue(selector.applies(method, compiler));
754 Expect.isTrue(typedSelector.applies(method, compiler)); 754 Expect.isTrue(typedSelector.applies(method, compiler));
755 })); 755 }));
756 } 756 }
757 757
758 void testAnalyzeAllInjectedMembers() { 758 void testAnalyzeAllInjectedMembers() {
759 void expect(String patchText, [expectedWarnings]) { 759 void expect(String patchText, [expectedWarnings]) {
760 if (expectedWarnings == null) expectedWarnings = []; 760 if (expectedWarnings == null) expectedWarnings = [];
761 if (expectedWarnings is! List) { 761 if (expectedWarnings is! List) {
762 expectedWarnings = <MessageKind>[expectedWarnings]; 762 expectedWarnings = <MessageKind>[expectedWarnings];
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 testPatchNoGetter(); 832 testPatchNoGetter();
833 testPatchNonSetter(); 833 testPatchNonSetter();
834 testPatchNoSetter(); 834 testPatchNoSetter();
835 testPatchNonFunction(); 835 testPatchNonFunction();
836 836
837 testPatchAndSelector(); 837 testPatchAndSelector();
838 838
839 testAnalyzeAllInjectedMembers(); 839 testAnalyzeAllInjectedMembers();
840 testTypecheckPatchedMembers(); 840 testTypecheckPatchedMembers();
841 } 841 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/field_type_simple_inferer_test.dart ('k') | tests/compiler/dart2js/simple_inferrer_closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698