| Index: pkg/serialization/lib/src/serialization_rule.dart
|
| diff --git a/pkg/serialization/lib/src/serialization_rule.dart b/pkg/serialization/lib/src/serialization_rule.dart
|
| index d63f07ab8842b63f6b91505e40673b327b7083a3..378da45394e3360854e876dc5ea15764520d4b49 100644
|
| --- a/pkg/serialization/lib/src/serialization_rule.dart
|
| +++ b/pkg/serialization/lib/src/serialization_rule.dart
|
| @@ -392,19 +392,20 @@ class NamedObjectRule extends SerializationRule {
|
| */
|
| class MirrorRule extends NamedObjectRule {
|
| bool appliesTo(object, Writer writer) => object is DeclarationMirror;
|
| - nameFor(DeclarationMirror object, Writer writer) => object.qualifiedName;
|
| + nameFor(DeclarationMirror object, Writer writer) =>
|
| + MirrorSystem.getName(object.qualifiedName);
|
|
|
| inflateEssential(state, Reader r) {
|
| var qualifiedName = r.resolveReference(state.first);
|
| var lookupFull = r.objectNamed(qualifiedName, (x) => null);
|
| if (lookupFull != null) return lookupFull;
|
| var separatorIndex = qualifiedName.lastIndexOf(".");
|
| - var lib = qualifiedName.substring(0, separatorIndex);
|
| + var lib = new Symbol(qualifiedName.substring(0, separatorIndex));
|
| var type = qualifiedName.substring(separatorIndex + 1);
|
| var lookup = r.objectNamed(type, (x) => null);
|
| if (lookup != null) return lookup;
|
| var libMirror = currentMirrorSystem().libraries[lib];
|
| - return libMirror.classes[type];
|
| + return libMirror.classes[new Symbol(type)];
|
| }
|
| }
|
|
|
| @@ -469,6 +470,16 @@ abstract class CustomRule extends SerializationRule {
|
| get hasVariableLengthEntries => true;
|
| }
|
|
|
| +/** A hard-coded rule for serializing Symbols. */
|
| +class SymbolRule extends CustomRule {
|
| + bool appliesTo(instance, _) => instance is Symbol;
|
| + getState(instance) => [MirrorSystem.getName(instance)];
|
| + create(state) => new Symbol(state[0]);
|
| + setState(symbol, state) {}
|
| + int get dataLength => 1;
|
| + bool get hasVariableLengthEntries => false;
|
| +}
|
| +
|
| /** Create a lazy list/map that will inflate its items on demand in [r]. */
|
| _lazy(l, Reader r) {
|
| if (l is List) return new _LazyList(l, r);
|
|
|