Detect and prevent creation of bad Identifier#21581
Conversation
| //// function f(o) { return o.nested.[|great|]; } | ||
|
|
||
| verify.rangesReferenceEachOther(); | ||
|
|
There was a problem hiding this comment.
This was the test that broke under the new assertion. I'm just removing a comment here that does nothing (it only has two slashes).
There was a problem hiding this comment.
Yeah, I must have left it from earlier testing and checked it in by mistake. But it would probably be good to retain this as a parser test.
There was a problem hiding this comment.
By "this" I meant the above code. This below is a regular comment that doesn't test anything.
sandersn
left a comment
There was a problem hiding this comment.
Good as-is, but it would be nice to add a parsing test too.
| //// function f(o) { return o.nested.[|great|]; } | ||
|
|
||
| verify.rangesReferenceEachOther(); | ||
|
|
There was a problem hiding this comment.
Yeah, I must have left it from earlier testing and checked it in by mistake. But it would probably be good to retain this as a parser test.
Fixes #20792
In
Node.getChildren()we create synthetic nodes for all of the tokens that weren't parsed. This can cause a problem if we scan anIdentifierbecause we don't give it any text here (and besides, an Identifier shouldn't be trivia). After adding an assertion and running all tests, I found that there was one kind of jsdoc node which we weren't avoiding scanning trivia for -- we need to avoid scanning trivia for these because arbitrary tokens could appear in a comment.