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

Unified Diff: test/generated_sdk/lib/collection/linked_hash_map.dart

Issue 959913003: cleanup patch generation to preseve comments and remove @patch (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 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: test/generated_sdk/lib/collection/linked_hash_map.dart
diff --git a/test/generated_sdk/lib/collection/linked_hash_map.dart b/test/generated_sdk/lib/collection/linked_hash_map.dart
index b381af9b5782996b9297f0fd38043f17eef0fc95..ecf78432e1ca951f562ef5744cbe125d17bf5831 100644
--- a/test/generated_sdk/lib/collection/linked_hash_map.dart
+++ b/test/generated_sdk/lib/collection/linked_hash_map.dart
@@ -24,7 +24,35 @@ part of dart.collection;
* The map allows `null` as a key.
*/
abstract class LinkedHashMap<K, V> implements HashMap<K, V> {
- @patch
+ /**
+ * Creates an insertion-ordered hash-table based [Map].
+ *
+ * If [equals] is provided, it is used to compare the keys in the table with
+ * new keys. If [equals] is omitted, the key's own [Object.operator==] is used
+ * instead.
+ *
+ * Similar, if [hashCode] is provided, it is used to produce a hash value
+ * for keys in order to place them in the hash table. If it is omitted, the
+ * key's own [Object.hashCode] is used.
+ *
+ * If using methods like [operator[]], [remove] and [containsKey] together
+ * with a custom equality and hashcode, an extra `isValidKey` function
+ * can be supplied. This function is called before calling [equals] or
+ * [hashCode] with an argument that may not be a [K] instance, and if the
+ * call returns false, the key is assumed to not be in the set.
+ * The [isValidKey] function defaults to just testing if the object is a
+ * [K] instance.
+ *
+ * The used `equals` and `hashCode` method should always be consistent,
+ * so that if `equals(a, b)` then `hashCode(a) == hashCode(b)`. The hash
+ * of an object, or what it compares equal to, should not change while the
+ * object is in the table. If it does change, the result is unpredictable.
+ *
+ * If you supply one of [equals] and [hashCode],
+ * you should generally also to supply the other.
+ * An example would be using [identical] and [identityHashCode],
+ * which is equivalent to using the shorthand [LinkedHashMap.identity]).
+ */
factory LinkedHashMap({ bool equals(K key1, K key2),
int hashCode(K key),
bool isValidKey(potentialKey) }) {
@@ -54,7 +82,13 @@ abstract class LinkedHashMap<K, V> implements HashMap<K, V> {
return new _LinkedCustomHashMap<K, V>(equals, hashCode, isValidKey);
}
- @patch
+ /**
+ * Creates an insertion-ordered identity-based map.
+ *
+ * Effectively a shorthand for:
+ *
+ * new LinkedHashMap(equals: identical, hashCode: identityHashCodeOf)
+ */
factory LinkedHashMap.identity() = _LinkedIdentityHashMap<K, V>;
/**
« no previous file with comments | « test/generated_sdk/lib/collection/hash_set.dart ('k') | test/generated_sdk/lib/collection/linked_hash_set.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698