avm1: ActionNewMethod supports auto-boxing values

This allows `new ("FOO".bar)()`, although there is probably no
good reason to do this. :-)
This commit is contained in:
Mike Welsh 2020-01-21 17:50:15 -08:00
parent 70bec9437f
commit 4b7bac706b
1 changed files with 2 additions and 1 deletions

View File

@ -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)?