mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:47:47 +00:00
LibJS: Minor formatting changes in Function.cpp
This commit is contained in:
parent
ae05dc8abc
commit
85582953c6
1 changed files with 9 additions and 15 deletions
|
@ -43,9 +43,12 @@ Function::Function(Object& prototype, Value bound_this, Vector<Value> bound_argu
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function::~Function()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
BoundFunction* Function::bind(Value bound_this_value, Vector<Value> arguments)
|
BoundFunction* Function::bind(Value bound_this_value, Vector<Value> arguments)
|
||||||
{
|
{
|
||||||
|
|
||||||
Function& target_function = is_bound_function() ? static_cast<BoundFunction&>(*this).target_function() : *this;
|
Function& target_function = is_bound_function() ? static_cast<BoundFunction&>(*this).target_function() : *this;
|
||||||
|
|
||||||
auto bound_this_object = [bound_this_value, this]() -> Value {
|
auto bound_this_object = [bound_this_value, this]() -> Value {
|
||||||
|
@ -63,21 +66,17 @@ BoundFunction* Function::bind(Value bound_this_value, Vector<Value> arguments)
|
||||||
|
|
||||||
i32 computed_length = 0;
|
i32 computed_length = 0;
|
||||||
auto length_property = get("length");
|
auto length_property = get("length");
|
||||||
if (interpreter().exception()) {
|
if (interpreter().exception())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
if (length_property.is_number())
|
||||||
if (length_property.is_number()) {
|
|
||||||
computed_length = max(0, length_property.to_i32() - static_cast<i32>(arguments.size()));
|
computed_length = max(0, length_property.to_i32() - static_cast<i32>(arguments.size()));
|
||||||
}
|
|
||||||
|
|
||||||
Object* constructor_prototype = nullptr;
|
Object* constructor_prototype = nullptr;
|
||||||
auto prototype_property = target_function.get("prototype");
|
auto prototype_property = target_function.get("prototype");
|
||||||
if (interpreter().exception()) {
|
if (interpreter().exception())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
if (prototype_property.is_object())
|
||||||
if (prototype_property.is_object()) {
|
|
||||||
constructor_prototype = &prototype_property.as_object();
|
constructor_prototype = &prototype_property.as_object();
|
||||||
}
|
|
||||||
|
|
||||||
auto all_bound_arguments = bound_arguments();
|
auto all_bound_arguments = bound_arguments();
|
||||||
all_bound_arguments.append(move(arguments));
|
all_bound_arguments.append(move(arguments));
|
||||||
|
@ -91,13 +90,8 @@ void Function::visit_children(Visitor& visitor)
|
||||||
|
|
||||||
visitor.visit(m_bound_this);
|
visitor.visit(m_bound_this);
|
||||||
|
|
||||||
for (auto argument : m_bound_arguments) {
|
for (auto argument : m_bound_arguments)
|
||||||
visitor.visit(argument);
|
visitor.visit(argument);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Function::~Function()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue