Fix printing BigIntLiterals/DecimalLiterals with compact option (#12424)

This commit is contained in:
Brian Ng 2020-11-30 20:18:57 -06:00 committed by GitHub
parent 2ca28d78e6
commit 7018ed6e46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 4 deletions

View File

@ -216,19 +216,19 @@ export function StringLiteral(node: Object) {
export function BigIntLiteral(node: Object) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.token(raw);
this.word(raw);
return;
}
this.token(node.value + "n");
this.word(node.value + "n");
}
export function DecimalLiteral(node: Object) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.token(raw);
this.word(raw);
return;
}
this.token(node.value + "m");
this.word(node.value + "m");
}
export function PipelineTopicExpression(node: Object) {

View File

@ -0,0 +1,5 @@
function a() { return 100n; }
function b() { return 9223372036854775807n; }
function c() { return 0o16432n; }
function d() { return 0xFFF123n; }
function e() { return 0b101011101n; }

View File

@ -0,0 +1,3 @@
{
"compact": true
}

View File

@ -0,0 +1 @@
function a(){return 100n;}function b(){return 9223372036854775807n;}function c(){return 0o16432n;}function d(){return 0xFFF123n;}function e(){return 0b101011101n;}

View File

@ -0,0 +1,5 @@
function a() { return 100m; }
function b() { return 9223372036854775807m; }
function c() { return 0.m; }
function d() { return 3.1415926535897932m; }
function e() { return 100.000m; }

View File

@ -0,0 +1,4 @@
{
"compact": true,
"plugins": ["decimal"]
}

View File

@ -0,0 +1 @@
function a(){return 100m;}function b(){return 9223372036854775807m;}function c(){return 0.m;}function d(){return 3.1415926535897932m;}function e(){return 100.000m;}