forked from JavaTX/JavaCompilerCore
Verbesserung von Assign: sollte jetzt auch mehrere Variablen korrekt
abspeichern - allerdings entsteht im class-File nur eine einzige. Problem in IntLiteral etc.?
This commit is contained in:
parent
acdc36d23f
commit
c00e61eae6
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user