This method is similar to getChildren() but allows filtering based on $token->getTypeName().
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Commits
- rPHUc2363a1af19d: Add a few methods to `AASTNode` and `AASTToken`
See D10558.
Diff Detail
Diff Detail
- Repository
- rPHU libphutil
- Branch
- master
- Lint
Lint Passed - Unit
Tests Passed - Build Status
Buildable 2630 Build 2634: [Placeholder Plan] Wait for 30 Seconds
Event Timeline
Comment Actions
It looks like D10558 only actually needs something like getNextSemanticToken(). Maybe that's cleaner?
I think you could even getNextToken(), make sure it's isSemantic(), and then use it (i.e., "don't do anything if the next token is whitespace or a comment").
Offhand, one minor issue here is that a semantic token range is potentially the entire file.
These generally seem fine, but maybe consider a simpler approach if there aren't other use cases or you haven't already dismissed it.
Comment Actions
getNextToken() sounds reasonable... possibly I could do the following in D10558 and avoid the need to change AASTNode at all:
$after = last($value->getTokens())->getNextToken();