Fixed stack overflows

This commit is contained in:
Tobe O 2018-08-17 19:10:33 -04:00
parent a570537bac
commit 83bb384fbc

View file

@ -88,8 +88,8 @@ class _ReflectedClassMirror extends ReflectedClass {
mirror.typeVariables mirror.typeVariables
.map((m) => new _ReflectedTypeParameter(m)) .map((m) => new _ReflectedTypeParameter(m))
.toList(), .toList(),
mirror.metadata.map((m) => new _ReflectedInstanceMirror(m)).toList(), [],
_constructorsOf(mirror), [],
_declarationsOf(mirror), _declarationsOf(mirror),
mirror.reflectedType, mirror.reflectedType,
); );
@ -115,14 +115,21 @@ class _ReflectedClassMirror extends ReflectedClass {
var value = mirror.declarations[key]; var value = mirror.declarations[key];
if (value is dart.MethodMirror && !value.isConstructor) { if (value is dart.MethodMirror && !value.isConstructor) {
out.add(new ReflectedDeclaration(dart.MirrorSystem.getName(key), out.add(new _ReflectedDeclarationMirror(
value.isStatic, new _ReflectedMethodMirror(value))); dart.MirrorSystem.getName(key), value));
} }
} }
return out; return out;
} }
@override
List<ReflectedInstance> get annotations =>
mirror.metadata.map((m) => new _ReflectedInstanceMirror(m)).toList();
@override
List<ReflectedFunction> get constructors => _constructorsOf(mirror);
@override @override
bool isAssignableTo(ReflectedType other) { bool isAssignableTo(ReflectedType other) {
return other is _ReflectedTypeMirror && mirror.isAssignableTo(other.mirror); return other is _ReflectedTypeMirror && mirror.isAssignableTo(other.mirror);
@ -137,6 +144,20 @@ class _ReflectedClassMirror extends ReflectedClass {
} }
} }
class _ReflectedDeclarationMirror extends ReflectedDeclaration {
final String name;
final dart.MethodMirror mirror;
_ReflectedDeclarationMirror(this.name, this.mirror)
: super(name, mirror.isStatic, null);
@override
bool get isStatic => mirror.isStatic;
@override
ReflectedFunction get function => new _ReflectedMethodMirror(mirror);
}
class _ReflectedInstanceMirror extends ReflectedInstance { class _ReflectedInstanceMirror extends ReflectedInstance {
final dart.InstanceMirror mirror; final dart.InstanceMirror mirror;