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

Unified Diff: pkg/serialization/lib/src/basic_rule.dart

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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: pkg/serialization/lib/src/basic_rule.dart
diff --git a/pkg/serialization/lib/src/basic_rule.dart b/pkg/serialization/lib/src/basic_rule.dart
index 19a8bcab3c63f059edae35a827df76855c1c1d04..a4c7fd8f08563c66444bdab424a7faa7a50c77bf 100644
--- a/pkg/serialization/lib/src/basic_rule.dart
+++ b/pkg/serialization/lib/src/basic_rule.dart
@@ -130,12 +130,16 @@ class BasicRule extends SerializationRule {
useMaps = false;
}
- /** Create either a list or a map to hold the object's state, depending
+ /**
+ * Create either a list or a map to hold the object's state, depending
* on the [useMaps] variable. If using a Map, we wrap it in order to keep
* the protocol compatible. See [configureForLists]/[configureForMaps].
+ *
+ * The list need to be growable for SimpleJson format to work.
floitsch 2013/02/26 13:54:19 If a list is returned, it is growable.
*/
createStateHolder() =>
- useMaps ? new _MapWrapper(fields.contents) : new List(fields.length);
+ useMaps ? new _MapWrapper(fields.contents)
floitsch 2013/02/26 13:54:19 I would prefer an 'if', and the length-assignment
+ : (new List()..length = fields.length);
/**
* Wrap the state if it's passed in as a map, and if the keys are references,

Powered by Google App Engine
This is Rietveld 408576698