mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-26 09:35:46 +00:00
LibJS: Split Function into subclasses NativeFunction and ScriptFunction
Both types of functions are now Function and implement calling via:
virtual Value call(Interpreter&, Vector<Value> arguments);
This removes the need for CallExpression::execute() to care about which
kind of function it's calling. :^)
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
namespace JS {
|
||||
|
||||
NativeFunction::NativeFunction(AK::Function<Value(Interpreter&, Vector<Argument>)> native_function)
|
||||
NativeFunction::NativeFunction(AK::Function<Value(Interpreter&, Vector<Value>)> native_function)
|
||||
: m_native_function(move(native_function))
|
||||
{
|
||||
}
|
||||
@@ -39,4 +39,9 @@ NativeFunction::~NativeFunction()
|
||||
{
|
||||
}
|
||||
|
||||
Value NativeFunction::call(Interpreter& interpreter, Vector<Value> arguments)
|
||||
{
|
||||
return m_native_function(interpreter, move(arguments));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user