forked from JavaTX/JavaCompilerCore
207 lines
6.3 KiB
Java
Executable File
207 lines
6.3 KiB
Java
Executable File
// ino.module.NewArray.8641.package
|
||
package mycompiler.mystatement;
|
||
// ino.end
|
||
// ino.module.NewArray.8641.import
|
||
import java.util.Hashtable;
|
||
import java.util.Vector;
|
||
|
||
import mycompiler.mybytecode.ClassFile;
|
||
import mycompiler.mybytecode.CodeAttribute;
|
||
import mycompiler.mybytecode.JVMCode;
|
||
import mycompiler.myclass.Class;
|
||
import mycompiler.myexception.CTypeReconstructionException;
|
||
import mycompiler.myexception.JVMCodeException;
|
||
import mycompiler.mytype.GenericTypeVar;
|
||
import mycompiler.mytype.Type;
|
||
import mycompiler.mytypereconstruction.CSupportData;
|
||
import mycompiler.mytypereconstruction.set.CSubstitutionSet;
|
||
import mycompiler.mytypereconstruction.set.CTripleSet;
|
||
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
|
||
import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption;
|
||
|
||
import org.apache.log4j.Logger;
|
||
// ino.end
|
||
|
||
|
||
import typinferenz.ConstraintsSet;
|
||
import typinferenz.JavaCodeResult;
|
||
import typinferenz.ResultSet;
|
||
import typinferenz.assumptions.TypeAssumptions;
|
||
|
||
|
||
|
||
|
||
// ino.class.NewArray.25787.declaration
|
||
public class NewArray extends Expr
|
||
// ino.end
|
||
// ino.class.NewArray.25787.body
|
||
{
|
||
// ino.method.NewArray.25791.definition
|
||
public NewArray(int offset,int variableLength)
|
||
// ino.end
|
||
// ino.method.NewArray.25791.body
|
||
{
|
||
super(offset,variableLength);
|
||
}
|
||
// ino.end
|
||
// ino.attribute.type.25794.declaration
|
||
private Type type;
|
||
// ino.end
|
||
// ino.attribute.expr.25797.declaration
|
||
public Vector<Expr> expr = new Vector<Expr>();
|
||
// ino.end
|
||
// ino.attribute.parserlog.25800.declaration
|
||
protected static Logger parserlog = Logger.getLogger("parser");
|
||
// ino.end
|
||
|
||
|
||
// ino.method.getType.25803.defdescription type=javadoc
|
||
/**
|
||
* Author: J<>rg B<>uerle<br/>
|
||
* @return Returns the type.
|
||
*/
|
||
// ino.end
|
||
// ino.method.getType.25803.definition
|
||
public Type getType()
|
||
// ino.end
|
||
// ino.method.getType.25803.body
|
||
{
|
||
return type;
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.setType.25806.defdescription type=javadoc
|
||
/**
|
||
* Author: J<>rg B<>uerle<br/>
|
||
* @param type The type to set.
|
||
*/
|
||
// ino.end
|
||
// ino.method.setType.25806.definition
|
||
public void setType(Type type)
|
||
// ino.end
|
||
// ino.method.setType.25806.body
|
||
{
|
||
this.type = type;
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.get_Name.25809.definition
|
||
public String get_Name()
|
||
// ino.end
|
||
// ino.method.get_Name.25809.body
|
||
{
|
||
return null;
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.sc_check.25812.definition
|
||
public void sc_check(Vector<Class> classname, Hashtable bh, Hashtable<String, String> ch,boolean ext, Hashtable parach, Hashtable<String, Hashtable> parabh)
|
||
// ino.end
|
||
// ino.method.sc_check.25812.body
|
||
{
|
||
if(ext)
|
||
parserlog.debug(" ---NewArray---");
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.get_codegen_Array_Type.25815.definition
|
||
public int get_codegen_Array_Type()
|
||
throws JVMCodeException
|
||
// ino.end
|
||
// ino.method.get_codegen_Array_Type.25815.body
|
||
{
|
||
if(this.getType().equals("boolean")) return 4;
|
||
else if(this.getType().equals("char")) return 5;
|
||
else if(this.getType().equals("float")) return 6;
|
||
else if(this.getType().equals("double")) return 7;
|
||
else if(this.getType().equals("byte")) return 8;
|
||
else if(this.getType().equals("short")) return 9;
|
||
else if(this.getType().equals("int")) return 10;
|
||
else if(this.getType().equals("long")) return 11;
|
||
else throw new JVMCodeException("JVMCodeException: NewArray: int get_codegen_Array_Type()");
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.codegen.25818.definition
|
||
public void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
|
||
throws JVMCodeException
|
||
// ino.end
|
||
// ino.method.codegen.25818.body
|
||
{
|
||
if(JVMCode.get_nType(this.getType().getName()) == 4) {
|
||
for(int i = 0; i < expr.size(); i++) ((Expr)expr.elementAt(i)).codegen(classfile, code, paralist);
|
||
code.add_code(JVMCode.anewarray);
|
||
code.add_code_short(classfile.add_CONSTANT_Class_info(this.getType().getName()));
|
||
}
|
||
else {
|
||
for(int i = 0; i < expr.size(); i++) ((Expr)expr.elementAt(i)).codegen(classfile, code, paralist);
|
||
code.add_code(JVMCode.newarray);
|
||
code.add_code_byte(this.get_codegen_Array_Type());
|
||
}
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.TRExp.25821.defdescription type=javadoc
|
||
/**
|
||
* Implementierung des Algorithmus 5.32 von Martin Pl<50>micke
|
||
* <br>Author: J<>rg B<>uerle
|
||
* @param sigma
|
||
* @param V
|
||
* @param supportData
|
||
* @return
|
||
*/
|
||
// ino.end
|
||
// ino.method.TRExp.25821.definition
|
||
public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
||
// ino.end
|
||
// ino.method.TRExp.25821.body
|
||
{
|
||
throw CTypeReconstructionException.createNotImplementedException();
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.TRStatement.25824.definition
|
||
public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
||
// ino.end
|
||
// ino.method.TRStatement.25824.body
|
||
{
|
||
throw CTypeReconstructionException.createNotImplementedException();
|
||
}
|
||
// ino.end
|
||
// ino.method.wandleRefTypeAttributes2GenericAttributes.25827.definition
|
||
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
|
||
// ino.end
|
||
// ino.method.wandleRefTypeAttributes2GenericAttributes.25827.body
|
||
{
|
||
}
|
||
// ino.end
|
||
|
||
public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable)
|
||
{
|
||
if(this.get_UsedId().get_Name_1Element().equals(NameVariable))
|
||
{
|
||
//wenn Variable mit gleichem Namen gefunden->schreibe Offset
|
||
localAssumption.addOffset(this.get_UsedId().getOffset());
|
||
}
|
||
if(this.expr!=null){
|
||
for(Expr n : this.expr)
|
||
{
|
||
n.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
||
}}
|
||
}
|
||
|
||
@Override
|
||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||
// TODO Auto-generated method stub
|
||
return null;
|
||
}
|
||
|
||
@Override
|
||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||
// TODO Auto-generated method stub
|
||
return null;
|
||
}
|
||
|
||
}
|
||
// ino.end
|