mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
refactor: 拆分 Kernel 中可变 Session 与不可变 Core
This commit is contained in:
@@ -2,26 +2,26 @@ use std::sync::Arc;
|
||||
|
||||
use crate::bind_constructor_hash;
|
||||
use crate::bindings::{apply_binding_table, configure_native_constructor};
|
||||
use oxide_kernel::kernel::OxideKernel;
|
||||
use oxide_kernel::kernel::{KernelCore, KernelSession};
|
||||
use oxide_types::object::JsObject;
|
||||
|
||||
pub fn bind_boolean(kernel: &Arc<OxideKernel>, global: &mut JsObject) {
|
||||
let ctor_ptr = kernel.builtin_world().boolean_constructor.as_ptr() as *mut JsObject;
|
||||
pub fn bind_boolean(core: &Arc<KernelCore>, session: &KernelSession, global: &mut JsObject) {
|
||||
let ctor_ptr = session.builtin_world().boolean_constructor.as_ptr() as *mut JsObject;
|
||||
let ctor = unsafe { &mut *ctor_ptr };
|
||||
let proto_ptr = kernel.builtin_world().boolean_proto.as_ptr() as *mut JsObject;
|
||||
let proto_ptr = session.builtin_world().boolean_proto.as_ptr() as *mut JsObject;
|
||||
let proto = unsafe { &mut *proto_ptr };
|
||||
|
||||
configure_native_constructor(ctor, crate::builtins::boolean::boolean_constructor as *const (), 1);
|
||||
|
||||
apply_binding_table(
|
||||
kernel.builtin_world(),
|
||||
session.builtin_world(),
|
||||
proto,
|
||||
kernel,
|
||||
core,
|
||||
&[
|
||||
("valueOf", crate::builtins::boolean::boolean_prototype_value_of as *const (), 0),
|
||||
("toString", crate::builtins::boolean::boolean_prototype_to_string as *const (), 0),
|
||||
],
|
||||
);
|
||||
|
||||
bind_constructor_hash!(kernel, global, "Boolean", ctor_ptr, crate::builtins::boolean::boolean_constructor, 1);
|
||||
bind_constructor_hash!(core, global, "Boolean", ctor_ptr, crate::builtins::boolean::boolean_constructor, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user