fix: 修复 new Error() 未调用原生构造函数问题

This commit is contained in:
爱特每羊队
2026-06-07 23:13:32 +08:00
parent 850f9f12ed
commit 963264ee27
+6
View File
@@ -212,6 +212,12 @@ fn bind_error(kernel: &Arc<OxideKernel>, global: &mut JsObject) {
global.set_shape_id(err_shape);
global.ensure_hash_props().push(Box::new(err_val));
global.bump_generation();
{
let err_ctor_ptr = kernel.builtin_world().error_constructor.as_ptr() as *mut JsObject;
let err_ctor = unsafe { &mut *err_ctor_ptr };
err_ctor.set_native_fn(Some(crate::builtins::error::error_constructor as *const ()));
}
}
fn bind_string(kernel: &Arc<OxideKernel>, global: &mut JsObject) {