1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-19 19:55:30 +08:00

Consistent use of "value Value"/"vl Value"

This commit is contained in:
Alexander F Rødseth 2016-06-24 09:47:41 +02:00
parent e2ef7653d2
commit e3f7ae2533
2 changed files with 12 additions and 12 deletions

View File

@ -30,8 +30,8 @@ type Value struct {
value interface{}
}
func (vl Value) safe() bool {
return vl.kind < valueEmpty
func (value Value) safe() bool {
return value.kind < valueEmpty
}
var (

View File

@ -168,32 +168,32 @@ type _number struct {
// FIXME
// http://www.goinggo.net/2013/08/gustavos-ieee-754-brain-teaser.html
// http://bazaar.launchpad.net/~niemeyer/strepr/trunk/view/6/strepr.go#L160
func (vl Value) number() (number _number) {
switch vl := vl.value.(type) {
func (value Value) number() (number _number) {
switch value := value.value.(type) {
case int8:
number.int64 = int64(vl)
number.int64 = int64(value)
return
case int16:
number.int64 = int64(vl)
number.int64 = int64(value)
return
case uint8:
number.int64 = int64(vl)
number.int64 = int64(value)
return
case uint16:
number.int64 = int64(vl)
number.int64 = int64(value)
return
case uint32:
number.int64 = int64(vl)
number.int64 = int64(value)
return
case int:
number.int64 = int64(vl)
number.int64 = int64(value)
return
case int64:
number.int64 = vl
number.int64 = value
return
}
float := vl.float64()
float := value.float64()
if float == 0 {
return
}