JS: avoid double reporting dead code with js/unused-variable

This commit is contained in:
Esben Sparre Andreasen
2019-02-12 15:07:28 +01:00
parent 91dccc3356
commit 8af501d4d5
2 changed files with 10 additions and 2 deletions

View File

@@ -190,6 +190,10 @@ predicate unusedImports(ImportVarDeclProvider provider, string msg) {
from ASTNode sel, string msg
where
unusedNonImports(sel, msg) or
unusedImports(sel, msg)
(
unusedNonImports(sel, msg) or
unusedImports(sel, msg)
) and
// avoid reporting if the definition is unreachable
sel.getFirstControlFlowNode().getBasicBlock() instanceof ReachableBasicBlock
select sel, msg

View File

@@ -0,0 +1,4 @@
(function(){
throw 42;
var x = 42;
});