Skip to content

Commit 7ef07c1

Browse files
committed
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.
1 parent b140e02 commit 7ef07c1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

javascript/extractor/src/com/semmle/js/parser/JSDocParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ private JSDocTypeExpression parseRecordType() throws ParseError {
829829

830830
private JSDocTypeExpression parseNameExpression() throws ParseError {
831831
SourceLocation loc = loc();
832+
Object value = this.value; // save the value of the current token
832833
expect(Token.NAME);
833834
// Hacky initial implementation with wrong locations
834835
String[] parts = value.toString().split("\\.");

0 commit comments

Comments
 (0)