mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
Merge pull request #1311 from emarteca/unreachableThrows
Approved by xiemaisi
This commit is contained in:
@@ -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."
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user