Chromium Code Reviews| Index: runtime/lib/mirrors_impl.dart |
| diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart |
| index 88a89cc5a2f220466eb79773bbcc1d36b80ca401..c4b50da005eae93626588e1354635ec0d41a3de8 100644 |
| --- a/runtime/lib/mirrors_impl.dart |
| +++ b/runtime/lib/mirrors_impl.dart |
| @@ -374,7 +374,12 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl |
| // dynamic, void and the function types have their names set eagerly in the |
| // constructor. |
| if(_simpleName == null) { |
| - _simpleName = _s(_name(_reflectee)); |
| + var simpleString = _name(_reflectee); |
| + if (simpleString.contains('&')) { |
| + _simpleName = this._computeMixinApplicationName; |
| + } else { |
| + _simpleName = _s(simpleString); |
| + } |
|
regis
2013/08/20 18:56:37
That answers my question about the missing name in
|
| } |
| return _simpleName; |
| } |
| @@ -417,7 +422,7 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl |
| // Object has no superclass. |
| return null; |
| } |
| - _superclass = reflectClass(supertype); |
| + _superclass = _Mirrors._reflectType(supertype); |
| } |
| return _superclass; |
| } |
| @@ -426,16 +431,43 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl |
| List<ClassMirror> get superinterfaces { |
| if (_superinterfaces == null) { |
| _superinterfaces = _interfaces(_reflectee) |
| - .map((i) => reflectClass(i)).toList(growable:false); |
| + .map((i) => _Mirrors._reflectType(i)).toList(growable:false); |
| } |
| return _superinterfaces; |
| } |
| + get _computeMixinApplicationName { |
| + var mixins = new List<ClassMirror>(); |
| + var klass = this; |
| + while (_computeMixin(klass._reflectee) != null) { |
| + mixins.add(klass.mixin); |
| + klass = klass.superclass; |
| + } |
| + return _s( |
| + _n(klass.qualifiedName) |
| + + ' with ' |
| + + mixins.reversed.map((m)=>_n(m.qualifiedName)).join(', ')); |
| + } |
| + |
| + var _mixin; |
| + ClassMirror get mixin { |
| + if (_mixin == null) { |
| + var mixinType = _computeMixin(_reflectee); |
| + if (mixinType == null) { |
| + // The reflectee is not a mixin application. |
| + _mixin = this; |
| + } else { |
| + _mixin = _Mirrors._reflectType(mixinType); |
| + } |
| + } |
| + return _mixin; |
| + } |
| + |
| Map<Symbol, Mirror> _members; |
| Map<Symbol, Mirror> get members { |
| if (_members == null) { |
| - _members = _makeMemberMap(_computeMembers(_reflectee)); |
| + _members = _makeMemberMap(mixin._computeMembers(_reflectee)); |
| } |
| return _members; |
| } |
| @@ -485,7 +517,10 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl |
| Map<Symbol, MethodMirror> get constructors { |
| if (_constructors == null) { |
| - _constructors = _makeMemberMap(_computeConstructors(_reflectee)); |
| + var constructorsList = _computeConstructors(_reflectee); |
| + var stringName = _n(simpleName); |
| + constructorsList.forEach((c) => c._patchConstructorName(stringName)); |
| + _constructors = _makeMemberMap(constructorsList); |
| } |
| return _constructors; |
| } |
| @@ -593,6 +628,9 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl |
| static _interfaces(reflectee) |
| native "ClassMirror_interfaces"; |
| + static _computeMixin(reflectee) |
| + native "ClassMirror_mixin"; |
| + |
| _computeMembers(reflectee) |
| native "ClassMirror_members"; |
| @@ -675,11 +713,12 @@ class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl |
| abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl |
| implements DeclarationMirror { |
| - _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName); |
| + _LocalDeclarationMirrorImpl(this._reflectee, this._simpleName); |
| final _reflectee; |
| - final Symbol simpleName; |
| + Symbol _simpleName; |
| + Symbol get simpleName => _simpleName; |
| Symbol _qualifiedName = null; |
| Symbol get qualifiedName { |
| @@ -1004,6 +1043,15 @@ class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl |
| return _constructorName; |
| } |
| + void _patchConstructorName(ownerName) { |
| + var cn = _n(constructorName); |
| + if(cn == ''){ |
| + _simpleName = _s(ownerName); |
| + } else { |
| + _simpleName = _s(ownerName + "." + cn); |
| + } |
| + } |
| + |
| final bool isConstConstructor; |
| final bool isGenerativeConstructor; |
| final bool isRedirectingConstructor; |