summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-05-05 08:49:46 +0200
committerLinus Groh <mail@linusgroh.de>2022-05-05 22:40:57 +0200
commitdd547c3374d92607d6da90a78e3d39fb17fc32b0 (patch)
tree6195051276db8ea84c9abd92bcbd43fe404d59b6 /Userland/Libraries/LibJS
parent0c65624a32e0af2961c32a54f4ea8147397c52ab (diff)
downloadserenity-dd547c3374d92607d6da90a78e3d39fb17fc32b0.zip
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.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/GlobalObject.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp
index 0b4ef3912e..6221af7650 100644
--- a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp
@@ -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);
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.h b/Userland/Libraries/LibJS/Runtime/GlobalObject.h
index 2bcc49bf3c..fa3a20a365 100644
--- a/Userland/Libraries/LibJS/Runtime/GlobalObject.h
+++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.h
@@ -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; }