diff options
Diffstat (limited to 'Userland/Libraries/LibCpp/Parser.cpp')
-rw-r--r-- | Userland/Libraries/LibCpp/Parser.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index c3a630f0db..64c814d717 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -1237,6 +1237,16 @@ NonnullRefPtr<Type> Parser::parse_type(ASTNode& parent) type = ptr; } + if (!eof() && (peek().type() == Token::Type::And || peek().type() == Token::Type::AndAnd)) { + type->set_end(position()); + auto ref_token = consume(); + auto ref = create_ast_node<Reference>(parent, type->start(), ref_token.end(), ref_token.type() == Token::Type::And ? Reference::Kind::Lvalue : Reference::Kind::Rvalue); + type->set_parent(*ref); + ref->set_referenced_type(type); + ref->set_end(position()); + type = ref; + } + type->set_end(position()); return type; } |