diff --git a/_test/method31.go b/_test/method31.go new file mode 100644 index 000000000..5555162dd --- /dev/null +++ b/_test/method31.go @@ -0,0 +1,29 @@ +package main + +import "fmt" + +var db dbWrapper + +type dbWrapper struct { + DB *cmap +} + +func (d *dbWrapper) get() *cmap { + return d.DB +} + +type cmap struct { + name string +} + +func (c *cmap) f() { + fmt.Println("in f, c", c) +} + +func main() { + db.DB = &cmap{name: "test"} + db.get().f() +} + +// Output: +// in f, c &{test} diff --git a/interp/gta.go b/interp/gta.go index 38eff35f5..bfabb9091 100644 --- a/interp/gta.go +++ b/interp/gta.go @@ -125,6 +125,9 @@ func (interp *Interpreter) gta(root *node, rpath, pkgID string) ([]*node, error) // Add a function symbol in the package name space sc.sym[n.child[1].ident] = &symbol{kind: funcSym, typ: n.typ, node: n, index: -1} } + if n.typ.incomplete { + revisit = append(revisit, n) + } return false case importSpec: