Tests escaped properties, showing current behavior for class static blocks.
@@ -420,6 +420,21 @@ public final class LiveVariablesAnalysisTest {
assertEscaped("var _x", "_x");
}
+ // TODO(b/235871861): Escaped properties are currently 'NotEscaped' for Static Blocks.
+ @Test
+ public void testEscapedInClassStaticBlock() {
+ // Expected: Escaped
+ assertNotEscaped("var a; class C{ static{a()}}", "a");
+ assertNotEscaped("var a; class C{static{ param1() } }", "param1");
+ }
+
+ @Test
+ public void testNotEscapedInClassStaticBlock() {
+ assertNotEscaped("var a; class C{static{}} a()", "a");
+ assertNotEscaped("var a; class C{static{var c; c()}}", "c");
+ assertNotEscaped("var a; class C{static{var a;a()}}a()", "a");
+ }
+
// ES6 does not require separate handling for catch because the catch block is already recognized
// by the scope creator
@Test
