Index: sdk/lib/_internal/lib/js_mirrors.dart |
diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart |
index 88decfe41e335b24be18c46d811b255c54ac3a03..e826fd2078bb0e17687005b00375501bef72c587 100644 |
--- a/sdk/lib/_internal/lib/js_mirrors.dart |
+++ b/sdk/lib/_internal/lib/js_mirrors.dart |
@@ -29,7 +29,8 @@ import 'dart:_js_helper' show |
runtimeTypeToString; |
import 'dart:_interceptors' show |
Interceptor, |
- JSExtendableArray; |
+ JSExtendableArray, |
+ getInterceptor; |
ahe
2013/08/30 20:40:14
I think you can remove this import if my suggestio
rmacnak
2013/08/30 21:08:29
Done.
|
import 'dart:_js_names'; |
/// No-op method that is called to inform the compiler that tree-shaking needs |
@@ -677,6 +678,22 @@ class JsInstanceMirror extends JsObjectMirror implements InstanceMirror { |
return JSInvocationMirror.invokeFromMirror(invocation, reflectee); |
} |
+ operator ==(other) { |
+ return other is JsInstanceMirror && |
+ identical(reflectee, other.reflectee); |
+ } |
+ |
+ int get hashCode { |
+ // If the reflectee is intercepted, use the base hashCode to preserve the |
+ // illusion that, e.g. doubles, with the same value are identical. |
+ // Otherwise, use the primitive identity hash to maintain correctness even |
+ // if a user-defined hashCode returns different values for successive |
+ // invocations. |
+ return getInterceptor(reflectee) is Interceptor |
ahe
2013/08/30 20:40:14
I think other native types, such as DivElement, wi
rmacnak
2013/08/30 21:08:29
Done, but I have to also separate out null. typeof
|
+ ? reflectee.hashCode |
+ : Primitives.objectHashCode(reflectee); |
+ } |
+ |
String toString() => 'InstanceMirror on ${Error.safeToString(reflectee)}'; |
// TODO(ahe): Remove this method from the API. |