mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
pkg/eval/vals: Clean up FromGo.
This commit is contained in:
parent
6052a4dc4a
commit
a5baad65f8
|
@ -108,18 +108,9 @@ func ScanToGo(src interface{}, ptr interface{}) error {
|
|||
func FromGo(a interface{}) interface{} {
|
||||
switch a := a.(type) {
|
||||
case *big.Int:
|
||||
if i, ok := getInt(a); ok {
|
||||
return i
|
||||
}
|
||||
return a
|
||||
return NormalizeBigInt(a)
|
||||
case *big.Rat:
|
||||
if a.IsInt() {
|
||||
if i, ok := getInt(a.Num()); ok {
|
||||
return i
|
||||
}
|
||||
return a.Num()
|
||||
}
|
||||
return a
|
||||
return NormalizeBigRat(a)
|
||||
case rune:
|
||||
return string(a)
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue
Block a user