mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibJS: Move [[BoundThis]] and [[BoundArguments]] to BoundFunction
This commit is contained in:
parent
4566472ed6
commit
9043041dd3
Notes:
sideshowbarker
2024-07-18 03:27:54 +09:00
Author: https://github.com/linusg
Commit: 9043041dd3
Pull-request: https://github.com/SerenityOS/serenity/pull/10203
Reviewed-by: https://github.com/IdanHo ✅
Reviewed-by: https://github.com/davidot
7 changed files with 31 additions and 39 deletions
|
@ -9,9 +9,11 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
BoundFunction::BoundFunction(GlobalObject& global_object, FunctionObject& bound_target_function, Value bound_this, Vector<Value> arguments, i32 length, Object* constructor_prototype)
|
||||
: FunctionObject(bound_this, move(arguments), *global_object.function_prototype())
|
||||
BoundFunction::BoundFunction(GlobalObject& global_object, FunctionObject& bound_target_function, Value bound_this, Vector<Value> bound_arguments, i32 length, Object* constructor_prototype)
|
||||
: FunctionObject(*global_object.function_prototype())
|
||||
, m_bound_target_function(&bound_target_function)
|
||||
, m_bound_this(bound_this)
|
||||
, m_bound_arguments(move(bound_arguments))
|
||||
, m_constructor_prototype(constructor_prototype)
|
||||
, m_name(String::formatted("bound {}", bound_target_function.name()))
|
||||
, m_length(length)
|
||||
|
@ -52,7 +54,12 @@ FunctionEnvironment* BoundFunction::create_environment(FunctionObject& function_
|
|||
void BoundFunction::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
||||
visitor.visit(m_bound_target_function);
|
||||
visitor.visit(m_bound_this);
|
||||
for (auto argument : m_bound_arguments)
|
||||
visitor.visit(argument);
|
||||
|
||||
visitor.visit(m_constructor_prototype);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue