avm2: class methods can also live in the AS3 namespace
This commit is contained in:
parent
5e5d8e4fff
commit
91d63e4dc1
|
@ -553,6 +553,19 @@ impl<'gc> Class<'gc> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
|
pub fn define_as3_builtin_class_methods(
|
||||||
|
&mut self,
|
||||||
|
mc: MutationContext<'gc, '_>,
|
||||||
|
items: &[(&'static str, NativeMethodImpl)],
|
||||||
|
) {
|
||||||
|
for &(name, value) in items {
|
||||||
|
self.define_class_trait(Trait::from_method(
|
||||||
|
QName::new(Namespace::as3_namespace(), name),
|
||||||
|
Method::from_builtin(value, name, mc),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[inline(never)]
|
||||||
pub fn define_as3_builtin_instance_methods(
|
pub fn define_as3_builtin_instance_methods(
|
||||||
&mut self,
|
&mut self,
|
||||||
mc: MutationContext<'gc, '_>,
|
mc: MutationContext<'gc, '_>,
|
||||||
|
|
|
@ -341,7 +341,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
|
||||||
write.define_as3_builtin_instance_methods(mc, AS3_INSTANCE_METHODS);
|
write.define_as3_builtin_instance_methods(mc, AS3_INSTANCE_METHODS);
|
||||||
|
|
||||||
const PUBLIC_CLASS_METHODS: &[(&str, NativeMethodImpl)] = &[("fromCharCode", from_char_code)];
|
const PUBLIC_CLASS_METHODS: &[(&str, NativeMethodImpl)] = &[("fromCharCode", from_char_code)];
|
||||||
write.define_public_builtin_class_methods(mc, PUBLIC_CLASS_METHODS);
|
write.define_as3_builtin_class_methods(mc, PUBLIC_CLASS_METHODS);
|
||||||
|
|
||||||
class
|
class
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue