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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 21381002: Implement mirror equality on the VM. Resolves issue 12026. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 months 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
Index: runtime/lib/mirrors_impl.dart
===================================================================
--- runtime/lib/mirrors_impl.dart (revision 25673)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -296,6 +296,13 @@
String toString() => 'InstanceMirror on ${Error.safeToString(_reflectee)}';
+ bool operator ==(other) {
+ return other is _LocalInstanceMirrorImpl &&
+ identical(_reflectee, other._reflectee);
+ }
+
+ int get hashCode => _reflectee.hashCode;
rmacnak 2013/07/31 18:38:01 _reflectee.hashCode could raise an exception. It t
siva 2013/08/01 00:05:06 Could you explain under what circumstances reflect
ahe 2013/08/06 15:28:11 This hashCode implementation is not compatible wit
+
_invoke(reflectee, functionName, positionalArguments)
native 'InstanceMirror_invoke';
@@ -597,6 +604,13 @@
return _metadata(_reflectee).map(reflect).toList(growable:false);
}
+ bool operator ==(other) {
+ return this.runtimeType == other.runtimeType &&
rmacnak 2013/07/31 18:38:01 other.runtimeType should raise an exception. Is th
siva 2013/08/01 00:05:06 Ditto question about when an exception is raised.
+ this._reflectee == other._reflectee;
+ }
+
+ int get hashCode => simpleName.hashCode;
+
static _name(reflectee)
native "ClassMirror_name";
@@ -692,6 +706,13 @@
// reflect() and then make them into a Dart list.
return _metadata(_reflectee).map(reflect).toList(growable:false);
}
+
+ bool operator ==(other) {
+ return this.runtimeType == other.runtimeType &&
+ this._reflectee == other._reflectee;
+ }
+
+ int get hashCode => simpleName.hashCode;
}
class _LazyTypeVariableMirror {
@@ -901,6 +922,13 @@
String toString() => "LibraryMirror on '${_n(simpleName)}'";
+ bool operator ==(other) {
+ return this.runtimeType == other.runtimeType &&
+ this._reflectee == other._reflectee;
+ }
+
+ int get hashCode => simpleName.hashCode;
+
_invoke(reflectee, memberName, positionalArguments)
native 'LibraryMirror_invoke';
@@ -1144,7 +1172,7 @@
// TODO(11955): Remove once dynamicType and voidType are canonical objects in
// the object store.
- operator ==(other) {
+ bool operator ==(other) {
if (other is! _SpecialTypeMirrorImpl) {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698