소스 검색

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.
Itamar 3 년 전
부모
커밋
abc420b15a
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      Userland/Libraries/LibCpp/Parser.cpp

+ 1 - 0
Userland/Libraries/LibCpp/Parser.cpp

@@ -1260,6 +1260,7 @@ NonnullRefPtr<Type> Parser::parse_type(ASTNode& parent)
     }
 
     if (peek().type() == Token::Type::LeftParen) {
+        type->set_end(previous_token_end());
         consume();
         auto fn_type = create_ast_node<FunctionType>(parent, type->start(), position());
         fn_type->set_return_type(*type);