Skip to content

Commit d6499b9

Browse files
committed
Add support for Invert AST type (prettier#67)
Fixes prettier#58.
1 parent e7f8446 commit d6499b9

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/printer/tokens.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = {
1515
BitAnd: "&",
1616
BitXor: "^",
1717
BitOr: "|",
18+
Invert: "~",
1819
Lt: "<",
1920
LtE: "<=",
2021
Gt: ">",

tests/python_expressions/__snapshots__/jsfmt.spec.js.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ exports[`expressions.py 1`] = `
1616
90000000000000
1717
90000000000000.
1818
3j
19+
~3
1920
2021
x = a + 1
2122
x = 1 - a
@@ -354,6 +355,7 @@ a=1;a|=2
354355
90000000000000
355356
90000000000000.
356357
3j
358+
~3
357359
358360
x = a + 1
359361
x = 1 - a
@@ -772,6 +774,7 @@ exports[`expressions.py 2`] = `
772774
90000000000000
773775
90000000000000.
774776
3j
777+
~3
775778
776779
x = a + 1
777780
x = 1 - a
@@ -1110,6 +1113,7 @@ a=1;a|=2
11101113
90000000000000
11111114
90000000000000.
11121115
3j
1116+
~3
11131117
11141118
x = a + 1
11151119
x = 1 - a

tests/python_expressions/expressions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
90000000000000
1414
90000000000000.
1515
3j
16+
~3
1617

1718
x = a + 1
1819
x = 1 - a

0 commit comments

Comments
 (0)