JS: Ensure correct value is used in parseNameExpression()

The call to expect() below here updates 'token' and 'value' to that of the NEXT token (not the name).

The code happened to work because the 'value' field is only updated if a token with a relevant value is found. E.g. if a name token could be followed by another name, then we would have seen the wrong name here.
This commit is contained in:
Asger F
2025-03-21 10:44:10 +01:00
parent 6868f66108
commit cc2bec0808

View File

@@ -829,6 +829,7 @@ public class JSDocParser {
private JSDocTypeExpression parseNameExpression() throws ParseError {
SourceLocation loc = loc();
Object value = this.value; // save the value of the current token
expect(Token.NAME);
// Hacky initial implementation with wrong locations
String[] parts = value.toString().split("\\.");