dop251 / goja

ECMAScript/JavaScript engine in pure Go
MIT License
5.63k stars 378 forks source link

Allow access to the public fields of unexported embedded struct #578

Closed ganigeorgiev closed 5 months ago

ganigeorgiev commented 5 months ago

This is a small change to allow accessing the public fields of unexported embedded struct. For example:

type base struct {
    Name string
}

type Foo struct {
    base
}

vm := goja.New()
vm.Set("foo", Foo{base{Name: "test"}})
vm.RunString("foo.Name") // currently prints undefined, expected "test"