mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 20:17:13 +02:00
LibJS: Track whether ScriptFunctions and FunctionExpressions are arrow
functions
This commit is contained in:
committed by
Andreas Kling
parent
5243e9974d
commit
c12125fa81
Notes:
sideshowbarker
2024-07-19 05:58:30 +09:00
Author: https://github.com/jack-karamanian Commit: https://github.com/SerenityOS/serenity/commit/c12125fa817 Pull-request: https://github.com/SerenityOS/serenity/pull/2454
@@ -47,18 +47,19 @@ static ScriptFunction* script_function_from(Interpreter& interpreter)
|
||||
return static_cast<ScriptFunction*>(this_object);
|
||||
}
|
||||
|
||||
ScriptFunction* ScriptFunction::create(GlobalObject& global_object, const FlyString& name, const Statement& body, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, LexicalEnvironment* parent_environment)
|
||||
ScriptFunction* ScriptFunction::create(GlobalObject& global_object, const FlyString& name, const Statement& body, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, LexicalEnvironment* parent_environment, bool is_arrow_function)
|
||||
{
|
||||
return global_object.heap().allocate<ScriptFunction>(name, body, move(parameters), m_function_length, parent_environment, *global_object.function_prototype());
|
||||
return global_object.heap().allocate<ScriptFunction>(name, body, move(parameters), m_function_length, parent_environment, *global_object.function_prototype(), is_arrow_function);
|
||||
}
|
||||
|
||||
ScriptFunction::ScriptFunction(const FlyString& name, const Statement& body, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, LexicalEnvironment* parent_environment, Object& prototype)
|
||||
ScriptFunction::ScriptFunction(const FlyString& name, const Statement& body, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, LexicalEnvironment* parent_environment, Object& prototype, bool is_arrow_function)
|
||||
: Function(prototype)
|
||||
, m_name(name)
|
||||
, m_body(body)
|
||||
, m_parameters(move(parameters))
|
||||
, m_parent_environment(parent_environment)
|
||||
, m_function_length(m_function_length)
|
||||
, m_is_arrow_function(is_arrow_function)
|
||||
{
|
||||
define_property("prototype", Object::create_empty(interpreter(), interpreter().global_object()), 0);
|
||||
define_native_property("length", length_getter, nullptr, Attribute::Configurable);
|
||||
|
||||
Reference in New Issue
Block a user