Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: pkg/serialization/lib/src/serialization_rule.dart

Issue 86193003: Remove use of deprecated mirror API from pkg/serialization. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/serialization/lib/src/serialization_rule.dart
diff --git a/pkg/serialization/lib/src/serialization_rule.dart b/pkg/serialization/lib/src/serialization_rule.dart
index 49e42ae7885db2724f4bb509a7f85c5a81af7a65..38fafca6d93e187859173e37655e4d6208d57300 100644
--- a/pkg/serialization/lib/src/serialization_rule.dart
+++ b/pkg/serialization/lib/src/serialization_rule.dart
@@ -410,13 +410,17 @@ class MirrorRule extends NamedObjectRule {
if (name.contains(":")) {
var uri = Uri.parse(name);
var libMirror = currentMirrorSystem().libraries[uri];
- return libMirror.classes[new Symbol(type)];
+ var candidate = libMirror.declarations[new Symbol(type)];
+ return candidate is ClassMirror ? candidate : null;
} else {
var symbol = new Symbol(name);
var typeSymbol = new Symbol(type);
- var libMirror = currentMirrorSystem().libraries.values.firstWhere(
- (lib) => lib.simpleName == symbol && lib.classes[typeSymbol] != null);
- return libMirror.classes[typeSymbol];
+ for (var libMirror in currentMirrorSystem().libraries.values) {
+ if (libMirror.simpleName != symbol) continue;
+ var candidate = libMirror.declarations[typeSymbol];
+ if (candidate != null && candidate is ClassMirror) return candidate;
+ }
+ return null;
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698