mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-30 13:19:02 +00:00
LibJS: Disallow static methods named prototype in classes
This commit is contained in:
parent
40b8689f9b
commit
93b57e6d8c
Notes:
sideshowbarker
2024-07-18 08:39:51 +09:00
Author: https://github.com/davidot
Commit: 93b57e6d8c
Pull-request: https://github.com/SerenityOS/serenity/pull/8667
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/linusg
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