diff --git a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java index bc5a3806..6cf24c88 100644 --- a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java +++ b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java @@ -143,6 +143,10 @@ public class DHBWInstructionFactory extends InstructionFactory{ return InstructionFactory.createLoad(bytecodeType, getStoreIndex(variableName)); } + public LocalVariableInstruction createStore(org.apache.commons.bcel6.generic.Type bytecodeType, String variableName) { + return InstructionFactory.createStore(bytecodeType, getStoreIndex(variableName)); + } + public Integer getStoreIndex(String variableName) { if(storeIndexes.get(variableName) == null){ Integer index = storeIndexes.size()+1; diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java index 9e863d01..9dfb6560 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java @@ -208,7 +208,7 @@ public class Assign extends Expr } */ //Es wird momentan immer von RefType ausgegangen: - il.append(new ASTORE(_factory.getStoreIndex(expr1.get_Name()))); + il.append(_factory.createStore(expr2.getType().getBytecodeType(cg, rs), expr1.get_Name())); return il; }