JS: Fixes in DeadStoreOfLocal

This commit is contained in:
Asger F
2019-09-04 11:21:26 +01:00
parent 5573279580
commit 61e1d793df
2 changed files with 5 additions and 4 deletions

View File

@@ -36,6 +36,11 @@ where
exists(v.getAnAccess()) and
// don't flag ambient variable definitions
not dead.(ASTNode).isAmbient() and
// don't flag variables with ambient uses
not exists(LexicalAccess access |
access.getALexicalName() = v.getADeclaration().getALexicalName() and
access.isAmbient()
) and
// don't flag function expressions
not exists(FunctionExpr fe | dead = fe.getId()) and
// don't flag function declarations nested inside blocks or other compound statements;

View File

@@ -1,7 +1,3 @@
| computedInterfaceProperty.ts:1:10:1:12 | Foo | This definition of Foo is useless, since its value is never read. |
| computedInterfaceProperty.ts:7:7:7:17 | Bar = "Bar" | The initial value of Bar is unused, since it is always overwritten. |
| computedInterfaceProperty.ts:13:7:13:17 | Baz = "Baz" | The initial value of Baz is unused, since it is always overwritten. |
| computedInterfaceProperty.ts:21:1:21:10 | class C {} | This definition of C is useless, since its value is never read. |
| overload.ts:10:12:10:14 | baz | This definition of baz is useless, since its value is never read. |
| tst2.js:26:9:26:14 | x = 23 | The initial value of x is unused, since it is always overwritten. |
| tst2.js:28:9:28:14 | x = 42 | This definition of x is useless, since its value is never read. |