- Speichern einer lokalen Variable unter Verwenung der InstructionFactory

This commit is contained in:
Enrico Schrödter 2016-04-14 14:53:18 +02:00
parent a23f77c337
commit 65a1038574
2 changed files with 5 additions and 1 deletions

View File

@ -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;

View File

@ -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;
}