mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 10:15:36 +00:00
Remove unreachable code (#903)
These lines are unreachable, all paths above them lead to earlier returns. Signed-off-by: Stephen Kitt <steve@sk2.org> Co-authored-by: John Kerl <kerl.john.r@gmail.com>
This commit is contained in:
parent
d536318ed6
commit
46d013d44f
9 changed files with 0 additions and 32 deletions
|
|
@ -278,14 +278,6 @@ func divide_n_ii(input1, input2 *mlrval.Mlrval) *mlrval.Mlrval {
|
|||
} else {
|
||||
return mlrval.FromFloat(float64(a) / float64(b))
|
||||
}
|
||||
|
||||
c := float64(a) * float64(b)
|
||||
|
||||
if math.Abs(c) > 9223372036854774784.0 {
|
||||
return mlrval.FromFloat(c)
|
||||
} else {
|
||||
return mlrval.FromInt(a * b)
|
||||
}
|
||||
}
|
||||
|
||||
func divide_f_if(input1, input2 *mlrval.Mlrval) *mlrval.Mlrval {
|
||||
|
|
|
|||
|
|
@ -15,18 +15,14 @@ func BIF_length(input1 *mlrval.Mlrval) *mlrval.Mlrval {
|
|||
switch input1.Type() {
|
||||
case mlrval.MT_ERROR:
|
||||
return mlrval.FromInt(0)
|
||||
break
|
||||
case mlrval.MT_ABSENT:
|
||||
return mlrval.FromInt(0)
|
||||
break
|
||||
case mlrval.MT_ARRAY:
|
||||
arrayval := input1.AcquireArrayValue()
|
||||
return mlrval.FromInt(int64(len(arrayval)))
|
||||
break
|
||||
case mlrval.MT_MAP:
|
||||
mapval := input1.AcquireMapValue()
|
||||
return mlrval.FromInt(mapval.FieldCount)
|
||||
break
|
||||
}
|
||||
return mlrval.FromInt(1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,8 +179,6 @@ func BIF_sec2dhms(input1 *mlrval.Mlrval) *mlrval.Mlrval {
|
|||
fmt.Sprintf("%ds", s),
|
||||
)
|
||||
}
|
||||
|
||||
return mlrval.ERROR
|
||||
}
|
||||
|
||||
func BIF_sec2hms(input1 *mlrval.Mlrval) *mlrval.Mlrval {
|
||||
|
|
@ -202,8 +200,6 @@ func BIF_sec2hms(input1 *mlrval.Mlrval) *mlrval.Mlrval {
|
|||
return mlrval.FromString(
|
||||
fmt.Sprintf("%s%02d:%02d:%02d", sign, h, m, s),
|
||||
)
|
||||
|
||||
return mlrval.ERROR
|
||||
}
|
||||
|
||||
func BIF_fsec2dhms(input1 *mlrval.Mlrval) *mlrval.Mlrval {
|
||||
|
|
@ -285,8 +281,6 @@ func BIF_fsec2hms(input1 *mlrval.Mlrval) *mlrval.Mlrval {
|
|||
fmt.Sprintf("%s%02d:%02d:%.6f", sign, h, m, float64(s)+fractional),
|
||||
)
|
||||
}
|
||||
|
||||
return mlrval.ERROR
|
||||
}
|
||||
|
||||
// Helper function
|
||||
|
|
|
|||
|
|
@ -156,13 +156,10 @@ func openEncodedHandleForRead(
|
|||
switch encoding {
|
||||
case FileInputEncodingBzip2:
|
||||
return NewBZip2ReadCloser(handle), nil
|
||||
break
|
||||
case FileInputEncodingGzip:
|
||||
return gzip.NewReader(handle)
|
||||
break
|
||||
case FileInputEncodingZlib:
|
||||
return zlib.NewReader(handle)
|
||||
break
|
||||
}
|
||||
|
||||
InternalCodingErrorIf(encoding != FileInputEncodingDefault)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ func InternalCodingErrorPanic(message string) {
|
|||
),
|
||||
)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// WhereAreWe shows a stack trace from the current callsite.
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ func (omap *OrderedMap) Get(key string) interface{} {
|
|||
} else {
|
||||
return pe.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The Get is sufficient for pointer values -- the caller can check if the
|
||||
|
|
@ -110,7 +109,6 @@ func (omap *OrderedMap) GetWithCheck(key string) (interface{}, bool) {
|
|||
} else {
|
||||
return pe.Value, true
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ func (mlrmap *Mlrmap) Get(key string) *Mlrval {
|
|||
} else {
|
||||
return pe.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PutReference copies the key but not the value. This is not safe for DSL use,
|
||||
|
|
|
|||
|
|
@ -310,8 +310,6 @@ func (mv *Mlrval) PutIndexed(indices []*Mlrval, rvalue *Mlrval) error {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
|
@ -432,10 +430,7 @@ func putIndexedOnArray(
|
|||
zindex := mindex.intval - 1
|
||||
return (*baseArray)[zindex].PutIndexed(indices[1:], rvalue)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -253,8 +253,6 @@ func MlrvalDecodeFromJSON(decoder *json.Decoder) (
|
|||
|
||||
return mv, false, nil
|
||||
}
|
||||
|
||||
return nil, false, fmt.Errorf("mlr: unimplemented")
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue