Reflecting void in MirrorsReflector now forwards to dynamic.

This commit is contained in:
Tobe O 2018-08-20 22:32:06 -04:00
parent cb977c84e2
commit a9c1b7ff0d
3 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,6 @@
# 1.0.0-alpha.4
* Safely handle `void` return types of methods.
# 1.0.0-alpha.3 # 1.0.0-alpha.3
* Reflecting `void` in `MirrorsReflector` now forwards to `dynamic`. * Reflecting `void` in `MirrorsReflector` now forwards to `dynamic`.

View file

@ -33,7 +33,7 @@ class MirrorsReflector implements Reflector {
ReflectedType reflectType(Type type) { ReflectedType reflectType(Type type) {
var mirror = dart.reflectType(type); var mirror = dart.reflectType(type);
if (mirror.hasReflectedType) { if (!mirror.hasReflectedType) {
return reflectType(dynamic); return reflectType(dynamic);
} else { } else {
if (mirror is dart.ClassMirror) { if (mirror is dart.ClassMirror) {
@ -185,8 +185,10 @@ class _ReflectedMethodMirror extends ReflectedFunction {
mirror.metadata mirror.metadata
.map((mirror) => new _ReflectedInstanceMirror(mirror)) .map((mirror) => new _ReflectedInstanceMirror(mirror))
.toList(), .toList(),
const MirrorsReflector() !mirror.returnType.hasReflectedType
.reflectType(mirror.returnType.reflectedType), ? const MirrorsReflector().reflectType(dynamic)
: const MirrorsReflector()
.reflectType(mirror.returnType.reflectedType),
mirror.parameters.map(_reflectParameter).toList(), mirror.parameters.map(_reflectParameter).toList(),
mirror.isGetter, mirror.isGetter,
mirror.isSetter); mirror.isSetter);

View file

@ -1,5 +1,5 @@
name: angel_container name: angel_container
version: 1.0.0-alpha.3 version: 1.0.0-alpha.4
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
description: "A better IoC container and dependency injector for Angel, ultimately allowing Angel to be used without dart:mirrors." description: "A better IoC container and dependency injector for Angel, ultimately allowing Angel to be used without dart:mirrors."
homepage: https://github.com/angel-dart/container.git homepage: https://github.com/angel-dart/container.git