forked from JavaTX/JavaCompilerCore
Merge mit refactoring
This commit is contained in:
commit
141e952c7a
@ -66,7 +66,7 @@ public class Constructor extends Method {
|
|||||||
InstructionList il = new InstructionList(); //sollte nicht new sein sondern aus Block kommen
|
InstructionList il = new InstructionList(); //sollte nicht new sein sondern aus Block kommen
|
||||||
Class parentClass = this.getParentClass();
|
Class parentClass = this.getParentClass();
|
||||||
|
|
||||||
MethodGenerator method = new MethodGenerator(Constants.ACC_PUBLIC, this.getType().getBytecodeType(cg), org.apache.commons.bcel6.generic.Type.NO_ARGS , new String[] { }, "<init>", parentClass.name, il, _cp);
|
MethodGenerator method = new MethodGenerator(Constants.ACC_PUBLIC, this.getType().getBytecodeType(cg), this.parameterlist.getBytecodeTypeList(cg) , this.parameterlist.getParameterNameArray(), "<init>", parentClass.name, il, _cp);
|
||||||
|
|
||||||
//FieldInitializations an Block anfügen
|
//FieldInitializations an Block anfügen
|
||||||
Block block = this.get_Block();
|
Block block = this.get_Block();
|
||||||
|
@ -195,17 +195,16 @@ public class NewClass extends Expr
|
|||||||
@Override
|
@Override
|
||||||
public InstructionList genByteCode(ClassGenerator _cg) {
|
public InstructionList genByteCode(ClassGenerator _cg) {
|
||||||
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(InstructionConstants.DUP);
|
|
||||||
|
|
||||||
if(arglist!=null){
|
if(arglist!=null){
|
||||||
il.append(arglist.generateBytecode(_cg));
|
il.append(arglist.generateBytecode(_cg));
|
||||||
il.append(_cg.getInstructionFactory().createInvoke(this.get_Name(), "<init>",
|
il.append(_cg.getInstructionFactory().createInvoke(this.getType().getDescription(), "<init>",
|
||||||
org.apache.commons.bcel6.generic.Type.VOID,
|
org.apache.commons.bcel6.generic.Type.VOID,
|
||||||
this.arglist.getBytecodeTypeList(_cg), Constants.INVOKESPECIAL));
|
this.arglist.getBytecodeTypeList(_cg), Constants.INVOKESPECIAL));
|
||||||
}else{
|
}else{
|
||||||
il.append(_cg.getInstructionFactory().createInvoke(this.get_Name(), "<init>",
|
il.append(_cg.getInstructionFactory().createInvoke(this.getType().getDescription(), "<init>",
|
||||||
org.apache.commons.bcel6.generic.Type.VOID,
|
org.apache.commons.bcel6.generic.Type.VOID,
|
||||||
new org.apache.commons.bcel6.generic.Type[]{}, Constants.INVOKESPECIAL));
|
new org.apache.commons.bcel6.generic.Type[]{}, Constants.INVOKESPECIAL));
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ public class NewStatementTest {
|
|||||||
public void test() {
|
public void test() {
|
||||||
SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory);
|
SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
@Test
|
@Test
|
||||||
public void testUntypedVectorDeclaredMethods() {
|
public void testUntypedVectorDeclaredMethods() {
|
||||||
try{
|
try{
|
||||||
@ -51,5 +52,6 @@ public class NewStatementTest {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user