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:
Stephen Kitt 2022-01-27 18:23:00 +01:00 committed by GitHub
parent d536318ed6
commit 46d013d44f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 0 additions and 32 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -91,7 +91,6 @@ func InternalCodingErrorPanic(message string) {
),
)
}
os.Exit(1)
}
// WhereAreWe shows a stack trace from the current callsite.

View file

@ -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
}
// ----------------------------------------------------------------

View file

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

View file

@ -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
}
// ----------------------------------------------------------------

View file

@ -253,8 +253,6 @@ func MlrvalDecodeFromJSON(decoder *json.Decoder) (
return mv, false, nil
}
return nil, false, fmt.Errorf("mlr: unimplemented")
}
// ================================================================