function compareBindingAndReference({ binding, refPath, stmts }) {
  const state = {
    binding: null,
    reference: null
  };

  for (const [idx, stmt] of stmts.entries()) {
    if (isAncestor(stmt, binding.path)) {
      state.binding = { idx };
    }

    for (const ref of binding.referencePaths) {
      if (ref === refPath && isAncestor(stmt, ref)) {
        state.reference = {
          idx,
          scope: binding.path.scope === ref.scope ? "current" : "other"
        };
        break;
      }
    }
  }

  return state;
}
Handle when binding is created inside a parent block and
the corresponding parent is removed by other plugins
if (false) { var a } -> var a