avm2: Remove `Class::class_init`
This commit is contained in:
parent
13ee356b8c
commit
e222a1646c
|
@ -334,11 +334,15 @@ impl<'gc> Class<'gc> {
|
|||
// This can only happen for non-builtin Vector types,
|
||||
// so let's create one here directly.
|
||||
|
||||
let object_vector_cls = this_read
|
||||
let object_vector_i_class = this_read
|
||||
.applications
|
||||
.get(&None)
|
||||
.expect("Vector.<*> not initialized?");
|
||||
|
||||
let object_vector_c_class = object_vector_i_class
|
||||
.c_class()
|
||||
.expect("T$ cannot be generic");
|
||||
|
||||
let param = param.expect("Trying to create Vector<*>, which shouldn't happen here");
|
||||
let name = format!("Vector.<{}>", param.name().to_qualified_name(mc));
|
||||
|
||||
|
@ -353,14 +357,14 @@ impl<'gc> Class<'gc> {
|
|||
.object_vector
|
||||
.inner_class_definition(),
|
||||
),
|
||||
object_vector_cls.instance_init(),
|
||||
object_vector_cls.class_init(),
|
||||
object_vector_i_class.instance_init(),
|
||||
object_vector_c_class.instance_init(),
|
||||
context.avm2.classes().class.inner_class_definition(),
|
||||
mc,
|
||||
);
|
||||
|
||||
new_class.set_param(mc, Some(Some(param)));
|
||||
new_class.0.write(mc).call_handler = object_vector_cls.call_handler();
|
||||
new_class.0.write(mc).call_handler = object_vector_i_class.call_handler();
|
||||
|
||||
new_class.mark_traits_loaded(context.gc_context);
|
||||
new_class
|
||||
|
@ -1302,17 +1306,6 @@ impl<'gc> Class<'gc> {
|
|||
self.0.write(mc).native_instance_init = new_native_init;
|
||||
}
|
||||
|
||||
/// Get this class's class initializer.
|
||||
pub fn class_init(self) -> Method<'gc> {
|
||||
self.0
|
||||
.read()
|
||||
.c_class
|
||||
.expect("Accessed class_init on a c_class")
|
||||
.0
|
||||
.read()
|
||||
.instance_init
|
||||
}
|
||||
|
||||
/// Set a call handler for this class.
|
||||
pub fn set_call_handler(self, mc: &Mutation<'gc>, new_call_handler: Method<'gc>) {
|
||||
self.0.write(mc).call_handler = Some(new_call_handler);
|
||||
|
|
|
@ -335,9 +335,12 @@ impl<'gc> ClassObject<'gc> {
|
|||
let object: Object<'gc> = self.into();
|
||||
|
||||
let scope = self.0.read().class_scope;
|
||||
let class = self.0.read().class;
|
||||
let c_class = self
|
||||
.inner_class_definition()
|
||||
.c_class()
|
||||
.expect("ClassObject stores an i_class");
|
||||
|
||||
let class_initializer = class.class_init();
|
||||
let class_initializer = c_class.instance_init();
|
||||
let class_init_fn = FunctionObject::from_method(
|
||||
activation,
|
||||
class_initializer,
|
||||
|
|
Loading…
Reference in New Issue