avm2: Support wildcard/any name in XMLList get_property_local

This is similar to #10018. Improves #8330.
This commit is contained in:
Tom Schuster 2023-03-14 23:08:38 +01:00 committed by Aaron Hill
parent 570b97f270
commit 1f8dccf5a2
4 changed files with 36 additions and 28 deletions

View File

@ -193,6 +193,7 @@ impl<'gc> TObject<'gc> for XmlListObject<'gc> {
return Ok(Value::Undefined); return Ok(Value::Undefined);
} }
} }
}
let matched_children = write let matched_children = write
.children .children
@ -218,10 +219,7 @@ impl<'gc> TObject<'gc> for XmlListObject<'gc> {
}) })
.collect(); .collect();
return Ok( return Ok(XmlListObject::new(activation, matched_children, Some(self.into())).into());
XmlListObject::new(activation, matched_children, Some(self.into())).into(),
);
}
} }
write.base.get_property_local(name, activation) write.base.get_property_local(name, activation)

View File

@ -25,3 +25,10 @@ for each (var child in children) {
for each (var child in xml.child("*")) { for each (var child in xml.child("*")) {
trace('child("*") child.id: ' + child.@id); trace('child("*") child.id: ' + child.@id);
} }
var xml_list = xml.animal;
trace("xml_list is an " + Object.prototype.toString.call(xml_list));
for each (var child in xml_list.*) {
trace("xml_list.* child: " + child);
}

View File

@ -6,3 +6,6 @@ child.id: 1
child.id: 2 child.id: 2
child("*") child.id: 1 child("*") child.id: 1
child("*") child.id: 2 child("*") child.id: 2
xml_list is an [object XMLList]
xml_list.* child: toto
xml_list.* child: piggy