Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
| =================================================================== |
| --- sdk/lib/_internal/compiler/implementation/lib/js_helper.dart (revision 23339) |
| +++ sdk/lib/_internal/compiler/implementation/lib/js_helper.dart (working copy) |
| @@ -145,13 +145,13 @@ |
| static int hashCodeSeed = 0; |
| static int objectHashCode(object) { |
| - int hash = JS('var', r'#.$identityHash', object); |
| + int hash = JS('int|Null', r'#.$identityHash', object); |
| if (hash == null) { |
| // TOOD(ahe): We should probably randomize this somehow. |
| hash = ++hashCodeSeed; |
| JS('void', r'#.$identityHash = #', object, hash); |
| } |
| - return hash; |
| + return JS('int', '#', hash); |
| } |
| /** |
| @@ -946,6 +946,28 @@ |
| String toString() => "Closure"; |
| } |
| +class BoundClosure extends Closure { |
| + var self; |
| + var target; |
| + var receiver; |
| + |
| + bool operator==(other) { |
| + if (identical(this, other)) return true; |
| + if (other is! BoundClosure) return false; |
| + return JS('bool', '# === # && # === # && # === #', |
| + this.self, other.self, |
|
kasperl
2013/05/29 13:30:14
Get rid of the this. prefixes.
ngeoffray
2013/05/29 15:33:19
Done.
|
| + this.target, other.target, |
| + this.receiver, other.receiver); |
| + } |
| + |
| + int get hashCode { |
| + return JS('int', '(# + # + #) & 0x3ffffff', |
| + self.hashCode, |
|
kasperl
2013/05/29 13:30:14
More indentation.
ngeoffray
2013/05/29 15:33:19
Done.
|
| + target.hashCode, |
| + receiver.hashCode); |
| + } |
| +} |
| + |
| bool jsHasOwnProperty(var jsObject, String property) { |
| return JS('bool', r'#.hasOwnProperty(#)', jsObject, property); |
| } |