Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,9 @@ public int run() throws IOException {
// ensuring that the finalize steps detects that no code was seen.
Path srcFolder = Paths.get(EnvironmentVariables.getWipDatabase(), "src");
try {
// Non-recursive delete because "src/" should be empty.
FileUtil8.delete(srcFolder);
FileUtil8.recursiveDelete(srcFolder);
} catch (NoSuchFileException e) {
Exceptions.ignore(e, "the directory did not exist");
} catch (DirectoryNotEmptyException e) {
Exceptions.ignore(e, "just leave the directory if it is not empty");
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Ensure at least one file without errors is included, as extraction fails otherwise.
console.log("Hello")
1 change: 1 addition & 0 deletions javascript/ql/lib/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ dataExtensions:
- semmle/javascript/security/domains/**/*.model.yml
- ext/*.model.yml
warnOnImplicitThis: true
compileForOverlayEval: true
12 changes: 8 additions & 4 deletions javascript/ql/lib/semmle/javascript/Tokens.qll
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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 }
Expand Down