mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-15 15:42:52 +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:
parent
de6f697eba
commit
d9c7009604
Notes:
sideshowbarker
2024-07-19 08:20:02 +09:00
Author: https://github.com/awesomekling
Commit: d9c7009604
9 changed files with 133 additions and 42 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue