diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-07-28 04:05:39 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-02 01:03:59 +0200 |
commit | 5d27740387b63a0381b29fe57b21f9aea2a6aecb (patch) | |
tree | c8c1fcc1710616497a604de1a97a6fae52f2d591 | |
parent | b81926d933b7897311b3a381f202a44b8da20aff (diff) | |
download | serenity-5d27740387b63a0381b29fe57b21f9aea2a6aecb.zip |
LibCpp: Accept scoped variable declarations
For instance, `Type Scope::Class::variable = value;` is a valid
declaration.
-rw-r--r-- | Userland/Libraries/LibCpp/Parser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index 2ddf77e55a..e3ce9d4186 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -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); |