- args_size bugfix
This commit is contained in:
parent
362be98c30
commit
5ac19d7a59
@ -13,7 +13,7 @@ import java.io.*;
|
||||
public class IfStatementCreator {
|
||||
private InstructionFactory _factory;
|
||||
private ConstantPoolGen _cp;
|
||||
private ClassGen _cg;
|
||||
private ClassGenerator _cg;
|
||||
|
||||
public IfStatementCreator() {
|
||||
|
||||
@ -32,7 +32,7 @@ public class IfStatementCreator {
|
||||
|
||||
private void createMethod_0() {
|
||||
InstructionList il = new InstructionList();
|
||||
MethodGen method = new MethodGen(0, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", "bcelifier.IfStatement", il, _cp);
|
||||
MethodGen method = new MethodGenerator(0, Type.VOID, new Type[] { new ObjectType("java.lang.Boolean") }, new String[] { "arg0" }, "<init>", "bcelifier.IfStatement", il, _cp);
|
||||
|
||||
InstructionHandle ih_0 = il.append(_factory.createLoad(Type.OBJECT, 0));
|
||||
il.append(_factory.createInvoke("java.lang.Object", "<init>", Type.VOID, Type.NO_ARGS, Const.INVOKESPECIAL));
|
||||
|
@ -139,7 +139,7 @@ public class DHBWInstructionFactory extends InstructionFactory{
|
||||
return new INVOKEDYNAMIC(index);
|
||||
}
|
||||
|
||||
public LocalVariableInstruction createLoad(org.apache.commons.bcel6.generic.Type bytecodeType, String variableName) {
|
||||
public static LocalVariableInstruction createLoad(org.apache.commons.bcel6.generic.Type bytecodeType, String variableName) {
|
||||
return InstructionFactory.createLoad(bytecodeType, getStoreIndex(variableName));
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ public class DHBWInstructionFactory extends InstructionFactory{
|
||||
return InstructionFactory.createStore(bytecodeType, getStoreIndex(variableName));
|
||||
}
|
||||
|
||||
public Integer getStoreIndex(String variableName) {
|
||||
public static Integer getStoreIndex(String variableName) {
|
||||
if(storeIndexes.get(variableName) == null){
|
||||
Integer index = storeIndexes.size()+1;
|
||||
storeIndexes.put(variableName, index);
|
||||
|
@ -1,6 +1,7 @@
|
||||
// ino.module.Method.8564.package
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
// ino.end
|
||||
// ino.module.Method.8564.import
|
||||
@ -620,9 +621,10 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
private void addMethodToClassGenerator(ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) {
|
||||
DHBWConstantPoolGen _cp = cg.getConstantPool();
|
||||
InstructionList il = new InstructionList();
|
||||
|
||||
org.apache.commons.bcel6.generic.Type[] argumentTypes = org.apache.commons.bcel6.generic.Type.NO_ARGS;
|
||||
String[] argumentNames = new String[]{};
|
||||
|
||||
ArrayList<org.apache.commons.bcel6.generic.Type> argumentTypes = new ArrayList<org.apache.commons.bcel6.generic.Type>();
|
||||
ArrayList<String> argumentNames = new ArrayList<String>();
|
||||
|
||||
if(this.parameterlist != null && this.parameterlist.size() > 0){
|
||||
generateArgumentList(argumentTypes, argumentNames, cg, _factory, t);
|
||||
}
|
||||
@ -632,22 +634,17 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
|
||||
Type returnType = this.getType();
|
||||
|
||||
MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg, t), argumentTypes , argumentNames, this.get_Method_Name(), getParentClass().name, il, _cp);
|
||||
MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg, t), argumentTypes.toArray(new org.apache.commons.bcel6.generic.Type[parameterlist.size()]) , argumentNames.toArray(new String[parameterlist.size()]), this.get_Method_Name(), getParentClass().name, il, _cp);
|
||||
|
||||
cg.addMethod(method.createMethod(cg, getParameterList(), returnType, get_Block(), t));
|
||||
}
|
||||
|
||||
private void generateArgumentList(org.apache.commons.bcel6.generic.Type[] argumentTypes, String[] argumentNames, ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) {
|
||||
argumentTypes = new org.apache.commons.bcel6.generic.Type[this.parameterlist.size()];
|
||||
argumentNames = new String[this.parameterlist.size()];
|
||||
int i = 0;
|
||||
private void generateArgumentList(ArrayList<org.apache.commons.bcel6.generic.Type> argumentTypes, ArrayList<String> argumentNames, ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) {
|
||||
for(FormalParameter parameter : this.parameterlist){
|
||||
argumentTypes[i] = parameter.getType().getBytecodeType(cg, t);
|
||||
argumentNames[i] = parameter.getIdentifier();
|
||||
argumentTypes.add(parameter.getType().getBytecodeType(cg, t));
|
||||
argumentNames.add(parameter.getIdentifier());
|
||||
|
||||
_factory.getStoreIndex(parameter.getIdentifier());
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user