From 4b7bac706bc034beed673e1d46ed3ea9ea17fa4a Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Tue, 21 Jan 2020 17:50:15 -0800 Subject: [PATCH] avm1: ActionNewMethod supports auto-boxing values This allows `new ("FOO".bar)()`, although there is probably no good reason to do this. :-) --- core/src/avm1.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/avm1.rs b/core/src/avm1.rs index 7bf346d97..64254a033 100644 --- a/core/src/avm1.rs +++ b/core/src/avm1.rs @@ -1716,13 +1716,14 @@ impl<'gc> Avm1<'gc> { fn action_new_method(&mut self, context: &mut UpdateContext<'_, 'gc, '_>) -> Result<(), Error> { let method_name = self.pop(); - let object = self.pop().as_object()?; + let object_val = self.pop(); let num_args = self.pop().as_i64()?; let mut args = Vec::new(); for _ in 0..num_args { args.push(self.pop()); } + let object = value_object::ValueObject::boxed(self, context, object_val); let constructor = object .get(&method_name.as_string()?, self, context)? .resolve(self, context)?