File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,12 @@ impl Visit for Collector {
306306 }
307307 AssignTarget :: Pat ( _) => n. visit_children_with ( self ) ,
308308 }
309+
310+ if let Expr :: New ( new_expr) = & * n. right {
311+ self . without_cur_defining ( |a| {
312+ new_expr. visit_children_with ( a) ;
313+ } ) ;
314+ }
309315 } else {
310316 n. visit_children_with ( self )
311317 }
@@ -2379,6 +2385,27 @@ export const Foo = () => {
23792385 } ;
23802386 }
23812387
2388+ #[ test]
2389+ fn no_unused_vars_static_init_is_usage ( ) {
2390+ assert_lint_err ! {
2391+ NoUnusedVars ,
2392+ "let foo: Foo;
2393+ class Foo {
2394+ instance;
2395+ static {
2396+ foo = new Foo();
2397+ }
2398+ }
2399+ " : [
2400+ {
2401+ col: 4 ,
2402+ message: variant!( NoUnusedVarsMessage , NeverUsed , "foo" ) ,
2403+ hint: variant!( NoUnusedVarsHint , AddPrefix , "foo" ) ,
2404+ }
2405+ ] ,
2406+ } ;
2407+ }
2408+
23822409 // TODO(magurotuna): deals with this using ControlFlow
23832410 #[ test]
23842411 #[ ignore = "control flow analysis is not implemented yet" ]
You can’t perform that action at this time.
0 commit comments