| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The base class for all Dart objects. | 8 * The base class for all Dart objects. |
| 9 * | 9 * |
| 10 * Because Object is the root of the Dart class hierarchy, | 10 * Because Object is the root of the Dart class hierarchy, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 * | 51 * |
| 52 * The method should also be consistent over time, so equality of two objects | 52 * The method should also be consistent over time, so equality of two objects |
| 53 * should not change over time, or at least only change if one of the objects | 53 * should not change over time, or at least only change if one of the objects |
| 54 * was modified. | 54 * was modified. |
| 55 * | 55 * |
| 56 * If a subclass overrides the equality operator it should override | 56 * If a subclass overrides the equality operator it should override |
| 57 * the [hashCode] method as well to maintain consistency. | 57 * the [hashCode] method as well to maintain consistency. |
| 58 */ | 58 */ |
| 59 bool operator ==(other) => identical(this, other); | 59 bool operator ==(other) => identical(this, other); |
| 60 | 60 |
| 61 @patch | 61 /** |
| 62 * Get a hash code for this object. |
| 63 * |
| 64 * All objects have hash codes. Hash codes are guaranteed to be the |
| 65 * same for objects that are equal when compared using the equality |
| 66 * operator [:==:]. Other than that there are no guarantees about |
| 67 * the hash codes. They will not be consistent between runs and |
| 68 * there are no distribution guarantees. |
| 69 * |
| 70 * If a subclass overrides [hashCode] it should override the |
| 71 * equality operator as well to maintain consistency. |
| 72 */ |
| 62 int get hashCode => Primitives.objectHashCode(this); | 73 int get hashCode => Primitives.objectHashCode(this); |
| 63 | 74 |
| 64 @patch | 75 /** |
| 76 * Returns a string representation of this object. |
| 77 */ |
| 65 String toString() => Primitives.objectToString(this); | 78 String toString() => Primitives.objectToString(this); |
| 66 | 79 |
| 67 @patch | 80 /** |
| 81 * [noSuchMethod] is invoked when users invoke a non-existent method |
| 82 * on an object. The name of the method and the arguments of the |
| 83 * invocation are passed to [noSuchMethod] in an [Invocation]. |
| 84 * If [noSuchMethod] returns a value, that value becomes the result of |
| 85 * the original invocation. |
| 86 * |
| 87 * The default behavior of [noSuchMethod] is to throw a |
| 88 * [NoSuchMethodError]. |
| 89 */ |
| 68 dynamic noSuchMethod(Invocation invocation) { | 90 dynamic noSuchMethod(Invocation invocation) { |
| 69 throw new NoSuchMethodError( | 91 throw new NoSuchMethodError( |
| 70 this, | 92 this, |
| 71 invocation.memberName, | 93 invocation.memberName, |
| 72 invocation.positionalArguments, | 94 invocation.positionalArguments, |
| 73 invocation.namedArguments); | 95 invocation.namedArguments); |
| 74 } | 96 } |
| 75 | 97 |
| 76 @patch | 98 /** |
| 99 * A representation of the runtime type of the object. |
| 100 */ |
| 77 Type get runtimeType => getRuntimeType(this); | 101 Type get runtimeType => getRuntimeType(this); |
| 78 } | 102 } |
| OLD | NEW |