Clean up the current set of builtins to accurately reflect the namespace hierarchy.

This commit is contained in:
David Wendt 2020-02-22 19:12:33 -05:00
parent 38b1524a49
commit f6e2ca1fe5
5 changed files with 14 additions and 12 deletions

View File

@ -6,10 +6,9 @@ use crate::avm2::object::{Object, TObject};
use crate::avm2::script_object::ScriptObject;
use gc_arena::{Collect, MutationContext};
mod flash;
mod function;
mod movieclip;
mod object;
mod sprite;
/// This structure represents all system builtins' prototypes.
#[derive(Clone, Collect)]
@ -30,8 +29,8 @@ pub fn construct_global_scope<'gc>(
let object_proto = ScriptObject::bare_object(mc);
let function_proto = function::create_proto(mc, object_proto);
let sprite_proto = sprite::create_proto(mc, object_proto, function_proto);
let movieclip_proto = movieclip::create_proto(mc, sprite_proto, function_proto);
let sprite_proto = flash::display::sprite::create_proto(mc, object_proto, function_proto);
let movieclip_proto = flash::display::movieclip::create_proto(mc, sprite_proto, function_proto);
object::fill_proto(mc, object_proto, function_proto);
@ -74,7 +73,7 @@ pub fn construct_global_scope<'gc>(
QName::new(Namespace::package("flash.display"), "Sprite"),
FunctionObject::from_builtin_constr(
mc,
sprite::constructor,
flash::display::sprite::constructor,
sprite_proto,
function_proto,
)
@ -88,7 +87,7 @@ pub fn construct_global_scope<'gc>(
QName::new(Namespace::package("flash.display"), "MovieClip"),
FunctionObject::from_builtin_constr(
mc,
movieclip::constructor,
flash::display::movieclip::constructor,
movieclip_proto,
function_proto,
)

View File

@ -0,0 +1,3 @@
//! `flash` namespace
pub mod display;

View File

@ -0,0 +1,4 @@
//! `flash.display` namespace
pub mod movieclip;
pub mod sprite;

View File

@ -25,7 +25,5 @@ pub fn create_proto<'gc>(
_fn_proto: Object<'gc>,
) -> Object<'gc> {
// TODO: Use `StageObject` here.
let movieclip_proto = ScriptObject::object(mc, super_proto);
movieclip_proto
ScriptObject::object(mc, super_proto)
}

View File

@ -25,7 +25,5 @@ pub fn create_proto<'gc>(
_fn_proto: Object<'gc>,
) -> Object<'gc> {
// TODO: Use `StageObject` here.
let sprite_proto = ScriptObject::object(mc, super_proto);
sprite_proto
ScriptObject::object(mc, super_proto)
}