LibCpp: Accept scoped variable declarations

For instance, `Type Scope::Class::variable = value;` is a valid
declaration.
This commit is contained in:
Ali Mohammad Pur 2021-07-28 04:05:39 +04:30 committed by Andreas Kling
commit 5d27740387
Notes: sideshowbarker 2024-07-18 07:36:51 +09:00

View file

@ -301,10 +301,10 @@ bool Parser::match_variable_declaration()
parse_type(get_dummy_node());
// Identifier
if (!peek(Token::Type::Identifier).has_value()) {
if (!match_name())
return false;
}
consume();
parse_name(get_dummy_node());
if (match(Token::Type::Equals)) {
consume(Token::Type::Equals);