Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用walk时第二个实参cb的参数是不是漏了? #4

Open
zhuxindi opened this issue Apr 29, 2019 · 0 comments
Open

调用walk时第二个实参cb的参数是不是漏了? #4

zhuxindi opened this issue Apr 29, 2019 · 0 comments

Comments

@zhuxindi
Copy link

ast.js中walk调用cb会传入一个参数
exports.walk = function (node, cb) {
if (node instanceof Array) {
node.forEach(function (child) {
cb(child);
});
} else if (typeof node === 'object' && node !== null) {
cb(node);
}
};
replaceOuter.js中_walk调用walk时的cb是不带参数的
function _walk(node, isExpression) {
walk(node, function () {
// replace this
if (node.type === 'ThisExpression') {
...
}
函数体中的node拿到的是_walk的第一个参数,是个数组

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant