delve/_fixtures/testvariables4.go
Luke Hoban e6477c01b1 proc/variables: Support for embedded structs
Embedded structs are encoded in DWARF as fields with
package-qualified names.  They define an anonymous field
on the struct with the non-qualified name, as well as
promoted fields for each field of the embedded struct so
long as these are not shadowed by fields of the containing
struct.

Fixes #220.
2015-10-06 18:17:49 -07:00

33 lines
428 B
Go

package main
import (
"fmt"
"runtime"
)
type A struct {
val int
}
type C struct {
s string
}
type B struct {
A
*C
a A
ptr *A
}
func main() {
b := B{A: A{-314}, C: &C{"hello"}, a: A{42}, ptr: &A{1337}}
fmt.Println(b)
fmt.Println(b.val)
fmt.Println(b.A.val)
fmt.Println(b.a.val)
fmt.Println(b.ptr.val)
fmt.Println(b.C.s)
fmt.Println(b.s)
runtime.Breakpoint()
}