update traversal api, removing return false; in favor of this.stop();
This commit is contained in:
parent
860432cdfd
commit
0ebc073762
@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1 +1,3 @@
|
||||
module.exports = require("regenerator").transform;
|
||||
exports.ast = {
|
||||
before: require("regenerator").transform
|
||||
};
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -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")));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user