File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -69,8 +69,7 @@ fn append_child<'gc>(
6969) -> Result < Value < ' gc > , Error < ' gc > > {
7070 if let ( Some ( xmlnode) , Some ( child_xmlnode) ) = (
7171 this. as_xml_node ( ) ,
72- args. get ( 0 )
73- . and_then ( |n| n. coerce_to_object ( activation) . as_xml_node ( ) ) ,
72+ args. get ( 0 ) . and_then ( |n| n. as_xml_node ( ) ) ,
7473 ) {
7574 if !xmlnode. has_child ( child_xmlnode) {
7675 let position = xmlnode. children_len ( ) ;
@@ -89,10 +88,8 @@ fn insert_before<'gc>(
8988) -> Result < Value < ' gc > , Error < ' gc > > {
9089 if let ( Some ( xmlnode) , Some ( child_xmlnode) , Some ( insertpoint_xmlnode) ) = (
9190 this. as_xml_node ( ) ,
92- args. get ( 0 )
93- . and_then ( |n| n. coerce_to_object ( activation) . as_xml_node ( ) ) ,
94- args. get ( 1 )
95- . and_then ( |n| n. coerce_to_object ( activation) . as_xml_node ( ) ) ,
91+ args. get ( 0 ) . and_then ( |n| n. as_xml_node ( ) ) ,
92+ args. get ( 1 ) . and_then ( |n| n. as_xml_node ( ) ) ,
9693 ) {
9794 if !xmlnode. has_child ( child_xmlnode) {
9895 if let Some ( position) = xmlnode. child_position ( insertpoint_xmlnode) {
Original file line number Diff line number Diff line change @@ -508,6 +508,14 @@ impl<'gc> Value<'gc> {
508508 Value :: Bool ( _) | Value :: Object ( _) | Value :: MovieClip ( _) => None ,
509509 }
510510 }
511+
512+ /// Get the underlying XML node for this value, if it exists.
513+ pub fn as_xml_node ( self ) -> Option < crate :: avm1:: xml:: XmlNode < ' gc > > {
514+ match self {
515+ Value :: Object ( obj) => obj. as_xml_node ( ) ,
516+ _ => None ,
517+ }
518+ }
511519}
512520
513521/// Calculate `value * 10^exp` through repeated multiplication or division.
You can’t perform that action at this time.
0 commit comments