From 1b459f522d83278026563ea893e0cecd73b2d0ed Mon Sep 17 00:00:00 2001 From: David Wendt Date: Mon, 28 Oct 2019 18:30:22 -0400 Subject: [PATCH] Implement `ActionImplementsOp`. This commit title has won the "World's Lowest-Entropy Commit Title" award for 2019. --- core/src/avm1.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/src/avm1.rs b/core/src/avm1.rs index 0071a82f9..8c3dc83f6 100644 --- a/core/src/avm1.rs +++ b/core/src/avm1.rs @@ -416,6 +416,7 @@ impl<'gc> Avm1<'gc> { Action::Increment => self.action_increment(context), Action::InitArray => self.action_init_array(context), Action::InitObject => self.action_init_object(context), + Action::ImplementsOp => self.action_implements_op(context), Action::InstanceOf => self.action_instance_of(context), Action::Jump { offset } => self.action_jump(context, offset, reader), Action::Less => self.action_less(context), @@ -1342,6 +1343,25 @@ impl<'gc> Avm1<'gc> { Ok(()) } + fn action_implements_op( + &mut self, + context: &mut UpdateContext<'_, 'gc, '_>, + ) -> Result<(), Error> { + let constr = self.pop()?.as_object()?; + let count = self.pop()?.as_i64()?; //TODO: Is this coercion actually performed by Flash? + let mut interfaces = vec![]; + + //TODO: If one of the interfaces is not an object, do we leave the + //whole stack dirty, or...? + for _ in 0..count { + interfaces.push(self.pop()?.as_object()?); + } + + constr.write(context.gc_context).set_interfaces(interfaces); + + Ok(()) + } + fn action_instance_of( &mut self, context: &mut UpdateContext<'_, 'gc, '_>,