| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of serialization; | 5 part of serialization; |
| 6 | 6 |
| 7 // TODO(alanknight): We should have an example and tests for subclassing | 7 // TODO(alanknight): We should have an example and tests for subclassing |
| 8 // serialization rule rather than using the hard-coded ClosureToMap rule. And | 8 // serialization rule rather than using the hard-coded ClosureToMap rule. And |
| 9 // possibly an abstract superclass that's designed to be subclassed that way. | 9 // possibly an abstract superclass that's designed to be subclassed that way. |
| 10 /** | 10 /** |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 pullStateFrom(Iterator stream) { | 322 pullStateFrom(Iterator stream) { |
| 323 var length = stream.next(); | 323 var length = stream.next(); |
| 324 var ruleData = new List(); | 324 var ruleData = new List(); |
| 325 for (var i = 0; i < length; i++) { | 325 for (var i = 0; i < length; i++) { |
| 326 ruleData.add(stream.next()); | 326 ruleData.add(stream.next()); |
| 327 } | 327 } |
| 328 return ruleData; | 328 return ruleData; |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 /** Helper function for PrimitiveRule to tell which objects it applies to. */ | |
| 333 bool isPrimitive(object) { | |
| 334 return object is num || object is String || object is bool; | |
| 335 } | |
| 336 | |
| 337 /** Typedef for the object construction closure used in ClosureRule. */ | 332 /** Typedef for the object construction closure used in ClosureRule. */ |
| 338 typedef ConstructType(Map m); | 333 typedef ConstructType(Map m); |
| 339 | 334 |
| 340 /** Typedef for the state-getting closure used in ClosureToMapRule. */ | 335 /** Typedef for the state-getting closure used in ClosureToMapRule. */ |
| 341 typedef Map<String, dynamic> GetStateType(object); | 336 typedef Map<String, dynamic> GetStateType(object); |
| 342 | 337 |
| 343 /** Typedef for the state-setting closure used in ClosureToMapRule. */ | 338 /** Typedef for the state-setting closure used in ClosureToMapRule. */ |
| 344 typedef void NonEssentialStateType(object, Map m); | 339 typedef void NonEssentialStateType(object, Map m); |
| 345 | 340 |
| 346 /** | 341 /** |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 sort([f]) => _throw(); | 572 sort([f]) => _throw(); |
| 578 clear() => _throw(); | 573 clear() => _throw(); |
| 579 removeAt(x) => _throw(); | 574 removeAt(x) => _throw(); |
| 580 removeLast() => _throw(); | 575 removeLast() => _throw(); |
| 581 getRange(x, y) => _throw(); | 576 getRange(x, y) => _throw(); |
| 582 setRange(x, y, z, [a]) => _throw(); | 577 setRange(x, y, z, [a]) => _throw(); |
| 583 removeRange(x, y) => _throw(); | 578 removeRange(x, y) => _throw(); |
| 584 insertRange(x, y, [z]) => _throw(); | 579 insertRange(x, y, [z]) => _throw(); |
| 585 void set length(x) => _throw(); | 580 void set length(x) => _throw(); |
| 586 } | 581 } |
| OLD | NEW |