mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 06:48:38 +09:00
Issue #1240 - Part 9 - Fix incorrectly parsing decimal BigInt 0n. The decimal parser strips leading 0s, so prevent tokenbuf being empty.
This commit is contained in:
parent
7a30b0fa2d
commit
4aa193b16b
1 changed files with 5 additions and 2 deletions
|
|
@ -1646,9 +1646,12 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
|
|||
if (isBigInt) {
|
||||
size_t length = userbuf.addressOfNextRawChar() - numStart - 1;
|
||||
tokenbuf.clear();
|
||||
if(!tokenbuf.reserve(length))
|
||||
if(!tokenbuf.reserve(length > 0 ? length : 1))
|
||||
goto error;
|
||||
tokenbuf.infallibleAppend(numStart, length);
|
||||
if(length > 0)
|
||||
tokenbuf.infallibleAppend(numStart, length);
|
||||
else
|
||||
tokenbuf.infallibleAppend("0", 1);
|
||||
tp->type = TOK_BIGINT;
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue