forked from JavaTX/JavaCompilerCore
151 lines
4.1 KiB
Java
151 lines
4.1 KiB
Java
|
// ino.module.ParameterList.8565.package
|
|||
|
package mycompiler.myclass;
|
|||
|
// ino.end
|
|||
|
// ino.module.ParameterList.8565.import
|
|||
|
import java.util.Vector;
|
|||
|
import typinferenz.JavaCodeResult;
|
|||
|
import typinferenz.ResultSet;
|
|||
|
import mycompiler.mybytecode.ClassFile;
|
|||
|
import mycompiler.mybytecode.CodeAttribute;
|
|||
|
import mycompiler.mytype.*;
|
|||
|
import java.util.Iterator;
|
|||
|
|
|||
|
// ino.end
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// ino.class.ParameterList.23620.declaration
|
|||
|
public class ParameterList
|
|||
|
// ino.end
|
|||
|
// ino.class.ParameterList.23620.body
|
|||
|
{
|
|||
|
// ino.attribute.formalparameter.23623.declaration
|
|||
|
public Vector<FormalParameter> formalparameter = new Vector<FormalParameter>();
|
|||
|
// ino.end
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// ino.method.set_AddParameter.23626.definition
|
|||
|
public void set_AddParameter(FormalParameter fp)
|
|||
|
// ino.end
|
|||
|
// ino.method.set_AddParameter.23626.body
|
|||
|
{
|
|||
|
formalparameter.addElement(fp);
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// ino.method.get_codegen_ParameterList.23629.definition
|
|||
|
public String get_codegen_ParameterList(Vector paralist)
|
|||
|
// ino.end
|
|||
|
// ino.method.get_codegen_ParameterList.23629.body
|
|||
|
{
|
|||
|
String ret = "(";
|
|||
|
for(int i=0 ; i < this.formalparameter.size() ; i++)
|
|||
|
{
|
|||
|
//feda 13.06.2007 Array behandlung bei Parametern in Methoden
|
|||
|
if (this.formalparameter.elementAt(i).getType() instanceof BaseType) {
|
|||
|
BaseType BT = (BaseType)this.formalparameter.elementAt(i).getType();
|
|||
|
if (BT.IsArray() == true) {
|
|||
|
ret += "[";
|
|||
|
}
|
|||
|
}
|
|||
|
if (this.formalparameter.elementAt(i).getType() instanceof RefType) {
|
|||
|
RefType RT = (RefType)this.formalparameter.elementAt(i).getType();
|
|||
|
if (RT.IsArray() == true) {
|
|||
|
ret += "[";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
ret += this.formalparameter.elementAt(i).getType().get_codegen_Type(paralist);
|
|||
|
}
|
|||
|
return ret + ")";
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.getParameterAt.23632.definition
|
|||
|
public FormalParameter getParameterAt(int i)
|
|||
|
// ino.end
|
|||
|
// ino.method.getParameterAt.23632.body
|
|||
|
{
|
|||
|
if (i >= formalparameter.size() ) return null;
|
|||
|
|
|||
|
return formalparameter.elementAt(i);
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
|
|||
|
// ino.method.sc_get_Formalparalist.23635.definition
|
|||
|
public Vector<FormalParameter> sc_get_Formalparalist()
|
|||
|
// ino.end
|
|||
|
// ino.method.sc_get_Formalparalist.23635.body
|
|||
|
{
|
|||
|
return formalparameter;
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.codegen.23638.definition
|
|||
|
public void codegen(ClassFile classfile, CodeAttribute code)
|
|||
|
// ino.end
|
|||
|
// ino.method.codegen.23638.body
|
|||
|
{
|
|||
|
for(int i = 0; i < formalparameter.size(); i++)
|
|||
|
formalparameter.elementAt(i).codegen(classfile, code);
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.getParameterCount.23641.defdescription type=javadoc
|
|||
|
/**
|
|||
|
* Author: J<EFBFBD>rg B<EFBFBD>uerle<br/>
|
|||
|
* @return Die Anzahl der Parameter
|
|||
|
*/
|
|||
|
// ino.end
|
|||
|
// ino.method.getParameterCount.23641.definition
|
|||
|
public int getParameterCount()
|
|||
|
// ino.end
|
|||
|
// ino.method.getParameterCount.23641.body
|
|||
|
{
|
|||
|
return formalparameter.size();
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
/**
|
|||
|
* @author Andreas Stadelmeier, a10023
|
|||
|
* @return Die Typinformationen der Parameter in der Parameterliste
|
|||
|
*/
|
|||
|
public String getTypeInformation() {
|
|||
|
String ret = "";
|
|||
|
for(FormalParameter param : this.formalparameter){
|
|||
|
ret += param.getTypeInformation();
|
|||
|
}
|
|||
|
return ret;
|
|||
|
}
|
|||
|
|
|||
|
public String toString(){
|
|||
|
if(formalparameter == null)return "[]"; //"Leere Parameterliste";
|
|||
|
//String ret = "ParameterListe, "+formalparameter.size()+" Eintr<74>ge [ ";
|
|||
|
String ret = " [ ";
|
|||
|
for(FormalParameter param : this.formalparameter){
|
|||
|
ret += param.toString()+", ";
|
|||
|
}
|
|||
|
return ret + "]";
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
|||
|
JavaCodeResult ret = new JavaCodeResult();
|
|||
|
Iterator<FormalParameter> it = this.formalparameter.iterator();
|
|||
|
while(it.hasNext()){
|
|||
|
FormalParameter param = it.next();
|
|||
|
ret.attach(param.printJavaCode(resultSet));
|
|||
|
if(it.hasNext())ret.attach(", ");
|
|||
|
}
|
|||
|
//if(this.formalparameter.size()>0)ret = ret.substring(0, ret.length() - 2);
|
|||
|
return ret;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
// ino.end
|