mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibJS: Move has_constructor() from NativeFunction to FunctionObject
At a later point this will indicate whether some FunctionObject "has a [[Construct]] internal method" (separate from the current FunctionObject call() / construct()), to help with a more spec-compliant implementation of [[Call]] and [[Construct]]. This means that it is no longer relevant to just NativeFunction.
This commit is contained in:
@@ -181,7 +181,7 @@ Value NewExpression::execute(Interpreter& interpreter, GlobalObject& global_obje
|
||||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
if (!callee_value.is_function() || (is<NativeFunction>(callee_value.as_object()) && !static_cast<NativeFunction&>(callee_value.as_object()).has_constructor())) {
|
||||
if (!callee_value.is_function() || !callee_value.as_function().has_constructor()) {
|
||||
throw_type_error_for_callee(interpreter, global_object, callee_value, "constructor"sv);
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user