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

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

Issue 14566015: Change default format to produce output that can be passed between isolates (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review changes Created 7 years, 7 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
« no previous file with comments | « pkg/serialization/lib/src/format.dart ('k') | pkg/serialization/test/serialization_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/serialization/lib/src/reader_writer.dart
diff --git a/pkg/serialization/lib/src/reader_writer.dart b/pkg/serialization/lib/src/reader_writer.dart
index 297c7de2dabff8eecfdbc733353c24cb9e4d377c..b40196e87c4ab058ad8b40d9b9d4c742f036254e 100644
--- a/pkg/serialization/lib/src/reader_writer.dart
+++ b/pkg/serialization/lib/src/reader_writer.dart
@@ -241,6 +241,9 @@ abstract class ReaderOrWriter {
/** Return the list of serialization rules we are using.*/
List<SerializationRule> get rules;
+ /** Return the internal collection of object state and [Reference] objects. */
+ List<List> get states;
+
/**
* Return the object, or state, that ref points to, depending on which
* we're generating.
@@ -278,6 +281,9 @@ class Reader implements ReaderOrWriter {
*/
List<List> _data;
+ /** Return the internal collection of object state and [Reference] objects. */
+ get states => _data;
+
/**
* The resulting objects, indexed according to the same scheme as
* _data, where each rule has a number, and rules keep track of the objects
@@ -467,7 +473,7 @@ class Reader implements ReaderOrWriter {
asReference(anObject, {Function ifReference: doNothing,
Function ifNotReference : doNothing}) {
if (anObject is Reference) return ifReference(anObject);
- if (anObject is Map && anObject["__Ref"] == true) {
+ if (anObject is Map && anObject["__Ref"] != null) {
var ref =
new Reference(this, anObject["rule"], anObject["object"]);
return ifReference(ref);
@@ -585,8 +591,8 @@ class Reference {
*/
// TODO(alanknight): This is a hack both in defining a toJson specific to a
// particular representation, and the use of a bogus sentinel "__Ref"
- Map<String, dynamic> toJson() => {
- "__Ref" : true,
+ Map<String, int> toJson() => {
+ "__Ref" : 0,
"rule" : ruleNumber,
"object" : objectNumber
};
« no previous file with comments | « pkg/serialization/lib/src/format.dart ('k') | pkg/serialization/test/serialization_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698