diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java index fc209ed6..88243383 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java @@ -7,6 +7,7 @@ import java.util.Hashtable; import java.util.Iterator; import org.apache.bcel.generic.ClassGen; +import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.InstructionFactory; import org.apache.bcel.generic.InstructionList; @@ -171,17 +172,18 @@ public class Assign extends Expr - + int counter = 0; //Zaehlvariable für ISTORE @Override public InstructionList genByteCode(ClassGen cg) { // TODO Auto-generated method stub //Bytecode: bipush 20 // istore_1 - InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool()); + //InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool()); InstructionList il = expr2.genByteCode(cg);//expr2 rechte expr - //il.append(_factory.createConstant(expr2)); - il.append(_factory.ISTORE_1); + //il.append(_factory.ISTORE_1); + counter++; + il.append(new ISTORE(counter)); //nimmt das auch die Variable und nicht den Zaehler? return il; } diff --git a/test/bytecode/Assign.jav b/test/bytecode/Assign.jav index ba88c14c..8f32ab9c 100644 --- a/test/bytecode/Assign.jav +++ b/test/bytecode/Assign.jav @@ -1,7 +1,7 @@ class Assign{ -void method() {i; i = 20;} +void method() {i; i = 20; j; j=50;k; k=50;l; l =70;}//m; m=120; n; n=60; } \ No newline at end of file