mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +00:00
LibJS: Disallow static methods named prototype in classes
This commit is contained in:
parent
40b8689f9b
commit
93b57e6d8c
1 changed files with 6 additions and 0 deletions
|
@ -674,6 +674,12 @@ NonnullRefPtr<ClassExpression> Parser::parse_class_expression(bool expect_class_
|
||||||
break;
|
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 {
|
} else {
|
||||||
expected("property key");
|
expected("property key");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue