Exemplo n.º 1
0
 private void setProperty(
     InvokeInstruction insn, String property, List<Instruction> instructions, Variable valueVar) {
   Variable nameVar = program.createVariable();
   StringConstantInstruction nameInsn = new StringConstantInstruction();
   nameInsn.setConstant(property);
   nameInsn.setReceiver(nameVar);
   instructions.add(nameInsn);
   InvokeInstruction accessorInvoke = new InvokeInstruction();
   accessorInvoke.setType(InvocationType.SPECIAL);
   accessorInvoke.setMethod(
       new MethodReference(
           ResourceAccessor.class, "put", Object.class, String.class, Object.class, void.class));
   accessorInvoke.getArguments().add(insn.getInstance());
   accessorInvoke.getArguments().add(nameVar);
   accessorInvoke.getArguments().add(valueVar);
   instructions.add(accessorInvoke);
 }
Exemplo n.º 2
0
 @Override
 public void visit(StringConstantInstruction insn) {
   assign(Expr.constant(insn.getConstant()), insn.getReceiver());
 }