Fix strong mode errors (closes #56) (#58)
diff --git a/lib/build/initializer_plugin.dart b/lib/build/initializer_plugin.dart
index f049df0..cc8a7d2 100644
--- a/lib/build/initializer_plugin.dart
+++ b/lib/build/initializer_plugin.dart
@@ -302,9 +302,9 @@
object.toIntValue() ??
object.toStringValue();
if (value == null) {
- value = object.toListValue();
- if (value != null) {
- return value.map((DartObject element) => _getValue(element)).toList();
+ List list = object.toListValue();
+ if (list != null) {
+ return list.map((DartObject element) => _getValue(element)).toList();
}
Map<DartObject, DartObject> map = object.toMapValue();
if (map != null) {
diff --git a/lib/src/initializer.dart b/lib/src/initializer.dart
index 60a04d5..bb50558 100644
--- a/lib/src/initializer.dart
+++ b/lib/src/initializer.dart
@@ -41,8 +41,9 @@
const LibraryIdentifier(this.name, this.package, this.path);
- bool operator ==(LibraryIdentifier other) =>
- name == other.name && package == other.package && path == other.path;
+ bool operator ==(dynamic other) =>
+ other is LibraryIdentifier && name == other.name && package == other.package &&
+ path == other.path;
String toString() => '$name: $package:$path';
}
diff --git a/lib/src/mirror_loader.dart b/lib/src/mirror_loader.dart
index 11722c1..cbd2a60 100644
--- a/lib/src/mirror_loader.dart
+++ b/lib/src/mirror_loader.dart
@@ -8,8 +8,8 @@
import 'package:path/path.dart' as path;
import 'package:initialize/initialize.dart';
-final _root = currentMirrorSystem().isolate.rootLibrary;
-final _libs = currentMirrorSystem().libraries;
+final LibraryMirror _root = currentMirrorSystem().isolate.rootLibrary;
+final Map<Uri, LibraryMirror> _libs = currentMirrorSystem().libraries;
Queue<Function> loadInitializers(
{List<Type> typeFilter, InitializerFilter customFilter, Uri from}) {
diff --git a/lib/transformer.dart b/lib/transformer.dart
index 34acd4a..25adeef 100644
--- a/lib/transformer.dart
+++ b/lib/transformer.dart
@@ -271,9 +271,9 @@
var metaNodes;
var node = element.computeNode();
if (node is SimpleIdentifier && node.parent is LibraryIdentifier) {
- metaNodes = node.parent.parent.metadata;
+ metaNodes = (node.parent.parent as AnnotatedNode).metadata;
} else if (node is ClassDeclaration || node is FunctionDeclaration) {
- metaNodes = node.metadata;
+ metaNodes = (node as AnnotatedNode).metadata;
} else {
return found;
}
@@ -283,7 +283,9 @@
var meta = metaNode.elementAnnotation;
var e = meta.element;
if (e is PropertyAccessorElement) {
- return _isInitializer(e.variable.evaluationResult.value.type);
+ // 'as dynamic' is because evaluationResult is a property on an impl class, e.g. one that
+ // isn't supposed to be used externally.
+ return _isInitializer((e.variable as dynamic).evaluationResult.value.type);
} else if (e is ConstructorElement) {
return _isInitializer(e.returnType);
}