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

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

Issue 27510003: Scanner for UTF-8 byte arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixes compiler tests 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 Element ensure(compiler, 47 Element ensure(compiler,
48 String name, 48 String name,
49 Element lookup(name), 49 Element lookup(name),
50 {bool expectIsPatched: false, 50 {bool expectIsPatched: false,
51 bool expectIsPatch: false, 51 bool expectIsPatch: false,
52 bool checkHasBody: false, 52 bool checkHasBody: false,
53 bool expectIsGetter: false, 53 bool expectIsGetter: false,
54 bool expectIsFound: true, 54 bool expectIsFound: true,
55 bool expectIsRegular: false}) { 55 bool expectIsRegular: false}) {
56 var element = lookup(buildSourceString(name)); 56 var element = lookup(name);
57 if (!expectIsFound) { 57 if (!expectIsFound) {
58 Expect.isNull(element); 58 Expect.isNull(element);
59 return element; 59 return element;
60 } 60 }
61 Expect.isNotNull(element); 61 Expect.isNotNull(element);
62 if (expectIsGetter) { 62 if (expectIsGetter) {
63 Expect.isTrue(element is AbstractFieldElement); 63 Expect.isTrue(element is AbstractFieldElement);
64 Expect.isNotNull(element.getter); 64 Expect.isNotNull(element.getter);
65 element = element.getter; 65 element = element.getter;
66 } 66 }
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
740 buildSourceString('method'), compiler.coreLibrary, 0); 740 'method', compiler.coreLibrary, 0);
ngeoffray 2013/10/18 10:19:37 One line?
lukas 2013/10/24 16:48:36 Done.
741 var typedSelector = new TypedSelector.exact(cls, selector); 741 var typedSelector = new TypedSelector.exact(cls, selector);
742 Element method = 742 Element method =
743 cls.implementation.lookupLocalMember(buildSourceString('method')); 743 cls.implementation.lookupLocalMember('method');
ngeoffray 2013/10/18 10:19:37 ditto
lukas 2013/10/24 16:48:36 Done.
744 Expect.isTrue(selector.applies(method, compiler)); 744 Expect.isTrue(selector.applies(method, compiler));
745 Expect.isTrue(typedSelector.applies(method, compiler)); 745 Expect.isTrue(typedSelector.applies(method, compiler));
746 746
747 // Check that the declaration method in the declaration class is a target 747 // Check that the declaration method in the declaration class is a target
748 // for a typed selector. 748 // for a typed selector.
749 selector = new Selector.call( 749 selector = new Selector.call(
750 buildSourceString('clear'), compiler.coreLibrary, 0); 750 'clear', compiler.coreLibrary, 0);
ngeoffray 2013/10/18 10:19:37 ditto
lukas 2013/10/24 16:48:36 Done.
751 typedSelector = new TypedSelector.exact(cls, selector); 751 typedSelector = new TypedSelector.exact(cls, selector);
752 method = cls.lookupLocalMember(buildSourceString('clear')); 752 method = cls.lookupLocalMember('clear');
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 // Check that the declaration method in the declaration class is a target 756 // Check that the declaration method in the declaration class is a target
757 // for a typed selector on a subclass. 757 // for a typed selector on a subclass.
758 cls = ensure(compiler, "B", compiler.coreLibrary.find); 758 cls = ensure(compiler, "B", compiler.coreLibrary.find);
759 cls.ensureResolved(compiler); 759 cls.ensureResolved(compiler);
760 typedSelector = new TypedSelector.exact(cls, selector); 760 typedSelector = new TypedSelector.exact(cls, selector);
761 Expect.isTrue(selector.applies(method, compiler)); 761 Expect.isTrue(selector.applies(method, compiler));
762 Expect.isTrue(typedSelector.applies(method, compiler)); 762 Expect.isTrue(typedSelector.applies(method, compiler));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 testPatchNoGetter(); 840 testPatchNoGetter();
841 testPatchNonSetter(); 841 testPatchNonSetter();
842 testPatchNoSetter(); 842 testPatchNoSetter();
843 testPatchNonFunction(); 843 testPatchNonFunction();
844 844
845 testPatchAndSelector(); 845 testPatchAndSelector();
846 846
847 testAnalyzeAllInjectedMembers(); 847 testAnalyzeAllInjectedMembers();
848 testTypecheckPatchedMembers(); 848 testTypecheckPatchedMembers();
849 } 849 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698