From 7dcb3339917da174307eca9256c592c884a16b39 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sun, 23 Oct 2022 21:09:37 -0500 Subject: [PATCH] avm2: Remove dead code from MovieClip constructor The call to `super_init` will initialize a `DisplayObject` (if unset) in the `Sprite` constructor, using exactly the same logic that we're attempting to use. The code in `MovieClip` is unreachable, and can be deleted. --- core/src/avm2/globals/flash/display/movieclip.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/core/src/avm2/globals/flash/display/movieclip.rs b/core/src/avm2/globals/flash/display/movieclip.rs index a133be9b0..12f6f3d9e 100644 --- a/core/src/avm2/globals/flash/display/movieclip.rs +++ b/core/src/avm2/globals/flash/display/movieclip.rs @@ -12,9 +12,7 @@ use crate::avm2::Namespace; use crate::avm2::QName; use crate::display_object::{MovieClip, Scene, TDisplayObject}; use crate::string::{AvmString, WString}; -use crate::tag_utils::SwfMovie; use gc_arena::{GcCell, MutationContext}; -use std::sync::Arc; /// Implements `flash.display.MovieClip`'s instance constructor. pub fn instance_init<'gc>( @@ -24,17 +22,6 @@ pub fn instance_init<'gc>( ) -> Result, Error<'gc>> { if let Some(this) = this { activation.super_init(this, &[])?; - - if this.as_display_object().is_none() { - let class_object = this - .instance_of() - .ok_or("Attempted to construct MovieClip on a bare object")?; - let movie = Arc::new(SwfMovie::empty(activation.context.swf.version())); - let new_do = - MovieClip::new_with_avm2(movie, this, class_object, activation.context.gc_context); - - this.init_display_object(activation.context.gc_context, new_do.into()); - } } Ok(Value::Undefined) }