1 #include "codegen/CodeGen.h"
3 #include "ast/AstNode.h"
9 void CodeGenerator::emitClassDecl(ast::ClassDecl
const* decl) {
11 for(
auto* method : decl->methods())
12 emitFunctionDecl(method);
15 std::vector<tir::Type*> fieldTypes{};
16 for(
auto* field : decl->fields()) {
17 auto ty = emitType(field->type());
18 if(field->modifiers().isStatic()) {
19 gvMap[field] = cu.CreateGlobalVariable(ty, field->name());
21 fieldTypes.push_back(ty);
24 if(!fieldTypes.empty())
25 typeMap[decl] = tir::StructType::get(ctx, fieldTypes);
29 for(
auto* method : decl->methods()) {
30 if(method->modifiers().isStatic()) {