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

Side by Side Diff: pkg/compiler/lib/src/world.dart

Issue 2829223003: Check equivalence of closed world based on kernel elements. (Closed)
Patch Set: Test hello world! Created 3 years, 8 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 library dart2js.world; 5 library dart2js.world;
6 6
7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; 7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX;
8 import 'common.dart'; 8 import 'common.dart';
9 import 'constants/constant_system.dart'; 9 import 'constants/constant_system.dart';
10 import 'common_elements.dart' show CommonElements; 10 import 'common_elements.dart' show CommonElements;
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 if (element is SynthesizedCallMethodElementX) { 1093 if (element is SynthesizedCallMethodElementX) {
1094 return getMightBePassedToApply(element.expression); 1094 return getMightBePassedToApply(element.expression);
1095 } 1095 }
1096 return _functionsThatMightBePassedToApply.contains(element); 1096 return _functionsThatMightBePassedToApply.contains(element);
1097 } 1097 }
1098 1098
1099 @override 1099 @override
1100 bool getCurrentlyKnownMightBePassedToApply(Entity element) { 1100 bool getCurrentlyKnownMightBePassedToApply(Entity element) {
1101 return getMightBePassedToApply(element); 1101 return getMightBePassedToApply(element);
1102 } 1102 }
1103
1104 @override
1105 String dump([ClassElement cls]) {
Siggi Cherem (dart-lang) 2017/04/21 17:04:21 now that this is shared, should Element be Entity?
Johnni Winther 2017/04/24 09:53:46 The implementation actually still requires the arg
1106 StringBuffer sb = new StringBuffer();
1107 if (cls != null) {
1108 sb.write("Classes in the closed world related to $cls:\n");
1109 } else {
1110 sb.write("Instantiated classes in the closed world:\n");
1111 }
1112 getClassHierarchyNode(commonElements.objectClass)
1113 .printOn(sb, ' ', instantiatedOnly: cls == null, withRespectTo: cls);
1114 return sb.toString();
1115 }
1103 } 1116 }
1104 1117
1105 class ClosedWorldImpl extends ClosedWorldBase { 1118 class ClosedWorldImpl extends ClosedWorldBase {
1106 ClosedWorldImpl( 1119 ClosedWorldImpl(
1107 {CommonElements commonElements, 1120 {CommonElements commonElements,
1108 ConstantSystem constantSystem, 1121 ConstantSystem constantSystem,
1109 NativeData nativeData, 1122 NativeData nativeData,
1110 InterceptorData interceptorData, 1123 InterceptorData interceptorData,
1111 BackendUsage backendUsage, 1124 BackendUsage backendUsage,
1112 ResolutionWorldBuilder resolutionWorldBuilder, 1125 ResolutionWorldBuilder resolutionWorldBuilder,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 if (cls != commonElements.functionClass && 1241 if (cls != commonElements.functionClass &&
1229 cls.implementsFunction(commonElements)) { 1242 cls.implementsFunction(commonElements)) {
1230 ClassSet subtypeSet = getClassSet(commonElements.functionClass); 1243 ClassSet subtypeSet = getClassSet(commonElements.functionClass);
1231 subtypeSet.addSubtype(node); 1244 subtypeSet.addSubtype(node);
1232 } 1245 }
1233 if (!node.isInstantiated && node.parentNode != null) { 1246 if (!node.isInstantiated && node.parentNode != null) {
1234 _updateSuperClassHierarchyNodeForClass(node.parentNode); 1247 _updateSuperClassHierarchyNodeForClass(node.parentNode);
1235 } 1248 }
1236 } 1249 }
1237 1250
1238 @override
1239 String dump([ClassElement cls]) {
1240 StringBuffer sb = new StringBuffer();
1241 if (cls != null) {
1242 sb.write("Classes in the closed world related to $cls:\n");
1243 } else {
1244 sb.write("Instantiated classes in the closed world:\n");
1245 }
1246 getClassHierarchyNode(commonElements.objectClass)
1247 .printOn(sb, ' ', instantiatedOnly: cls == null, withRespectTo: cls);
1248 return sb.toString();
1249 }
1250
1251 SideEffects getSideEffectsOfElement(Element element) { 1251 SideEffects getSideEffectsOfElement(Element element) {
1252 // The type inferrer (where the side effects are being computed), 1252 // The type inferrer (where the side effects are being computed),
1253 // does not see generative constructor bodies because they are 1253 // does not see generative constructor bodies because they are
1254 // created by the backend. Also, it does not make any distinction 1254 // created by the backend. Also, it does not make any distinction
1255 // between a constructor and its body for side effects. This 1255 // between a constructor and its body for side effects. This
1256 // implies that currently, the side effects of a constructor body 1256 // implies that currently, the side effects of a constructor body
1257 // contain the side effects of the initializers. 1257 // contain the side effects of the initializers.
1258 assert(!element.isGenerativeConstructorBody); 1258 assert(!element.isGenerativeConstructorBody);
1259 assert(!element.isField); 1259 assert(!element.isField);
1260 return super.getSideEffectsOfElement(element); 1260 return super.getSideEffectsOfElement(element);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 1334
1335 @override 1335 @override
1336 bool _checkEntity(Entity element) => true; 1336 bool _checkEntity(Entity element) => true;
1337 1337
1338 @override 1338 @override
1339 void registerClosureClass(ClassElement cls) { 1339 void registerClosureClass(ClassElement cls) {
1340 throw new UnimplementedError('KernelClosedWorld.registerClosureClass'); 1340 throw new UnimplementedError('KernelClosedWorld.registerClosureClass');
1341 } 1341 }
1342 1342
1343 @override 1343 @override
1344 String dump([ClassEntity cls]) {
1345 throw new UnimplementedError('KernelClosedWorld.dump');
1346 }
1347
1348 @override
1349 bool hasElementIn(ClassEntity cls, Selector selector, Entity element) { 1344 bool hasElementIn(ClassEntity cls, Selector selector, Entity element) {
1350 throw new UnimplementedError('KernelClosedWorld.hasElementIn'); 1345 throw new UnimplementedError('KernelClosedWorld.hasElementIn');
1351 } 1346 }
1352 } 1347 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698