Input
function foo(arg) {
const { y } = arg, { z, x = null } = y;
return z ? z : null;
}
Output
TypeError: test3.js: Cannot read property 'end' of null
at _evaluate (C:\Users\John\Documents\GitHub\babili\packages\babili\node_modules\babel-traverse\lib\path\evaluation.js:159:57)
at evaluate (C:\Users\John\Documents\GitHub\babili\packages\babili\node_modules\babel-traverse\lib\path\evaluation.js:65:17)
...
REPL
The following version does not produce an exception but generates incorrect output:
Input
function foo(arg) {
const { y } = arg, { z, x = null } = y;
return z;
}
Output
function foo(a){const{y:b}=a;return z}
REPL
Note: removing , x = null produces correct output. Alternatively returning x + z produces correct output (REPL)
Input
Output
REPL
The following version does not produce an exception but generates incorrect output:
Input
Output
REPL
Note: removing
, x = nullproduces correct output. Alternatively returningx + zproduces correct output (REPL)