Merge pull request #1311 from emarteca/unreachableThrows

Approved by xiemaisi
This commit is contained in:
semmle-qlci
2019-05-09 10:37:41 +01:00
committed by GitHub
3 changed files with 10 additions and 1 deletions

View File

@@ -26,5 +26,7 @@ where
// ignore ambient statements
not s.isAmbient() and
// ignore empty statements
not s instanceof EmptyStmt
not s instanceof EmptyStmt and
// ignore unreachable throws
not s instanceof ThrowStmt
select s.(FirstLineOf), "This statement is unreachable."

View File

@@ -73,3 +73,9 @@ function f(){
return z;
}; // ';' is unreachable, but alert is squelched
}
// test for unreachable throws
function z() {
return 10;
throw new Error(); // this throws is unreachable, but alert should not be produced
}