diff --git a/angel_container/CHANGELOG.md b/angel_container/CHANGELOG.md index 91e2b33b..4ca4d534 100644 --- a/angel_container/CHANGELOG.md +++ b/angel_container/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.0.0-alpha.4 +* Safely handle `void` return types of methods. + # 1.0.0-alpha.3 * Reflecting `void` in `MirrorsReflector` now forwards to `dynamic`. diff --git a/angel_container/lib/src/mirrors/reflector.dart b/angel_container/lib/src/mirrors/reflector.dart index 9cf6f9f8..ca865dd2 100644 --- a/angel_container/lib/src/mirrors/reflector.dart +++ b/angel_container/lib/src/mirrors/reflector.dart @@ -33,7 +33,7 @@ class MirrorsReflector implements Reflector { ReflectedType reflectType(Type type) { var mirror = dart.reflectType(type); - if (mirror.hasReflectedType) { + if (!mirror.hasReflectedType) { return reflectType(dynamic); } else { if (mirror is dart.ClassMirror) { @@ -185,8 +185,10 @@ class _ReflectedMethodMirror extends ReflectedFunction { mirror.metadata .map((mirror) => new _ReflectedInstanceMirror(mirror)) .toList(), - const MirrorsReflector() - .reflectType(mirror.returnType.reflectedType), + !mirror.returnType.hasReflectedType + ? const MirrorsReflector().reflectType(dynamic) + : const MirrorsReflector() + .reflectType(mirror.returnType.reflectedType), mirror.parameters.map(_reflectParameter).toList(), mirror.isGetter, mirror.isSetter); diff --git a/angel_container/pubspec.yaml b/angel_container/pubspec.yaml index cb6329d3..963dc15f 100644 --- a/angel_container/pubspec.yaml +++ b/angel_container/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_container -version: 1.0.0-alpha.3 +version: 1.0.0-alpha.4 author: Tobe O 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