partial visit
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 194
- Avg merge
- 22h 43m
- Merged PRs (30d)
- 10
Description
I want to visit an AST, but exclude CallExpression arguments. How can I do this? Given the script below, I'm missing almost all identifiers
```
const { parse } = require('recast')
const { visit } = require('ast-types')
const src = `
[
() => ((x() ? y() : z()) + y()).len() + (auth(creator).lower(1) + year()).len(">", 0).postfix(_) + title().len(">", 0).lower() + other(),
() => x()
]
`
const idents = {
visitIdentifier(path) {
console.log(path.node.name)
this.traverse(path)
},
visitCallExpression(path) {
this.traverse(path.get('callee'))
// this.traverse(path)
},
}
let ast = parse(src)
ast = visit(ast, idents)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the visit API and the visitCallExpression example in the issue, then inspect how path.get('callee') differs from traversing the full path. Reproduce the script and compare the identifiers logged with the intended exclusion; done means the traversal visits the desired nodes without CallExpression arguments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100