optional async transformers should remove their ids - fixes #552

This commit is contained in:
Sebastian McKenzie
2015-01-22 08:15:35 +11:00
parent 81ff635c60
commit 5463872926
3 changed files with 5 additions and 3 deletions

View File

@@ -20,10 +20,12 @@ module.exports = function (node, callId, scope) {
traverse(node, visitor, scope);
var call = t.callExpression(callId, [node]);
var id = node.id;
delete node.id;
if (t.isFunctionDeclaration(node)) {
var declar = t.variableDeclaration("var", [
t.variableDeclarator(node.id, call)
var declar = t.variableDeclaration("let", [
t.variableDeclarator(id, call)
]);
declar._blockHoist = true;
return declar;

View File

@@ -10,7 +10,6 @@ exports.manipulateOptions = function (opts) {
exports.optional = true;
exports.Function = function (node, parent, scope, context, file) {
if (!node.async || node.generator) return;