Skip to content

Commit

Permalink
Cow
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Mar 8, 2023
1 parent 586c223 commit 02fec0d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/swc_ecma_parser/src/lexer/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,13 @@ impl<'a> Lexer<'a> {

write!(raw_val, "{}", exp).unwrap();

raw_val
.replace('_', "")
.parse()
.expect("failed to parse float literal")
if raw_val.contains('_') {
Cow::Owned(raw_val.replace('_', ""))
} else {
Cow::Borrowed(&raw_val)
}
.parse()
.expect("failed to parse float literal")
}
}
_ => {}
Expand Down

0 comments on commit 02fec0d

Please sign in to comment.