fix: 绑定 Function 和 Object prototype harness helper

This commit is contained in:
2026-06-09 19:31:46 +08:00
parent a6982bdf56
commit 06c313e802
7 changed files with 103 additions and 7 deletions
@@ -2,8 +2,12 @@ use std::sync::Arc;
use oxide_kernel::builtin::FunctionMethods;
use oxide_kernel::kernel::OxideKernel;
use oxide_types::object::JsObject;
use oxide_types::value::JsValue;
pub fn bind_function(kernel: &Arc<OxideKernel>) {
use super::bind_global_value;
pub fn bind_function(kernel: &Arc<OxideKernel>, global: &mut JsObject) {
let function_methods = FunctionMethods {
call: crate::builtins::function::function_call as *const (),
apply: crate::builtins::function::function_apply as *const (),
@@ -15,4 +19,7 @@ pub fn bind_function(kernel: &Arc<OxideKernel>) {
kernel.string_forge().as_ref(),
kernel.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));
}