ssa: map range/next

This commit is contained in:
visualfc
2024-06-29 20:43:12 +08:00
parent 2ccd1625e7
commit 28ebce6b65
5 changed files with 373 additions and 53 deletions

View File

@@ -574,8 +574,12 @@ func (p *context) compileInstrOrValue(b llssa.Builder, iv instrOrValue, asValue
x := p.compileValue(b, v.X)
ret = b.Range(x)
case *ssa.Next:
var typ llssa.Type
if !v.IsString {
typ = p.prog.Type(v.Iter.(*ssa.Range).X.Type(), llssa.InGo)
}
iter := p.compileValue(b, v.Iter)
ret = b.Next(iter, v.IsString)
ret = b.Next(typ, iter, v.IsString)
case *ssa.ChangeInterface:
t := v.Type()
x := p.compileValue(b, v.X)