fix: break/continue 携当前语句列表累积值且循环出口值按迭代回写

This commit is contained in:
2026-09-20 12:19:52 +00:00
parent c4ce29c6f2
commit 28ccbebd52
15 changed files with 429 additions and 66 deletions
+5
View File
@@ -23,12 +23,17 @@ impl Emitter {
for s in &block.body {
self.emit_block_fn_entry_init_stmt(s, ctx)?;
}
// 块语句列表独立累积:压列表帧,每条非空语句记最后非空值寄存器,
// break/continue 携值解析据此取块内累积值。
ctx.push_completion_list();
let mut r = None;
for s in &block.body {
if let Some(rr) = self.emit_statement(s, ctx)? {
r = Some(rr);
ctx.set_completion_last(rr);
}
}
ctx.pop_completion_list();
ctx.block_fn_entry_mats.pop();
ctx.pop_scope();
Ok(r)