diff options
author | Linus Groh <mail@linusgroh.de> | 2022-01-19 19:42:45 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-19 19:42:45 +0000 |
commit | b2c6206adb046c2463f7308a113ef0368c34d3e2 (patch) | |
tree | 86f744a5b5f53037e005875ec0ace0c343014e3f /Userland | |
parent | 7d0782f3087f6a20775dc5e7aa6820badcbdfeaf (diff) | |
download | serenity-b2c6206adb046c2463f7308a113ef0368c34d3e2.zip |
LibJS: Add missing definition of AsyncFunction.prototype.constructor
We also forgot to allocate an AsyncFunctionConstructor and assign it to
m_async_function_constructor during GlobalObject initialization, whoops!
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/GlobalObject.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp index 1c86d71dcf..7a18d2b37e 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -278,19 +278,23 @@ void GlobalObject::initialize_global_object() JS_ENUMERATE_TYPED_ARRAYS #undef __JS_ENUMERATE - // The generator constructor cannot be initialized with add_constructor as it has no global binding + // NOTE: These constructors cannot be initialized with add_constructor as they have no global binding. m_generator_function_constructor = heap().allocate<GeneratorFunctionConstructor>(*this, *this); + m_async_generator_function_constructor = heap().allocate<AsyncGeneratorFunctionConstructor>(*this, *this); + m_async_function_constructor = heap().allocate<AsyncFunctionConstructor>(*this, *this); + // 27.3.3.1 GeneratorFunction.prototype.constructor, https://tc39.es/ecma262/#sec-generatorfunction.prototype.constructor m_generator_function_prototype->define_direct_property(vm.names.constructor, m_generator_function_constructor, Attribute::Configurable); - // The async generator constructor cannot be initialized with add_constructor as it has no global binding - m_async_generator_function_constructor = heap().allocate<AsyncGeneratorFunctionConstructor>(*this, *this); // 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); + // 27.7.3.1 AsyncFunction.prototype.constructor, https://tc39.es/ecma262/#sec-async-function-prototype-properties-constructor + m_async_function_prototype->define_direct_property(vm.names.constructor, m_async_function_constructor, 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(); |