File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,7 @@ pub fn exec<'gc>(
201201 }
202202
203203 let signature = & * method. resolved_param_config ( ) ;
204+ let return_type = method. resolved_return_type ( ) ;
204205
205206 // Check for too many arguments
206207 if arguments. len ( ) > signature. len ( ) && !method. is_variadic ( ) && !method. is_unchecked ( )
@@ -231,7 +232,15 @@ pub fn exec<'gc>(
231232 . context
232233 . avm2
233234 . push_call ( activation. gc ( ) , method, bound_class) ;
234- native_method ( & mut activation, receiver, & arguments)
235+
236+ let result = native_method ( & mut activation, receiver, & arguments) ;
237+ result. and_then ( |v| {
238+ if let Some ( return_type) = return_type {
239+ v. coerce_to_type ( & mut activation, return_type)
240+ } else {
241+ Ok ( v)
242+ }
243+ } )
235244 }
236245 MethodKind :: Bytecode ( _) => {
237246 // This used to be a one step called Activation::from_method,
You can’t perform that action at this time.
0 commit comments