Skip to content

Commit 3667e4b

Browse files
committed
lint
1 parent 5f255b2 commit 3667e4b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

experimental/parser/lex_number.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ func lexNumber(l *lexer) token.Token {
6161

6262
what := taxa.Int
6363
result, ok := parseInt(digits, base)
64-
if !ok {
64+
switch {
65+
case !ok:
6566
if !taxa.IsFloatText(digits) {
6667
l.Error(errInvalidNumber{Token: tok})
6768
// Need to set a value to avoid parse errors in Token.AsInt.
@@ -99,12 +100,16 @@ func lexNumber(l *lexer) token.Token {
99100
} else {
100101
token.SetValue(tok, value)
101102
}
102-
} else if result.big != nil {
103+
104+
case result.big != nil:
103105
token.SetValue(tok, result.big)
104-
} else if base != 10 || result.hasThousands {
106+
107+
case base == 10 && !result.hasThousands:
105108
// We explicitly do not call SetValue for the most common case of base
106109
// 10 integers, because that is handled for us on-demand in AsInt. This
107110
// is a memory consumption optimization.
111+
112+
default:
108113
token.SetValue(tok, result.small)
109114
}
110115

0 commit comments

Comments
 (0)