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

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

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Undo change to test-script. 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/serialization/lib/src/basic_rule.dart ('k') | pkg/serialization/lib/src/reader_writer.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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 * and return the Map representation that the reader expects, with top-level 154 * and return the Map representation that the reader expects, with top-level
155 * entries for "rules", "data", and "roots". Nested lists/maps will be 155 * entries for "rules", "data", and "roots". Nested lists/maps will be
156 * converted into Reference objects. Note that if the data was not written 156 * converted into Reference objects. Note that if the data was not written
157 * with [storeRoundTripInfo] true this will fail. 157 * with [storeRoundTripInfo] true this will fail.
158 */ 158 */
159 Map<String, dynamic> read(String input, Reader r) { 159 Map<String, dynamic> read(String input, Reader r) {
160 var data = json.parse(input); 160 var data = json.parse(input);
161 var result = {}; 161 var result = {};
162 result["rules"] = null; 162 result["rules"] = null;
163 var ruleData = 163 var ruleData =
164 new List(r.serialization.rules.length).mappedBy((x) => []).toList(); 164 new List(r.serialization.rules.length).map((x) => []).toList();
165 var top = recursivelyFixUp(data, r, ruleData); 165 var top = recursivelyFixUp(data, r, ruleData);
166 result["data"] = ruleData; 166 result["data"] = ruleData;
167 result["roots"] = [top]; 167 result["roots"] = [top];
168 return result; 168 return result;
169 } 169 }
170 170
171 /** 171 /**
172 * Convert nested references in [data] into [Reference] objects. 172 * Convert nested references in [data] into [Reference] objects.
173 */ 173 */
174 recursivelyFixUp(data, Reader r, List result) { 174 recursivelyFixUp(data, Reader r, List result) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } else { 427 } else {
428 return new Reference(r, a, b); 428 return new Reference(r, a, b);
429 } 429 }
430 } 430 }
431 431
432 /** Return the next element from the input. */ 432 /** Return the next element from the input. */
433 _next(Iterator input) { 433 _next(Iterator input) {
434 input.moveNext(); 434 input.moveNext();
435 return input.current; 435 return input.current;
436 } 436 }
437 } 437 }
OLDNEW
« no previous file with comments | « pkg/serialization/lib/src/basic_rule.dart ('k') | pkg/serialization/lib/src/reader_writer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698