fix: 修复编译空语句残留上一句返回值问题

This commit is contained in:
2026-06-06 13:39:58 +08:00
parent 715755aa52
commit 4edfec5dbf
+3 -2
View File
@@ -153,8 +153,9 @@ impl Compiler {
let mut last_result: Option<u8> = None;
for stmt in &program.body {
if let Some(r) = self.emit_statement(stmt, &mut ctx)? {
last_result = Some(r);
match self.emit_statement(stmt, &mut ctx)? {
Some(r) => last_result = Some(r),
None => last_result = None,
}
}