ensure block

This commit is contained in:
Amjad Masad 2015-11-10 17:34:46 -08:00
parent 8891ed38b8
commit 0711fa67b4

View File

@ -42,7 +42,8 @@ export default function () {
}, },
Loop(path, file) { Loop(path, file) {
let { parent, scope } = path; let { node, parent, scope } = path;
t.ensureBlock(node);
let blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file); let blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file);
let replace = blockScoping.run(); let replace = blockScoping.run();
if (replace) path.replaceWith(replace); if (replace) path.replaceWith(replace);
@ -79,7 +80,6 @@ function convertBlockScopedToVar(node, parent, scope) {
} }
node[t.BLOCK_SCOPED_SYMBOL] = true; node[t.BLOCK_SCOPED_SYMBOL] = true;
node._let = true;
node.kind = "var"; node.kind = "var";
} }