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:
@@ -1,25 +1,25 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use oxide_kernel::builtin::FunctionMethods;
|
||||
use oxide_kernel::kernel::OxideKernel;
|
||||
use oxide_kernel::kernel::{KernelCore, KernelSession};
|
||||
use oxide_types::object::JsObject;
|
||||
use oxide_types::value::JsValue;
|
||||
|
||||
use super::bind_global_value;
|
||||
|
||||
pub fn bind_function(kernel: &Arc<OxideKernel>, global: &mut JsObject) {
|
||||
pub fn bind_function(core: &Arc<KernelCore>, session: &KernelSession, global: &mut JsObject) {
|
||||
let function_methods = FunctionMethods {
|
||||
call: crate::builtins::function::function_call as *const (),
|
||||
apply: crate::builtins::function::function_apply as *const (),
|
||||
bind: crate::builtins::function::function_bind as *const (),
|
||||
to_string: crate::builtins::function::function_to_string as *const (),
|
||||
};
|
||||
kernel.builtin_world().bind_function_methods(
|
||||
session.builtin_world().bind_function_methods(
|
||||
&function_methods,
|
||||
kernel.string_forge().as_ref(),
|
||||
kernel.shape_forge().as_ref(),
|
||||
core.string_forge().as_ref(),
|
||||
core.shape_forge().as_ref(),
|
||||
);
|
||||
|
||||
let function_ctor = kernel.builtin_world().function_constructor.as_ptr() as *mut JsObject;
|
||||
bind_global_value(kernel, global, "Function", JsValue::from_js_object(function_ctor));
|
||||
let function_ctor = session.builtin_world().function_constructor.as_ptr() as *mut JsObject;
|
||||
bind_global_value(core, global, "Function", JsValue::from_js_object(function_ctor));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user