make sure any long specifier is stripped from a bigint value

This commit is contained in:
Dave Holoway
2020-06-07 15:46:08 +01:00
parent fc9d58b9da
commit 20831c2326

View File

@@ -2333,7 +2333,9 @@ class LiteralNumber extends LiteralValue {
switch (this.numberKind) {
case 'hex-number-literal':
case 'int-number-literal':
return BigInt(this.name);
// unlike parseInt, BigInt doesn't like invalid characters, so
// ensure we strip any trailing long specifier
return BigInt(this.name.match(/(.+?)[lL]?$/)[1]);
}
return null;
}