160 lines
4.6 KiB
Java
Executable File
160 lines
4.6 KiB
Java
Executable File
// ino.module.IntLiteral.8635.package
|
|
package de.dhbwstuttgart.syntaxtree.statement;
|
|
// ino.end
|
|
// ino.module.IntLiteral.8635.import
|
|
import java.util.Hashtable;
|
|
|
|
import org.apache.commons.bcel6.generic.BIPUSH;
|
|
import org.apache.commons.bcel6.generic.ClassGen;
|
|
import org.apache.commons.bcel6.generic.ConstantPoolGen;
|
|
import org.apache.commons.bcel6.generic.InstructionFactory;
|
|
import org.apache.commons.bcel6.generic.InstructionList;
|
|
import org.apache.commons.bcel6.generic.LDC;
|
|
import org.apache.commons.bcel6.generic.LDC2_W;
|
|
|
|
import de.dhbwstuttgart.typeinference.Menge;
|
|
import de.dhbwstuttgart.logger.Logger;
|
|
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
|
import de.dhbwstuttgart.myexception.JVMCodeException;
|
|
import de.dhbwstuttgart.syntaxtree.Class;
|
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
|
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
|
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
|
|
|
|
|
|
|
|
|
// ino.class.IntLiteral.25447.declaration
|
|
public class DoubleLiteral extends Literal
|
|
// ino.end
|
|
// ino.class.IntLiteral.25447.body
|
|
{
|
|
// ino.attribute.Int.25451.declaration
|
|
private double Double;
|
|
// ino.end
|
|
// ino.attribute.parserlog.25454.declaration
|
|
protected static Logger parserlog = Logger.getLogger("parser");
|
|
// ino.end
|
|
|
|
|
|
// ino.method.IntLiteral.25457.definition
|
|
public DoubleLiteral()
|
|
// ino.end
|
|
// ino.method.IntLiteral.25457.body
|
|
{
|
|
super(-1,-1);
|
|
|
|
this.setType(new RefType("Double",this,this.getOffset()));
|
|
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.set_Int.25460.definition
|
|
public void set_Double(double i)
|
|
// ino.end
|
|
// ino.method.set_Int.25460.body
|
|
{
|
|
this.Double = i;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.get_Int.25463.definition
|
|
public double get_Double()
|
|
// ino.end
|
|
// ino.method.get_Int.25463.body
|
|
{
|
|
return Double;
|
|
}
|
|
// ino.end
|
|
|
|
/*
|
|
// ino.method.sc_check.25466.definition
|
|
public void sc_check(Menge<Class> classname, Hashtable ch, Hashtable<String, String> bh, boolean ext, Hashtable parach, Hashtable<String, Hashtable> parabh)
|
|
// ino.end
|
|
// ino.method.sc_check.25466.body
|
|
{
|
|
parserlog.debug("SC -> Semantik-Check f�r DoubleLiteral wurde aufgerufen --> nichts zu tun!");
|
|
}
|
|
// ino.end
|
|
*/
|
|
|
|
// ino.method.get_Name.25469.definition
|
|
public String get_Name()
|
|
// ino.end
|
|
// ino.method.get_Name.25469.body
|
|
{
|
|
return null;
|
|
}
|
|
// ino.end
|
|
|
|
|
|
// ino.method.toString.25484.defdescription type=javadoc
|
|
/**
|
|
* <br/>Author: Martin Pl�micke
|
|
* @return
|
|
*/
|
|
// ino.end
|
|
// ino.method.toString.25484.definition
|
|
public String toString()
|
|
// ino.end
|
|
// ino.method.toString.25484.body
|
|
{
|
|
return type.toString() + " " + Double;
|
|
}
|
|
// ino.end
|
|
// ino.method.wandleRefTypeAttributes2GenericAttributes.25487.definition
|
|
public void wandleRefTypeAttributes2GenericAttributes(Menge<Type> paralist, Menge<GenericTypeVar> genericMethodParameters)
|
|
// ino.end
|
|
// ino.method.wandleRefTypeAttributes2GenericAttributes.25487.body
|
|
{
|
|
}
|
|
// ino.end
|
|
|
|
@Override
|
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
|
this.setType(assumptions.checkType(new RefType("Double",this,this.getOffset()), this));
|
|
return new ConstraintsSet();
|
|
}
|
|
|
|
@Override
|
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
|
JavaCodeResult ret = new JavaCodeResult();
|
|
ret.attach(""+this.Double);
|
|
return ret;
|
|
}
|
|
@Override
|
|
public Menge<SyntaxTreeNode> getChildren() {
|
|
Menge<SyntaxTreeNode> ret = new Menge<SyntaxTreeNode>();
|
|
return ret;
|
|
}
|
|
|
|
//alter Double-Versuch vermutlich inkorrekt
|
|
/*@Override
|
|
public InstructionList genByteCode(ClassGen cg) {
|
|
InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool());
|
|
InstructionList il = new InstructionList();
|
|
il.append(new BIPUSH(new Double(get_Double()).byteValue()));
|
|
return il;
|
|
}*/
|
|
|
|
@Override
|
|
public InstructionList genByteCode(ClassGen cg) {
|
|
ConstantPoolGen cp = cg.getConstantPool();
|
|
//InstructionFactory _factory = new InstructionFactory(cg, cp);
|
|
InstructionList il = new InstructionList();
|
|
|
|
cp.addDouble(get_Double());
|
|
il.append(new LDC2_W(cp.getSize()-1));
|
|
return il;
|
|
|
|
}
|
|
|
|
}
|
|
// ino.end
|