1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:45:08 +00:00

LibJS: Throw TypeError when calling class constructor without 'new'

This commit is contained in:
Linus Groh 2020-11-11 21:37:40 +00:00 committed by Andreas Kling
parent b07c7f589f
commit 1b0c862f3a
5 changed files with 21 additions and 5 deletions

View file

@ -715,6 +715,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
ASSERT(class_constructor_value.is_function() && class_constructor_value.as_function().is_script_function());
ScriptFunction* class_constructor = static_cast<ScriptFunction*>(&class_constructor_value.as_function());
class_constructor->set_is_class_constructor();
Value super_constructor = js_undefined();
if (!m_super_class.is_null()) {
super_constructor = m_super_class->execute(interpreter, global_object);