ssa: map delete, map eql nil

This commit is contained in:
visualfc
2024-06-29 21:35:20 +08:00
parent 28ebce6b65
commit 439e377111
7 changed files with 239 additions and 83 deletions

View File

@@ -150,6 +150,9 @@ func (b Builder) MapLen(x Expr) Expr {
log.Printf("MapLen %v\n", x.impl)
}
prog := b.Prog
if x.impl.IsNull() {
return prog.Val(0)
}
x.Type = prog.Pointer(prog.Int())
return b.Load(x)
}
@@ -607,7 +610,6 @@ func (b Builder) Next(typ Type, iter Expr, isString bool) Expr {
b.SetBlockEx(blks[2], AtEnd, false)
b.blk.last = blks[2].last
return phi.Expr
}
// The MakeChan instruction creates a new channel object and yields a