| 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 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 Loading... |
| 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 // TODO(johnniwinther): Support [cls] as a [ClassEntity]. |
| 1105 @override |
| 1106 String dump([ClassElement cls]) { |
| 1107 StringBuffer sb = new StringBuffer(); |
| 1108 if (cls != null) { |
| 1109 sb.write("Classes in the closed world related to $cls:\n"); |
| 1110 } else { |
| 1111 sb.write("Instantiated classes in the closed world:\n"); |
| 1112 } |
| 1113 getClassHierarchyNode(commonElements.objectClass) |
| 1114 .printOn(sb, ' ', instantiatedOnly: cls == null, withRespectTo: cls); |
| 1115 return sb.toString(); |
| 1116 } |
| 1103 } | 1117 } |
| 1104 | 1118 |
| 1105 class ClosedWorldImpl extends ClosedWorldBase { | 1119 class ClosedWorldImpl extends ClosedWorldBase { |
| 1106 ClosedWorldImpl( | 1120 ClosedWorldImpl( |
| 1107 {CommonElements commonElements, | 1121 {CommonElements commonElements, |
| 1108 ConstantSystem constantSystem, | 1122 ConstantSystem constantSystem, |
| 1109 NativeData nativeData, | 1123 NativeData nativeData, |
| 1110 InterceptorData interceptorData, | 1124 InterceptorData interceptorData, |
| 1111 BackendUsage backendUsage, | 1125 BackendUsage backendUsage, |
| 1112 ResolutionWorldBuilder resolutionWorldBuilder, | 1126 ResolutionWorldBuilder resolutionWorldBuilder, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 if (cls != commonElements.functionClass && | 1242 if (cls != commonElements.functionClass && |
| 1229 cls.implementsFunction(commonElements)) { | 1243 cls.implementsFunction(commonElements)) { |
| 1230 ClassSet subtypeSet = getClassSet(commonElements.functionClass); | 1244 ClassSet subtypeSet = getClassSet(commonElements.functionClass); |
| 1231 subtypeSet.addSubtype(node); | 1245 subtypeSet.addSubtype(node); |
| 1232 } | 1246 } |
| 1233 if (!node.isInstantiated && node.parentNode != null) { | 1247 if (!node.isInstantiated && node.parentNode != null) { |
| 1234 _updateSuperClassHierarchyNodeForClass(node.parentNode); | 1248 _updateSuperClassHierarchyNodeForClass(node.parentNode); |
| 1235 } | 1249 } |
| 1236 } | 1250 } |
| 1237 | 1251 |
| 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) { | 1252 SideEffects getSideEffectsOfElement(Element element) { |
| 1252 // The type inferrer (where the side effects are being computed), | 1253 // The type inferrer (where the side effects are being computed), |
| 1253 // does not see generative constructor bodies because they are | 1254 // does not see generative constructor bodies because they are |
| 1254 // created by the backend. Also, it does not make any distinction | 1255 // created by the backend. Also, it does not make any distinction |
| 1255 // between a constructor and its body for side effects. This | 1256 // between a constructor and its body for side effects. This |
| 1256 // implies that currently, the side effects of a constructor body | 1257 // implies that currently, the side effects of a constructor body |
| 1257 // contain the side effects of the initializers. | 1258 // contain the side effects of the initializers. |
| 1258 assert(!element.isGenerativeConstructorBody); | 1259 assert(!element.isGenerativeConstructorBody); |
| 1259 assert(!element.isField); | 1260 assert(!element.isField); |
| 1260 return super.getSideEffectsOfElement(element); | 1261 return super.getSideEffectsOfElement(element); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 | 1335 |
| 1335 @override | 1336 @override |
| 1336 bool _checkEntity(Entity element) => true; | 1337 bool _checkEntity(Entity element) => true; |
| 1337 | 1338 |
| 1338 @override | 1339 @override |
| 1339 void registerClosureClass(ClassElement cls) { | 1340 void registerClosureClass(ClassElement cls) { |
| 1340 throw new UnimplementedError('KernelClosedWorld.registerClosureClass'); | 1341 throw new UnimplementedError('KernelClosedWorld.registerClosureClass'); |
| 1341 } | 1342 } |
| 1342 | 1343 |
| 1343 @override | 1344 @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) { | 1345 bool hasElementIn(ClassEntity cls, Selector selector, Entity element) { |
| 1350 throw new UnimplementedError('KernelClosedWorld.hasElementIn'); | 1346 throw new UnimplementedError('KernelClosedWorld.hasElementIn'); |
| 1351 } | 1347 } |
| 1352 } | 1348 } |
| OLD | NEW |