@ -121,6 +121,15 @@ std::any IRGenImpl::visitLVal(SysYParser::LValContext* ctx) {
// 首先尝试从语义分析获取变量定义
auto* var_decl = sema_.ResolveVarUse(ctx);
// 从语义分析获取变量定义
auto* decl = sema_.ResolveVarUse(ctx);
if (!decl) {
auto* const_def = sema_.ResolveConstUse(ctx);
if (!const_def) {
FormatError("irgen",
"使用缺少语义绑定: " + varName);
}
if (var_decl) {
// 找到变量定义