BoolLiteral implementiert

This commit is contained in:
Schubert, Julia (WWI2012D) 2015-06-23 00:23:14 +02:00
parent 93f4257cdc
commit acdc36d23f
2 changed files with 147 additions and 135 deletions

View File

@ -5,6 +5,8 @@ package de.dhbwstuttgart.syntaxtree.statement;
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;
@ -29,11 +31,7 @@ public class BoolLiteral extends Literal
// ino.end
// ino.class.BoolLiteral.25089.body
{
@Override
public void genByteCode(ClassGen _cg) {
// TODO Auto-generated method stub
}
@ -129,6 +127,20 @@ public class BoolLiteral extends Literal
}
@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

View File

@ -1,6 +1,6 @@
class BoolLit{
void method() { b = true; }
void method() { b; b = false; }