google / google/closure-compiler

JSDoc: JSTypeExpression#getRoot() nodes have random source locations

Open
#489 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.