mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
The logic of patching reflect struct representation has been fixed in presence of function fields and to better handle indirect recursivity (struct recursive through nested struct). Fixes #1519.
26 lines
220 B
Go
26 lines
220 B
Go
package main
|
|
|
|
type F func(a *A)
|
|
|
|
type A struct {
|
|
B string
|
|
D
|
|
}
|
|
|
|
type D struct {
|
|
*A
|
|
E *A
|
|
f F
|
|
}
|
|
|
|
func f1(a *A) { println("in f1", a.B) }
|
|
|
|
func main() {
|
|
a := &A{B: "b"}
|
|
a.D = D{f: f1}
|
|
a.f(a)
|
|
}
|
|
|
|
// Output:
|
|
// in f1 b
|