chore: cargo fmt

This commit is contained in:
Adrian Wielgosik 2022-02-02 23:07:34 +01:00 committed by Adrian Wielgosik
parent 9059e199e2
commit 2c4b260a8c
6 changed files with 23 additions and 9 deletions

View File

@ -65,7 +65,11 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
"<Namespace native instance initializer>", "<Namespace native instance initializer>",
mc, mc,
)); ));
write.set_call_handler(Method::from_builtin(class_call, "<Namespace call handler>", mc)); write.set_call_handler(Method::from_builtin(
class_call,
"<Namespace call handler>",
mc,
));
class class
} }

View File

@ -274,7 +274,11 @@ pub fn create_class<'gc>(gc_context: MutationContext<'gc, '_>) -> GcCell<'gc, Cl
gc_context, gc_context,
); );
let mut write = object_class.write(gc_context); let mut write = object_class.write(gc_context);
write.set_call_handler(Method::from_builtin(class_call, "<Object call handler>", gc_context)); write.set_call_handler(Method::from_builtin(
class_call,
"<Object call handler>",
gc_context,
));
write.define_class_trait(Trait::from_const( write.define_class_trait(Trait::from_const(
QName::new(Namespace::public(), "length"), QName::new(Namespace::public(), "length"),

View File

@ -56,7 +56,6 @@ fn class_call<'gc>(
this: Option<Object<'gc>>, this: Option<Object<'gc>>,
args: &[Value<'gc>], args: &[Value<'gc>],
) -> Result<Value<'gc>, Error> { ) -> Result<Value<'gc>, Error> {
let this_class = activation.subclass_object().unwrap(); let this_class = activation.subclass_object().unwrap();
if args.len() == 1 { if args.len() == 1 {
@ -295,7 +294,11 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc); let mut write = class.write(mc);
write.set_instance_allocator(regexp_allocator); write.set_instance_allocator(regexp_allocator);
write.set_call_handler(Method::from_builtin(class_call, "<RegExp call handler>", mc)); write.set_call_handler(Method::from_builtin(
class_call,
"<RegExp call handler>",
mc,
));
const PUBLIC_INSTANCE_PROPERTIES: &[( const PUBLIC_INSTANCE_PROPERTIES: &[(
&str, &str,

View File

@ -8,7 +8,7 @@ use crate::avm2::globals::array::{
}; };
use crate::avm2::globals::NS_VECTOR; use crate::avm2::globals::NS_VECTOR;
use crate::avm2::method::{Method, NativeMethodImpl}; use crate::avm2::method::{Method, NativeMethodImpl};
use crate::avm2::names::{Namespace, QName, Multiname}; use crate::avm2::names::{Multiname, Namespace, QName};
use crate::avm2::object::{vector_allocator, FunctionObject, Object, TObject, VectorObject}; use crate::avm2::object::{vector_allocator, FunctionObject, Object, TObject, VectorObject};
use crate::avm2::value::Value; use crate::avm2::value::Value;
use crate::avm2::vector::VectorStorage; use crate::avm2::vector::VectorStorage;
@ -1046,7 +1046,11 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
"<Vector specialized class initializer>", "<Vector specialized class initializer>",
mc, mc,
)); ));
write.set_call_handler(Method::from_builtin(class_call, "<Vector call handler>", mc)); write.set_call_handler(Method::from_builtin(
class_call,
"<Vector call handler>",
mc,
));
const PUBLIC_INSTANCE_PROPERTIES: &[( const PUBLIC_INSTANCE_PROPERTIES: &[(
&str, &str,

View File

@ -760,8 +760,7 @@ impl<'gc> TObject<'gc> for ClassObject<'gc> {
) -> Result<Value<'gc>, Error> { ) -> Result<Value<'gc>, Error> {
if let Some(call_handler) = self.0.read().call_handler.clone() { if let Some(call_handler) = self.0.read().call_handler.clone() {
let scope = self.0.read().class_scope; let scope = self.0.read().class_scope;
let func = let func = Executable::from_method(call_handler, scope, None, Some(self));
Executable::from_method(call_handler, scope, None, Some(self));
func.exec(receiver, arguments, activation, self.into()) func.exec(receiver, arguments, activation, self.into())
} else { } else {

View File

@ -573,7 +573,7 @@ impl<'gc> Value<'gc> {
pub fn as_object(&self) -> Option<Object<'gc>> { pub fn as_object(&self) -> Option<Object<'gc>> {
match self { match self {
Value::Object(o) => Some(*o), Value::Object(o) => Some(*o),
_ => None _ => None,
} }
} }