Skip to content

Commit

Permalink
lift the declarations without mutating the node[fix babel#402]
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshshanmugam committed Feb 2, 2017
1 parent ac5eccc commit 76454db
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -24,9 +24,10 @@ module.exports = function({ types: t }) {
return;
}

init.node.declarations = init.node.declarations.concat(
firstNode.id
);
init.node.declarations = [
...init.node.declarations,
t.variableDeclarator(firstNode.id)
];

body[0].replaceWith(t.assignmentExpression(
"=",
Expand Down

0 comments on commit 76454db

Please sign in to comment.