test/com/google/javascript/jscomp/NodeUtilTest.java
/**
   * When the left side is a destructuring pattern, generally it's not possible to identify the RHS
   * for a specific name on the LHS.
   */
When the left side is a destructuring pattern, generally it's not possible to identify the RHS
for a specific name on the LHS.
When the left side is a destructuring pattern generally it ' s not possible to identify the RHS for a specific name on the LHS .
@Test
  public void testIsExpressionResultUsed() {
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("for (x in y) z", "x"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("for (x in y) z", "y"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("for (x in y) z", "z"))).isFalse();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("for (x of y) z", "x"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("for (x of y) z", "y"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("for (x of y) z", "z"))).isFalse();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("for (x; y; z) a", "x"))).isFalse();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("for (x; y; z) a", "y"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("for (x; y; z) a", "z"))).isFalse();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("function f() { return y }", "y")))
        .isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("function f() { y }", "y")))
        .isFalse();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("var x = ()=> y", "y"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("var x = ()=>{ y }", "y")))
        .isFalse();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("({a: x = y} = z)", "y"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("[x = y] = z", "y"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("({x: y})", "y"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("[y]", "y"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("y()", "y"))).isTrue();
    assertThat(NodeUtil.isExpressionResultUsed(getNameNodeFrom("y``", "y"))).isTrue();
  }
@ Test public void testIsExpressionResultUsed ( ) { assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "for (x in y) z" , "x" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "for (x in y) z" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "for (x in y) z" , "z" ) ) ) . isFalse ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "for (x of y) z" , "x" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "for (x of y) z" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "for (x of y) z" , "z" ) ) ) . isFalse ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "for (x; y; z) a" , "x" ) ) ) . isFalse ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "for (x; y; z) a" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "for (x; y; z) a" , "z" ) ) ) . isFalse ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "function f() { return y }" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "function f() { y }" , "y" ) ) ) . isFalse ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "var x = ()=> y" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "var x = ()=>{ y }" , "y" ) ) ) . isFalse ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "({a: x = y} = z)" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "[x = y] = z" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "({x: y})" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "[y]" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "y()" , "y" ) ) ) . isTrue ( ) ; assertThat ( NodeUtil . isExpressionResultUsed ( getNameNodeFrom ( "y``" , "y" ) ) ) . isTrue ( ) ; }
When the left side is a destructuring pattern, generally it's not possible to identify the RHS
 for a specific name on the LHS.
When the left side is a destructuring pattern generally it ' s not possible to identify the RHS for a specific name on the LHS .