JavaPatternMatching/src/de/dhbwstuttgart/syntaxtree/statement/This.java

160 lines
4.8 KiB
Java
Raw Normal View History

2013-10-18 11:33:46 +00:00
// ino.module.This.8654.package
2014-09-02 08:33:54 +00:00
package de.dhbwstuttgart.syntaxtree.statement;
2013-10-18 11:33:46 +00:00
// ino.end
// ino.module.This.8654.import
import java.util.Hashtable;
import org.apache.commons.bcel6.generic.ClassGen;
import org.apache.commons.bcel6.generic.InstructionFactory;
import org.apache.commons.bcel6.generic.InstructionHandle;
import org.apache.commons.bcel6.generic.InstructionList;
import org.apache.commons.bcel6.generic.MethodGen;
import org.apache.commons.bcel6.generic.ObjectType;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
2014-10-09 10:01:16 +00:00
import de.dhbwstuttgart.logger.Logger;
2014-09-04 14:35:44 +00:00
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
import de.dhbwstuttgart.myexception.JVMCodeException;
import de.dhbwstuttgart.myexception.SCStatementException;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.Constructor;
2014-09-04 14:35:44 +00:00
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
2015-02-26 14:50:23 +00:00
import de.dhbwstuttgart.syntaxtree.type.Void;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
2015-02-26 14:50:23 +00:00
import de.dhbwstuttgart.typeinference.assumptions.ConstructorAssumption;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
2013-10-18 11:33:46 +00:00
// ino.class.This.26261.declaration
public class This extends Expr
// ino.end
// ino.class.This.26261.body
{
// ino.method.This.26265.definition
public This(int offset,int variableLength)
// ino.end
// ino.method.This.26265.body
{
super(offset,variableLength);
}
// ino.end
public This(SyntaxTreeNode parent){
this(0,0);
this.parent = parent;
}
2013-10-18 11:33:46 +00:00
// ino.attribute.arglist.26268.declaration
public ArgumentList arglist;
// ino.end
// ino.attribute.parserlog.26271.declaration
protected static Logger parserlog = Logger.getLogger("parser");
// ino.end
// ino.method.set_ArgumentList.26274.definition
public void set_ArgumentList(ArgumentList al)
// ino.end
// ino.method.set_ArgumentList.26274.body
{
this.arglist = al;
}
// ino.end
public ArgumentList getArgumentList()
{
return this.arglist;
}
// ino.method.set_UsedId.26277.definition
public void set_UsedId(UsedId ui)
// ino.end
// ino.method.set_UsedId.26277.body
{
this.usedid = ui;
}
// ino.end
2014-11-04 12:47:05 +00:00
/*
2013-10-18 11:33:46 +00:00
// ino.method.sc_check.26280.definition
public void sc_check(Menge<Class> classname, Hashtable ch, Hashtable<String, String> bh, boolean ext, Hashtable parach, Hashtable<String, Hashtable> parabh)
2013-10-18 11:33:46 +00:00
throws SCStatementException
// ino.end
// ino.method.sc_check.26280.body
{
if(ext)
parserlog.debug(" ---This---");
}
// ino.end
2014-11-04 12:47:05 +00:00
*/
2013-10-18 11:33:46 +00:00
// ino.method.get_Name.26286.definition
public String get_Name()
// ino.end
// ino.method.get_Name.26286.body
{ return null; }
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.26295.definition
public void wandleRefTypeAttributes2GenericAttributes(Menge<Type> paralist, Menge<GenericTypeVar> genericMethodParameters)
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.26295.body
{
}
// ino.end
@Override
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
ConstraintsSet ret = new ConstraintsSet();
//this.set_Type(new);
//this.setType(assumptions.getThisValue());//Die Assumption für this als TypeVariable setzen.
this.setType(this.getParentClass().getType());
2013-10-18 11:33:46 +00:00
return ret;
}
@Override
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
2015-02-26 14:50:23 +00:00
throw new TypeinferenceException("this ist keine Anweisung", this);
}
public String toString()
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.toString.25738.body
{
//return receiver/*.toString()*/ + " " + usedid.toString();
return type + " (" + "this" +"(" + this.getArgumentList() + "))";
}
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
return new JavaCodeResult("this");
}
2014-02-22 03:58:49 +00:00
@Override
public Menge<SyntaxTreeNode> getChildren() {
Menge<SyntaxTreeNode> ret = new Menge<SyntaxTreeNode>();
2014-02-22 03:58:49 +00:00
return ret;
}
@Override
public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs) {
InstructionList il = new InstructionList();
il.append(InstructionFactory.createLoad( org.apache.commons.bcel6.generic.Type.OBJECT, 0));
2015-08-27 14:36:19 +00:00
return il;
}
2014-03-17 16:55:55 +00:00
2013-10-18 11:33:46 +00:00
}