1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +00:00

LibJS: Disallow static methods named prototype in classes

This commit is contained in:
davidot 2021-07-12 01:30:04 +02:00 committed by Andreas Kling
parent 40b8689f9b
commit 93b57e6d8c

View file

@ -674,6 +674,12 @@ NonnullRefPtr<ClassExpression> Parser::parse_class_expression(bool expect_class_
break;
}
//https://tc39.es/ecma262/#sec-class-definitions-static-semantics-early-errors
// ClassElement : static MethodDefinition
// It is a Syntax Error if PropName of MethodDefinition is "prototype".
if (is_static && name == "prototype"sv)
syntax_error("Classes may not have a static property named 'prototype'");
} else {
expected("property key");
}