Skip to content

Commit c8ca9e6

Browse files
committed
Remove unreachable condition
lexNumberOrDateStart() is only called from lexValue() on isDigit(r), so !isDigit(r) in there can never happen.
1 parent 1121f81 commit c8ca9e6

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

lex.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -928,19 +928,9 @@ func lexLongUnicodeEscape(lx *lexer) stateFn {
928928
// lexBaseNumberOrDate can differentiate base prefixed integers from other
929929
// types.
930930
func lexNumberOrDateStart(lx *lexer) stateFn {
931-
r := lx.next()
932-
switch r {
933-
case '0':
931+
if lx.next() == '0' {
934932
return lexBaseNumberOrDate
935933
}
936-
937-
if !isDigit(r) {
938-
// The only way to reach this state is if the value starts
939-
// with a digit, so specifically treat anything else as an
940-
// error.
941-
return lx.errorf("expected a digit but got %q", r)
942-
}
943-
944934
return lexNumberOrDate
945935
}
946936

0 commit comments

Comments
 (0)