Skip to content

Commit 5370f85

Browse files
committed
Upgrade to rustc 63c4f22f2 2014-11-05, kind of.
Tests are still broken, because of rust-lang/rust#18659
1 parent 716ab6c commit 5370f85

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/tokenizer.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -434,17 +434,23 @@ fn consume_numeric(tokenizer: &mut Tokenizer) -> ComponentValue {
434434
}
435435
}
436436
}
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+
};
438451
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,
448454
representation: representation,
449455
};
450456
if !tokenizer.is_eof() && tokenizer.current_char() == '%' {

0 commit comments

Comments
 (0)