}
public void caseIdentityStmt(IdentityStmt stmt) {
assignment(stmt);
}
public void assignment(DefinitionStmt stmt) {
Variable result = translateExpression(stmt.getRightOpBox());
if (result.getType() == VariableType.NONE) {
return; // no need to track this object
}
// assign to a local variable?
if (stmt.getLeftOp() instanceof Local) {
Variable lefthandSide = factory.getLocal((Local)stmt.getLeftOp());
assignValue(lefthandSide, result);
// assign to a field?
} else if (stmt.getLeftOp() instanceof FieldRef) {
FieldRef ref = (FieldRef)stmt.getLeftOp();
// delegate the translation
fieldReferenceTranslator.translateFieldAssignment(ref, result, factory);
// assign into an array slot?
} else if (stmt.getLeftOp() instanceof ArrayRef) {
ArrayRef left = (ArrayRef)stmt.getLeftOp();
Value array = left.getBase();
if (array instanceof Local) {
Local arrayLocal = (Local)array;
Variable arrayVariable = factory.getLocal(arrayLocal);
switch (result.getType()) {
case STRING:
case PRIMITIVE:
addStatement(new ArrayWriteElement(arrayVariable, result));