Fehler in Bytecodegen der Methode beheben

This commit is contained in:
JanUlrich 2015-11-27 16:53:01 +01:00
parent 141e952c7a
commit 1017b02704
2 changed files with 13 additions and 12 deletions

View File

@ -767,18 +767,18 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
argumentNames[i] = parameter.getIdentifier(); argumentNames[i] = parameter.getIdentifier();
i++; i++;
} }
short constants = Constants.ACC_PUBLIC; //Per Definition ist jede Methode public
if(this.modifiers != null && this.modifiers.includesModifier(new Static())) constants += Constants.ACC_STATIC;
Type returnType = this.getType();
//Methode generieren:
MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg), argumentTypes , argumentNames, this.get_Method_Name(), parentClass.name, il, _cp);
//Methode generieren und anfügen:
cg.addMethod(method.createMethod(cg, getParameterList(), returnType, get_Block()));
} }
short constants = Constants.ACC_PUBLIC; //Per Definition ist jede Methode public
if(this.modifiers != null && this.modifiers.includesModifier(new Static())) constants += Constants.ACC_STATIC;
Type returnType = this.getType();
//Methode generieren:
MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg), argumentTypes , argumentNames, this.get_Method_Name(), parentClass.name, il, _cp);
//Methode generieren und anfügen:
cg.addMethod(method.createMethod(cg, getParameterList(), returnType, get_Block()));
} }
} }

View File

@ -197,7 +197,8 @@ public class NewClass extends Expr
InstructionList il = new InstructionList(); InstructionList il = new InstructionList();
//il.append(_cg.getInstructionFactory().createNew(get_Name())); //il.append(_cg.getInstructionFactory().createNew(get_Name()));
il.append(_cg.getInstructionFactory().createNew(this.getType().getBytecodeType(_cg).toString())); il.append(_cg.getInstructionFactory().createNew(this.getType().getBytecodeType(_cg).toString()));
il.append(InstructionConstants.DUP);
if(arglist!=null){ if(arglist!=null){
il.append(arglist.generateBytecode(_cg)); il.append(arglist.generateBytecode(_cg));
il.append(_cg.getInstructionFactory().createInvoke(this.getType().getDescription(), "<init>", il.append(_cg.getInstructionFactory().createInvoke(this.getType().getDescription(), "<init>",