| Index: pkg/analyzer/lib/src/dart/element/type.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
|
| index 0f8ec27422f1043550d33383de72ccce8ae0200f..b06d584de2173a51212b0d847aaaeb2807938576 100644
|
| --- a/pkg/analyzer/lib/src/dart/element/type.dart
|
| +++ b/pkg/analyzer/lib/src/dart/element/type.dart
|
| @@ -18,6 +18,11 @@ import 'package:analyzer/src/generated/type_system.dart';
|
| import 'package:analyzer/src/generated/utilities_dart.dart';
|
|
|
| /**
|
| + * Type of callbacks used by [DeferredFunctionTypeImpl].
|
| + */
|
| +typedef FunctionTypedElement FunctionTypedElementComputer();
|
| +
|
| +/**
|
| * A [Type] that represents the type 'bottom'.
|
| */
|
| class BottomTypeImpl extends TypeImpl {
|
| @@ -90,6 +95,41 @@ class CircularTypeImpl extends DynamicTypeImpl {
|
| }
|
|
|
| /**
|
| + * The type of a function, method, constructor, getter, or setter that has been
|
| + * resynthesized from a summary. The actual underlying element won't be
|
| + * constructed until it's needed.
|
| + */
|
| +class DeferredFunctionTypeImpl extends FunctionTypeImpl {
|
| + /**
|
| + * Callback which should be invoked when the element associated with this
|
| + * function type is needed.
|
| + *
|
| + * Once the callback has been invoked, it is set to `null` to reduce GC
|
| + * pressure.
|
| + */
|
| + FunctionTypedElementComputer _computeElement;
|
| +
|
| + /**
|
| + * If [_computeElement] has been called, the value it returned. Otherwise
|
| + * `null`.
|
| + */
|
| + FunctionTypedElement _computedElement;
|
| +
|
| + DeferredFunctionTypeImpl(this._computeElement, String name,
|
| + List<DartType> typeArguments, bool isInstantiated)
|
| + : super._(null, name, null, typeArguments, isInstantiated);
|
| +
|
| + @override
|
| + FunctionTypedElement get element {
|
| + if (_computeElement != null) {
|
| + _computedElement = _computeElement();
|
| + _computeElement = null;
|
| + }
|
| + return _computedElement;
|
| + }
|
| +}
|
| +
|
| +/**
|
| * The [Type] representing the type `dynamic`.
|
| */
|
| class DynamicTypeImpl extends TypeImpl {
|
| @@ -1941,7 +1981,8 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
|
| * If there is a single type which is at least as specific as all of the
|
| * types in [types], return it. Otherwise return `null`.
|
| */
|
| - static DartType _findMostSpecificType(List<DartType> types, TypeSystem typeSystem) {
|
| + static DartType _findMostSpecificType(
|
| + List<DartType> types, TypeSystem typeSystem) {
|
| // The << relation ("more specific than") is a partial ordering on types,
|
| // so to find the most specific type of a set, we keep a bucket of the most
|
| // specific types seen so far such that no type in the bucket is more
|
|
|