Пример #1
0
  /** @return true iff 'this' is assigned to by the method */
  public static boolean isThisAssigned(MethodData info) throws IllegalArgumentException {
    if (info == null) {
      throw new IllegalArgumentException();
    }
    ThisAssignmentChecker c = (ThisAssignmentChecker) info.getInfo(key);
    if (c == null) {
      c = new ThisAssignmentChecker(info);
      info.putInfo(key, c);
    }

    return c.assignmentToThis;
  }
Пример #2
0
  private void recalculateFrom(MethodData info) {
    assignmentToThis = false;

    if (!info.getIsStatic()) {
      IInstruction[] instructions = info.getInstructions();

      for (int i = 0; i < instructions.length; i++) {
        IInstruction instr = instructions[i];
        if (instr instanceof StoreInstruction) {
          StoreInstruction st = (StoreInstruction) instr;
          if (st.getVarIndex() == 0) {
            assignmentToThis = true;
          }
        }
      }
    }
  }