mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
style: 自动格式化
This commit is contained in:
@@ -51,12 +51,8 @@ pub fn bind_array(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
with_method: oxide_builtins::array::array_with::<crate::vm::Vm> as *const (),
|
||||
};
|
||||
|
||||
env.world().bind_array_methods(
|
||||
&_array_methods,
|
||||
env.string_forge(),
|
||||
env.shape_forge(),
|
||||
env.realm_id,
|
||||
);
|
||||
env.world()
|
||||
.bind_array_methods(&_array_methods, env.string_forge(), env.shape_forge(), env.realm_id);
|
||||
|
||||
let array_proto_ptr = env.world().array_proto.as_ptr() as *mut JsObject;
|
||||
let array_proto = unsafe { &mut *array_proto_ptr };
|
||||
|
||||
@@ -170,8 +170,7 @@ pub fn sync_async_disposable_stack_ctor(env: BindEnv<'_>, global: &mut JsObject)
|
||||
let Some(proto_pos) = env.shape_forge().lookup_position(ctor.shape_id(), si_prototype) else {
|
||||
return;
|
||||
};
|
||||
let new_proto =
|
||||
JsValue::from_js_object(env.world().async_disposable_stack_proto.as_ptr() as *mut JsObject);
|
||||
let new_proto = JsValue::from_js_object(env.world().async_disposable_stack_proto.as_ptr() as *mut JsObject);
|
||||
ctor.set_prop_at(proto_pos, new_proto);
|
||||
|
||||
let proto_ptr = env.world().async_disposable_stack_proto.as_ptr() as *mut JsObject;
|
||||
|
||||
@@ -6,8 +6,7 @@ use oxide_types::value::JsValue;
|
||||
use super::BindEnv;
|
||||
|
||||
fn bind_error_subtype_constructor(
|
||||
env: BindEnv<'_>, global: &mut JsObject, name: &str, proto_ptr: *mut JsObject,
|
||||
ctor_fn: *const (), arg_count: u8,
|
||||
env: BindEnv<'_>, global: &mut JsObject, name: &str, proto_ptr: *mut JsObject, ctor_fn: *const (), arg_count: u8,
|
||||
) {
|
||||
let sf = env.string_forge();
|
||||
let sh = env.shape_forge();
|
||||
@@ -108,11 +107,8 @@ pub fn bind_error(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
is_error: oxide_builtins::error::error_is_error::<crate::vm::Vm> as *const (),
|
||||
to_json: oxide_builtins::error::error_to_json::<crate::vm::Vm> as *const (),
|
||||
};
|
||||
env.world().bind_error_methods(
|
||||
&error_methods,
|
||||
env.string_forge(),
|
||||
env.shape_forge(),
|
||||
);
|
||||
env.world()
|
||||
.bind_error_methods(&error_methods, env.string_forge(), env.shape_forge());
|
||||
|
||||
// stack 为访问器成对安装(getter 现算栈串 / setter 走
|
||||
// SetterThatIgnoresPrototypeProperties),经 getset 绑定器登记复用键,
|
||||
|
||||
@@ -20,12 +20,8 @@ pub fn bind_function(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
to_string: oxide_builtins::function::function_to_string::<crate::vm::Vm> as *const (),
|
||||
has_instance: oxide_builtins::function::function_symbol_has_instance::<crate::vm::Vm> as *const (),
|
||||
};
|
||||
env.world().bind_function_methods(
|
||||
&function_methods,
|
||||
env.string_forge(),
|
||||
env.shape_forge(),
|
||||
env.realm_id,
|
||||
);
|
||||
env.world()
|
||||
.bind_function_methods(&function_methods, env.string_forge(), env.shape_forge(), env.realm_id);
|
||||
|
||||
let function_ctor = env.world().function_constructor.as_ptr() as *mut JsObject;
|
||||
configure_native_constructor(
|
||||
|
||||
@@ -36,8 +36,7 @@ pub fn bind_object(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
as *const (),
|
||||
group_by: oxide_builtins::object::object_group_by::<crate::vm::Vm> as *const (),
|
||||
};
|
||||
env.world()
|
||||
.bind_object_methods(&methods, env.string_forge(), env.shape_forge());
|
||||
env.world().bind_object_methods(&methods, env.string_forge(), env.shape_forge());
|
||||
|
||||
let object_proto_ptr = env.world().object_proto.as_ptr() as *mut JsObject;
|
||||
let object_proto = unsafe { &mut *object_proto_ptr };
|
||||
|
||||
@@ -60,11 +60,8 @@ pub fn bind_string(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
sub: oxide_builtins::string::string_sub::<crate::vm::Vm> as *const (),
|
||||
sup: oxide_builtins::string::string_sup::<crate::vm::Vm> as *const (),
|
||||
};
|
||||
env.world().bind_string_methods(
|
||||
&string_methods,
|
||||
env.string_forge(),
|
||||
env.shape_forge(),
|
||||
);
|
||||
env.world()
|
||||
.bind_string_methods(&string_methods, env.string_forge(), env.shape_forge());
|
||||
|
||||
let ctor_ptr = env.world().string_constructor.as_ptr() as *mut JsObject;
|
||||
let ctor = unsafe { &mut *ctor_ptr };
|
||||
@@ -103,9 +100,7 @@ pub fn bind_string(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
if let Some(pos) = env.shape_forge().lookup_position(proto.shape_id(), iter_key) {
|
||||
let v = proto.get_prop_at(pos);
|
||||
if v.is_object() {
|
||||
env.world()
|
||||
.string_default_iterator
|
||||
.set(v.as_js_object_ptr() as *const JsObject);
|
||||
env.world().string_default_iterator.set(v.as_js_object_ptr() as *const JsObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,10 +117,7 @@ pub fn bind_temporal(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
env.core,
|
||||
instant_proto,
|
||||
9,
|
||||
JsValue::perm_string(
|
||||
env.string_forge()
|
||||
.string_ptr(env.string_forge().intern("Temporal.Instant").0),
|
||||
),
|
||||
JsValue::perm_string(env.string_forge().string_ptr(env.string_forge().intern("Temporal.Instant").0)),
|
||||
PropAttributes::new(false, false, true),
|
||||
env.realm_id,
|
||||
);
|
||||
@@ -666,10 +663,7 @@ pub fn bind_temporal(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
env.core,
|
||||
plain_time_proto,
|
||||
9,
|
||||
JsValue::perm_string(
|
||||
env.string_forge()
|
||||
.string_ptr(env.string_forge().intern("Temporal.PlainTime").0),
|
||||
),
|
||||
JsValue::perm_string(env.string_forge().string_ptr(env.string_forge().intern("Temporal.PlainTime").0)),
|
||||
PropAttributes::new(false, false, true),
|
||||
env.realm_id,
|
||||
);
|
||||
@@ -911,10 +905,7 @@ pub fn bind_temporal(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
env.core,
|
||||
duration_proto,
|
||||
9,
|
||||
JsValue::perm_string(
|
||||
env.string_forge()
|
||||
.string_ptr(env.string_forge().intern("Temporal.Duration").0),
|
||||
),
|
||||
JsValue::perm_string(env.string_forge().string_ptr(env.string_forge().intern("Temporal.Duration").0)),
|
||||
PropAttributes::new(false, false, true),
|
||||
env.realm_id,
|
||||
);
|
||||
|
||||
@@ -354,8 +354,7 @@ pub fn bind_typed_array(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
bind_typed_array_abstract_ctor(env);
|
||||
|
||||
// 把 `%TypedArray%` 抽象构造器暴露为全局 `TypedArray`(具体构造器的 [[Prototype]])。
|
||||
let abstract_ctor_val =
|
||||
JsValue::from_js_object(env.world().typed_array_constructor.as_ptr() as *mut JsObject);
|
||||
let abstract_ctor_val = JsValue::from_js_object(env.world().typed_array_constructor.as_ptr() as *mut JsObject);
|
||||
bind_global_value(env.core, global, "TypedArray", abstract_ctor_val);
|
||||
|
||||
bind_typed_array_constructor!(
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
//! 安装(既有槽更新槽值、无槽新开)。
|
||||
|
||||
use crate::bind_constructor;
|
||||
use crate::bindings::{apply_binding_table, bind_accessor_getset, bind_accessor_getter, configure_native_constructor, BindEnv};
|
||||
use crate::bindings::{
|
||||
apply_binding_table, bind_accessor_getset, bind_accessor_getter, configure_native_constructor, BindEnv,
|
||||
};
|
||||
use oxide_kernel::shape_forge::{ShapeForge, EMPTY_SHAPE_ID};
|
||||
use oxide_types::object::{JsObject, PropAttributes};
|
||||
use oxide_types::string_forge::PermInterner;
|
||||
@@ -165,11 +167,7 @@ pub fn bind_worker(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
// 幂等守卫。
|
||||
let si_import_scripts = sf.intern("importScripts").0;
|
||||
if sh.lookup_position(global.shape_id(), si_import_scripts).is_none() {
|
||||
apply_binding_table(
|
||||
env,
|
||||
global,
|
||||
&[("importScripts", crate::worker::bindings::import_scripts as *const (), 1)],
|
||||
);
|
||||
apply_binding_table(env, global, &[("importScripts", crate::worker::bindings::import_scripts as *const (), 1)]);
|
||||
}
|
||||
// EventTarget 三方法直绑全局(worker realm 经 self === global 可达;全局原型链
|
||||
// 是 Object.prototype,首版不改全局原型,三方法直绑全局等价可见)。幂等守卫。
|
||||
@@ -241,12 +239,7 @@ pub fn bind_worker(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
let si_location = sf.intern("location").0;
|
||||
if sh.lookup_position(global.shape_id(), si_location).is_none() {
|
||||
if worker_realm {
|
||||
bind_accessor_getter(
|
||||
env,
|
||||
global,
|
||||
"location",
|
||||
crate::worker::bindings::self_location as *const (),
|
||||
);
|
||||
bind_accessor_getter(env, global, "location", crate::worker::bindings::self_location as *const ());
|
||||
} else {
|
||||
bind_global_empty_string_property(global, sf, sh, si_location);
|
||||
}
|
||||
|
||||
@@ -285,8 +285,8 @@ pub(crate) fn bind_accessor_getter_key(
|
||||
/// getter/setter 函数对象登记进 world 释放表,session 收尾时统一释放,
|
||||
/// 与 `bind_accessor_getter` 的 getter 及方法 wrapper 同一生命周期约定。
|
||||
pub(crate) fn bind_accessor_getset(
|
||||
env: BindEnv<'_>, proto: &mut JsObject, key: u32, getter_name: &str, setter_name: &str,
|
||||
getter_fn: *const (), setter_fn: *const (),
|
||||
env: BindEnv<'_>, proto: &mut JsObject, key: u32, getter_name: &str, setter_name: &str, getter_fn: *const (),
|
||||
setter_fn: *const (),
|
||||
) {
|
||||
let shape_forge = env.shape_forge();
|
||||
let string_forge = env.string_forge();
|
||||
|
||||
Reference in New Issue
Block a user