gen reflectClass method
This commit is contained in:
parent
ccdffe7901
commit
5ca37494cf
2 changed files with 19 additions and 4 deletions
|
@ -48,6 +48,18 @@ class ReflectorLibraryGenerator {
|
|||
clazz.constructors.add(new Constructor((b) {
|
||||
b..constant = true;
|
||||
}));
|
||||
|
||||
// Add a reflectClass that just forwards to reflectType
|
||||
clazz.methods.add(new Method((b) {
|
||||
b
|
||||
..name = 'reflectClass'
|
||||
..returns = refer('ReflectedClass')
|
||||
..annotations.add(refer('override'))
|
||||
..requiredParameters.add(new Parameter((b) => b
|
||||
..name = 'type'
|
||||
..type = refer('Type')))
|
||||
..body = new Code('return reflectType(type) as ReflectedClass;');
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,14 @@ part of angel_container_generator_test;
|
|||
|
||||
class AngelContainerGeneratorTestReflector implements Reflector {
|
||||
const AngelContainerGeneratorTestReflector();
|
||||
|
||||
@override
|
||||
ReflectedClass reflectClass(Type type) {
|
||||
return reflectType(type) as ReflectedClass;
|
||||
}
|
||||
}
|
||||
|
||||
ReflectedClass _reflectedArtistClass = const _ReflectedArtistClass._();
|
||||
|
||||
class _ReflectedArtistClass extends ReflectedClass {
|
||||
const _ReflectedArtistClass._()
|
||||
class _ReflectedArtist extends ReflectedClass {
|
||||
const _ReflectedArtist._()
|
||||
: super('Artist', const [], const [], const [], const [], Artist);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue