ConstantExpression for true false

This commit is contained in:
2013-06-01 17:57:54 +02:00
parent 712cc419ab
commit 281bad8788

View File

@@ -48,8 +48,14 @@ void CodeGenVisitor::visit(BinOpExpression* e) {
} }
void CodeGenVisitor::visit(ConstantExpression* e) { void CodeGenVisitor::visit(ConstantExpression* e) {
if(e->getValue() == "true") {
value_ = llvm::ConstantInt::get(llvm::getGlobalContext(), llvm::APInt(1, 1, 10));
} else if(e->getValue() == "false") {
value_ = llvm::ConstantInt::get(llvm::getGlobalContext(), llvm::APInt(1, 0, 10));
} else {
value_ = llvm::ConstantInt::get(llvm::getGlobalContext(), llvm::APInt(32, e->getValue(), 10)); value_ = llvm::ConstantInt::get(llvm::getGlobalContext(), llvm::APInt(32, e->getValue(), 10));
} }
}
void CodeGenVisitor::visit(ExpressionStatement* e) { void CodeGenVisitor::visit(ExpressionStatement* e) {
} }