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

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

Issue 2366363002: Move remaining functionality from ClassWorld to ClosedWorld (Closed)
Patch Set: Created 4 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
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 'package:compiler/src/compiler.dart'; 8 import 'package:compiler/src/compiler.dart';
9 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind; 9 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
10 import 'package:compiler/src/elements/elements.dart'; 10 import 'package:compiler/src/elements/elements.dart';
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 935
936 compiler.phase = Compiler.PHASE_DONE_RESOLVING; 936 compiler.phase = Compiler.PHASE_DONE_RESOLVING;
937 937
938 // Check that a method just in the patch class is a target for a 938 // Check that a method just in the patch class is a target for a
939 // typed selector. 939 // typed selector.
940 Selector selector = 940 Selector selector =
941 new Selector.call(const PublicName('method'), CallStructure.NO_ARGS); 941 new Selector.call(const PublicName('method'), CallStructure.NO_ARGS);
942 TypeMask typeMask = new TypeMask.exact(cls, world); 942 TypeMask typeMask = new TypeMask.exact(cls, world);
943 FunctionElement method = cls.implementation.lookupLocalMember('method'); 943 FunctionElement method = cls.implementation.lookupLocalMember('method');
944 method.computeType(compiler.resolution); 944 method.computeType(compiler.resolution);
945 Expect.isTrue(selector.applies(method, world.backend)); 945 Expect.isTrue(selector.applies(method));
946 Expect.isTrue(typeMask.canHit(method, selector, world)); 946 Expect.isTrue(typeMask.canHit(method, selector, world));
947 947
948 // Check that the declaration method in the declaration class is a target 948 // Check that the declaration method in the declaration class is a target
949 // for a typed selector. 949 // for a typed selector.
950 selector = 950 selector =
951 new Selector.call(const PublicName('clear'), CallStructure.NO_ARGS); 951 new Selector.call(const PublicName('clear'), CallStructure.NO_ARGS);
952 typeMask = new TypeMask.exact(cls, world); 952 typeMask = new TypeMask.exact(cls, world);
953 method = cls.lookupLocalMember('clear'); 953 method = cls.lookupLocalMember('clear');
954 method.computeType(compiler.resolution); 954 method.computeType(compiler.resolution);
955 Expect.isTrue(selector.applies(method, world.backend)); 955 Expect.isTrue(selector.applies(method));
956 Expect.isTrue(typeMask.canHit(method, selector, world)); 956 Expect.isTrue(typeMask.canHit(method, selector, world));
957 957
958 // Check that the declaration method in the declaration class is a target 958 // Check that the declaration method in the declaration class is a target
959 // for a typed selector on a subclass. 959 // for a typed selector on a subclass.
960 cls = ensure(compiler, "B", compiler.commonElements.coreLibrary.find); 960 cls = ensure(compiler, "B", compiler.commonElements.coreLibrary.find);
961 cls.ensureResolved(compiler.resolution); 961 cls.ensureResolved(compiler.resolution);
962 typeMask = new TypeMask.exact(cls, world); 962 typeMask = new TypeMask.exact(cls, world);
963 Expect.isTrue(selector.applies(method, world.backend)); 963 Expect.isTrue(selector.applies(method));
964 Expect.isTrue(typeMask.canHit(method, selector, world)); 964 Expect.isTrue(typeMask.canHit(method, selector, world));
965 } 965 }
966 966
967 Future testAnalyzeAllInjectedMembers() async { 967 Future testAnalyzeAllInjectedMembers() async {
968 Future expect(String patchText, [expectedWarnings]) async { 968 Future expect(String patchText, [expectedWarnings]) async {
969 if (expectedWarnings == null) expectedWarnings = []; 969 if (expectedWarnings == null) expectedWarnings = [];
970 if (expectedWarnings is! List) { 970 if (expectedWarnings is! List) {
971 expectedWarnings = <MessageKind>[expectedWarnings]; 971 expectedWarnings = <MessageKind>[expectedWarnings];
972 } 972 }
973 973
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 await testPatchNonFunction(); 1116 await testPatchNonFunction();
1117 1117
1118 await testPatchAndSelector(); 1118 await testPatchAndSelector();
1119 1119
1120 await testEffectiveTarget(); 1120 await testEffectiveTarget();
1121 1121
1122 await testAnalyzeAllInjectedMembers(); 1122 await testAnalyzeAllInjectedMembers();
1123 await testTypecheckPatchedMembers(); 1123 await testTypecheckPatchedMembers();
1124 }); 1124 });
1125 } 1125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698