| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 '../common.dart'; | 5 import '../common.dart'; |
| 6 import '../common/registry.dart' show Registry; | 6 import '../common/registry.dart' show Registry; |
| 7 import '../compiler.dart' show Compiler; | 7 import '../compiler.dart' show Compiler; |
| 8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
| 9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder(); | 50 final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder(); |
| 51 | 51 |
| 52 TypeVariableHandler(this._compiler); | 52 TypeVariableHandler(this._compiler); |
| 53 | 53 |
| 54 ClassElement get _typeVariableClass => _backend.helpers.typeVariableClass; | 54 ClassElement get _typeVariableClass => _backend.helpers.typeVariableClass; |
| 55 CodeEmitterTask get _task => _backend.emitter; | 55 CodeEmitterTask get _task => _backend.emitter; |
| 56 MetadataCollector get _metadataCollector => _task.metadataCollector; | 56 MetadataCollector get _metadataCollector => _task.metadataCollector; |
| 57 JavaScriptBackend get _backend => _compiler.backend; | 57 JavaScriptBackend get _backend => _compiler.backend; |
| 58 DiagnosticReporter get reporter => _compiler.reporter; | 58 DiagnosticReporter get reporter => _compiler.reporter; |
| 59 | 59 |
| 60 void onQueueEmpty(Enqueuer enqueuer) { | 60 /// Compute the [WorldImpact] for the type variables registered since last |
| 61 if (enqueuer.isResolutionQueue) return; | 61 /// flush. |
| 62 | 62 WorldImpact flush({bool forResolution}) { |
| 63 enqueuer.applyImpact(null, impactBuilder.flush()); | 63 if (forResolution) return const WorldImpact(); |
| 64 return impactBuilder.flush(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 void registerClassWithTypeVariables( | 67 void registerClassWithTypeVariables( |
| 67 ClassElement cls, Enqueuer enqueuer, Registry registry) { | 68 ClassElement cls, Enqueuer enqueuer, Registry registry) { |
| 68 if (enqueuer.isResolutionQueue) { | 69 if (enqueuer.isResolutionQueue) { |
| 69 // On first encounter, we have to ensure that the support classes get | 70 // On first encounter, we have to ensure that the support classes get |
| 70 // resolved. | 71 // resolved. |
| 71 if (!_seenClassesWithTypeVariables) { | 72 if (!_seenClassesWithTypeVariables) { |
| 72 _backend.enqueueClass(enqueuer, _typeVariableClass, registry); | 73 _backend.enqueueClass(enqueuer, _typeVariableClass, registry); |
| 73 _typeVariableClass.ensureResolved(_compiler.resolution); | 74 _typeVariableClass.ensureResolved(_compiler.resolution); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 169 } |
| 169 | 170 |
| 170 List<jsAst.Expression> typeVariablesOf(ClassElement classElement) { | 171 List<jsAst.Expression> typeVariablesOf(ClassElement classElement) { |
| 171 List<jsAst.Expression> result = _typeVariables[classElement]; | 172 List<jsAst.Expression> result = _typeVariables[classElement]; |
| 172 if (result == null) { | 173 if (result == null) { |
| 173 result = const <jsAst.Expression>[]; | 174 result = const <jsAst.Expression>[]; |
| 174 } | 175 } |
| 175 return result; | 176 return result; |
| 176 } | 177 } |
| 177 } | 178 } |
| OLD | NEW |