mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00
Merge e8fe2e44e4
into 3ca729876b
This commit is contained in:
commit
903fb37e2b
|
@ -30,6 +30,10 @@ func newGoMapObject(value reflect.Value) *goMapObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o goMapObject) toKey(name string) reflect.Value {
|
func (o goMapObject) toKey(name string) reflect.Value {
|
||||||
|
if reflect.ValueOf(name).CanConvert(o.keyType) {
|
||||||
|
return reflect.ValueOf(name).Convert(o.keyType)
|
||||||
|
}
|
||||||
|
|
||||||
reflectValue, err := stringToReflectValue(name, o.keyType.Kind())
|
reflectValue, err := stringToReflectValue(name, o.keyType.Kind())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user