@@ -10,8 +10,7 @@ use crate::avm1::{
1010use crate :: avm2:: activation:: Activation as Avm2Activation ;
1111use crate :: avm2:: object:: TObject as _;
1212use crate :: avm2:: Value as Avm2Value ;
13- use crate :: avm2:: { ArrayObject as Avm2ArrayObject , Error as Avm2Error , Object as Avm2Object } ;
14-
13+ use crate :: avm2:: { ArrayObject as Avm2ArrayObject , Object as Avm2Object } ;
1514use crate :: context:: UpdateContext ;
1615use crate :: string:: AvmString ;
1716use gc_arena:: Collect ;
@@ -183,8 +182,8 @@ impl Value {
183182 }
184183 }
185184
186- pub fn from_avm2 ( value : Avm2Value ) -> Result < Value , Avm2Error > {
187- Ok ( match value {
185+ pub fn from_avm2 ( value : Avm2Value ) -> Value {
186+ match value {
188187 Avm2Value :: Undefined | Avm2Value :: Null => Value :: Null ,
189188 Avm2Value :: Bool ( value) => value. into ( ) ,
190189 Avm2Value :: Number ( value) => value. into ( ) ,
@@ -194,20 +193,20 @@ impl Value {
194193 Avm2Value :: Object ( object) => {
195194 if let Some ( array) = object. as_array_storage ( ) {
196195 let length = array. length ( ) ;
197- let values: Result < Vec < _ > , Avm2Error > = ( 0 ..length)
196+ let values = ( 0 ..length)
198197 . map ( |i| {
199198 // FIXME - is this right?
200199 let element = array. get ( i) . unwrap_or ( Avm2Value :: Null ) ;
201200 Value :: from_avm2 ( element)
202201 } )
203202 . collect ( ) ;
204- Value :: List ( values? )
203+ Value :: List ( values)
205204 } else {
206205 log:: warn!( "from_avm2 needs to be implemented for Avm2Value::Object" ) ;
207206 Value :: Null
208207 }
209208 }
210- } )
209+ }
211210 }
212211
213212 pub fn into_avm2 < ' gc > ( self , activation : & mut Avm2Activation < ' _ , ' gc , ' _ > ) -> Avm2Value < ' gc > {
@@ -284,11 +283,8 @@ impl<'gc> Callback<'gc> {
284283 . into_iter ( )
285284 . map ( |v| v. into_avm2 ( & mut activation) )
286285 . collect ( ) ;
287- if let Ok ( result) = method
288- . call ( None , & args, & mut activation)
289- . and_then ( Value :: from_avm2)
290- {
291- result
286+ if let Ok ( result) = method. call ( None , & args, & mut activation) {
287+ Value :: from_avm2 ( result)
292288 } else {
293289 Value :: Null
294290 }
0 commit comments