remap UpdateExpression in module exports - closes #334
This commit is contained in:
@@ -50,17 +50,25 @@ function traverse(parent, opts, scope) {
|
||||
}
|
||||
};
|
||||
|
||||
var stop = false;
|
||||
|
||||
var context = {
|
||||
stop: function () {
|
||||
stop = true;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
var ourScope = scope;
|
||||
if (t.isScope(node)) ourScope = new Scope(node, scope);
|
||||
|
||||
// enter
|
||||
if (opts.enter) {
|
||||
var result = opts.enter(node, parent, ourScope);
|
||||
var result = opts.enter.call(context, node, parent, ourScope);
|
||||
maybeReplace(result);
|
||||
|
||||
// stop iteration
|
||||
if (result === false) return;
|
||||
if (stop || result === false) return;
|
||||
}
|
||||
|
||||
// traverse node
|
||||
@@ -68,7 +76,7 @@ function traverse(parent, opts, scope) {
|
||||
|
||||
// exit
|
||||
if (opts.exit) {
|
||||
maybeReplace(opts.exit(node, parent, ourScope));
|
||||
maybeReplace(opts.exit.call(context, node, parent, ourScope));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -89,7 +97,6 @@ traverse.removeProperties = function (tree) {
|
||||
delete node._declarations;
|
||||
delete node.extendedRange;
|
||||
delete node._scopeInfo;
|
||||
delete node._scope;
|
||||
delete node.tokens;
|
||||
delete node.range;
|
||||
delete node.start;
|
||||
|
||||
Reference in New Issue
Block a user