diff --git a/lib/6to5/transformation/transformers/_alias-functions.js b/lib/6to5/transformation/transformers/_alias-functions.js index 4d4b78ea67..7dbabf3710 100644 --- a/lib/6to5/transformation/transformers/_alias-functions.js +++ b/lib/6to5/transformation/transformers/_alias-functions.js @@ -20,7 +20,7 @@ var go = function (getBody, node, file, scope) { if (!node._aliasFunction) { if (t.isFunction(node)) { // stop traversal of this node as it'll be hit again by this transformer - return false; + return this.stop(); } else { return; } @@ -30,10 +30,10 @@ var go = function (getBody, node, file, scope) { traverse(node, { enter: function (node, parent) { if (t.isFunction(node) && !node._aliasFunction) { - return false; + return this.stop(); } - if (node._ignoreAliasFunctions) return false; + if (node._ignoreAliasFunctions) return this.stop(); var getId; @@ -49,7 +49,7 @@ var go = function (getBody, node, file, scope) { } }); - return false; + return this.stop(); } }); diff --git a/lib/6to5/transformation/transformers/es6-generators.js b/lib/6to5/transformation/transformers/es6-generators.js index 7b7c0a3f0e..c7dc28d55e 100644 --- a/lib/6to5/transformation/transformers/es6-generators.js +++ b/lib/6to5/transformation/transformers/es6-generators.js @@ -1 +1,3 @@ -module.exports = require("regenerator").transform; +exports.ast = { + before: require("regenerator").transform +}; diff --git a/lib/6to5/transformation/transformers/es6-let-scoping.js b/lib/6to5/transformation/transformers/es6-let-scoping.js index 7d6fa09b76..3abc6c6c90 100644 --- a/lib/6to5/transformation/transformers/es6-let-scoping.js +++ b/lib/6to5/transformation/transformers/es6-let-scoping.js @@ -280,7 +280,7 @@ LetScoping.prototype.checkLoop = function () { var replace; if (t.isFunction(node) || t.isLoop(node)) { - return false; + return this.stop(); } if (node && !node.label) { @@ -329,7 +329,7 @@ LetScoping.prototype.hoistVarDeclarations = function () { } else if (isVar(node, parent)) { return self.pushDeclar(node).map(t.expressionStatement); } else if (t.isFunction(node)) { - return false; + return this.stop(); } } }); @@ -388,9 +388,9 @@ LetScoping.prototype.getLetReferences = function () { } }); - return false; + return this.stop(); } else if (t.isLoop(node)) { - return false; + return this.stop(); } } }); diff --git a/lib/6to5/transformation/transformers/use-strict.js b/lib/6to5/transformation/transformers/use-strict.js index c4b352cc20..02d4dbc264 100644 --- a/lib/6to5/transformation/transformers/use-strict.js +++ b/lib/6to5/transformation/transformers/use-strict.js @@ -1,12 +1,14 @@ var t = require("../../types"); -module.exports = function (ast) { - var body = ast.program.body; - var first = body[0]; +exports.ast = { + exit: function (ast) { + var body = ast.program.body; + var first = body[0]; - var noStrict = !first || !t.isExpressionStatement(first) || !t.isLiteral(first.expression) || first.expression.value !== "use strict"; + var noStrict = !first || !t.isExpressionStatement(first) || !t.isLiteral(first.expression) || first.expression.value !== "use strict"; - if (noStrict) { - body.unshift(t.expressionStatement(t.literal("use strict"))); + if (noStrict) { + body.unshift(t.expressionStatement(t.literal("use strict"))); + } } };