Bugfix: Methodenparameter

This commit is contained in:
Enrico Schrödter 2016-04-07 15:44:29 +02:00
parent 45cad9f675
commit b707a0f03e
3 changed files with 10 additions and 2 deletions

View File

@ -53,7 +53,7 @@ public class ClassGenerator extends ClassGen{
}
public DHBWInstructionFactory getInstructionFactory() {
return factory ;
return factory;
}
/**

View File

@ -158,4 +158,8 @@ public class DHBWInstructionFactory extends InstructionFactory{
public Attribute createSignatureAttribute(String signature) {
return new Signature(cp.addUtf8("Signature"),2,cp.addUtf8(signature),cp.getConstantPool());
}
public void resetStoreIndexes() {
storeIndexes = new HashMap<>();
}
}

View File

@ -12,6 +12,7 @@ import org.apache.commons.bcel6.generic.InstructionList;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.bytecode.DHBWInstructionFactory;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.myexception.JVMCodeException;
import de.dhbwstuttgart.syntaxtree.Method;
@ -324,7 +325,8 @@ public class MethodCall extends Expr
@Override
public InstructionList genByteCode(ClassGenerator cg, TypeinferenceResultSet rs) {
InstructionList il = new InstructionList();
InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool());
DHBWInstructionFactory _factory = cg.getInstructionFactory();
_factory.resetStoreIndexes();
il.append(receiver.get_Expr().genByteCode(cg, rs));
@ -343,6 +345,8 @@ public class MethodCall extends Expr
argumentTypen = new org.apache.commons.bcel6.generic.Type[this.getArgumentList().size()];
int i = 0;
for(Expr argument : this.arglist.expr){
_factory.getStoreIndex(argument.get_Name());
argumentTypen[i] = argument.getType().getBytecodeType(cg, rs);
//Das Argument auf den Stack legen:
il.append(argument.genByteCode(cg, rs));