refactor(lexer): 移除未使用的期望函数并修复内存分配错误

移除了 scc_lexer_tok_expect 函数,因为它不再被使用。
在 lexer_stream_extend 函数中添加了返回语句,以在内存重新分配失败时正确处理错误。

BREAKING CHANGE: 移除了 scc_lexer_tok_expect 函数
This commit is contained in:
zzy
2026-01-10 17:43:31 +08:00
parent c01e6e1db4
commit 6c801fbb92
3 changed files with 23 additions and 18 deletions

View File

@@ -14,6 +14,7 @@ static void lexer_stream_extend(scc_lexer_stream_t *stream, usize n) {
scc_realloc(null, new_cap * sizeof(scc_lexer_tok_t));
if (!new_data) {
LOG_FATAL("lexer_stream_extend: realloc failed\n");
return;
}
// 将旧缓冲区中的数据拷贝到新缓冲区,保持顺序