stage2 支持左值的引用绑定

This commit is contained in:
zzy committed 2026-09-29 23:00:24 +08:00
1 parent 40cffa9cb5
commit 0e38858785
4 files changed
+200 -198

No files matched your search

+8 -8
View File
@@ -456,20 +456,20 @@ fn cg_swap(cg: *Cgen) { emit(cg, .Swap, .Void, 0); }
fn cg_gaddr(cg: *Cgen, idx: usize) { emit(cg, .Gaddr, .Void, idx); }
fn cg_load_slot(cg: *Cgen, ref: usize, k: VmKind) {
cg_laddr(cg, slot_result(&cg.frame, ref));
cg_load(cg, k);
emit(cg, .Laddr, .Void, slot_result(&cg.frame, ref));
emit(cg, .Load, k, 0);
}
fn cg_store_slot(cg: *Cgen, ref: usize, k: VmKind) {
cg_laddr(cg, slot_result(&cg.frame, ref));
cg_swap(cg);
cg_store(cg, k);
emit(cg, .Laddr, .Void, slot_result(&cg.frame, ref));
emit(cg, .Swap, .Void, 0);
emit(cg, .Store, k, 0);
}
fn cg_store_at(cg: *Cgen, addr: usize, k: VmKind) {
cg_laddr(cg, addr);
cg_swap(cg);
cg_store(cg, k);
emit(cg, .Laddr, .Void, addr);
emit(cg, .Swap, .Void, 0);
emit(cg, .Store, k, 0);
}
type DataLoc = struct {