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

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

Issue 12207205: Revert "Remove deprecated mappedBy." (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/http/lib/src/byte_stream.dart ('k') | runtime/lib/array.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // the library will be ok, but we need to get rid of the extra key before 209 // the library will be ok, but we need to get rid of the extra key before
210 // the data is shown to the user, so we destructively modify. 210 // the data is shown to the user, so we destructively modify.
211 if (data is List) { 211 if (data is List) {
212 ruleNumber = data.last; 212 ruleNumber = data.last;
213 data = data.take(data.length -1); 213 data = data.take(data.length -1);
214 } else if (data is Map) { 214 } else if (data is Map) {
215 ruleNumber = data.remove(RULE); 215 ruleNumber = data.remove(RULE);
216 } else { 216 } else {
217 throw new SerializationException("Invalid data format"); 217 throw new SerializationException("Invalid data format");
218 } 218 }
219 // Do not use map or other lazy operations for this. They do not play 219 // Do not use mappedBy or other lazy operations for this. They do not play
220 // well with a function that destructively modifies its arguments. 220 // well with a function that destructively modifies its arguments.
221 var newData = mapValues(data, (each) => recursivelyFixUp(each, r, result)); 221 var newData = mapValues(data, (each) => recursivelyFixUp(each, r, result));
222 result[ruleNumber].add(newData); 222 result[ruleNumber].add(newData);
223 return new Reference(r, ruleNumber, result[ruleNumber].length - 1); 223 return new Reference(r, ruleNumber, result[ruleNumber].length - 1);
224 } 224 }
225 } 225 }
226 226
227 /** 227 /**
228 * Writes to a simple mostly-flat format. Details are subject to change. 228 * Writes to a simple mostly-flat format. Details are subject to change.
229 * Right now this produces a List containing null, num, and String. This is 229 * Right now this produces a List containing null, num, and String. This is
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return new Reference(r, a, b); 462 return new Reference(r, a, b);
463 } 463 }
464 } 464 }
465 465
466 /** Return the next element from the input. */ 466 /** Return the next element from the input. */
467 _next(Iterator input) { 467 _next(Iterator input) {
468 input.moveNext(); 468 input.moveNext();
469 return input.current; 469 return input.current;
470 } 470 }
471 } 471 }
OLDNEW
« no previous file with comments | « pkg/http/lib/src/byte_stream.dart ('k') | runtime/lib/array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698