mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
LibJS: Allow methods in classes named 'async'
Also add tests for all static, setter and getter cases.
This commit is contained in:
parent
65bebb5241
commit
2c6183da1e
8 changed files with 85 additions and 1 deletions
|
@ -1086,7 +1086,9 @@ NonnullRefPtr<ClassExpression> Parser::parse_class_expression(bool expect_class_
|
|||
|
||||
if (match(TokenType::Async)) {
|
||||
auto lookahead_token = next_token();
|
||||
if (lookahead_token.type() != TokenType::Semicolon && lookahead_token.type() != TokenType::CurlyClose
|
||||
// If async is followed by a Semicolon or CurlyClose it is a field (CurlyClose indicates end of class)
|
||||
// Otherwise if it is followed by a ParenOpen it is a function named async
|
||||
if (lookahead_token.type() != TokenType::Semicolon && lookahead_token.type() != TokenType::CurlyClose && lookahead_token.type() != TokenType::ParenOpen
|
||||
&& !lookahead_token.trivia_contains_line_terminator()) {
|
||||
consume();
|
||||
is_async = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue