diff --git a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java index f5e998398f52..8d00712b653b 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java +++ b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java @@ -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; } diff --git a/javascript/ql/integration-tests/diagnostics/syntax-error/good.js b/javascript/ql/integration-tests/diagnostics/syntax-error/good.js new file mode 100644 index 000000000000..7b0bfcf5c25b --- /dev/null +++ b/javascript/ql/integration-tests/diagnostics/syntax-error/good.js @@ -0,0 +1,2 @@ +// Ensure at least one file without errors is included, as extraction fails otherwise. +console.log("Hello") diff --git a/javascript/ql/lib/qlpack.yml b/javascript/ql/lib/qlpack.yml index 1ee1c8c78150..d8d53ef1c7ef 100644 --- a/javascript/ql/lib/qlpack.yml +++ b/javascript/ql/lib/qlpack.yml @@ -23,3 +23,4 @@ dataExtensions: - semmle/javascript/security/domains/**/*.model.yml - ext/*.model.yml warnOnImplicitThis: true +compileForOverlayEval: true diff --git a/javascript/ql/lib/semmle/javascript/Tokens.qll b/javascript/ql/lib/semmle/javascript/Tokens.qll index c6a9b05a3d1a..3d4e70d61498 100644 --- a/javascript/ql/lib/semmle/javascript/Tokens.qll +++ b/javascript/ql/lib/semmle/javascript/Tokens.qll @@ -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 }