fix: 添加标签表索引校验

This commit is contained in:
2026-06-06 15:49:26 +08:00
parent ebb169a63b
commit 479d86fae6
2 changed files with 18 additions and 11 deletions
+7
View File
@@ -93,6 +93,13 @@ impl CompileCtx {
idx as u16
}
pub(crate) fn resolve_label(&self, label: Label) -> Result<usize, String> {
self.label_map
.get(&label)
.copied()
.ok_or_else(|| format!("Label {:?} not found in bytecode map", label))
}
pub(crate) fn push_scope(&mut self) {
self.symbols.push_scope();
}