Adding struts
This commit is contained in:
19
ccodegen.cpp
19
ccodegen.cpp
@@ -278,9 +278,22 @@ gen_ast(Ast *ast){
|
||||
gen("String %s = LIT(\"%s\");", node->name.str, sym->intern_val.str);
|
||||
}
|
||||
else if(sym->type == type_type){
|
||||
gen("// typedef ");
|
||||
gen_simple_decl(sym->type_val, node->name);
|
||||
gen(";");
|
||||
if(sym->type_val->kind == TYPE_Struct){
|
||||
Ast_Struct *agg = (Ast_Struct *)node->value;
|
||||
gen("struct %s{", node->name.str);
|
||||
global_indent++;
|
||||
For(agg->members){
|
||||
genln("");
|
||||
gen_ast(it[0]);
|
||||
}
|
||||
global_indent--;
|
||||
genln("};");
|
||||
}
|
||||
else{
|
||||
gen("// typedef ");
|
||||
gen_simple_decl(sym->type_val, node->name);
|
||||
gen(";");
|
||||
}
|
||||
}
|
||||
else{
|
||||
parsing_error(node->pos, "C_Codegen: Unhandled type of constant expression");
|
||||
|
||||
Reference in New Issue
Block a user