File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,20 @@ func boolLit(old ast.BoolLit) bool {
166
166
// unsigned integer literal.
167
167
func uintLit (old ast.UintLit ) uint64 {
168
168
text := old .Text ()
169
- x , err := strconv .ParseUint (text , 10 , 64 )
169
+ var x uint64
170
+ var err error
171
+ switch {
172
+ case strings .HasPrefix (text , "u0x" ):
173
+ text = text [len ("u0x" ):]
174
+ x , err = strconv .ParseUint (text , 16 , 64 )
175
+ case strings .HasPrefix (text , "s0x" ):
176
+ text = text [len ("s0x" ):]
177
+ // TODO: figure out how to handle negative values.
178
+ // The problem at here was we should return an int64 but since signature parse as uint64
179
+ x , err = strconv .ParseUint (text , 16 , 64 )
180
+ default :
181
+ x , err = strconv .ParseUint (text , 10 , 64 )
182
+ }
170
183
if err != nil {
171
184
panic (fmt .Errorf ("unable to parse unsigned integer literal %q; %v" , text , err ))
172
185
}
You can’t perform that action at this time.
0 commit comments