google / google/closure-compiler
JSDoc: JSTypeExpression#getRoot() nodes have random source locations
Open
bug
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
`JsDocInfoParser` provides random source positions for `JSTypeExpressions` in various JSDoc tags (most often, the position of the following token is used,) and this varies across kinds of parsed types. One point is that `JsDocInfoParser#wrapNode(int, Node)` uses the current stream position, not the Node's position.
On a related note, `JsDocTokenStream#ungetChar()` does not rewind the `charno` value along with `cursor`, which seems to contribute to this issue.
Contributor guide
Assessment
This issue has not been assessed yet.