Bla
This commit is contained in:
@@ -59,6 +59,32 @@ void CodeGenVisitor::visit(ForStatement* e) {
|
||||
}
|
||||
|
||||
void CodeGenVisitor::visit(FunctionCallExpression* e) {
|
||||
llvm::Function* cf = module_->getFunction(e->getId());
|
||||
if (!cf) {
|
||||
// TODO error
|
||||
return;
|
||||
}
|
||||
|
||||
auto values = e->getValues()->getValues();
|
||||
if (cf->arg_size() != values.size()) {
|
||||
// TODO error
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<llvm::Value*> args;
|
||||
auto iter = values.begin();
|
||||
auto end = values.end();
|
||||
for (; iter != end; ++iter) {
|
||||
Expression *expr = (*iter);
|
||||
expr->accept(this);
|
||||
if (!value_) {
|
||||
// TODO error
|
||||
}
|
||||
args.push_back(value_);
|
||||
}
|
||||
|
||||
value_ = builder_->CreateCall(cf, args, "calltmp");
|
||||
value_->dump();
|
||||
}
|
||||
|
||||
void CodeGenVisitor::visit(FunctionDefinition* e) {
|
||||
|
||||
@@ -80,7 +80,7 @@ void PrintVisitor::visit(FunctionDefinition* e) {
|
||||
println(ss.str());
|
||||
ss.str("");
|
||||
ss.clear();
|
||||
ss << "Type: " << e->getType()->getName();
|
||||
ss << "Type: " << e->getType();
|
||||
println(ss.str());
|
||||
ParameterList* params = e->getParams();
|
||||
if (params) {
|
||||
|
||||
@@ -1,9 +1 @@
|
||||
#include "AST/Type.h"
|
||||
|
||||
Type::Type(std::string name) : name_(name) {
|
||||
//
|
||||
}
|
||||
|
||||
std::string Type::getName() {
|
||||
return name_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user