Skip to content

Commit fe2ed81

Browse files
adrian17evilpie
authored andcommitted
avm2: Implement JS->AS3 Object deserialization
1 parent 4ed6088 commit fe2ed81

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

core/src/external.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,19 @@ impl Value {
225225
Value::String(value) => {
226226
Avm2Value::String(AvmString::new_utf8(activation.context.gc_context, value))
227227
}
228-
Value::Object(_values) => {
229-
tracing::warn!("into_avm2 needs to be implemented for Value::Object");
230-
Avm2Value::Undefined
228+
Value::Object(values) => {
229+
let obj = activation
230+
.avm2()
231+
.classes()
232+
.object
233+
.construct(activation, &[])
234+
.unwrap();
235+
for (key, value) in values.into_iter() {
236+
let key = AvmString::new_utf8(activation.context.gc_context, key);
237+
let value = value.into_avm2(activation);
238+
obj.set_public_property(key, value, activation).unwrap();
239+
}
240+
Avm2Value::Object(obj)
231241
}
232242
Value::List(values) => {
233243
let storage = values

0 commit comments

Comments
 (0)