Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/oxc_parser/src/js/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,17 +500,17 @@ impl<'a, C: Config> ParserImpl<'a, C> {
let token = self.cur_token();
let kind = token.kind();
let has_separator = token.has_separator();
let (base, number_kind) = match kind {
Kind::DecimalBigInt => (BigintBase::Decimal, Kind::Decimal),
Kind::BinaryBigInt => (BigintBase::Binary, Kind::Binary),
Kind::OctalBigInt => (BigintBase::Octal, Kind::Octal),
Kind::HexBigInt => (BigintBase::Hex, Kind::Hex),
let base = match kind {
Kind::DecimalBigInt => BigintBase::Decimal,
Kind::BinaryBigInt => BigintBase::Binary,
Kind::OctalBigInt => BigintBase::Octal,
Kind::HexBigInt => BigintBase::Hex,
_ => return self.unexpected(),
};
let span = token.span();
let raw = self.cur_src();
let src = raw.strip_suffix('n').unwrap();
let value = parse_big_int(src, number_kind, has_separator, self.allocator());
let value = parse_big_int(src, kind, has_separator, self.allocator());

self.bump_any();
BigIntLiteral::boxed(span, value, Some(Str::from(raw)), base, self)
Expand Down
8 changes: 4 additions & 4 deletions crates/oxc_parser/src/lexer/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,10 @@ pub fn parse_big_int<'a>(

let radix = match kind {
// Skip parsing with `BigInt` - it's already in decimal form, and underscores are removed
Kind::Decimal => return Str::from_cow_in(&s, &allocator),
Kind::Binary => 2,
Kind::Octal => 8,
Kind::Hex => 16,
Kind::DecimalBigInt => return Str::from_cow_in(&s, &allocator),
Kind::BinaryBigInt => 2,
Kind::OctalBigInt => 8,
Kind::HexBigInt => 16,
_ => unreachable!(),
};

Expand Down
Loading