mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
LibJS: Add the remaining generator objects
- %GeneratorFunction% - %GeneratorFunction.prototype% - %GeneratorFunction.prototype.prototype% - %Generator%.prototype
This commit is contained in:
committed by
Linus Groh
parent
b205c9814a
commit
22b17219ff
Notes:
sideshowbarker
2024-07-18 12:03:11 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/22b17219ff8 Pull-request: https://github.com/SerenityOS/serenity/pull/8104 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/FunctionConstructor.h>
|
||||
#include <LibJS/Runtime/Function.h>
|
||||
#include <LibJS/Runtime/GeneratorFunctionConstructor.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
GeneratorFunctionConstructor::GeneratorFunctionConstructor(GlobalObject& global_object)
|
||||
: NativeFunction(*static_cast<Object*>(global_object.function_constructor()))
|
||||
{
|
||||
}
|
||||
|
||||
void GeneratorFunctionConstructor::initialize(GlobalObject& global_object)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
|
||||
// 27.3.2.1 GeneratorFunction.length, https://tc39.es/ecma262/#sec-generatorfunction.length
|
||||
define_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
// 27.3.2.2 GeneratorFunction.prototype, https://tc39.es/ecma262/#sec-generatorfunction.length
|
||||
define_property(vm.names.prototype, global_object.generator_function_prototype(), 0);
|
||||
}
|
||||
|
||||
GeneratorFunctionConstructor::~GeneratorFunctionConstructor()
|
||||
{
|
||||
}
|
||||
|
||||
// 27.3.1.1 GeneratorFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-generatorfunction
|
||||
Value GeneratorFunctionConstructor::call()
|
||||
{
|
||||
return construct(*this);
|
||||
}
|
||||
|
||||
// 27.3.1.1 GeneratorFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-generatorfunction
|
||||
Value GeneratorFunctionConstructor::construct(Function&)
|
||||
{
|
||||
TODO();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user