stackitem: support Null item (de-)serialization
It's binary representation contains just type (AnyT).
This commit is contained in:
parent
c0e482fe6c
commit
a980cac0b3
1 changed files with 4 additions and 0 deletions
|
@ -70,6 +70,8 @@ func serializeItemTo(item Item, w *io.BinWriter, seen map[Item]bool) {
|
||||||
serializeItemTo(t.Value().([]MapElement)[i].Key, w, seen)
|
serializeItemTo(t.Value().([]MapElement)[i].Key, w, seen)
|
||||||
serializeItemTo(t.Value().([]MapElement)[i].Value, w, seen)
|
serializeItemTo(t.Value().([]MapElement)[i].Value, w, seen)
|
||||||
}
|
}
|
||||||
|
case Null:
|
||||||
|
w.WriteB(byte(AnyT))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +129,8 @@ func DecodeBinaryStackItem(r *io.BinReader) Item {
|
||||||
m.Add(key, value)
|
m.Add(key, value)
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
|
case AnyT:
|
||||||
|
return Null{}
|
||||||
default:
|
default:
|
||||||
r.Err = errors.New("unknown type")
|
r.Err = errors.New("unknown type")
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue