mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge pull request #20421 from asgerf/js/compile-for-overlay-eval
JS: Add compileForOverlayEval: true
This commit is contained in:
@@ -498,12 +498,9 @@ public class AutoBuild {
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// Ensure at least one file without errors is included, as extraction fails otherwise.
|
||||
console.log("Hello")
|
||||
@@ -23,3 +23,4 @@ dataExtensions:
|
||||
- semmle/javascript/security/domains/**/*.model.yml
|
||||
- ext/*.model.yml
|
||||
warnOnImplicitThis: true
|
||||
compileForOverlayEval: true
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
|
||||
import javascript
|
||||
|
||||
pragma[nomagic]
|
||||
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 +35,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