Fix parentheses removal in nullish-coalescing operation (#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
This commit is contained in:
Siddhant N Trivedi 2020-01-16 04:00:28 +05:30 committed by Nicolò Ribaudo
parent e7961a08a8
commit 6ad7e19a27
3 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import * as t from "@babel/types";
const PRECEDENCE = {
"||": 0,
"??": 0,
"&&": 1,
"|": 2,
"^": 3,

View File

@ -0,0 +1,2 @@
const foo = 'test'
console.log((foo ?? '') == '')

View File

@ -0,0 +1,2 @@
const foo = 'test';
console.log((foo ?? '') == '');