Chromium Code Reviews| Index: reflectable/lib/src/mirrors_unimpl.dart |
| diff --git a/reflectable/lib/src/mirrors_unimpl.dart b/reflectable/lib/src/mirrors_unimpl.dart |
| index 82b0412825a54d4985271d8c1092afc0a1635d24..2364785770b49ad36ab5d376834f31b2c9cb3632 100644 |
| --- a/reflectable/lib/src/mirrors_unimpl.dart |
| +++ b/reflectable/lib/src/mirrors_unimpl.dart |
| @@ -29,52 +29,17 @@ bool get isTransformed => true; |
| _unsupported() => throw new UnimplementedError(); |
| -abstract class DeclarationMirrorUnimpl implements DeclarationMirror { |
| - String get simpleName => _unsupported(); |
| - String get qualifiedName => _unsupported(); |
| - DeclarationMirror get owner => _unsupported(); |
| - bool get isPrivate => _unsupported(); |
| - bool get isTopLevel => _unsupported(); |
| - SourceLocation get location => _unsupported(); |
| - List<Object> get metadata => _unsupported(); |
| -} |
| - |
| -abstract class ObjectMirrorUnimpl implements ObjectMirror { |
| - Object invoke(String memberName, List positionalArguments, |
| - [Map<Symbol, dynamic> namedArguments]) => _unsupported(); |
| - Object invokeGetter(String getterName) => _unsupported(); |
| - Object invokeSetter(String setterName, Object value) => _unsupported(); |
| - |
| - Object getField(String name) { |
| - throw new UnsupportedError("Use invokeGetter instead of getField"); |
| - } |
| - |
| - void setField(String name, Object value) { |
| - throw new UnsupportedError("Use invokeSetter instead of setField"); |
| - } |
| -} |
| - |
| -abstract class InstanceMirrorUnimpl extends ObjectMirrorUnimpl |
| - implements InstanceMirror { |
| - ClassMirror get type => _unsupported(); |
| - bool get hasReflectee => _unsupported(); |
| - get reflectee => _unsupported(); |
| - bool operator ==(other) => _unsupported(); |
| - int get hashCode => _unsupported(); |
| - delegate(Invocation invocation) => _unsupported(); |
| -} |
| - |
| /// Invokes a getter on an object. |
| -typedef Object InvokerOfGetter(Object instance); |
| +typedef Object _InvokerOfGetter(Object instance); |
| /// Invokes a setter on an object. |
| -typedef Object InvokerOfSetter(Object instance, Object value); |
| +typedef Object _InvokerOfSetter(Object instance, Object value); |
| /// Invokes a static getter. |
| -typedef Object StaticGetter(); |
| +typedef Object _StaticGetter(); |
| /// Invokes a setter on an object. |
| -typedef Object StaticSetter(Object value); |
| +typedef Object _StaticSetter(Object value); |
| /// The data backing a reflector. |
| class ReflectorData { |
| @@ -84,7 +49,7 @@ class ReflectorData { |
| final List<ClassMirror> classMirrors; |
| /// Repository of method mirrors used (via indices into this list) by |
| - /// the above class mirrors to describe the behavior of the mirrored |
| + /// the [classMirrors] to describe the behavior of the mirrored |
| /// class and its instances, and of variable mirrors used to describe |
| /// their state. From the behavioral point of view there are no fields, |
| /// but each of them gives rise to a getter and possibly a setter (whose |
| @@ -97,6 +62,10 @@ class ReflectorData { |
| /// redundancy in the stored information. |
| final List<DeclarationMirror> memberMirrors; |
| + /// Repository of parameter mirrors used (via indices into this list) by |
| + /// the [memberMirrors] to describe the parameters of methods |
| + final List<ParameterMirror> parameterMirrors; |
| + |
| /// List of [Type]s used to select class mirrors: If M is a class |
| /// mirror in [classMirrors] at index `i`, the mirrored class (and |
| /// hence the runtime type of the mirrored instances) is found in |
| @@ -105,17 +74,17 @@ class ReflectorData { |
| /// Map from getter names to closures accepting an instance and returning |
| /// the result of invoking the getter with that name on that instance. |
| - final Map<String, InvokerOfGetter> getters; |
| + final Map<String, _InvokerOfGetter> getters; |
| /// Map from setter names to closures accepting an instance and a new value, |
| /// invoking the setter of that name on that instance, and returning its |
| /// return value. |
| - final Map<String, InvokerOfSetter> setters; |
| + final Map<String, _InvokerOfSetter> setters; |
| Map<Type, ClassMirror> _typeToClassMirrorCache; |
| - ReflectorData(this.classMirrors, this.memberMirrors, this.types, this.getters, |
| - this.setters); |
| + ReflectorData(this.classMirrors, this.memberMirrors, this.parameterMirrors, |
| + this.types, this.getters, this.setters); |
| /// Returns a class-mirror for the given [type]. |
| /// |
| @@ -135,20 +104,24 @@ Map<Reflectable, ReflectorData> data = throw new StateError( |
| "Did you forget to add the main file to the " |
| "reflectable transformer's entry_points in pubspec.yaml?"); |
| -class InstanceMirrorImpl implements InstanceMirror { |
| + |
| +abstract class _DataCaching { |
| ReflectorData _dataCache; |
| + ReflectableImpl get _reflector; |
| + |
| ReflectorData get _data { |
| if (_dataCache == null) { |
| - _dataCache = data[_reflectable]; |
| + _dataCache = data[_reflector]; |
|
floitsch
2015/08/13 17:33:36
Why is this lazy? It's just a lookup into a map. T
eernst
2015/08/14 12:05:34
We have done that for a while, I just created the
floitsch
2015/08/17 14:32:23
Why is it not filled at construction?
eernst
2015/08/19 13:41:56
Could do that, check https://codereview.chromium.o
|
| } |
| return _dataCache; |
| } |
| +} |
| - final ReflectableImpl _reflectable; |
| - |
| +class _InstanceMirrorImpl extends _DataCaching implements InstanceMirror { |
| + final ReflectableImpl _reflector; |
| final Object reflectee; |
| - InstanceMirrorImpl(this.reflectee, this._reflectable) { |
| + _InstanceMirrorImpl(this.reflectee, this._reflector) { |
| _type = _data.classMirrorForType(reflectee.runtimeType); |
| if (_type == null) { |
| throw new NoSuchCapabilityError( |
| @@ -174,12 +147,12 @@ class InstanceMirrorImpl implements InstanceMirror { |
| bool get hasReflectee => true; |
| bool operator ==(other) { |
| - return other is InstanceMirrorImpl && |
| - other._reflectable == _reflectable && |
| + return other is _InstanceMirrorImpl && |
| + other._reflector == _reflector && |
| other.reflectee == reflectee; |
| } |
| - int get hashCode => reflectee.hashCode ^ _reflectable.hashCode; |
| + int get hashCode => reflectee.hashCode ^ _reflector.hashCode; |
| delegate(Invocation invocation) => _unsupported(); |
| @@ -205,52 +178,6 @@ class InstanceMirrorImpl implements InstanceMirror { |
| } |
| } |
| -abstract class ClosureMirrorUnimpl extends InstanceMirrorUnimpl |
| - implements ClosureMirror { |
| - MethodMirror get function => _unsupported(); |
| - InstanceMirror apply(List positionalArguments, |
| - [Map<Symbol, dynamic> namedArguments]) => _unsupported(); |
| -} |
| - |
| -abstract class LibraryMirrorUnimpl extends DeclarationMirrorUnimpl |
| - with ObjectMirrorUnimpl implements LibraryMirror { |
| - Uri get uri => _unsupported(); |
| - Map<String, DeclarationMirror> get declarations => _unsupported(); |
| - bool operator ==(other) => _unsupported(); |
| - int get hashCode => _unsupported(); |
| - List<LibraryDependencyMirror> get libraryDependencies => _unsupported(); |
| -} |
| - |
| -class LibraryDependencyMirrorUnimpl implements LibraryDependencyMirror { |
| - bool get isImport => _unsupported(); |
| - bool get isExport => _unsupported(); |
| - bool get isDeferred => _unsupported(); |
| - LibraryMirror get sourceLibrary => _unsupported(); |
| - LibraryMirror get targetLibrary => _unsupported(); |
| - String get prefix => _unsupported(); |
| - List<CombinatorMirror> get combinators => _unsupported(); |
| - SourceLocation get location => _unsupported(); |
| - List<Object> get metadata => _unsupported(); |
| -} |
| - |
| -abstract class CombinatorMirrorUnimpl implements CombinatorMirror { |
| - List<String> get identifiers => _unsupported(); |
| - bool get isShow => _unsupported(); |
| - bool get isHide => _unsupported(); |
| -} |
| - |
| -abstract class TypeMirrorUnimpl extends DeclarationMirrorUnimpl |
| - implements TypeMirror { |
| - bool get hasReflectedType => _unsupported(); |
| - Type get reflectedType => _unsupported(); |
| - List<TypeVariableMirror> get typeVariables => _unsupported(); |
| - List<TypeMirror> get typeArguments => _unsupported(); |
| - bool get isOriginalDeclaration => _unsupported(); |
| - TypeMirror get originalDeclaration => _unsupported(); |
| - bool isSubtypeOf(TypeMirror other) => _unsupported(); |
| - bool isAssignableTo(TypeMirror other) => _unsupported(); |
| -} |
| - |
| int _variableToImplicitAccessorAttributes(VariableMirror variableMirror) { |
| int attributes = 0; |
| if (variableMirror.isPrivate) attributes |= constants.privateAttribute; |
| @@ -262,29 +189,32 @@ int _variableToImplicitAccessorAttributes(VariableMirror variableMirror) { |
| MethodMirror _variableToGetterMirror(VariableMirrorImpl variableMirror) { |
| int descriptor = constants.getter; |
| descriptor |= _variableToImplicitAccessorAttributes(variableMirror); |
| + // TODO(eernst) clarify: Make sure it is the right `ownerIndex`: Write a test |
| + // that compares owners in pre/post-transform code. |
| return new MethodMirrorImpl(variableMirror.simpleName, descriptor, |
| - variableMirror.ownerIndex, variableMirror.reflectable, []); |
| + variableMirror._ownerIndex, [], variableMirror._reflector, []); |
| } |
| +// TODO(eernst) implement: Make this method take an `index` parameter which |
| +// will be the index of the returned `MethodMirror`, such that the enclosed |
| +// parameter mirror can get the right ownerIndex. |
| MethodMirror _variableToSetterMirror(VariableMirrorImpl variableMirror) { |
| - int descriptor = constants.setter; |
| + int descriptor = constants.setter | constants.syntheticAttribute; |
| descriptor |= _variableToImplicitAccessorAttributes(variableMirror); |
| - return new MethodMirrorImpl(variableMirror.simpleName + "=", descriptor, |
| - variableMirror.ownerIndex, variableMirror.reflectable, []); |
| + int parameterDescriptor = constants.parameter | constants.syntheticAttribute; |
| + String name = variableMirror.simpleName + "="; |
| + return new MethodMirrorImpl(name, descriptor, variableMirror._ownerIndex, |
| + [ // TODO(eernst) clarify: Make sure it is the right `ownerIndex`: Write a |
| + // test that compares owners in pre/post-transform code. |
|
floitsch
2015/08/13 17:33:36
What's missing to write the test?
floitsch
2015/08/17 14:32:23
?
eernst
2015/08/19 13:41:56
Oops, forgot that. Turned out to require more refa
|
| + new ParameterMirrorImpl(name, parameterDescriptor, |
| + variableMirror._ownerIndex, variableMirror._reflector, [], null, -1)], |
|
floitsch
2015/08/13 17:33:36
long line.
eernst
2015/08/14 12:05:34
Fixed. Btw, doing the usual 'Reformat with Dart st
|
| + variableMirror._reflector, []); |
| } |
| -class ClassMirrorImpl implements ClassMirror { |
| - ReflectorData _dataCache; |
| - ReflectorData get _data { |
| - if (_dataCache == null) { |
| - _dataCache = data[_reflectable]; |
| - } |
| - return _dataCache; |
| - } |
| - |
| +class ClassMirrorImpl extends _DataCaching implements ClassMirror { |
| /// The reflector which represents the mirror system that this |
| /// mirror belongs to. |
| - final ReflectableImpl _reflectable; |
| + final ReflectableImpl _reflector; |
| /// The index of this mirror in the [ReflectorData.classMirrors] table. |
| /// Also this is the index of the Type of the reflected class in |
| @@ -310,12 +240,12 @@ class ClassMirrorImpl implements ClassMirror { |
| final String simpleName; |
| final String qualifiedName; |
| final List<Object> _metadata; |
| - final Map<String, StaticGetter> getters; |
| - final Map<String, StaticSetter> setters; |
| + final Map<String, _StaticGetter> getters; |
| + final Map<String, _StaticSetter> setters; |
| final Map<String, Function> constructors; |
| ClassMirrorImpl(this.simpleName, this.qualifiedName, this._classIndex, |
| - this._reflectable, this._declarationIndices, this._instanceMemberIndices, |
| + this._reflector, this._declarationIndices, this._instanceMemberIndices, |
| this._superclassIndex, this.getters, this.setters, this.constructors, |
| metadata) |
| : _metadata = (metadata == null) |
| @@ -408,7 +338,7 @@ class ClassMirrorImpl implements ClassMirror { |
| @override |
| Object invoke(String memberName, List positionalArguments, |
| [Map<Symbol, dynamic> namedArguments]) { |
| - StaticGetter getter = getters[memberName]; |
| + _StaticGetter getter = getters[memberName]; |
| if (getter == null) { |
| throw new NoSuchInvokeCapabilityError( |
| reflectedType, memberName, positionalArguments, namedArguments); |
| @@ -419,7 +349,7 @@ class ClassMirrorImpl implements ClassMirror { |
| @override |
| Object invokeGetter(String getterName) { |
| - StaticGetter getter = getters[getterName]; |
| + _StaticGetter getter = getters[getterName]; |
| if (getter == null) { |
| throw new NoSuchInvokeCapabilityError(reflectedType, getterName, [], {}); |
| } |
| @@ -428,7 +358,7 @@ class ClassMirrorImpl implements ClassMirror { |
| @override |
| Object invokeSetter(String setterName, Object value) { |
| - StaticSetter setter = setters[setterName]; |
| + _StaticSetter setter = setters[setterName]; |
| if (setter == null) { |
| throw new NoSuchInvokeCapabilityError( |
| reflectedType, setterName, [value], {}); |
| @@ -500,42 +430,7 @@ class ClassMirrorImpl implements ClassMirror { |
| // operations. |
| } |
| -abstract class TypeVariableMirrorUnimpl extends TypeMirrorUnimpl |
| - implements TypeVariableMirror { |
| - TypeMirror get upperBound => _unsupported(); |
| - bool get isStatic => _unsupported(); |
| - bool operator ==(other) => _unsupported(); |
| - int get hashCode => _unsupported(); |
| -} |
| - |
| -abstract class TypedefMirrorUnimpl extends TypeMirrorUnimpl |
| - implements TypedefMirror { |
| - FunctionTypeMirror get referent => _unsupported(); |
| -} |
| - |
| -abstract class MethodMirrorUnimpl extends DeclarationMirrorUnimpl |
| - implements MethodMirror { |
| - TypeMirror get returnType => _unsupported(); |
| - String get source => _unsupported(); |
| - List<ParameterMirror> get parameters => _unsupported(); |
| - bool get isStatic => _unsupported(); |
| - bool get isAbstract => _unsupported(); |
| - bool get isSynthetic => _unsupported(); |
| - bool get isRegularMethod => _unsupported(); |
| - bool get isOperator => _unsupported(); |
| - bool get isGetter => _unsupported(); |
| - bool get isSetter => _unsupported(); |
| - bool get isConstructor => _unsupported(); |
| - String get constructorName => _unsupported(); |
| - bool get isConstConstructor => _unsupported(); |
| - bool get isGenerativeConstructor => _unsupported(); |
| - bool get isRedirectingConstructor => _unsupported(); |
| - bool get isFactoryConstructor => _unsupported(); |
| - bool operator ==(other) => _unsupported(); |
| - int get hashCode => _unsupported(); |
| -} |
| - |
| -class MethodMirrorImpl implements MethodMirror { |
| +class MethodMirrorImpl extends _DataCaching implements MethodMirror { |
| /// An encoding of the attributes and kind of this mirror. |
| final int _descriptor; |
| @@ -545,6 +440,10 @@ class MethodMirrorImpl implements MethodMirror { |
| /// The index of the [ClassMirror] of the owner of this method, |
| final int _ownerIndex; |
| + /// The indices of the [ParameterMirror]s describing the formal parameters |
| + /// of this method. |
| + final List<int> _parameterIndices; |
| + |
| /// The [Reflectable] associated with this mirror. |
| final ReflectableImpl _reflector; |
| @@ -554,14 +453,14 @@ class MethodMirrorImpl implements MethodMirror { |
| final List<Object> _metadata; |
| MethodMirrorImpl(this._name, this._descriptor, this._ownerIndex, |
| - this._reflector, List<Object> metadata) |
| + this._parameterIndices, this._reflector, List<Object> metadata) |
| : _metadata = (metadata == null) |
| ? null |
| : new UnmodifiableListView(metadata); |
| int get kind => constants.kindFromEncoding(_descriptor); |
| - ClassMirror get owner => data[_reflector].classMirrors[_ownerIndex]; |
| + ClassMirror get owner => _data.classMirrors[_ownerIndex]; |
| @override |
| String get constructorName => _name; |
| @@ -610,9 +509,9 @@ class MethodMirrorImpl implements MethodMirror { |
| @override |
| bool get isTopLevel => owner is LibraryMirror; |
| + // It is allowed to return null. |
| @override |
| - SourceLocation get location => |
| - throw new UnsupportedError("Location not supported"); |
| + SourceLocation get location => null; |
| @override |
| List<Object> get metadata { |
| @@ -623,9 +522,12 @@ class MethodMirrorImpl implements MethodMirror { |
| return _metadata; |
| } |
| - // TODO(sigurdm) feature: support `parameters`. |
| @override |
| - List<ParameterMirror> get parameters => throw new UnimplementedError(); |
| + List<ParameterMirror> get parameters { |
| + return _parameterIndices |
| + .map((int parameterIndex) => _data.parameterMirrors[parameterIndex]) |
| + .toList(); |
| + } |
| @override |
| String get qualifiedName => "${owner.qualifiedName}.$_name"; |
| @@ -646,45 +548,33 @@ class MethodMirrorImpl implements MethodMirror { |
| String toString() => "MethodMirror($_name)"; |
| } |
| -abstract class VariableMirrorUnimpl extends DeclarationMirrorUnimpl |
| +abstract class VariableMirrorBase extends _DataCaching |
| implements VariableMirror { |
| - TypeMirror get type => _unsupported(); |
| - bool get isStatic => _unsupported(); |
| - bool get isFinal => _unsupported(); |
| - bool get isConst => _unsupported(); |
| - bool operator ==(other) => _unsupported(); |
| - int get hashCode => _unsupported(); |
| -} |
| - |
| -class VariableMirrorImpl implements VariableMirror { |
| - final int descriptor; |
| - final String name; |
| - final int ownerIndex; |
| - final ReflectableImpl reflectable; |
| + final String _name; |
| + final int _descriptor; |
| + final int _ownerIndex; |
| + final ReflectableImpl _reflector; |
| final List<Object> _metadata; |
| - VariableMirrorImpl(this.name, this.descriptor, this.ownerIndex, |
| - this.reflectable, List<Object> metadata) |
| + VariableMirrorBase(this._name, this._descriptor, this._ownerIndex, |
| + this._reflector, List<Object> metadata) |
| : _metadata = (metadata == null) |
| - ? null |
| - : new UnmodifiableListView(metadata); |
| - |
| - int get kind => constants.kindFromEncoding(descriptor); |
| + ? null : new UnmodifiableListView(metadata); |
| - ClassMirror get owner => data[reflectable].classMirrors[ownerIndex]; |
| + int get kind => constants.kindFromEncoding(_descriptor); |
| @override |
| - String get qualifiedName => "${owner.qualifiedName}.$name"; |
| + bool get isPrivate => 0 != _descriptor & constants.privateAttribute; |
|
floitsch
2015/08/13 17:33:36
parenthesis and put 0 to the right.
eernst
2015/08/14 12:05:34
Done.
Btw, that's a very old C-ish habit: `if (NU
|
| @override |
| - bool get isPrivate => 0 != descriptor & constants.privateAttribute; |
| + bool get isTopLevel => owner is LibraryMirror; |
| @override |
| - bool get isTopLevel => owner is LibraryMirror; |
| + bool get isFinal => 0 != _descriptor & constants.finalAttribute; |
|
floitsch
2015/08/13 17:33:36
ditto. (and probably other locations).
eernst
2015/08/14 12:05:34
Done.
|
| + // It is allowed to return null. |
| @override |
| - SourceLocation get location => |
| - throw new UnsupportedError("Location not supported"); |
| + SourceLocation get location => null; |
| @override |
| List<Object> get metadata { |
| @@ -696,40 +586,145 @@ class VariableMirrorImpl implements VariableMirror { |
| } |
| @override |
| - TypeMirror get type => _unsupported(); |
| + bool operator ==(other) => _unsupported(); |
| @override |
| - bool get isStatic => 0 != descriptor & constants.staticAttribute; |
| + int get hashCode => _unsupported(); |
| @override |
| - bool get isFinal => 0 != descriptor & constants.finalAttribute; |
| + String get simpleName => _name; |
| +} |
| +class VariableMirrorImpl extends VariableMirrorBase { |
| @override |
| - bool get isConst => 0 != descriptor & constants.constAttribute; |
| + ClassMirror get owner => _data.classMirrors[_ownerIndex]; |
| @override |
| - bool operator ==(other) => _unsupported(); |
| + String get qualifiedName => "${owner.qualifiedName}.$_name"; |
| @override |
| - int get hashCode => _unsupported(); |
| + TypeMirror get type => _unsupported(); |
| + |
| + @override |
| + bool get isStatic => 0 != _descriptor & constants.staticAttribute; |
| @override |
| - String get simpleName => name; |
| + bool get isConst => 0 != _descriptor & constants.constAttribute; |
| + |
| + VariableMirrorImpl(String name, int descriptor, int ownerIndex, |
| + ReflectableImpl reflectable, List<Object> metadata) |
| + : super(name, descriptor, ownerIndex, reflectable, metadata); |
| } |
| -abstract class ParameterMirrorUnimpl extends VariableMirrorUnimpl |
| +class ParameterMirrorImpl extends VariableMirrorBase |
| implements ParameterMirror { |
| - TypeMirror get type => _unsupported(); |
| - bool get isOptional => _unsupported(); |
| - bool get isNamed => _unsupported(); |
| - bool get hasDefaultValue => _unsupported(); |
| - Object get defaultValue => _unsupported(); |
| + final _classMirrorIndex; |
| + |
| + @override |
| + final defaultValue; |
| + |
| + @override |
| + bool get isStatic => 0 != _descriptor & constants.staticAttribute; |
| + |
| + @override |
| + bool get isConst => 0 != _descriptor & constants.constAttribute; |
| + |
| + @override |
| + bool get hasDefaultValue => |
| + 0 != _descriptor & constants.hasDefaultValueAttribute; |
| + |
| + @override |
| + bool get isOptional => 0 != _descriptor & constants.optionalAttribute; |
| + |
| + @override |
| + bool get isNamed => 0 != _descriptor & constants.namedAttribute; |
| + |
| + bool get _isDynamic => 0 != _descriptor & constants.dynamicAttribute; |
| + |
| + bool get _isClassType => 0 != _descriptor & constants.classTypeAttribute; |
| + |
| + // TODO(eernst) clarify: A parameter cannot be accessed using dot |
| + // notation, and hence it has no qualified name. So is the following |
| + // behavior correct? |
| + @override |
| + String get qualifiedName { |
| + throw new NoSuchCapabilityError( |
| + "Attempting to get the `qualifiedName` of the parameter $_name."); |
| + } |
| + |
| + @override |
| + MethodMirror get owner => _data.memberMirrors[_ownerIndex]; |
| + |
| + @override |
| + TypeMirror get type { |
| + if (_isDynamic) return new DynamicMirrorImpl(); |
| + if (_isClassType) { |
| + if (_classMirrorIndex == -1) { |
| + throw new NoSuchCapabilityError( |
| + "Attempting to get a class mirror for an un-marked class (type of $_name)"); |
|
floitsch
2015/08/13 17:33:36
long line.
eernst
2015/08/14 12:05:34
Funny, 'Reformat with Dart style' does not output
|
| + } |
| + return _data.classMirrors[_classMirrorIndex]; |
| + } |
| + return _unsupported(); |
| + } |
| + |
| + ParameterMirrorImpl(String name, int descriptor, int ownerIndex, |
| + ReflectableImpl reflectable, List<Object> metadata, this.defaultValue, |
| + this._classMirrorIndex) |
| + : super(name, descriptor, ownerIndex, reflectable, metadata); |
| } |
| -abstract class SourceLocationUnimpl { |
| - int get line => _unsupported(); |
| - int get column => _unsupported(); |
| - Uri get sourceUri => _unsupported(); |
| +class DynamicMirrorImpl implements TypeMirror { |
| + |
| + @override |
| + bool get isPrivate => false; |
| + |
| + @override |
| + bool get isTopLevel => true; |
| + |
| + // TODO(eernst) implement: test what 'dart:mirrors' does, then do the same. |
| + @override |
| + bool get isOriginalDeclaration => true; |
| + |
| + @override |
| + bool get hasReflectedType => true; |
| + |
| + @override |
| + Type get reflectedType => dynamic; |
| + |
| + @override |
| + String get simpleName => "dynamic"; |
| + |
| + // TODO(eernst) implement: do as in 'dart:mirrors'. |
| + @override |
| + List<TypeVariableMirror> get typeVariables => <TypeVariableMirror>[]; |
| + |
| + @override |
| + List<TypeMirror> get typeArguments => <TypeMirror>[]; |
| + |
| + // TODO(eernst) implement: do as in 'dart:mirrors'. |
| + @override |
| + TypeMirror get originalDeclaration => null; |
| + |
| + // It is allowed to return null. |
| + @override |
| + SourceLocation get location => null; |
| + |
| + @override |
| + bool isSubtypeOf(TypeMirror other) => true; |
| + |
| + @override |
| + bool isAssignableTo(TypeMirror other) => true; |
| + |
| + // TODO(eernst) implement: do as 'dart:mirrors' does. |
| + @override |
| + DeclarationMirror get owner => null; |
| + |
| + @override |
| + String get qualifiedName => simpleName; |
| + |
| + @override |
| + List<Object> get metadata => <Object>[]; |
| } |
| abstract class ReflectableImpl extends ReflectableBase |
| @@ -750,7 +745,7 @@ abstract class ReflectableImpl extends ReflectableBase |
| @override |
| InstanceMirror reflect(Object reflectee) { |
| - return new InstanceMirrorImpl(reflectee, this); |
| + return new _InstanceMirrorImpl(reflectee, this); |
| } |
| @override |