| 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.enqueue; | 5 library dart2js.enqueue; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import 'cache_strategy.dart'; | 9 import 'cache_strategy.dart'; |
| 10 import 'common/backend_api.dart' show Backend; | 10 import 'common/backend_api.dart' show Backend; |
| 11 import 'common/resolution.dart' show Resolution; | 11 import 'common/resolution.dart' show Resolution; |
| 12 import 'common/tasks.dart' show CompilerTask; | 12 import 'common/tasks.dart' show CompilerTask; |
| 13 import 'common/work.dart' show WorkItem; | 13 import 'common/work.dart' show WorkItem; |
| 14 import 'common.dart'; | 14 import 'common.dart'; |
| 15 import 'compiler.dart' show Compiler, GlobalDependencyRegistry; | 15 import 'compiler.dart' show Compiler, GlobalDependencyRegistry; |
| 16 import 'options.dart'; | 16 import 'options.dart'; |
| 17 import 'elements/resolution_types.dart' show DartType, InterfaceType; | 17 import 'elements/resolution_types.dart' |
| 18 show ResolutionDartType, ResolutionInterfaceType; |
| 18 import 'elements/elements.dart' | 19 import 'elements/elements.dart' |
| 19 show | 20 show |
| 20 AnalyzableElement, | 21 AnalyzableElement, |
| 21 ClassElement, | 22 ClassElement, |
| 22 ConstructorElement, | 23 ConstructorElement, |
| 23 Element, | 24 Element, |
| 24 Entity, | 25 Entity, |
| 25 MemberElement; | 26 MemberElement; |
| 26 import 'elements/entities.dart'; | 27 import 'elements/entities.dart'; |
| 27 import 'native/native.dart' as native; | 28 import 'native/native.dart' as native; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 DiagnosticReporter get _reporter => _resolution.reporter; | 177 DiagnosticReporter get _reporter => _resolution.reporter; |
| 177 | 178 |
| 178 Iterable<ClassEntity> get processedClasses => _universe.processedClasses; | 179 Iterable<ClassEntity> get processedClasses => _universe.processedClasses; |
| 179 | 180 |
| 180 void applyImpact(WorldImpact worldImpact, {var impactSource}) { | 181 void applyImpact(WorldImpact worldImpact, {var impactSource}) { |
| 181 if (worldImpact.isEmpty) return; | 182 if (worldImpact.isEmpty) return; |
| 182 impactStrategy.visitImpact( | 183 impactStrategy.visitImpact( |
| 183 impactSource, worldImpact, _impactVisitor, impactUse); | 184 impactSource, worldImpact, _impactVisitor, impactUse); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void _registerInstantiatedType(InterfaceType type, | 187 void _registerInstantiatedType(ResolutionInterfaceType type, |
| 187 {ConstructorElement constructor, | 188 {ConstructorElement constructor, |
| 188 bool mirrorUsage: false, | 189 bool mirrorUsage: false, |
| 189 bool nativeUsage: false, | 190 bool nativeUsage: false, |
| 190 bool globalDependency: false, | 191 bool globalDependency: false, |
| 191 bool isRedirection: false}) { | 192 bool isRedirection: false}) { |
| 192 task.measure(() { | 193 task.measure(() { |
| 193 _universe.registerTypeInstantiation(type, _applyClassUse, | 194 _universe.registerTypeInstantiation(type, _applyClassUse, |
| 194 constructor: constructor, | 195 constructor: constructor, |
| 195 byMirrors: mirrorUsage, | 196 byMirrors: mirrorUsage, |
| 196 isRedirection: isRedirection); | 197 isRedirection: isRedirection); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 constructor: staticUse.element, | 268 constructor: staticUse.element, |
| 268 globalDependency: false, | 269 globalDependency: false, |
| 269 isRedirection: true); | 270 isRedirection: true); |
| 270 break; | 271 break; |
| 271 default: | 272 default: |
| 272 break; | 273 break; |
| 273 } | 274 } |
| 274 } | 275 } |
| 275 | 276 |
| 276 void processTypeUse(TypeUse typeUse) { | 277 void processTypeUse(TypeUse typeUse) { |
| 277 DartType type = typeUse.type; | 278 ResolutionDartType type = typeUse.type; |
| 278 switch (typeUse.kind) { | 279 switch (typeUse.kind) { |
| 279 case TypeUseKind.INSTANTIATION: | 280 case TypeUseKind.INSTANTIATION: |
| 280 _registerInstantiatedType(type, globalDependency: false); | 281 _registerInstantiatedType(type, globalDependency: false); |
| 281 break; | 282 break; |
| 282 case TypeUseKind.MIRROR_INSTANTIATION: | 283 case TypeUseKind.MIRROR_INSTANTIATION: |
| 283 _registerInstantiatedType(type, | 284 _registerInstantiatedType(type, |
| 284 mirrorUsage: true, globalDependency: false); | 285 mirrorUsage: true, globalDependency: false); |
| 285 break; | 286 break; |
| 286 case TypeUseKind.NATIVE_INSTANTIATION: | 287 case TypeUseKind.NATIVE_INSTANTIATION: |
| 287 _registerInstantiatedType(type, | 288 _registerInstantiatedType(type, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 298 } | 299 } |
| 299 break; | 300 break; |
| 300 case TypeUseKind.TYPE_LITERAL: | 301 case TypeUseKind.TYPE_LITERAL: |
| 301 if (type.isTypedef) { | 302 if (type.isTypedef) { |
| 302 universe.registerTypedef(type.element); | 303 universe.registerTypedef(type.element); |
| 303 } | 304 } |
| 304 break; | 305 break; |
| 305 } | 306 } |
| 306 } | 307 } |
| 307 | 308 |
| 308 void _registerIsCheck(DartType type) { | 309 void _registerIsCheck(ResolutionDartType type) { |
| 309 type = _universe.registerIsCheck(type); | 310 type = _universe.registerIsCheck(type); |
| 310 // Even in checked mode, type annotations for return type and argument | 311 // Even in checked mode, type annotations for return type and argument |
| 311 // types do not imply type checks, so there should never be a check | 312 // types do not imply type checks, so there should never be a check |
| 312 // against the type variable of a typedef. | 313 // against the type variable of a typedef. |
| 313 assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef); | 314 assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef); |
| 314 } | 315 } |
| 315 | 316 |
| 316 void _registerClosurizedMember(MemberElement element) { | 317 void _registerClosurizedMember(MemberElement element) { |
| 317 assert(element.isInstanceMember); | 318 assert(element.isInstanceMember); |
| 318 if (element.type.containsTypeVariables) { | 319 if (element.type.containsTypeVariables) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 @override | 542 @override |
| 542 WorkItem createWorkItem(MemberElement element) { | 543 WorkItem createWorkItem(MemberElement element) { |
| 543 assert(invariant(element, element.isDeclaration)); | 544 assert(invariant(element, element.isDeclaration)); |
| 544 if (element.isMalformed) return null; | 545 if (element.isMalformed) return null; |
| 545 | 546 |
| 546 assert(invariant(element, element is AnalyzableElement, | 547 assert(invariant(element, element is AnalyzableElement, |
| 547 message: 'Element $element is not analyzable.')); | 548 message: 'Element $element is not analyzable.')); |
| 548 return _resolution.createWorkItem(element); | 549 return _resolution.createWorkItem(element); |
| 549 } | 550 } |
| 550 } | 551 } |
| OLD | NEW |