Exemple #1
0
 @Override
 public void visit(PutFieldInstruction insn) {
   Expr right = Expr.var(insn.getValue().getIndex());
   Expr left;
   if (insn.getInstance() != null) {
     left = Expr.qualify(Expr.var(insn.getInstance().getIndex()), insn.getField());
   } else {
     left = Expr.qualify(null, insn.getField());
   }
   AssignmentStatement stmt = Statement.assign(left, right);
   stmt.setLocation(currentLocation);
   statements.add(stmt);
 }
Exemple #2
0
 @Override
 public void visit(GetFieldInstruction insn) {
   if (insn.getInstance() != null) {
     AssignmentStatement stmt =
         Statement.assign(
             Expr.var(insn.getReceiver().getIndex()),
             Expr.qualify(Expr.var(insn.getInstance().getIndex()), insn.getField()));
     stmt.setLocation(currentLocation);
     statements.add(stmt);
   } else {
     Expr fieldExpr = Expr.qualify(null, insn.getField());
     AssignmentStatement stmt =
         Statement.assign(Expr.var(insn.getReceiver().getIndex()), fieldExpr);
     stmt.setLocation(currentLocation);
     statements.add(stmt);
   }
 }