fix: automatic type conversion for untyped arg of append (#177)

This commit is contained in:
Marc Vertes
2019-05-01 16:49:57 +02:00
committed by Ludovic Fernandez
parent 5cdcf61e0e
commit c6c7f8cea6
3 changed files with 29 additions and 1 deletions

View File

@@ -39,6 +39,13 @@ func genValueRecv(n *Node) func(*Frame) reflect.Value {
}
}
func genValueAs(n *Node, t reflect.Type) func(*Frame) reflect.Value {
v := genValue(n)
return func(f *Frame) reflect.Value {
return v(f).Convert(t)
}
}
func genValue(n *Node) func(*Frame) reflect.Value {
switch n.kind {
case BasicLit, FuncDecl: