deopt on binding identifiers with same rest name - fixes #2091

This commit is contained in:
Sebastian McKenzie 2015-07-28 01:19:59 +01:00
parent 507303456f
commit 57d2323ae9
3 changed files with 22 additions and 0 deletions

View File

@ -78,6 +78,18 @@ var memberExpressionOptimisationVisitor = {
state.references.push(this);
}
},
/**
* Deopt on use of a binding identifier with the same name as our rest param.
*
* See https://github.com/babel/babel/issues/2091
*/
BindingIdentifier(node, parent, scope, state) {
if (node.name === state.name) {
state.deopted = true;
}
}
};

View File

@ -0,0 +1 @@
const deepAssign = (...args) => args = [];

View File

@ -0,0 +1,9 @@
"use strict";
var deepAssign = function deepAssign() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args = [];
};