traverse: pass opts.scope instead of opts
This commit is contained in:
@@ -37,7 +37,7 @@ Transformer.prototype.transform = function (file) {
|
||||
astRun("enter");
|
||||
|
||||
var build = function (exit) {
|
||||
return function (node, parent, opts) {
|
||||
return function (node, parent, scope) {
|
||||
// add any node type aliases that exist
|
||||
var types = [node.type].concat(t.ALIAS_KEYS[node.type] || []);
|
||||
|
||||
@@ -54,7 +54,7 @@ Transformer.prototype.transform = function (file) {
|
||||
if (exit) fn = fns.exit;
|
||||
if (!fn) return;
|
||||
|
||||
return fn(node, parent, file, opts.scope);
|
||||
return fn(node, parent, file, scope);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ function traverse(parent, callbacks, opts) {
|
||||
|
||||
// enter
|
||||
if (callbacks.enter) {
|
||||
result = callbacks.enter(node, parent, opts2);
|
||||
result = callbacks.enter(node, parent, opts2.scope);
|
||||
|
||||
// stop iteration
|
||||
if (result === false) return;
|
||||
@@ -67,7 +67,7 @@ function traverse(parent, callbacks, opts) {
|
||||
|
||||
// exit
|
||||
if (callbacks.exit) {
|
||||
maybeReplace(callbacks.exit(node, parent, opts2));
|
||||
maybeReplace(callbacks.exit(node, parent, opts2.scope));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user