diff --git a/gnovm/pkg/gnolang/op_assign.go b/gnovm/pkg/gnolang/op_assign.go index eb67ffcc351..41d210df3ee 100644 --- a/gnovm/pkg/gnolang/op_assign.go +++ b/gnovm/pkg/gnolang/op_assign.go @@ -1,7 +1,10 @@ package gnolang +import "fmt" + func (m *Machine) doOpDefine() { s := m.PopStmt().(*AssignStmt) + fmt.Println("---doOpDefine, s: ", s) // Define each value evaluated for Lhs. // NOTE: PopValues() returns a slice in // forward order, not the usual reverse. @@ -26,6 +29,7 @@ func (m *Machine) doOpDefine() { func (m *Machine) doOpAssign() { s := m.PopStmt().(*AssignStmt) + fmt.Println("---doOpAssign, s: ", s) // Assign each value evaluated for Lhs. // NOTE: PopValues() returns a slice in // forward order, not the usual reverse. diff --git a/gnovm/pkg/gnolang/op_decl.go b/gnovm/pkg/gnolang/op_decl.go index 2c20c43ae2f..a17b95935b7 100644 --- a/gnovm/pkg/gnolang/op_decl.go +++ b/gnovm/pkg/gnolang/op_decl.go @@ -6,6 +6,7 @@ import ( func (m *Machine) doOpValueDecl() { s := m.PopStmt().(*ValueDecl) + fmt.Println("---doOpValueDecl, s: ", s) lb := m.LastBlock() nt := Type(nil) if s.Type != nil { @@ -18,6 +19,7 @@ func (m *Machine) doOpValueDecl() { for i := 0; i < len(s.NameExprs); i++ { var tv TypedValue if rvs == nil { + println("---rvs is nil, using default value") // NOTE: Go/Gno wart. // implicit interface casting could // requiring the consideration of the typed-nil case. diff --git a/gnovm/pkg/gnolang/op_eval.go b/gnovm/pkg/gnolang/op_eval.go index c37af7d31af..8aaffa074c4 100644 --- a/gnovm/pkg/gnolang/op_eval.go +++ b/gnovm/pkg/gnolang/op_eval.go @@ -23,6 +23,7 @@ func (m *Machine) doOpEval() { debug.Printf("EVAL: (%T) %v\n", x, x) fmt.Println(m.String()) } + fmt.Printf("EVAL: (%T) %v\n", x, x) // This case moved out of switch for performance. // TODO: understand this better. if nx, ok := x.(*NameExpr); ok { @@ -37,6 +38,7 @@ func (m *Machine) doOpEval() { lb := m.LastBlock() // Push value, done. ptr := lb.GetPointerTo(m.Store, nx.Path) + fmt.Println("---ptr.Deref(): ", ptr.Deref()) m.PushValue(ptr.Deref()) return } diff --git a/gnovm/tests/files/zrealm_crossrealm41.gno b/gnovm/tests/files/zrealm_crossrealm41.gno new file mode 100644 index 00000000000..1d921647607 --- /dev/null +++ b/gnovm/tests/files/zrealm_crossrealm41.gno @@ -0,0 +1,20 @@ +// PKGPATH: gno.land/r/crossrealm_test +package crossrealm_test + +type local struct { + name string +} + +var ll local // this is attached as a zero value + +// XXX, consider more about this. +// var sll []crossrealm.bar +// var pll *crossrealm.bar + +func main() { + l := local{name: "a"} + println(l) +} + +// Output: +// (struct{("a" string)} gno.land/r/crossrealm_test.local) diff --git a/gnovm/tests/files/zrealm_crossrealm42.gno b/gnovm/tests/files/zrealm_crossrealm42.gno new file mode 100644 index 00000000000..c4ea99ff24d --- /dev/null +++ b/gnovm/tests/files/zrealm_crossrealm42.gno @@ -0,0 +1,12 @@ +// PKGPATH: gno.land/r/crossrealm_test +package crossrealm_test + +import crossrealm "gno.land/r/demo/tests/crossrealm" + +type LocalBar crossrealm.Bar + +var lb LocalBar + +func main() { + println(lb) +}