avm2: Add deep_copy method to XmlListObject
Also changes existing AS3 copy method to use that instead. Moved as other code needs to do the same operation.
This commit is contained in:
parent
fbaa02e295
commit
b3af4320e7
|
@ -201,12 +201,7 @@ pub fn copy<'gc>(
|
|||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let list = this.as_xml_list_object().unwrap();
|
||||
let children = list
|
||||
.children()
|
||||
.iter()
|
||||
.map(|child| E4XOrXml::E4X(child.node().deep_copy(activation.context.gc_context)))
|
||||
.collect();
|
||||
Ok(XmlListObject::new(activation, children, list.target()).into())
|
||||
Ok(list.deep_copy(activation).into())
|
||||
}
|
||||
|
||||
pub fn attribute<'gc>(
|
||||
|
|
|
@ -97,6 +97,15 @@ impl<'gc> XmlListObject<'gc> {
|
|||
self.0.read().target
|
||||
}
|
||||
|
||||
pub fn deep_copy(&self, activation: &mut Activation<'_, 'gc>) -> XmlListObject<'gc> {
|
||||
let children = self
|
||||
.children()
|
||||
.iter()
|
||||
.map(|child| E4XOrXml::E4X(child.node().deep_copy(activation.context.gc_context)))
|
||||
.collect();
|
||||
XmlListObject::new(activation, children, self.target())
|
||||
}
|
||||
|
||||
pub fn equals(
|
||||
&self,
|
||||
other: &Value<'gc>,
|
||||
|
|
Loading…
Reference in New Issue