1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-12 10:40:39 +09:00

LibJS: Implement constructor/non-constructor function calls

This adds Function::construct() for constructor function calls via `new`
keyword. NativeFunction doesn't have constructor behaviour by default,
ScriptFunction simply calls call() in construct()
This commit is contained in:
Linus Groh 2020-04-01 18:31:24 +01:00 committed by Andreas Kling
parent a27884e4be
commit 849e2c77e4
Notes: sideshowbarker 2024-07-19 08:00:53 +09:00
11 changed files with 66 additions and 1 deletions

View file

@ -50,6 +50,11 @@ Value ObjectConstructor::call(Interpreter& interpreter)
return interpreter.heap().allocate<Object>();
}
Value ObjectConstructor::construct(Interpreter& interpreter)
{
return call(interpreter);
}
Value ObjectConstructor::get_own_property_names(Interpreter& interpreter)
{
if (interpreter.call_frame().arguments.size() < 1)