forked from JavaTX/JavaCompilerCore
BoolLiteral implementiert
This commit is contained in:
parent
93f4257cdc
commit
acdc36d23f
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
class BoolLit{
|
||||
|
||||
void method() { b = true; }
|
||||
void method() { b; b = false; }
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user