Remove the `DisplayNode` slot from `ScriptObject`, since all display node objects should be `StageObject`s now.
This commit is contained in:
parent
fa9329df68
commit
724f845037
|
@ -11,7 +11,6 @@ use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
pub const TYPE_OF_OBJECT: &str = "object";
|
pub const TYPE_OF_OBJECT: &str = "object";
|
||||||
pub const TYPE_OF_FUNCTION: &str = "function";
|
pub const TYPE_OF_FUNCTION: &str = "function";
|
||||||
pub const TYPE_OF_MOVIE_CLIP: &str = "movieclip";
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Collect)]
|
#[derive(Debug, Copy, Clone, Collect)]
|
||||||
#[collect(no_drop)]
|
#[collect(no_drop)]
|
||||||
|
@ -19,7 +18,6 @@ pub struct ScriptObject<'gc>(GcCell<'gc, ScriptObjectData<'gc>>);
|
||||||
|
|
||||||
pub struct ScriptObjectData<'gc> {
|
pub struct ScriptObjectData<'gc> {
|
||||||
prototype: Option<Object<'gc>>,
|
prototype: Option<Object<'gc>>,
|
||||||
display_object: Option<DisplayObject<'gc>>,
|
|
||||||
values: HashMap<String, Property<'gc>>,
|
values: HashMap<String, Property<'gc>>,
|
||||||
function: Option<Executable<'gc>>,
|
function: Option<Executable<'gc>>,
|
||||||
type_of: &'static str,
|
type_of: &'static str,
|
||||||
|
@ -28,7 +26,6 @@ pub struct ScriptObjectData<'gc> {
|
||||||
unsafe impl<'gc> Collect for ScriptObjectData<'gc> {
|
unsafe impl<'gc> Collect for ScriptObjectData<'gc> {
|
||||||
fn trace(&self, cc: gc_arena::CollectionContext) {
|
fn trace(&self, cc: gc_arena::CollectionContext) {
|
||||||
self.prototype.trace(cc);
|
self.prototype.trace(cc);
|
||||||
self.display_object.trace(cc);
|
|
||||||
self.values.trace(cc);
|
self.values.trace(cc);
|
||||||
self.function.trace(cc);
|
self.function.trace(cc);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +35,6 @@ impl fmt::Debug for ScriptObjectData<'_> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
f.debug_struct("Object")
|
f.debug_struct("Object")
|
||||||
.field("prototype", &self.prototype)
|
.field("prototype", &self.prototype)
|
||||||
.field("display_object", &self.display_object)
|
|
||||||
.field("values", &self.values)
|
.field("values", &self.values)
|
||||||
.field("function", &self.function.is_some())
|
.field("function", &self.function.is_some())
|
||||||
.finish()
|
.finish()
|
||||||
|
@ -55,7 +51,6 @@ impl<'gc> ScriptObject<'gc> {
|
||||||
ScriptObjectData {
|
ScriptObjectData {
|
||||||
prototype: proto,
|
prototype: proto,
|
||||||
type_of: TYPE_OF_OBJECT,
|
type_of: TYPE_OF_OBJECT,
|
||||||
display_object: None,
|
|
||||||
values: HashMap::new(),
|
values: HashMap::new(),
|
||||||
function: None,
|
function: None,
|
||||||
},
|
},
|
||||||
|
@ -72,7 +67,6 @@ impl<'gc> ScriptObject<'gc> {
|
||||||
ScriptObjectData {
|
ScriptObjectData {
|
||||||
prototype: proto,
|
prototype: proto,
|
||||||
type_of: TYPE_OF_OBJECT,
|
type_of: TYPE_OF_OBJECT,
|
||||||
display_object: None,
|
|
||||||
values: HashMap::new(),
|
values: HashMap::new(),
|
||||||
function: None,
|
function: None,
|
||||||
},
|
},
|
||||||
|
@ -91,7 +85,6 @@ impl<'gc> ScriptObject<'gc> {
|
||||||
ScriptObjectData {
|
ScriptObjectData {
|
||||||
prototype: None,
|
prototype: None,
|
||||||
type_of: TYPE_OF_OBJECT,
|
type_of: TYPE_OF_OBJECT,
|
||||||
display_object: None,
|
|
||||||
values: HashMap::new(),
|
values: HashMap::new(),
|
||||||
function: None,
|
function: None,
|
||||||
},
|
},
|
||||||
|
@ -110,7 +103,6 @@ impl<'gc> ScriptObject<'gc> {
|
||||||
prototype: fn_proto,
|
prototype: fn_proto,
|
||||||
type_of: TYPE_OF_FUNCTION,
|
type_of: TYPE_OF_FUNCTION,
|
||||||
function: Some(function.into()),
|
function: Some(function.into()),
|
||||||
display_object: None,
|
|
||||||
values: HashMap::new(),
|
values: HashMap::new(),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
@ -146,11 +138,6 @@ impl<'gc> ScriptObject<'gc> {
|
||||||
function
|
function
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub fn display_object(self) -> Option<DisplayObject<'gc>> {
|
|
||||||
self.0.read().display_object
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Declare a native function on the current object.
|
/// Declare a native function on the current object.
|
||||||
///
|
///
|
||||||
/// This is intended for use with defining host object prototypes. Notably,
|
/// This is intended for use with defining host object prototypes. Notably,
|
||||||
|
@ -399,7 +386,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
||||||
}
|
}
|
||||||
/// Get the underlying display node for this object, if it exists.
|
/// Get the underlying display node for this object, if it exists.
|
||||||
fn as_display_object(&self) -> Option<DisplayObject<'gc>> {
|
fn as_display_object(&self) -> Option<DisplayObject<'gc>> {
|
||||||
self.0.read().display_object
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a copy of a given function.
|
/// Returns a copy of a given function.
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use crate::avm1::function::Executable;
|
use crate::avm1::function::Executable;
|
||||||
use crate::avm1::property::Attribute;
|
use crate::avm1::property::Attribute;
|
||||||
use crate::avm1::return_value::ReturnValue;
|
use crate::avm1::return_value::ReturnValue;
|
||||||
use crate::avm1::script_object::TYPE_OF_MOVIE_CLIP;
|
|
||||||
use crate::avm1::{Avm1, Error, Object, ObjectPtr, ScriptObject, TObject, Value};
|
use crate::avm1::{Avm1, Error, Object, ObjectPtr, ScriptObject, TObject, Value};
|
||||||
use crate::context::UpdateContext;
|
use crate::context::UpdateContext;
|
||||||
use crate::display_object::DisplayObject;
|
use crate::display_object::DisplayObject;
|
||||||
|
@ -12,6 +11,9 @@ use gc_arena::{Collect, MutationContext};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
/// The type string for MovieClip objects.
|
||||||
|
pub const TYPE_OF_MOVIE_CLIP: &str = "movieclip";
|
||||||
|
|
||||||
/// A ScriptObject that is inherently tied to a display node.
|
/// A ScriptObject that is inherently tied to a display node.
|
||||||
#[derive(Clone, Copy, Collect)]
|
#[derive(Clone, Copy, Collect)]
|
||||||
#[collect(no_drop)]
|
#[collect(no_drop)]
|
||||||
|
|
Loading…
Reference in New Issue