Fix typo in process_stmt

This commit is contained in:
Pragyansh Chaturvedi
2025-10-05 14:03:19 +05:30
parent ef36ea1e03
commit c7f2955ee9

View File

@ -411,7 +411,7 @@ def process_stmt(
raise ValueError("Failed to evaluate return expression") raise ValueError("Failed to evaluate return expression")
if val[1] != ret_type: if val[1] != ret_type:
raise ValueError( raise ValueError(
"Return type mismatch: expected" f"{ret_type}, got {val[1]}" "Return type mismatch: expected " f"{ret_type}, got {val[1]}"
) )
builder.ret(val[0]) builder.ret(val[0])
did_return = True did_return = True
@ -480,6 +480,9 @@ def allocate_mem(
continue continue
var_name = target.id var_name = target.id
rval = stmt.value rval = stmt.value
if var_name in local_sym_tab:
logger.info(f"Variable {var_name} already allocated")
continue
if isinstance(rval, ast.Call): if isinstance(rval, ast.Call):
if isinstance(rval.func, ast.Name): if isinstance(rval.func, ast.Name):
call_type = rval.func.id call_type = rval.func.id