Skip to content

Commit 0c824b7

Browse files
committed
Implement deserialize REPR function for P6int and...test cases pass! \o/ This means we can successfully serialize a (very simple) object with a cross-ref to an STable in another SC.
1 parent f4aeff9 commit 0c824b7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/6model/reprs/P6int.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,16 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
112112
return spec;
113113
}
114114

115-
/* Serializes the data into an object. */
115+
/* Serializes the data. */
116116
static void serialize(PARROT_INTERP, STable *st, void *data, SerializationWriter *writer) {
117117
writer->write_int(interp, writer, ((P6intBody *)data)->value);
118118
}
119119

120+
/* Deserializes the data. */
121+
static void deserialize(PARROT_INTERP, STable *st, void *data, SerializationReader *reader) {
122+
((P6intBody *)data)->value = reader->read_int(interp, reader);
123+
}
124+
120125
/* Initializes the P6int representation. */
121126
REPROps * P6int_initialize(PARROT_INTERP) {
122127
/* Allocate and populate the representation function table. */
@@ -136,5 +141,6 @@ REPROps * P6int_initialize(PARROT_INTERP) {
136141
this_repr->gc_free = gc_free;
137142
this_repr->get_storage_spec = get_storage_spec;
138143
this_repr->serialize = serialize;
144+
this_repr->deserialize = deserialize;
139145
return this_repr;
140146
}

0 commit comments

Comments
 (0)