| OLD | NEW |
| 1 | 1 |
| 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 library dart2js.common.resolution; | 6 library dart2js.common.resolution; |
| 7 | 7 |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../compiler.dart' show | 9 import '../compiler.dart' show |
| 10 Compiler; | 10 Compiler; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 if (other is! ListLiteralUse) return false; | 178 if (other is! ListLiteralUse) return false; |
| 179 return | 179 return |
| 180 type == other.type && | 180 type == other.type && |
| 181 isConstant == other.isConstant && | 181 isConstant == other.isConstant && |
| 182 isEmpty == other.isEmpty; | 182 isEmpty == other.isEmpty; |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 /// Mutable implementation of [WorldImpact] used to transform | 186 /// Mutable implementation of [WorldImpact] used to transform |
| 187 /// [ResolutionImpact] to [WorldImpact]. | 187 /// [ResolutionImpact] to [WorldImpact]. |
| 188 // TODO(johnniwinther): Remove [Registry] when dependency is tracked directly | 188 class TransformedWorldImpact implements WorldImpact { |
| 189 // on [WorldImpact]. | |
| 190 class TransformedWorldImpact extends WorldImpact { | |
| 191 final ResolutionImpact worldImpact; | 189 final ResolutionImpact worldImpact; |
| 192 | 190 |
| 193 Setlet<Element> _staticUses; | 191 Setlet<Element> _staticUses; |
| 194 Setlet<InterfaceType> _instantiatedTypes; | 192 Setlet<InterfaceType> _instantiatedTypes; |
| 195 Setlet<UniverseSelector> _dynamicGetters; | 193 Setlet<UniverseSelector> _dynamicGetters; |
| 196 Setlet<UniverseSelector> _dynamicInvocations; | 194 Setlet<UniverseSelector> _dynamicInvocations; |
| 197 Setlet<UniverseSelector> _dynamicSetters; | 195 Setlet<UniverseSelector> _dynamicSetters; |
| 198 | 196 |
| 199 TransformedWorldImpact(this.worldImpact); | 197 TransformedWorldImpact(this.worldImpact); |
| 200 | 198 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 223 | 221 |
| 224 @override | 222 @override |
| 225 Iterable<UniverseSelector> get dynamicSetters { | 223 Iterable<UniverseSelector> get dynamicSetters { |
| 226 return _dynamicSetters != null | 224 return _dynamicSetters != null |
| 227 ? _dynamicSetters : worldImpact.dynamicSetters; | 225 ? _dynamicSetters : worldImpact.dynamicSetters; |
| 228 } | 226 } |
| 229 | 227 |
| 230 @override | 228 @override |
| 231 Iterable<DartType> get isChecks => worldImpact.isChecks; | 229 Iterable<DartType> get isChecks => worldImpact.isChecks; |
| 232 | 230 |
| 231 @override |
| 232 Iterable<DartType> get onCatchTypes => worldImpact.onCatchTypes; |
| 233 |
| 233 _unsupported(String message) => throw new UnsupportedError(message); | 234 _unsupported(String message) => throw new UnsupportedError(message); |
| 234 | 235 |
| 235 void registerDynamicGetter(UniverseSelector selector) { | 236 void registerDynamicGetter(UniverseSelector selector) { |
| 236 if (_dynamicGetters == null) { | 237 if (_dynamicGetters == null) { |
| 237 _dynamicGetters = new Setlet<UniverseSelector>(); | 238 _dynamicGetters = new Setlet<UniverseSelector>(); |
| 238 _dynamicGetters.addAll(worldImpact.dynamicGetters); | 239 _dynamicGetters.addAll(worldImpact.dynamicGetters); |
| 239 } | 240 } |
| 240 _dynamicGetters.add(selector); | 241 _dynamicGetters.add(selector); |
| 241 } | 242 } |
| 242 | 243 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 Iterable<Element> get staticUses { | 288 Iterable<Element> get staticUses { |
| 288 return _staticUses != null ? _staticUses : worldImpact.staticUses; | 289 return _staticUses != null ? _staticUses : worldImpact.staticUses; |
| 289 } | 290 } |
| 290 | 291 |
| 291 @override | 292 @override |
| 292 Iterable<LocalFunctionElement> get closures => worldImpact.closures; | 293 Iterable<LocalFunctionElement> get closures => worldImpact.closures; |
| 293 | 294 |
| 294 String toString() { | 295 String toString() { |
| 295 StringBuffer sb = new StringBuffer(); | 296 StringBuffer sb = new StringBuffer(); |
| 296 sb.write('TransformedWorldImpact($worldImpact)'); | 297 sb.write('TransformedWorldImpact($worldImpact)'); |
| 297 sb.write(super.toString()); | 298 WorldImpact.printOn(sb, this); |
| 298 return sb.toString(); | 299 return sb.toString(); |
| 299 } | 300 } |
| 300 } | 301 } |
| 301 | 302 |
| 302 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. | 303 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. |
| 303 abstract class Resolution { | 304 abstract class Resolution { |
| 304 Parsing get parsing; | 305 Parsing get parsing; |
| 305 DiagnosticReporter get reporter; | 306 DiagnosticReporter get reporter; |
| 306 CoreTypes get coreTypes; | 307 CoreTypes get coreTypes; |
| 307 | 308 |
| 308 void resolveTypedef(TypedefElement typdef); | 309 void resolveTypedef(TypedefElement typdef); |
| 309 void resolveClass(ClassElement cls); | 310 void resolveClass(ClassElement cls); |
| 310 void registerClass(ClassElement cls); | 311 void registerClass(ClassElement cls); |
| 311 void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation); | 312 void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation); |
| 312 FunctionSignature resolveSignature(FunctionElement function); | 313 FunctionSignature resolveSignature(FunctionElement function); |
| 313 DartType resolveTypeAnnotation(Element element, TypeAnnotation node); | 314 DartType resolveTypeAnnotation(Element element, TypeAnnotation node); |
| 314 | 315 |
| 315 bool hasBeenResolved(Element element); | 316 bool hasBeenResolved(Element element); |
| 316 WorldImpact getWorldImpact(Element element); | 317 WorldImpact getWorldImpact(Element element); |
| 317 WorldImpact computeWorldImpact(Element element); | 318 WorldImpact computeWorldImpact(Element element); |
| 318 } | 319 } |
| 319 | 320 |
| 320 // TODO(johnniwinther): Rename to `Parser` or `ParsingContext`. | 321 // TODO(johnniwinther): Rename to `Parser` or `ParsingContext`. |
| 321 abstract class Parsing { | 322 abstract class Parsing { |
| 322 DiagnosticReporter get reporter; | 323 DiagnosticReporter get reporter; |
| 323 void parsePatchClass(ClassElement cls); | 324 void parsePatchClass(ClassElement cls); |
| 324 measure(f()); | 325 measure(f()); |
| 325 } | 326 } |
| OLD | NEW |