From c438618c536bb36e9b7c76008845016ed552b65f Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Sun, 2 Jun 2013 00:08:43 +0200 Subject: [PATCH] More error handling again --- src/AST/CodeGenVisitor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/AST/CodeGenVisitor.cpp b/src/AST/CodeGenVisitor.cpp index a3eabaf..95a8a9d 100644 --- a/src/AST/CodeGenVisitor.cpp +++ b/src/AST/CodeGenVisitor.cpp @@ -125,13 +125,13 @@ void CodeGenVisitor::visit(ForStatement* e) void CodeGenVisitor::visit(FunctionCallExpression* e) { llvm::Function* cf = module_->getFunction(e->getId()); if (!cf) { - // TODO error + throw "function to call not found"; return; } auto values = e->getValues()->getValues(); if (cf->arg_size() != values.size()) { - // TODO error + throw "argument size mismatch"; return; } @@ -142,7 +142,7 @@ void CodeGenVisitor::visit(FunctionCallExpression* e) { Expression *expr = (*iter); expr->accept(this); if (!value_) { - // TODO error + throw "error evaluating expression"; } args.push_back(value_); } @@ -234,7 +234,7 @@ void CodeGenVisitor::visit(IfStatement* e) { f->getBasicBlockList().push_back(elseBB); builder_->SetInsertPoint(elseBB); - // we cna add an else part here later ... + // we can add an else part here later ... builder_->CreateBr(mergeBB); @@ -319,7 +319,6 @@ void CodeGenVisitor::visit(RandomIfStatement* e) { void CodeGenVisitor::visit(ReturnStatement* e) { e->getExpr()->accept(this); - if (!value_) { throw "error evaluating expression"; }