Skip to content

Commit

Permalink
Fix parentheses removal in nullish-coalescing operation (babel#11014)
Browse files Browse the repository at this point in the history
* 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
sidntrivedi012 authored and nicolo-ribaudo committed Jan 15, 2020
1 parent e7961a0 commit 6ad7e19
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/babel-generator/src/node/parentheses.js
Expand Up @@ -2,6 +2,7 @@ import * as t from "@babel/types";

const PRECEDENCE = {
"||": 0,
"??": 0,
"&&": 1,
"|": 2,
"^": 3,
Expand Down
@@ -0,0 +1,2 @@
const foo = 'test'
console.log((foo ?? '') == '')
@@ -0,0 +1,2 @@
const foo = 'test';
console.log((foo ?? '') == '');

0 comments on commit 6ad7e19

Please sign in to comment.