mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibJS: Add getters for %{Async,}GeneratorFunction.prototype.prototype%
These exist as {Async,}GeneratorPrototype of course, but the spec doesn't always refer to them by the direct name.
This commit is contained in:
parent
0c65624a32
commit
dd547c3374
2 changed files with 6 additions and 1 deletions
|
@ -243,7 +243,7 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic
|
|||
// 33. If kind is generator, then
|
||||
if (kind == FunctionKind::Generator) {
|
||||
// a. Let prototype be OrdinaryObjectCreate(%GeneratorFunction.prototype.prototype%).
|
||||
prototype = Object::create(global_object, global_object.generator_prototype());
|
||||
prototype = Object::create(global_object, global_object.generator_function_prototype_prototype());
|
||||
|
||||
// b. Perform ! DefinePropertyOrThrow(F, "prototype", PropertyDescriptor { [[Value]]: prototype, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false }).
|
||||
function->define_direct_property(vm.names.prototype, prototype, Attribute::Writable);
|
||||
|
|
|
@ -40,6 +40,11 @@ public:
|
|||
Object* async_generator_prototype() { return m_async_generator_prototype; }
|
||||
Object* generator_prototype() { return m_generator_prototype; }
|
||||
|
||||
// Alias for the AsyncGenerator Prototype Object used by the spec (%AsyncGeneratorFunction.prototype.prototype%)
|
||||
Object* async_generator_function_prototype_prototype() { return m_async_generator_prototype; }
|
||||
// Alias for the Generator Prototype Object used by the spec (%GeneratorFunction.prototype.prototype%)
|
||||
Object* generator_function_prototype_prototype() { return m_generator_prototype; }
|
||||
|
||||
// Not included in JS_ENUMERATE_INTL_OBJECTS due to missing distinct constructor
|
||||
Object* intl_segments_prototype() { return m_intl_segments_prototype; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue