forked from JavaTX/JavaCompilerCore
GenCode: Reupload Assign Type-Switch wegen Mergeproblemen
This commit is contained in:
parent
6dd922a263
commit
b4d9cfbe0c
@ -6,6 +6,7 @@ import java.util.Enumeration;
|
|||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.apache.bcel.generic.ASTORE;
|
||||||
import org.apache.bcel.generic.ClassGen;
|
import org.apache.bcel.generic.ClassGen;
|
||||||
import org.apache.bcel.generic.ISTORE;
|
import org.apache.bcel.generic.ISTORE;
|
||||||
import org.apache.bcel.generic.InstructionFactory;
|
import org.apache.bcel.generic.InstructionFactory;
|
||||||
@ -171,7 +172,6 @@ public class Assign extends Expr
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static int counterAssign = 0; //Zaehlvariable für ISTORE
|
public static int counterAssign = 0; //Zaehlvariable für ISTORE
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -180,8 +180,16 @@ public class Assign extends Expr
|
|||||||
InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool());
|
InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool());
|
||||||
InstructionList il = expr2.genByteCode(cg);//expr2 rechte expr
|
InstructionList il = expr2.genByteCode(cg);//expr2 rechte expr
|
||||||
counterAssign++;
|
counterAssign++;
|
||||||
il.append(new ISTORE(counterAssign)); //macht ISTORE für meherere Variable nutzbar (nicht nur ISTORE_1, ISTORE_2, etc.)
|
//il.append(new ISTORE(counterAssign)); //macht ISTORE für meherere Variable nutzbar (nicht nur ISTORE_1, ISTORE_2, etc.)
|
||||||
//Anpassung für Variablen außerhalb von int = ISTORE nötig?
|
//Anpassung für Variablen außerhalb von int = ISTORE nötig?
|
||||||
|
switch(expr2.getType().toString()){//welche rückgabewerte entstehen hier??? Integer und String scheinen nicht zu stimmen
|
||||||
|
case "Integer": il.append(new ISTORE(counterAssign));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "String": il.append(new ASTORE(counterAssign));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//System.out.println(expr2.getType().toString());
|
||||||
return il;
|
return il;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user