File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -434,17 +434,23 @@ fn consume_numeric(tokenizer: &mut Tokenizer) -> ComponentValue {
434
434
}
435
435
}
436
436
}
437
- // TODO: handle overflow
437
+ let ( value, int_value) = {
438
+ // TODO: handle overflow
439
+ // Remove any + sign as int::from_str() does not parse them.
440
+ let repr = if representation. starts_with ( "+" ) {
441
+ representation. slice_from ( 1 )
442
+ } else {
443
+ representation. as_slice ( )
444
+ } ;
445
+ ( from_str :: < f64 > ( repr) . unwrap ( ) , if is_integer {
446
+ Some ( from_str :: < i64 > ( repr) . unwrap ( ) )
447
+ } else {
448
+ None
449
+ } )
450
+ } ;
438
451
let value = NumericValue {
439
- int_value : if is_integer { Some (
440
- // Remove any + sign as int::from_str() does not parse them.
441
- if representation. as_slice ( ) . starts_with ( "+" ) {
442
- from_str ( representation. as_slice ( ) . slice_from ( 1 ) )
443
- } else {
444
- from_str ( representation. as_slice ( ) )
445
- } . unwrap ( )
446
- ) } else { None } ,
447
- value : from_str ( representation. as_slice ( ) ) . unwrap ( ) ,
452
+ int_value : int_value,
453
+ value : value,
448
454
representation : representation,
449
455
} ;
450
456
if !tokenizer. is_eof ( ) && tokenizer. current_char ( ) == '%' {
You can’t perform that action at this time.
0 commit comments