diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-07-28 21:35:02 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-02 01:03:59 +0200 |
commit | 010be01694a986e3763da45a546bdb58d5fbc93b (patch) | |
tree | f0105246563b2ea6fcd62bd9cc335df58bc11aae | |
parent | e27ec04cddcb54415a8cfc54fc393913e87f9b9f (diff) | |
download | serenity-010be01694a986e3763da45a546bdb58d5fbc93b.zip |
LibCpp: Add support for east const
Now LibCpp can understand the eastest of consts too :^)
-rw-r--r-- | Userland/Libraries/LibCpp/Parser.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index fc193e57e6..cb77f61061 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -1219,6 +1219,9 @@ NonnullRefPtr<Type> Parser::parse_type(ASTNode& parent) if (match_keyword("auto")) { consume(Token::Type::Keyword); named_type->set_auto(true); + auto original_qualifiers = named_type->qualifiers(); + original_qualifiers.extend(parse_type_qualifiers()); + named_type->set_qualifiers(move(original_qualifiers)); named_type->set_end(position()); return named_type; } @@ -1234,6 +1237,10 @@ NonnullRefPtr<Type> Parser::parse_type(ASTNode& parent) } named_type->set_name(parse_name(*named_type)); + auto original_qualifiers = named_type->qualifiers(); + original_qualifiers.extend(parse_type_qualifiers()); + named_type->set_qualifiers(move(original_qualifiers)); + NonnullRefPtr<Type> type = named_type; while (!eof() && peek().type() == Token::Type::Asterisk) { type->set_end(position()); @@ -1241,6 +1248,7 @@ NonnullRefPtr<Type> Parser::parse_type(ASTNode& parent) auto ptr = create_ast_node<Pointer>(parent, type->start(), asterisk.end()); type->set_parent(*ptr); ptr->set_pointee(type); + ptr->set_qualifiers(parse_type_qualifiers()); ptr->set_end(position()); type = ptr; } |