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:
parent
e7961a08a8
commit
6ad7e19a27
@ -2,6 +2,7 @@ import * as t from "@babel/types";
|
|||||||
|
|
||||||
const PRECEDENCE = {
|
const PRECEDENCE = {
|
||||||
"||": 0,
|
"||": 0,
|
||||||
|
"??": 0,
|
||||||
"&&": 1,
|
"&&": 1,
|
||||||
"|": 2,
|
"|": 2,
|
||||||
"^": 3,
|
"^": 3,
|
||||||
|
|||||||
2
packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/input.js
vendored
Normal file
2
packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/input.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
const foo = 'test'
|
||||||
|
console.log((foo ?? '') == '')
|
||||||
2
packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/output.js
vendored
Normal file
2
packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/output.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
const foo = 'test';
|
||||||
|
console.log((foo ?? '') == '');
|
||||||
Loading…
x
Reference in New Issue
Block a user