📦 更新lsptree-sitter的依赖

🚀 优化部分无关代码

🐛 修复`ast`的测试代码
This commit is contained in:
csh
2025-11-15 21:19:45 +08:00
parent 1776437d1d
commit 8f25f212a7
6 changed files with 953943 additions and 950176 deletions
+2 -3
View File
@@ -1537,7 +1537,8 @@ namespace lsp::language::ast::detail
TSNode body_node = ts_node_child_by_field_name(node, "body", 4);
auto body_stmt = ParseStatement(body_node, ctx);
if (body_stmt && body_stmt->kind == NodeKind::kBlockStatement)
stmt->body = StatementCast<BlockStatement>(std::move(body_stmt));
stmt->body = std::unique_ptr<BlockStatement>(
static_cast<BlockStatement*>(body_stmt.release()));
return stmt;
}
@@ -1603,10 +1604,8 @@ namespace lsp::language::ast::detail
TSNode body_node = ts_node_child_by_field_name(node, "body", 4);
auto body = ParseStatement(body_node, ctx);
if (body && body->kind == NodeKind::kBlockStatement)
{
stmt->body = std::unique_ptr<BlockStatement>(
static_cast<BlockStatement*>(body.release()));
}
return stmt;
}
-7
View File
@@ -184,11 +184,4 @@ namespace lsp::language::ast::detail
// 表达式语句
StatementPtr ParseExpressionStatement(TSNode node, ParseContext& ctx);
template<typename To, typename From = Statement>
std::unique_ptr<To> StatementCast(std::unique_ptr<From>&& ptr)
{
static_assert(std::is_base_of_v<Statement, To>);
return std::unique_ptr<To>(static_cast<To*>(ptr.release()));
}
}