We already have the BranchGetter class, which is basically lenses over the AST. This PR adds an alternative version (named ASTPath for lack of a better name) with two major improvements:
the return type is narrowed to the actual return type, rather than just being Node
since it can now return the precise type, it allows lensing to primitive fields, not just to Nodes (so e.g. there is a lens for getting the String name field from an IdentifierExpression)
This PR is against ES2017; I'll port it to ES2018 once it lands.
We already have the
BranchGetter
class, which is basically lenses over the AST. This PR adds an alternative version (namedASTPath
for lack of a better name) with two major improvements:name
field from anIdentifierExpression
)This PR is against ES2017; I'll port it to ES2018 once it lands.