core: to_xml_string is now infallible

This commit is contained in:
Nathan Adams 2023-08-12 12:49:28 +02:00
parent 135d8c08bf
commit 5d9c73cbb1
1 changed files with 4 additions and 4 deletions

View File

@ -647,7 +647,7 @@ impl<'gc> E4XNode<'gc> {
);
}
return to_xml_string(E4XOrXml::E4X(*self), activation);
return Ok(to_xml_string(E4XOrXml::E4X(*self), activation));
}
other => Err(format!("XML.toString(): Not yet implemented for {other:?}").into()),
}
@ -657,7 +657,7 @@ impl<'gc> E4XNode<'gc> {
&self,
activation: &mut Activation<'_, 'gc>,
) -> Result<AvmString<'gc>, Error<'gc>> {
return to_xml_string(E4XOrXml::E4X(*self), activation);
return Ok(to_xml_string(E4XOrXml::E4X(*self), activation));
}
pub fn kind(&self) -> Ref<'_, E4XNodeKind<'gc>> {
@ -806,10 +806,10 @@ fn to_xml_string_inner(xml: E4XOrXml, buf: &mut WString) {
pub fn to_xml_string<'gc>(
xml: E4XOrXml<'gc>,
activation: &mut Activation<'_, 'gc>,
) -> Result<AvmString<'gc>, Error<'gc>> {
) -> AvmString<'gc> {
let mut buf = WString::new();
to_xml_string_inner(xml, &mut buf);
Ok(AvmString::new(activation.context.gc_context, buf))
AvmString::new(activation.context.gc_context, buf)
}
pub fn name_to_multiname<'gc>(