style: 自动格式化

This commit is contained in:
2026-06-30 15:09:19 +08:00
parent 32092bddd5
commit 9f3e353f56
5 changed files with 75 additions and 27 deletions
+12 -3
View File
@@ -82,11 +82,20 @@ pub fn function_apply<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult {
pub fn function_bind<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult {
if args.is_empty() {
return NativeResult::Err(crate::error::create_type_error(vm, "Function.prototype.bind called on null or undefined"));
return NativeResult::Err(crate::error::create_type_error(
vm,
"Function.prototype.bind called on null or undefined",
));
}
let target_val = vm.reg(args[0]);
if !target_val.is_object() || target_val.as_js_object_ptr().is_null() || !unsafe { &*target_val.as_js_object_ptr() }.is_function() {
return NativeResult::Err(crate::error::create_type_error(vm, "Function.prototype.bind called on non-function"));
if !target_val.is_object()
|| target_val.as_js_object_ptr().is_null()
|| !unsafe { &*target_val.as_js_object_ptr() }.is_function()
{
return NativeResult::Err(crate::error::create_type_error(
vm,
"Function.prototype.bind called on non-function",
));
}
let bound_this = if args.len() > 1 { vm.reg(args[1]) } else { JsValue::undefined() };