forked from JavaTX/JavaCompilerCore
BoolLiteral implementiert
This commit is contained in:
parent
93f4257cdc
commit
acdc36d23f
@ -1,134 +1,146 @@
|
|||||||
// ino.module.BoolLiteral.8626.package
|
// ino.module.BoolLiteral.8626.package
|
||||||
package de.dhbwstuttgart.syntaxtree.statement;
|
package de.dhbwstuttgart.syntaxtree.statement;
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.module.BoolLiteral.8626.import
|
// ino.module.BoolLiteral.8626.import
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
import org.apache.bcel.generic.ClassGen;
|
import org.apache.bcel.generic.ClassGen;
|
||||||
|
import org.apache.bcel.generic.InstructionFactory;
|
||||||
import de.dhbwstuttgart.typeinference.Menge;
|
import org.apache.bcel.generic.InstructionList;
|
||||||
import de.dhbwstuttgart.logger.Logger;
|
|
||||||
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
import de.dhbwstuttgart.typeinference.Menge;
|
||||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
import de.dhbwstuttgart.logger.Logger;
|
||||||
import de.dhbwstuttgart.syntaxtree.Class;
|
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
||||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
import de.dhbwstuttgart.syntaxtree.Class;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
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.declaration
|
||||||
// ino.class.BoolLiteral.25089.body
|
public class BoolLiteral extends Literal
|
||||||
{
|
// ino.end
|
||||||
@Override
|
// ino.class.BoolLiteral.25089.body
|
||||||
public void genByteCode(ClassGen _cg) {
|
{
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// ino.attribute.Bool.25093.declaration
|
||||||
|
private boolean Bool;
|
||||||
// ino.attribute.Bool.25093.declaration
|
// ino.end
|
||||||
private boolean Bool;
|
// ino.attribute.parserlog.25096.declaration
|
||||||
// ino.end
|
protected static Logger parserlog = Logger.getLogger("parser");
|
||||||
// ino.attribute.parserlog.25096.declaration
|
// ino.end
|
||||||
protected static Logger parserlog = Logger.getLogger("parser");
|
|
||||||
// ino.end
|
|
||||||
|
// ino.method.BoolLiteral.25099.definition
|
||||||
|
public BoolLiteral()
|
||||||
// ino.method.BoolLiteral.25099.definition
|
// ino.end
|
||||||
public BoolLiteral()
|
// ino.method.BoolLiteral.25099.body
|
||||||
// ino.end
|
{
|
||||||
// ino.method.BoolLiteral.25099.body
|
super(-1,-1);
|
||||||
{
|
// #JB# 20.04.2005
|
||||||
super(-1,-1);
|
// ###########################################################
|
||||||
// #JB# 20.04.2005
|
this.setType(new RefType("Boolean",this,this.getOffset()));
|
||||||
// ###########################################################
|
//this.setType(new Type("boolean"));
|
||||||
this.setType(new RefType("Boolean",this,this.getOffset()));
|
// ###########################################################
|
||||||
//this.setType(new Type("boolean"));
|
}
|
||||||
// ###########################################################
|
// ino.end
|
||||||
}
|
|
||||||
// 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.method.sc_check.25102.definition
|
// ino.end
|
||||||
public void sc_check(Menge<Class> classname, Hashtable ch, Hashtable<String, String> bh, boolean ext, Hashtable parach,Hashtable<String, Hashtable> parabh)
|
// ino.method.sc_check.25102.body
|
||||||
// ino.end
|
{
|
||||||
// ino.method.sc_check.25102.body
|
if(ext)
|
||||||
{
|
{
|
||||||
if(ext)
|
parserlog.debug(" ---BoolLiteral---");
|
||||||
{
|
}
|
||||||
parserlog.debug(" ---BoolLiteral---");
|
}
|
||||||
}
|
// ino.end
|
||||||
}
|
*/
|
||||||
// ino.end
|
|
||||||
*/
|
|
||||||
|
// ino.method.set_Bool.25105.definition
|
||||||
|
public void set_Bool(boolean b)
|
||||||
// ino.method.set_Bool.25105.definition
|
// ino.end
|
||||||
public void set_Bool(boolean b)
|
// ino.method.set_Bool.25105.body
|
||||||
// ino.end
|
{
|
||||||
// ino.method.set_Bool.25105.body
|
this.Bool = b;
|
||||||
{
|
}
|
||||||
this.Bool = b;
|
// ino.end
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
|
// ino.method.get_Name.25108.definition
|
||||||
|
public String get_Name()
|
||||||
// ino.method.get_Name.25108.definition
|
// ino.end
|
||||||
public String get_Name()
|
// ino.method.get_Name.25108.body
|
||||||
// ino.end
|
{
|
||||||
// ino.method.get_Name.25108.body
|
return null;
|
||||||
{
|
}
|
||||||
return null;
|
// ino.end
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||||
@Override
|
this.type = assumptions.checkType(new RefType("java.lang.Boolean",this,-1), this);
|
||||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
return new ConstraintsSet();
|
||||||
this.type = assumptions.checkType(new RefType("java.lang.Boolean",this,-1), this);
|
}
|
||||||
return new ConstraintsSet();
|
|
||||||
}
|
@Override
|
||||||
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||||
@Override
|
if(Bool)return new JavaCodeResult("true");
|
||||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
return new JavaCodeResult("false");
|
||||||
if(Bool)return new JavaCodeResult("true");
|
}
|
||||||
return new JavaCodeResult("false");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Menge<SyntaxTreeNode> getChildren() {
|
||||||
@Override
|
Menge<SyntaxTreeNode> ret = new Menge<SyntaxTreeNode>();
|
||||||
public Menge<SyntaxTreeNode> getChildren() {
|
return ret;
|
||||||
Menge<SyntaxTreeNode> ret = new Menge<SyntaxTreeNode>();
|
}
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wandleRefTypeAttributes2GenericAttributes(
|
||||||
@Override
|
Menge<Type> paralist,
|
||||||
public void wandleRefTypeAttributes2GenericAttributes(
|
Menge<GenericTypeVar> genericMethodParameters) {
|
||||||
Menge<Type> paralist,
|
// TODO Auto-generated method stub
|
||||||
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();
|
||||||
// ino.end
|
|
||||||
|
if (Bool == true){
|
||||||
|
il.append(_factory.ICONST_1);
|
||||||
|
}else {
|
||||||
|
il.append(_factory.ICONST_0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return il;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// ino.end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class BoolLit{
|
class BoolLit{
|
||||||
|
|
||||||
void method() { b = true; }
|
void method() { b; b = false; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user