浏览代码

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);