Does anyone know how to distinguish whether it is the same variable in ast?
643104191 opened this issue · comments
643104191 commented
const { parse, print, visit } = require('recast')
const ast = parse(`function test(samename){
samename(123);
var b = {
c: function (samename){
samename(456)
},
d: function() {
samename(789)
}
}
}`)
const funcAst = ast.program.body[0]
const arg = funcAst.params[0]
console.log(arg)
visit(funcAst, {
visitCallExpression(path) {
console.log(path.value.callee)
this.traverse(path)
}
})