Permalink
Browse files

Fix generic thawing of array objects

  • Loading branch information...
1 parent b292bdd commit 604037a0eca324f095d5f8fa678aaf60ad16c9f9 @sorear committed Oct 20, 2011
Showing with 14 additions and 4 deletions.
  1. +14 −4 lib/Serialize.cs
View
@@ -628,6 +628,16 @@ class ThawBuffer {
return ret;
}
+ // used from ObjRef only so guaranteed non-null
+ T[] RefsARegister<T>() where T : class {
+ int ct = Int();
+ T[] ret = new T[ct];
+ Register(ret);
+ for (int i = 0; i < ct; i++)
+ ret[i] = (T) ObjRef();
+ return ret;
+ }
+
public object ObjRef() {
var tag = (SerializationCode)Byte();
if (Config.SerTrace)
@@ -689,13 +699,13 @@ class ThawBuffer {
case SerializationCode.String:
return Register(String());
case SerializationCode.ArrP6any:
- return Register(RefsA<P6any>());
+ return RefsARegister<P6any>();
case SerializationCode.ArrVariable:
- return Register(RefsA<Variable>());
+ return RefsARegister<Variable>();
case SerializationCode.ArrString:
- return Register(RefsA<string>());
+ return RefsARegister<string>();
case SerializationCode.ArrCC:
- return Register(RefsA<CC>());
+ return RefsARegister<CC>();
case SerializationCode.Boolean:
return Register(Byte() != 0);
case SerializationCode.Int:

0 comments on commit 604037a

Please sign in to comment.