Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion convert/conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func FromDict(m *starlark.Dict) map[interface{}]interface{} {
key := FromValue(k)
// should never be not found or unhashable, so ignore err and found.
val, _, _ := m.Get(k)
ret[key] = val
ret[key] = FromValue(val)
}
return ret
}
Expand Down
5 changes: 5 additions & 0 deletions convert/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ type GoInterface struct {
v reflect.Value
}

// Value returns relfect.Value of the underlying interface
func (g *GoInterface) Value() reflect.Value {
return g.v
}

// Attr returns a starlark value that wraps the method or field with the given
// name.
func (g *GoInterface) Attr(name string) (starlark.Value, error) {
Expand Down
5 changes: 5 additions & 0 deletions convert/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func NewGoMap(m interface{}) *GoMap {
return &GoMap{v: v}
}

// Value returns relfect.Value of the underlying map
func (g *GoMap) Value() reflect.Value {
return g.v
}

// SetKey implements starlark.HasSetKey.
func (g *GoMap) SetKey(k, v starlark.Value) (err error) {
if g.frozen {
Expand Down
7 changes: 6 additions & 1 deletion convert/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type GoSlice struct {
frozen bool
}

// NewGoMap wraps the given slice in a new GoSlice. This function will panic if m
// NewGoSlice wraps the given slice in a new GoSlice. This function will panic if m
// is not a map.
func NewGoSlice(slice interface{}) *GoSlice {
v := reflect.ValueOf(slice)
Expand All @@ -31,6 +31,11 @@ func NewGoSlice(slice interface{}) *GoSlice {
return &GoSlice{v: v}
}

// Value returns relfect.Value of the underlying slice
func (g *GoSlice) Value() reflect.Value {
return g.v
}

// String returns the string representation of the value.
// Starlark string values are quoted as if by Python's repr.
func (g *GoSlice) String() string {
Expand Down
5 changes: 5 additions & 0 deletions convert/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ type GoStruct struct {
v reflect.Value
}

// Value returns relfect.Value of the underlying struct
func (g *GoStruct) Value() reflect.Value {
return g.v
}

// Attr returns a starlark value that wraps the method or field with the given
// name.
func (g *GoStruct) Attr(name string) (starlark.Value, error) {
Expand Down