forked from JavaTX/JavaCompilerCore
Iteration über Statements innerhalb method.java
This commit is contained in:
parent
2fac549cf5
commit
e9c6170d15
@ -728,7 +728,8 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
//TODO: Hier return type und Argument-Typen dynamisch generieren. return type mittels method.getReturnType() ermitteln
|
||||
|
||||
//Über Statements iterieren um den Block abzurufen
|
||||
for(Statement statements : ){
|
||||
//Muss dafür ein Statement Array erstellt werden, sodass ich über alle Statements in einem Block iterieren kann?
|
||||
for(Statement statements : block.get_Statement()){
|
||||
statements.genByteCode(cg);
|
||||
}
|
||||
|
||||
|
@ -261,12 +261,13 @@ public class Block extends Statement
|
||||
//ConstantPoolGen _cp = cg.getConstantPool();
|
||||
InstructionFactory _factory = new InstructionFactory(cg, _cp);
|
||||
InstructionList il = new InstructionList();
|
||||
//Instructionhandle dynamisch
|
||||
|
||||
//Frage: Wenn Block von Statements erbt, und Block selbst keinen BCEL Code besitzt, ist das hier dann nicht eine Sackgasse?
|
||||
|
||||
InstructionHandle ih_0 = il.append(_factory.createLoad(org.apache.bcel.generic.Type.OBJECT, 0)); //creates Constructor
|
||||
//Instructionhandle dynamisch
|
||||
InstructionHandle ih_0 = il.append(_factory.createLoad(org.apache.bcel.generic.Type.OBJECT, 0));
|
||||
il.append(_factory.createInvoke(this.getParentClass().superclassid.toString(), "<init>", org.apache.bcel.generic.Type.VOID, org.apache.bcel.generic.Type.NO_ARGS, Constants.INVOKESPECIAL));
|
||||
InstructionHandle ih_4 = il.append(_factory.createReturn(org.apache.bcel.generic.Type.VOID)); //creates Constructor
|
||||
InstructionHandle ih_4 = il.append(_factory.createReturn(org.apache.bcel.generic.Type.VOID));
|
||||
|
||||
il.dispose();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user