mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
JS: avoid double reporting dead code with js/unused-variable
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
(function(){
|
||||
throw 42;
|
||||
var x = 42;
|
||||
});
|
||||
Reference in New Issue
Block a user