summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-01-16 14:47:14 +0100
committerLinus Groh <mail@linusgroh.de>2022-01-16 14:50:22 +0100
commit30af8121ce00e6d3324cee71545647539c5f20fd (patch)
tree4bcb51de8d7c0ab192728417a93710e21eecc38f /Userland
parent4ed49e05a9bcc5db8986b2c3523098a0b6ceebb7 (diff)
downloadserenity-30af8121ce00e6d3324cee71545647539c5f20fd.zip
LibJS: Fix value of Generator.prototype.constructor
The spec says: 27.5.1.1 Generator.prototype.constructor https://tc39.es/ecma262/#sec-generator.prototype.constructor The initial value of Generator.prototype.constructor is %GeneratorFunction.prototype%. But we had it set to %GeneratorFunction% (the GeneratorFunction constructor).
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/GlobalObject.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
index 9b8240d5b2..47c914ee84 100644
--- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
@@ -169,7 +169,6 @@ void GlobalObject::initialize_global_object()
// %GeneratorFunction.prototype.prototype% must be initialized separately as it has no
// companion constructor
m_generator_prototype = heap().allocate<GeneratorPrototype>(*this, *this);
- m_generator_prototype->define_direct_property(vm.names.constructor, m_generator_function_constructor, Attribute::Configurable);
m_async_from_sync_iterator_prototype = heap().allocate<AsyncFromSyncIteratorPrototype>(*this, *this);
@@ -288,6 +287,9 @@ void GlobalObject::initialize_global_object()
// 27.4.3.1 AsyncGeneratorFunction.prototype.constructor, https://tc39.es/ecma262/#sec-asyncgeneratorfunction-prototype-constructor
m_async_generator_function_prototype->define_direct_property(vm.names.constructor, m_async_generator_function_constructor, Attribute::Configurable);
+ // 27.5.1.1 Generator.prototype.constructor, https://tc39.es/ecma262/#sec-generator.prototype.constructor
+ m_generator_prototype->define_direct_property(vm.names.constructor, m_generator_function_prototype, Attribute::Configurable);
+
m_array_prototype_values_function = &m_array_prototype->get_without_side_effects(vm.names.values).as_function();
m_date_constructor_now_function = &m_date_constructor->get_without_side_effects(vm.names.now).as_function();
m_eval_function = &get_without_side_effects(vm.names.eval).as_function();