Skip to content

Commit

Permalink
Fix hoisting of arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Mar 16, 2017
1 parent a176823 commit 5f075a9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/regenerator-transform/src/visit.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ exports.visitor = {
let didRenameArguments = renameArguments(path, argsId);
if (didRenameArguments) {
vars = vars || t.variableDeclaration("var", []);
const argumentIdentifier = t.identifier("arguments");
// we need to do this as otherwise arguments in arrow functions gets hoisted
argumentIdentifier._shadowedFunctionLiteral = path;
vars.declarations.push(t.variableDeclarator(
argsId, t.identifier("arguments")
argsId, argumentIdentifier
));
}

Expand Down

0 comments on commit 5f075a9

Please sign in to comment.