mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
JS: Fix bad join order in getNextToken()
This commit is contained in:
@@ -4,6 +4,13 @@
|
||||
|
||||
import javascript
|
||||
|
||||
private predicate adjacentTokens(Token token1, Token token2) {
|
||||
exists(TopLevel top, int index |
|
||||
tokeninfo(token1, _, top, index, _) and
|
||||
tokeninfo(token2, _, top, index + 1, _)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* A token occurring in a piece of JavaScript source code.
|
||||
*
|
||||
@@ -27,10 +34,7 @@ class Token extends Locatable, @token {
|
||||
string getValue() { tokeninfo(this, _, _, _, result) }
|
||||
|
||||
/** Gets the token following this token inside the same toplevel structure, if any. */
|
||||
Token getNextToken() {
|
||||
this.getTopLevel() = result.getTopLevel() and
|
||||
this.getIndex() + 1 = result.getIndex()
|
||||
}
|
||||
Token getNextToken() { adjacentTokens(this, result) }
|
||||
|
||||
/** Gets the token preceding this token inside the same toplevel structure, if any. */
|
||||
Token getPreviousToken() { result.getNextToken() = this }
|
||||
|
||||
Reference in New Issue
Block a user