Merge pull request babel/babel-eslint#146 from hzoo/i-142-2
use node.babelType for SpreadProperty
This commit is contained in:
parent
f57dde1ac3
commit
05f5cc3ea8
@ -170,10 +170,12 @@ function convertTemplateType(tokens) {
|
||||
|
||||
var astTransformVisitor = {
|
||||
noScope: true,
|
||||
enter: function (node) {
|
||||
// private var to track original node type
|
||||
node._babelType = node.type;
|
||||
},
|
||||
exit: function (node) { /* parent */
|
||||
if (this.isSpreadProperty()) {
|
||||
// private var to track if it's a spread property
|
||||
node._spread = true;
|
||||
node.type = "Property";
|
||||
node.kind = "init";
|
||||
node.computed = true;
|
||||
|
||||
@ -266,7 +266,7 @@ function monkeypatch() {
|
||||
if (id.type === "ObjectPattern") {
|
||||
// check if object destructuring has a spread
|
||||
var hasSpread = id.properties.filter(function(p) {
|
||||
return p._spread === true;
|
||||
return p._babelType === "SpreadProperty";
|
||||
});
|
||||
// visit properties if so
|
||||
if (hasSpread.length > 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user