Files
TypeScript/tests/cases/fourslash
Nathan Shively-Sanders 339a56fbf0 Avoid duplicates when finding jsdoc (#24086)
* Avoid duplicates when finding jsdoc

1. Add a cheap assert for detecting duplicates. getJSDocTags must find
either [1] 0 or 1 comments or [2] the first two comments must not be
identical. This does not always find duplicates for nodes with 3 or more
comments, but these nodes are exceptionally rare.

This assert fired for over 20 of the around 250 tests we have that
retrieve JSDoc at all. So I fixed the asserts in [2] and [3].

2. There were overlapping cases from calls to getSourceOfAssignment and
getSpecialPropertyAssignment. getSpecialPropertyAssignment is too
restrictive, but was in the correct location (parent vs parent.parent),
so I removed the getSourceOfAssignment call and replaced the
getSpecialPropertyAssignment calls with a less restrictive check.

3. When a node's parent is a PropertyDeclaration,
getJSDocCOmmentsAndTags would check the parent for jsdoc. But when the
*node* is a PropertyDeclaration, getJSDocCommentsAndTags would use the
jsdoc from the initializer. This second case is useful to make sure that
property declarations get all their jsdoc, but results in duplicates for
their initializers. I couldn't think of a better fix than tracking the
previous node in the recursive lookup of getJSDocCommentsAndTags, which
is a little clunky.

* Fix lint; remove new context parameter

* Update importJsNodeModule3 with fix
2018-05-15 15:12:29 -07:00
..
2018-01-17 15:18:54 -08:00
2018-01-31 11:12:09 -08:00
2018-04-16 15:59:22 -07:00
…
2017-12-15 16:31:27 -08:00
2018-01-31 11:12:09 -08:00
…
2018-01-17 15:18:54 -08:00
2018-01-17 15:18:54 -08:00
2017-12-27 16:56:03 -08:00
2017-12-07 12:39:16 -08:00
2018-05-04 11:29:54 -07:00
…
…
…