2013-10-18 11:33:46 +00:00
|
|
|
// ino.module.CharLiteral.8628.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.CharLiteral.8628.import
|
|
|
|
import java.util.Hashtable;
|
|
|
|
import java.util.Vector;
|
2014-10-09 10:01:16 +00:00
|
|
|
import de.dhbwstuttgart.logger.Logger;
|
2014-09-04 14:35:44 +00:00
|
|
|
import de.dhbwstuttgart.bytecode.ClassFile;
|
|
|
|
import de.dhbwstuttgart.bytecode.CodeAttribute;
|
|
|
|
import de.dhbwstuttgart.bytecode.JVMCode;
|
|
|
|
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
|
|
|
import de.dhbwstuttgart.myexception.JVMCodeException;
|
2014-09-02 08:33:54 +00:00
|
|
|
import de.dhbwstuttgart.syntaxtree.Class;
|
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.type.CharacterType;
|
|
|
|
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;
|
2014-09-05 09:49:31 +00:00
|
|
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
2013-10-18 11:33:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ino.class.CharLiteral.25166.declaration
|
|
|
|
public class CharLiteral extends Literal
|
|
|
|
// ino.end
|
|
|
|
// ino.class.CharLiteral.25166.body
|
|
|
|
{
|
|
|
|
// ino.attribute.Char.25170.declaration
|
|
|
|
private char Char;
|
|
|
|
// ino.end
|
|
|
|
// ino.attribute.parserlog.25173.declaration
|
|
|
|
protected static Logger parserlog = Logger.getLogger("parser");
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
|
|
// ino.method.CharLiteral.25176.definition
|
|
|
|
public CharLiteral()
|
|
|
|
// ino.end
|
|
|
|
// ino.method.CharLiteral.25176.body
|
|
|
|
{
|
|
|
|
super(-1,-1);
|
|
|
|
// #JB# 20.04.2005
|
|
|
|
// ###########################################################
|
2014-09-14 16:38:43 +00:00
|
|
|
this.setType(new CharacterType(this));
|
2013-10-18 11:33:46 +00:00
|
|
|
//this.setType(new Type("char"));
|
|
|
|
// ###########################################################
|
|
|
|
}
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ino.method.sc_check.25179.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.25179.body
|
|
|
|
{
|
|
|
|
if(ext)
|
|
|
|
parserlog.debug(" ---CharLiteral---");
|
|
|
|
}
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
// ino.method.set_Char.25182.definition
|
|
|
|
public void set_Char( char c)
|
|
|
|
// ino.end
|
|
|
|
// ino.method.set_Char.25182.body
|
|
|
|
{
|
|
|
|
this.Char = c ;
|
|
|
|
}
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ino.method.get_Name.25185.definition
|
|
|
|
public String get_Name()
|
|
|
|
// ino.end
|
|
|
|
// ino.method.get_Name.25185.body
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ino.method.codegen.25188.definition
|
|
|
|
public void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
|
|
|
|
throws JVMCodeException
|
|
|
|
// ino.end
|
|
|
|
// ino.method.codegen.25188.body
|
|
|
|
{
|
|
|
|
// Wert des chars auf den Stack laden
|
|
|
|
code.add_code(JVMCode.bipush);
|
|
|
|
code.add_code_byte((byte)Char);
|
|
|
|
|
|
|
|
// Auto-Boxing des Typs in Character
|
|
|
|
code.add_code(JVMCode.invokestatic);
|
|
|
|
code.add_code_short(classfile.add_method_ref("java/lang/Character", "valueOf", "(C)Ljava/lang/Character;"));
|
|
|
|
}
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
// ino.method.ConstantCodegen.25191.definition
|
|
|
|
public short ConstantCodegen(ClassFile classfile)
|
|
|
|
throws JVMCodeException
|
|
|
|
// ino.end
|
|
|
|
// ino.method.ConstantCodegen.25191.body
|
|
|
|
{
|
|
|
|
return (short) classfile.add_CONSTANT_Integer_info(Char);
|
|
|
|
}
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
|
|
|
return new JavaCodeResult("'"+String.valueOf(this.Char)+"'");
|
|
|
|
}
|
2014-02-22 03:58:49 +00:00
|
|
|
@Override
|
|
|
|
public Vector<SyntaxTreeNode> getChildren() {
|
|
|
|
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
|
|
|
|
return ret;
|
|
|
|
}
|
2014-09-05 09:49:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void wandleRefTypeAttributes2GenericAttributes(
|
|
|
|
Vector<Type> paralist,
|
|
|
|
Vector<GenericTypeVar> genericMethodParameters) {
|
|
|
|
}
|
2013-10-18 11:33:46 +00:00
|
|
|
}
|
|
|
|
// ino.end
|