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

Side by Side Diff: pkg/serialization/lib/src/format.dart

Issue 12096042: Remove import of collection-dev. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Really keep collection-dev in js-library for now. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 part of serialization; 1 part of serialization;
2 2
3 /** 3 /**
4 * An abstract class for serialization formats. Subclasses define how data 4 * An abstract class for serialization formats. Subclasses define how data
5 * is read or written to a particular output mechanism. 5 * is read or written to a particular output mechanism.
6 */ 6 */
7 abstract class Format { 7 abstract class Format {
8 /** 8 /**
9 * Return true if this format stores primitives in their own area and uses 9 * Return true if this format stores primitives in their own area and uses
10 * references to them (e.g. [SimpleFlatFormat]) and false if primitives 10 * references to them (e.g. [SimpleFlatFormat]) and false if primitives
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return data; 177 return data;
178 } 178 }
179 var ruleNumber; 179 var ruleNumber;
180 if (data is List) { 180 if (data is List) {
181 ruleNumber = data.removeLast(); 181 ruleNumber = data.removeLast();
182 } else if (data is Map) { 182 } else if (data is Map) {
183 ruleNumber = data.remove(ruleIdentifier); 183 ruleNumber = data.remove(ruleIdentifier);
184 } else { 184 } else {
185 throw new SerializationException("Invalid data format"); 185 throw new SerializationException("Invalid data format");
186 } 186 }
187 var newData = values(data).mappedBy( 187 var newData = mapValues(data, (x) => recursivelyFixUp(x, r, result));
188 (x) => recursivelyFixUp(x, r, result));
189 // TODO(alanknight): Ugh. Get rid of this if we can resolve bug 7982/7940.
190 if (newData is MappedList) {
191 newData = newData.toList();
192 }
193 result[ruleNumber].add(newData); 188 result[ruleNumber].add(newData);
194 return new Reference(r, ruleNumber, result[ruleNumber].length - 1); 189 return new Reference(r, ruleNumber, result[ruleNumber].length - 1);
195 } 190 }
196 } 191 }
197 192
198 /** 193 /**
199 * Writes to a simple mostly-flat format. Details are subject to change. 194 * Writes to a simple mostly-flat format. Details are subject to change.
200 * Right now this produces a List containing null, num, and String. This is 195 * Right now this produces a List containing null, num, and String. This is
201 * more space-efficient than the map formats, but much less human-readable. 196 * more space-efficient than the map formats, but much less human-readable.
202 * Simple usage is to turn this into JSON for transmission. 197 * Simple usage is to turn this into JSON for transmission.
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 return new Reference(r, a, b); 428 return new Reference(r, a, b);
434 } 429 }
435 } 430 }
436 431
437 /** Return the next element from the input. */ 432 /** Return the next element from the input. */
438 _next(Iterator input) { 433 _next(Iterator input) {
439 input.moveNext(); 434 input.moveNext();
440 return input.current; 435 return input.current;
441 } 436 }
442 } 437 }
OLDNEW
« no previous file with comments | « pkg/serialization/lib/serialization.dart ('k') | samples/swarm/swarm_ui_lib/observable/observable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698