diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index a3bbd5e55f..21aa975630 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -238,10 +238,21 @@ t.isReferenced = function (node, parent) { return parent.key === node && parent.computed; } + if (t.isRestElement(parent)) { + return false; + } + + if (t.isAssignmentPattern(parent)) { + return parent.right !== node; + } + + if (t.isPattern(parent)) { + return false; + } + if (t.isFunction(parent)) { for (var i = 0; i < parent.params.length; i++) { var param = parent.params[i]; - if (t.isRestElement(param)) param = param.argument; if (param === node) return false; }