Examples of StoreFieldInstruction


Examples of edu.cmu.cs.crystal.tac.model.StoreFieldInstruction

    Assignment write = (Assignment) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(write);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof StoreFieldInstruction);
   
    StoreFieldInstruction store = (StoreFieldInstruction) instr;
    Assert.assertTrue(store.getDestinationObject() instanceof ThisVariable);
    Assert.assertTrue(store.getDestinationObject().isUnqualifiedThis());
    Assert.assertEquals(
        tac.sourceVariable(((SingleVariableDeclaration) m.parameters().get(0)).resolveBinding()),
        store.getSourceOperand());
    Assert.assertEquals("f", store.getFieldName());
   
    Assert.assertEquals(tac.variable(write.getRightHandSide()), store.getSourceOperand());
   
    // Make sure there's no FieldLoad generated for the assigned-to field
    Assert.assertNull(tac.instruction(write.getLeftHandSide()));
  }
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.StoreFieldInstruction

    Assert.assertTrue(seq.getInstructions()[2] instanceof BinaryOperation);
    Assert.assertTrue(seq.getInstructions()[3] instanceof StoreFieldInstruction);
    CopyInstruction copy = (CopyInstruction) seq.getInstructions()[0];
    LoadLiteralInstruction one = (LoadLiteralInstruction) seq.getInstructions()[1];
    BinaryOperation add = (BinaryOperation) seq.getInstructions()[2];
    StoreFieldInstruction store = (StoreFieldInstruction) seq.getInstructions()[3];
    Assert.assertEquals(load.getTarget(), add.getOperand1());
    Assert.assertEquals(one.getTarget(), add.getOperand2());
    Assert.assertEquals(add.getTarget(), store.getSourceOperand());
    Assert.assertEquals(copy.getTarget(), seq.getResultVariable());
    Assert.assertFalse(add.getTarget().equals(seq.getResultVariable()));
   
    Assert.assertEquals(load.getTarget(), copy.getOperand());
   
    Assert.assertTrue(load.resolveFieldBinding().equals(store.resolveFieldBinding()));
  }
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.StoreFieldInstruction

   
    Assignment write = (Assignment) inv.arguments().get(0);
    instr = tac.instruction(write);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof StoreFieldInstruction);
    StoreFieldInstruction store = (StoreFieldInstruction) instr;
   
    Assert.assertTrue(store.getDestinationObject() instanceof ThisVariable);
    Assert.assertEquals("o", store.getFieldName());
    Assert.assertEquals(tac.variable(write.getRightHandSide()), store.getSourceOperand());
    Assert.assertEquals(tac.variable(write), store.getSourceOperand());
    Assert.assertEquals(args.get(0), store.getSourceOperand());
   
    // Make sure there's no FieldLoad generated for the assigned-to field
    Assert.assertNull(tac.instruction(write.getLeftHandSide()));
  }
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.StoreFieldInstruction

    TACInstruction decl = tac.instruction(f);
    Assert.assertNotNull(decl);
    Assert.assertTrue(decl instanceof StoreFieldInstruction);
   
    StoreFieldInstruction store = (StoreFieldInstruction) decl;
    Assert.assertTrue(store.getDestinationObject() instanceof ThisVariable);
    Assert.assertEquals("f", store.getFieldName());

    TACInstruction instr = tac.instruction(init);
    Assert.assertNotNull(instr);
    Assert.assertTrue(instr instanceof LoadLiteralInstruction);
   
    LoadLiteralInstruction load = (LoadLiteralInstruction) instr;
    Assert.assertEquals(load.getTarget(), store.getSourceOperand());
   
    Assignment write = (Assignment) ((ExpressionStatement) EclipseTACSimpleTestDriver.getLastStatement(c)).getExpression();
    TACInstruction again = tac.instruction(write);
    Assert.assertNotNull(again);
    Assert.assertTrue(again instanceof StoreFieldInstruction);
    Assert.assertFalse(store.equals(again));
  }
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.StoreFieldInstruction

    TACInstruction decl = tac.instruction(f);
    Assert.assertNotNull(decl);
    Assert.assertTrue(decl instanceof StoreFieldInstruction);
   
    StoreFieldInstruction store = (StoreFieldInstruction) decl;
    Assert.assertTrue(store.getDestinationObject() instanceof ThisVariable);
    Assert.assertEquals("f", store.getFieldName());

    TACInstruction instr = tac.instruction(init);
    Assert.assertNotNull(instr);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
   
    NewObjectInstruction alloc = (NewObjectInstruction) instr;
    Assert.assertEquals(alloc.getTarget(), store.getSourceOperand());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.