mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
A runtime builtin assignFromCall is added to handle multiple values returned at once. It is necessary if some of the values require to be set to interface values in the caller space, which is performed by reflect.Set in assignFromCall. Fixes #1311.
20 lines
183 B
Go
20 lines
183 B
Go
package main
|
|
|
|
type T struct {
|
|
v interface{}
|
|
}
|
|
|
|
func f() (ret int64, err error) {
|
|
ret += 2
|
|
return
|
|
}
|
|
|
|
func main() {
|
|
t := &T{}
|
|
t.v, _ = f()
|
|
println(t.v.(int64))
|
|
}
|
|
|
|
// Output:
|
|
// 2
|