You can simplify this to

    return x[1] != null &&
      x[1].type != 'BlockStatement' &&
      x[1].type != 'IfStatement'

But that'll still fail for nested if statements:

    if (x)
      if (y)
        y;