1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00
This commit is contained in:
M. Mert Yildiran 2025-08-18 22:33:09 +08:00 committed by GitHub
commit 903fb37e2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)