Fixed, working unions. Had to move the is_union member to the end. I'm not sure if this is a C bug or an effect of me doing something weird somewhere

This commit is contained in:
Nathan Braswell
2016-06-16 23:06:38 -07:00
parent 59f5c6f667
commit 4a33a94b15
4 changed files with 23 additions and 25 deletions

View File

@@ -443,16 +443,15 @@ obj c_generator (Object) {
})
})
type_poset.get_sorted().for_each(fun(vert: *ast_node) {
/*var base_name = vert->type_def.name*/
var base_name = get_name(vert)
plain_typedefs += string("typedef ")
/*if (is_type_def(vert) && vert->type_def.is_union) {*/
/*plain_typedefs += "union "*/
/*structs += "union "*/
/*} else {*/
if (is_type_def(vert) && vert->type_def.is_union) {
plain_typedefs += "union "
structs += "union "
} else {
plain_typedefs += "struct "
structs += "struct "
/*}*/
}
plain_typedefs += base_name + "_dummy " + base_name + ";\n"
structs += base_name + "_dummy {\n"
if (is_type_def(vert)) {