mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibCpp: Allow 'final' in a class declaration with inheritance
This commit is contained in:
parent
010be01694
commit
f16011e4d1
Notes:
sideshowbarker
2024-07-18 07:36:09 +09:00
Author: https://github.com/alimpfard
Commit: f16011e4d1
Pull-request: https://github.com/SerenityOS/serenity/pull/9156
Reviewed-by: https://github.com/itamar8910 ✅
1 changed files with 12 additions and 2 deletions
|
@ -700,7 +700,12 @@ bool Parser::match_class_declaration()
|
|||
|
||||
consume(Token::Type::Identifier);
|
||||
|
||||
if (peek().type() == Token::Type::Colon) {
|
||||
auto has_final = match_keyword("final");
|
||||
|
||||
if (peek(has_final ? 1 : 0).type() == Token::Type::Colon) {
|
||||
if (has_final)
|
||||
consume();
|
||||
|
||||
do {
|
||||
consume();
|
||||
|
||||
|
@ -1158,8 +1163,13 @@ NonnullRefPtr<StructOrClassDeclaration> Parser::parse_class_declaration(ASTNode&
|
|||
auto name_token = consume(Token::Type::Identifier);
|
||||
decl->set_name(text_of_token(name_token));
|
||||
|
||||
auto has_final = match_keyword("final");
|
||||
|
||||
// FIXME: Don't ignore this.
|
||||
if (peek().type() == Token::Type::Colon) {
|
||||
if (peek(has_final ? 1 : 0).type() == Token::Type::Colon) {
|
||||
if (has_final)
|
||||
consume();
|
||||
|
||||
do {
|
||||
consume();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue