forked from JavaTX/JavaCompilerCore
147 lines
3.8 KiB
Java
Executable File
147 lines
3.8 KiB
Java
Executable File
// ino.module.BoolLiteral.8626.package
|
|
package de.dhbwstuttgart.syntaxtree.statement;
|
|
// ino.end
|
|
// ino.module.BoolLiteral.8626.import
|
|
import java.util.Hashtable;
|
|
|
|
import org.apache.bcel.generic.ClassGen;
|
|
import org.apache.bcel.generic.InstructionFactory;
|
|
import org.apache.bcel.generic.InstructionList;
|
|
|
|
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.BoolLiteral.25089.declaration
|
|
public class BoolLiteral extends Literal
|
|
// ino.end
|
|
// ino.class.BoolLiteral.25089.body
|
|
{
|
|
|
|
|
|
|
|
|
|
// ino.attribute.Bool.25093.declaration
|
|
private boolean Bool;
|
|
// ino.end
|
|
// ino.attribute.parserlog.25096.declaration
|
|
protected static Logger parserlog = Logger.getLogger("parser");
|
|
// ino.end
|
|
|
|
|
|
// ino.method.BoolLiteral.25099.definition
|
|
public BoolLiteral()
|
|
// ino.end
|
|
// ino.method.BoolLiteral.25099.body
|
|
{
|
|
super(-1,-1);
|
|
// #JB# 20.04.2005
|
|
// ###########################################################
|
|
this.setType(new RefType("Boolean",this,this.getOffset()));
|
|
//this.setType(new Type("boolean"));
|
|
// ###########################################################
|
|
}
|
|
// ino.end
|
|
|
|
|
|
/*
|
|
// ino.method.sc_check.25102.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.25102.body
|
|
{
|
|
if(ext)
|
|
{
|
|
parserlog.debug(" ---BoolLiteral---");
|
|
}
|
|
}
|
|
// ino.end
|
|
*/
|
|
|
|
|
|
// ino.method.set_Bool.25105.definition
|
|
public void set_Bool(boolean b)
|
|
// ino.end
|
|
// ino.method.set_Bool.25105.body
|
|
{
|
|
this.Bool = b;
|
|
}
|
|
// ino.end
|
|
|
|
|
|
|
|
// ino.method.get_Name.25108.definition
|
|
public String get_Name()
|
|
// ino.end
|
|
// ino.method.get_Name.25108.body
|
|
{
|
|
return null;
|
|
}
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
|
this.type = assumptions.checkType(new RefType("java.lang.Boolean",this,-1), this);
|
|
return new ConstraintsSet();
|
|
}
|
|
|
|
@Override
|
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
|
if(Bool)return new JavaCodeResult("true");
|
|
return new JavaCodeResult("false");
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
public Menge<SyntaxTreeNode> getChildren() {
|
|
Menge<SyntaxTreeNode> ret = new Menge<SyntaxTreeNode>();
|
|
return ret;
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
public void wandleRefTypeAttributes2GenericAttributes(
|
|
Menge<Type> paralist,
|
|
Menge<GenericTypeVar> genericMethodParameters) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public InstructionList genByteCode(ClassGen cg) {
|
|
InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool());
|
|
InstructionList il = new InstructionList();
|
|
|
|
if (Bool == true){
|
|
il.append(_factory.ICONST_1);
|
|
}else {
|
|
il.append(_factory.ICONST_0);
|
|
}
|
|
|
|
|
|
return il;
|
|
}
|
|
|
|
}
|
|
// ino.end
|