mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
style: 自动格式化
This commit is contained in:
@@ -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() };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user