Does anyone know how to distinguish whether it is the same variable in ast?
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 194
- Avg merge
- 22h 43m
- Merged PRs (30d)
- 10
Description

```javasript
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)
}
})
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the parse(...) result and the visit(funcAst, ...) traversal shown in the issue, then inspect how the displayed call-expression callees relate to their surrounding functions. Determine how to distinguish the outer and inner samename bindings, and document or demonstrate a reliable way to identify them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100