feature: unsafe type conversion

This commit is contained in:
Nicholas Wiersma
2020-06-18 18:14:03 +02:00
committed by GitHub
parent 0643762852
commit f19b7563ea
12 changed files with 202 additions and 3 deletions

View File

@@ -329,6 +329,22 @@ func convert(n *node) {
value = genValue(c)
}
for _, con := range n.interp.convert {
if c.typ.rtype == nil {
continue
}
fn := con(c.typ.rtype, typ)
if fn == nil {
continue
}
n.exec = func(f *frame) bltn {
fn(value(f), dest(f))
return next
}
return
}
n.exec = func(f *frame) bltn {
dest(f).Set(value(f).Convert(typ))
return next