Chromium Code Reviews| Index: pkg/analyzer/lib/src/generated/resolver.dart |
| diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart |
| index 71d2e7b9ee3e69c16de835b4b74fadfe759730eb..aef1d881cd77f3bbfe49fba85d48b479f07be3fe 100644 |
| --- a/pkg/analyzer/lib/src/generated/resolver.dart |
| +++ b/pkg/analyzer/lib/src/generated/resolver.dart |
| @@ -9613,13 +9613,69 @@ abstract class TypeProvider { |
| * Return the type representing typenames that can't be resolved. |
| */ |
| DartType get undefinedType; |
| + |
| + /** |
| + * Return 'true' if [id] is the name of a getter on |
| + * the Object type. |
| + */ |
| + bool isObjectGetter(SimpleIdentifier id); |
|
Jennifer Messerly
2016/08/17 21:26:24
maybe pass in the String name here? it seems like
Leaf
2016/08/17 22:07:05
Done.
|
| + |
| + /** |
| + * Return 'true' if [id] is the name of a method on |
| + * the Object type. |
| + */ |
| + bool isObjectMethod(SimpleIdentifier id); |
| + |
| + /** |
| + * Return 'true' if [id] is the name of a method or getter on |
| + * the Object type. |
| + */ |
| + bool isObjectProperty(SimpleIdentifier id); |
|
Brian Wilkerson
2016/08/17 21:24:15
I think the analyzer code is generally fairly cons
Leaf
2016/08/17 22:07:05
Done.
|
| +} |
| + |
| +/** |
| + * Provide common functionality shared by the various TypeProvider |
| + * implementations |
|
Jennifer Messerly
2016/08/17 21:26:24
nit: should end with period
Leaf
2016/08/17 22:07:05
Done.
|
| + */ |
| +abstract class TypeProviderBaseMixin { |
| + InterfaceType get boolType; |
|
Brian Wilkerson
2016/08/17 21:24:15
Should this just implement TypeProvider (rather th
Leaf
2016/08/17 22:07:05
Nice. Didn't realize you could do this, much bett
|
| + InterfaceType get doubleType; |
| + InterfaceType get intType; |
| + List<InterfaceType> get nonSubtypableTypes => <InterfaceType>[ |
| + nullType, |
| + numType, |
| + intType, |
| + doubleType, |
| + boolType, |
| + stringType |
| + ]; |
| + InterfaceType get nullType; |
| + InterfaceType get numType; |
| + InterfaceType get objectType; |
| + InterfaceType get stringType; |
| + |
| + bool isObjectGetter(SimpleIdentifier id) { |
| + PropertyAccessorElement element = objectType.element.getGetter(id.name); |
| + return (element != null && !element.isStatic); |
| + } |
| + |
| + bool isObjectMethod(SimpleIdentifier id) { |
| + MethodElement element = objectType.element.getMethod(id.name); |
| + return (element != null && !element.isStatic); |
| + } |
| + |
| + bool isObjectProperty(SimpleIdentifier id) { |
| + return isObjectGetter(id) || isObjectMethod(id); |
| + } |
| } |
| /** |
| * Instances of the class `TypeProviderImpl` provide access to types defined by the language |
| * by looking for those types in the element model for the core library. |
| */ |
| -class TypeProviderImpl implements TypeProvider { |
| +class TypeProviderImpl extends Object |
| + with TypeProviderBaseMixin |
|
Jennifer Messerly
2016/08/17 21:26:24
in current Dart, this is equivalent to "extends Ty
Leaf
2016/08/17 22:07:05
Done.
|
| + implements TypeProvider { |
| /** |
| * The type representing the built-in type 'bool'. |
| */ |
| @@ -9809,16 +9865,6 @@ class TypeProviderImpl implements TypeProvider { |
| InterfaceType get mapType => _mapType; |
| @override |
| - List<InterfaceType> get nonSubtypableTypes => <InterfaceType>[ |
| - nullType, |
| - numType, |
| - intType, |
| - doubleType, |
| - boolType, |
| - stringType |
| - ]; |
| - |
| - @override |
| DartObjectImpl get nullObject { |
| if (_nullObject == null) { |
| _nullObject = new DartObjectImpl(nullType, NullState.NULL_STATE); |