mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 10:41:11 +08:00
style: 减少自动格式化换行
This commit is contained in:
@@ -7,20 +7,13 @@ use oxide_types::object::JsObject;
|
||||
use oxide_types::value::JsValue;
|
||||
|
||||
fn bind_error_subtype_constructor(
|
||||
kernel: &Arc<OxideKernel>,
|
||||
global: &mut JsObject,
|
||||
name: &str,
|
||||
proto_ptr: *mut JsObject,
|
||||
ctor_fn: *const (),
|
||||
kernel: &Arc<OxideKernel>, global: &mut JsObject, name: &str, proto_ptr: *mut JsObject, ctor_fn: *const (),
|
||||
) {
|
||||
let sf = kernel.string_forge().as_ref();
|
||||
let sh = kernel.shape_forge().as_ref();
|
||||
let function_proto_ptr = kernel.builtin_world().function_proto.as_ptr() as *mut JsObject;
|
||||
|
||||
let mut ctor = Box::new(JsObject::new_empty(
|
||||
EMPTY_SHAPE_ID,
|
||||
JsValue::from_js_object(function_proto_ptr),
|
||||
));
|
||||
let mut ctor = Box::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::from_js_object(function_proto_ptr)));
|
||||
ctor.set_function(true);
|
||||
ctor.set_native_fn(Some(ctor_fn));
|
||||
ctor.set_native_arg_count(1);
|
||||
@@ -32,25 +25,19 @@ fn bind_error_subtype_constructor(
|
||||
let ctor_shape1 = sh.make_shape(EMPTY_SHAPE_ID, si_prototype);
|
||||
let ctor_shape2 = sh.make_shape(ctor_shape1, si_name);
|
||||
ctor.set_shape_id(ctor_shape2);
|
||||
ctor.ensure_hash_props()
|
||||
.push(Box::new(JsValue::from_js_object(proto_ptr)));
|
||||
ctor.ensure_hash_props()
|
||||
.push(Box::new(JsValue::string(name_si, 0)));
|
||||
ctor.ensure_hash_props().push(Box::new(JsValue::from_js_object(proto_ptr)));
|
||||
ctor.ensure_hash_props().push(Box::new(JsValue::string(name_si, 0)));
|
||||
|
||||
let ctor_ptr = Box::into_raw(ctor);
|
||||
|
||||
let proto = unsafe { &mut *proto_ptr };
|
||||
let proto_ctor_shape = sh.make_shape(proto.shape_id(), sf.intern("constructor").0);
|
||||
proto.set_shape_id(proto_ctor_shape);
|
||||
proto
|
||||
.ensure_hash_props()
|
||||
.push(Box::new(JsValue::from_js_object(ctor_ptr)));
|
||||
proto.ensure_hash_props().push(Box::new(JsValue::from_js_object(ctor_ptr)));
|
||||
|
||||
let global_shape = sh.make_shape(global.shape_id(), name_si);
|
||||
global.set_shape_id(global_shape);
|
||||
global
|
||||
.ensure_hash_props()
|
||||
.push(Box::new(JsValue::from_js_object(ctor_ptr)));
|
||||
global.ensure_hash_props().push(Box::new(JsValue::from_js_object(ctor_ptr)));
|
||||
global.bump_generation();
|
||||
}
|
||||
|
||||
@@ -74,8 +61,7 @@ pub fn bind_error(kernel: &Arc<OxideKernel>, global: &mut JsObject) {
|
||||
|
||||
let si_err = kernel.string_forge().intern("Error").0;
|
||||
let err_shape = kernel.shape_forge().make_shape(global.shape_id(), si_err);
|
||||
let err_val =
|
||||
JsValue::from_js_object(kernel.builtin_world().error_constructor.as_ptr() as *mut JsObject);
|
||||
let err_val = JsValue::from_js_object(kernel.builtin_world().error_constructor.as_ptr() as *mut JsObject);
|
||||
global.set_shape_id(err_shape);
|
||||
global.ensure_hash_props().push(Box::new(err_val));
|
||||
global.bump_generation();
|
||||
|
||||
Reference in New Issue
Block a user