Skip to content

Commit

Permalink
fix printing bigint literals parsed by Flow (#6883)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorn0 authored and lydell committed Nov 8, 2019
1 parent ea70396 commit 361fd2d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/language-js/printer-estree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1625,8 +1625,8 @@ function printPathNoParens(path, options, print, args) {
case "NumericLiteral": // Babel 6 Literal split
return printNumber(n.extra.raw);
case "BigIntLiteral":
// babel: n.extra.raw, typescript: n.raw
return (n.extra ? n.extra.raw : n.raw).toLowerCase();
// babel: n.extra.raw, typescript: n.raw, flow: n.bigint
return (n.bigint || (n.extra ? n.extra.raw : n.raw)).toLowerCase();
case "BooleanLiteral": // Babel 6 Literal split
case "StringLiteral": // Babel 6 Literal split
case "Literal": {
Expand Down
2 changes: 1 addition & 1 deletion tests/big-int/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`literal.js 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
parsers: ["babel", "typescript", "flow"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down
2 changes: 1 addition & 1 deletion tests/big-int/jsfmt.spec.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
run_spec(__dirname, ["babel", "typescript"]);
run_spec(__dirname, ["babel", "typescript", "flow"]);

0 comments on commit 361fd2d

Please sign in to comment.