forked from JavaTX/JavaCompilerCore
213 lines
6.6 KiB
Java
Executable File
213 lines
6.6 KiB
Java
Executable File
// ino.module.IntLiteral.8635.package
|
||
package mycompiler.mystatement;
|
||
// ino.end
|
||
// ino.module.IntLiteral.8635.import
|
||
import java.util.Hashtable;
|
||
import java.util.Vector;
|
||
|
||
import mycompiler.mybytecode.ClassFile;
|
||
import mycompiler.mybytecode.CodeAttribute;
|
||
import mycompiler.myclass.Class;
|
||
import mycompiler.myexception.CTypeReconstructionException;
|
||
import mycompiler.myexception.JVMCodeException;
|
||
import mycompiler.mytype.FloatType;
|
||
import mycompiler.mytype.GenericTypeVar;
|
||
import mycompiler.mytype.RefType;
|
||
import mycompiler.mytype.Type;
|
||
import mycompiler.mytypereconstruction.CSupportData;
|
||
import mycompiler.mytypereconstruction.CTriple;
|
||
import mycompiler.mytypereconstruction.set.CSubstitutionSet;
|
||
import mycompiler.mytypereconstruction.set.CTripleSet;
|
||
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
|
||
|
||
import org.apache.log4j.Logger;
|
||
|
||
import typinferenz.ConstraintsSet;
|
||
import typinferenz.JavaCodeResult;
|
||
import typinferenz.ResultSet;
|
||
import typinferenz.assumptions.TypeAssumptions;
|
||
|
||
|
||
|
||
|
||
// ino.class.IntLiteral.25447.declaration
|
||
public class FloatLiteral extends Literal
|
||
// ino.end
|
||
// ino.class.IntLiteral.25447.body
|
||
{
|
||
// ino.attribute.Int.25451.declaration
|
||
private float Float;
|
||
// ino.end
|
||
// ino.attribute.parserlog.25454.declaration
|
||
protected static Logger parserlog = Logger.getLogger("parser");
|
||
// ino.end
|
||
|
||
|
||
// ino.method.IntLiteral.25457.definition
|
||
public FloatLiteral()
|
||
// ino.end
|
||
// ino.method.IntLiteral.25457.body
|
||
{
|
||
super(-1,-1);
|
||
|
||
this.setType(new FloatType());
|
||
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.set_Int.25460.definition
|
||
public void set_Float(float i)
|
||
// ino.end
|
||
// ino.method.set_Int.25460.body
|
||
{
|
||
this.Float = i;
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.get_Int.25463.definition
|
||
public float get_Float()
|
||
// ino.end
|
||
// ino.method.get_Int.25463.body
|
||
{
|
||
return Float;
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.sc_check.25466.definition
|
||
public void sc_check(Vector<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 FloatLiteral 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.codegen.25472.definition
|
||
public void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
|
||
throws JVMCodeException
|
||
// ino.end
|
||
// ino.method.codegen.25472.body
|
||
{
|
||
/*if (Int >= 0 && Int <= 5) // Kleine Werte lassen sich direkt realisieren
|
||
code.add_code(JVMCode.nconst_n("int", Int));
|
||
else if (Int >= -128 && Int <= 127) { // Aenderung des Codes fuer etwas groessere Werte
|
||
code.add_code(JVMCode.bipush);
|
||
code.add_code_byte((byte) Int);
|
||
} else if (Int >= -32768 && Int <= 32767) { // Aenderung des Codes fuer groessere Werte
|
||
code.add_code(JVMCode.sipush);
|
||
code.add_code_short((short) Int);
|
||
} else { // Ablage als Konstante
|
||
int index = classfile.add_CONSTANT_Integer_info(Int);
|
||
if (index < 256) {
|
||
code.add_code(JVMCode.ldc);
|
||
code.add_code_byte((byte) index);
|
||
} else {
|
||
code.add_code(JVMCode.ldc_w);
|
||
code.add_code_short((short) index);
|
||
}
|
||
}
|
||
|
||
// Auto-Boxing: Da int nicht so nicht weiterverwendet werden kann,
|
||
// in Integer umwandeln.
|
||
if (!getPrimitiveFlag()) {
|
||
code.add_code(JVMCode.invokestatic);
|
||
code.add_code_short(classfile.add_method_ref("java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;"));
|
||
}*/
|
||
throw new JVMCodeException("Bytecode nicht implementiert");
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.ConstantCodegen.25475.definition
|
||
public short ConstantCodegen(ClassFile classfile)
|
||
throws JVMCodeException
|
||
// ino.end
|
||
// ino.method.ConstantCodegen.25475.body
|
||
{
|
||
//return (short) classfile.add_CONSTANT_Integer_info(get_Int());
|
||
throw new JVMCodeException("Bytecode nicht implementiert");
|
||
}
|
||
// ino.end
|
||
|
||
|
||
// ino.method.TRStatement.25478.definition
|
||
public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
||
// ino.end
|
||
// ino.method.TRStatement.25478.body
|
||
{
|
||
throw CTypeReconstructionException.createNotImplementedException();
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.TRExp.25481.defdescription type=javadoc
|
||
/**
|
||
* Workaround: <20>berschreibt Methode TRExp aus der Super-Klasse
|
||
* <code>Literal</code>, weil die Implementierung von Unify (noch) nicht mit
|
||
* Basetypes umgehen kann.<br/>
|
||
* Anstatt den Basetype <code>IntegerType</code> zur<75>ckzugeben, wird ein
|
||
* <code>RefType</code> zur<75>ckgegeben.<br/>
|
||
* Diese Methode kann sp<73>ter entfernt werden, sodass automatisch die Methode der
|
||
* Super-Klasse verwendet wird.
|
||
* <br>Author: J<>rg B<>uerle
|
||
* @param sigma
|
||
* @param V
|
||
* @param supportData
|
||
* @return
|
||
*/
|
||
// ino.end
|
||
// ino.method.TRExp.25481.definition
|
||
public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
||
// ino.end
|
||
// ino.method.TRExp.25481.body
|
||
{
|
||
CTripleSet tripleSet = new CTripleSet();
|
||
tripleSet.addElement(new CTriple(sigma, new RefType("java.lang.Float",getOffset()),V));
|
||
return tripleSet;
|
||
}
|
||
// ino.end
|
||
|
||
// ino.method.toString.25484.defdescription type=javadoc
|
||
/**
|
||
* <br/>Author: Martin Pl<50>micke
|
||
* @return
|
||
*/
|
||
// ino.end
|
||
// ino.method.toString.25484.definition
|
||
public String toString()
|
||
// ino.end
|
||
// ino.method.toString.25484.body
|
||
{
|
||
return type.toString() + " " + Float;
|
||
}
|
||
// ino.end
|
||
// ino.method.wandleRefTypeAttributes2GenericAttributes.25487.definition
|
||
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
|
||
// ino.end
|
||
// ino.method.wandleRefTypeAttributes2GenericAttributes.25487.body
|
||
{
|
||
}
|
||
// ino.end
|
||
|
||
@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
|