From abc420b15ab8e367ba55926c8dd81370d558345d Mon Sep 17 00:00:00 2001 From: Itamar Date: Sun, 27 Feb 2022 19:31:50 +0200 Subject: [PATCH] LibCpp: Set end position for the return type node of FunctionType nodes Previously we didn't set the end position for the return type node of function FunctionType nodes. This caused a VERIFY failure crash when dumping an AST that contains such nodes. --- Userland/Libraries/LibCpp/Parser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index c5fdb17080..0a0e9bb7e0 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -1260,6 +1260,7 @@ NonnullRefPtr Parser::parse_type(ASTNode& parent) } if (peek().type() == Token::Type::LeftParen) { + type->set_end(previous_token_end()); consume(); auto fn_type = create_ast_node(parent, type->start(), position()); fn_type->set_return_type(*type);