forked from babel/babel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parentheses removal in nullish-coalescing operation (babel#11014)
* Added precedence for nullish-coalescing-operator * Made precedence equal to logical OR * Renamed the folders made for testing * Fixed the output test file of nullish-coalescing op
- Loading branch information
1 parent
e7961a0
commit 6ad7e19
Showing
3 changed files
with
5 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import * as t from "@babel/types"; | |
|
||
const PRECEDENCE = { | ||
"||": 0, | ||
"??": 0, | ||
"&&": 1, | ||
"|": 2, | ||
"^": 3, | ||
|
2 changes: 2 additions & 0 deletions
2
packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const foo = 'test' | ||
console.log((foo ?? '') == '') |
2 changes: 2 additions & 0 deletions
2
packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const foo = 'test'; | ||
console.log((foo ?? '') == ''); |