mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
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:
@@ -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("\\.");
|
||||
|
||||
Reference in New Issue
Block a user