forked from JavaTX/JavaCompilerCore
237 lines
7.3 KiB
Java
237 lines
7.3 KiB
Java
|
// ino.module.InstanceOf.8633.package
|
|||
|
package mycompiler.mystatement;
|
|||
|
// ino.end
|
|||
|
// ino.module.InstanceOf.8633.import
|
|||
|
import java.util.Enumeration;
|
|||
|
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.myexception.SCStatementException;
|
|||
|
import mycompiler.mytype.BooleanType;
|
|||
|
import mycompiler.mytype.GenericTypeVar;
|
|||
|
import mycompiler.mytype.RefType;
|
|||
|
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.TypeAssumptions;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// ino.class.InstanceOf.25352.declaration
|
|||
|
public class InstanceOf extends BinaryExpr
|
|||
|
// ino.end
|
|||
|
// ino.class.InstanceOf.25352.body
|
|||
|
{
|
|||
|
// ino.attribute.expr.25356.declaration
|
|||
|
public Expr expr;
|
|||
|
// ino.end
|
|||
|
// ino.attribute.reftype.25359.declaration
|
|||
|
private RefType reftype;
|
|||
|
// ino.end
|
|||
|
// ino.attribute.parserlog.25362.decldescription type=line
|
|||
|
// private boolean is_instance = false;
|
|||
|
// ino.end
|
|||
|
// ino.attribute.parserlog.25362.declaration
|
|||
|
protected static Logger parserlog = Logger.getLogger("parser");
|
|||
|
// ino.end
|
|||
|
|
|||
|
|
|||
|
// ino.method.InstanceOf.25365.definition
|
|||
|
public InstanceOf(int offset,int variableLength)
|
|||
|
// ino.end
|
|||
|
// ino.method.InstanceOf.25365.body
|
|||
|
{
|
|||
|
super(offset,variableLength);
|
|||
|
// #JB# 20.04.2005
|
|||
|
// ###########################################################
|
|||
|
this.setType(new BooleanType());
|
|||
|
//this.setType(new Type("boolean"));
|
|||
|
// ###########################################################
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.set_Expr.25368.definition
|
|||
|
public void set_Expr(Expr exp)
|
|||
|
// ino.end
|
|||
|
// ino.method.set_Expr.25368.body
|
|||
|
{
|
|||
|
this.expr = exp;
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.set_Type.25371.definition
|
|||
|
public void set_Type(RefType typ)
|
|||
|
// ino.end
|
|||
|
// ino.method.set_Type.25371.body
|
|||
|
{
|
|||
|
this.reftype = typ;
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.sc_check.25374.definition
|
|||
|
public void sc_check(Vector<Class> classname, Hashtable ch, Hashtable<String, String> bh, boolean ext, Hashtable parach, Hashtable<String, Hashtable> parabh)
|
|||
|
throws SCStatementException
|
|||
|
// ino.end
|
|||
|
// ino.method.sc_check.25374.body
|
|||
|
{
|
|||
|
if(ext)
|
|||
|
parserlog.debug(" ---InstanceOf---");
|
|||
|
Class cl;
|
|||
|
String hilf, basis;
|
|||
|
boolean merker=false;
|
|||
|
|
|||
|
if(ext)
|
|||
|
parserlog.debug("InstanceOf ruft sc_check von expr auf");
|
|||
|
try
|
|||
|
{
|
|||
|
expr.sc_check(classname,ch,bh,ext, parach, parabh);
|
|||
|
}
|
|||
|
catch(SCStatementException ex)
|
|||
|
{
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
|
|||
|
if(ext)
|
|||
|
parserlog.debug("InstanceOf pr<70>ft Typgleichheit: ");
|
|||
|
if(expr.getTypeName().equals(reftype.getName()))
|
|||
|
{
|
|||
|
//is_instance = true;
|
|||
|
if(ext)
|
|||
|
parserlog.debug("...erf<72>llt!");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//is_instance = false;
|
|||
|
if(ext)
|
|||
|
parserlog.debug("...nicht erf<72>llt!");
|
|||
|
}
|
|||
|
if(!reftype.getName().equals("int")|| !reftype.getName().equals("char") || !reftype.getName().equals("String") || !reftype.getName().equals("boolean"))
|
|||
|
{
|
|||
|
if(ext)
|
|||
|
parserlog.debug("Pr<EFBFBD>fe auf Basisklassen");
|
|||
|
hilf=expr.getTypeName();
|
|||
|
for(;;)
|
|||
|
{
|
|||
|
if(merker)
|
|||
|
break;
|
|||
|
for(Enumeration<Class> el=classname.elements();el.hasMoreElements();)
|
|||
|
{
|
|||
|
cl=el.nextElement();
|
|||
|
if(cl.getName().equals(hilf))
|
|||
|
{
|
|||
|
basis=cl.get_Superclass_Name();
|
|||
|
if(basis==null)
|
|||
|
{
|
|||
|
if(ext)
|
|||
|
parserlog.debug("Keine Basisklasse gefunden!");
|
|||
|
//is_instance=false;
|
|||
|
merker=true;
|
|||
|
break;
|
|||
|
}
|
|||
|
else
|
|||
|
if(reftype.getName().equals(basis))
|
|||
|
{
|
|||
|
if(ext)
|
|||
|
parserlog.debug("Basisklasse "+basis+" gefunden!Typ korrekt!");
|
|||
|
merker=true;
|
|||
|
break;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(ext)
|
|||
|
parserlog.debug("Gehe in n<>chste Vererbungsebene......");
|
|||
|
hilf=basis;
|
|||
|
merker=false;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.get_Name.25377.definition
|
|||
|
public String get_Name()
|
|||
|
// ino.end
|
|||
|
// ino.method.get_Name.25377.body
|
|||
|
{
|
|||
|
return null;
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.codegen.25380.definition
|
|||
|
public void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
|
|||
|
throws JVMCodeException
|
|||
|
// ino.end
|
|||
|
// ino.method.codegen.25380.body
|
|||
|
{
|
|||
|
expr.codegen(classfile, code, paralist);
|
|||
|
code.add_code(JVMCode.instanceof_);
|
|||
|
code.add_code_short(classfile.add_CONSTANT_Class_info(reftype.getName()));
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.TRExp.25383.definition
|
|||
|
public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
|||
|
// ino.end
|
|||
|
// ino.method.TRExp.25383.body
|
|||
|
{
|
|||
|
throw CTypeReconstructionException.createNotImplementedException();
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.TRStatement.25386.definition
|
|||
|
public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
|||
|
// ino.end
|
|||
|
// ino.method.TRStatement.25386.body
|
|||
|
{
|
|||
|
throw CTypeReconstructionException.createNotImplementedException();
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
// ino.method.wandleRefTypeAttributes2GenericAttributes.25389.definition
|
|||
|
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
|
|||
|
// ino.end
|
|||
|
// ino.method.wandleRefTypeAttributes2GenericAttributes.25389.body
|
|||
|
{
|
|||
|
}
|
|||
|
// ino.end
|
|||
|
|
|||
|
public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable)
|
|||
|
{
|
|||
|
expr.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
|