private Statement findFirstBlock(Statement stat, Integer varindex) {

    LinkedList<Statement> stack = new LinkedList<>();
    stack.add(stat);

    while (!stack.isEmpty()) {
      Statement st = stack.remove(0);

      if (stack.isEmpty() || mapStatementVars.get(st.id).contains(varindex)) {

        if (st.isLabeled() && !stack.isEmpty()) {
          return st;
        }

        if (st.getExprents() != null) {
          return st;
        }
        else {
          stack.clear();

          switch (st.type) {
            case SEQUENCE -> stack.addAll(0, st.getStats());
            case IF, ROOT, SWITCH, SYNCHRONIZED -> stack.add(st.getFirst());
            default -> {
              return st;
            }
          }
        }
      }
    }

    return null;
  }
private Statement findFirstBlock(Statement stat, Integer varindex)