traverse: pass opts.scope instead of opts

This commit is contained in:
Sebastian McKenzie
2014-11-09 21:24:48 +11:00
parent f4c81531ad
commit 06ba731452
2 changed files with 4 additions and 4 deletions

View File

@@ -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);
};
};

View File

@@ -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));
}
};