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

LibCpp: Parse inheritance

This commit is contained in:
Itamar 2022-04-03 21:55:55 +03:00 committed by Ali Mohammad Pur
parent 8cfabbcd93
commit f4cca20972
8 changed files with 43 additions and 1 deletions

View file

@ -1151,6 +1151,8 @@ NonnullRefPtr<StructOrClassDeclaration> Parser::parse_class_declaration(ASTNode&
auto has_final = match_keyword("final");
NonnullRefPtrVector<Name> baseclasses;
// FIXME: Don't ignore this.
if (peek(has_final ? 1 : 0).type() == Token::Type::Colon) {
if (has_final)
@ -1162,10 +1164,12 @@ NonnullRefPtr<StructOrClassDeclaration> Parser::parse_class_declaration(ASTNode&
while (match_keyword("private") || match_keyword("public") || match_keyword("protected") || match_keyword("virtual"))
consume();
(void)parse_name(get_dummy_node());
baseclasses.append(parse_name(*decl));
} while (peek().type() == Token::Type::Comma);
}
decl->set_baseclasses(move(baseclasses));
consume(Token::Type::LeftCurly);
while (!eof() && peek().type() != Token::Type::RightCurly) {