diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/trans/codegen_c.cpp | 4 | ||||
-rw-r--r-- | src/trans/enumerate.cpp | 17 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp index b73b4d37..ef64ebcd 100644 --- a/src/trans/codegen_c.cpp +++ b/src/trans/codegen_c.cpp @@ -77,7 +77,7 @@ namespace { { TRACE_FUNCTION_F(ty); TU_IFLET( ::HIR::TypeRef::Data, ty.m_data, Tuple, te, - // TODO: Pre-define tuple name + m_of << "typedef struct "; emit_ctype(ty); m_of << " "; emit_ctype(ty); m_of << ";\n"; ) else TU_IFLET( ::HIR::TypeRef::Data, ty.m_data, Function, te, // TODO: Pre-define function type name @@ -116,7 +116,7 @@ namespace { TU_IFLET( ::HIR::TypeRef::Data, ty.m_data, Tuple, te, if( te.size() > 0 ) { - m_of << "typedef struct {\n"; + m_of << "typedef struct "; emit_ctype(ty); m_of << " {\n"; for(unsigned int i = 0; i < te.size(); i++) { m_of << "\t"; diff --git a/src/trans/enumerate.cpp b/src/trans/enumerate.cpp index 25513c17..4de920db 100644 --- a/src/trans/enumerate.cpp +++ b/src/trans/enumerate.cpp @@ -268,11 +268,24 @@ namespace { } TRACE_FUNCTION_F(ty << " - " << (mode == Mode::Shallow ? "Shallow" : (mode == Mode::Normal ? "Normal" : "Deep"))); - if( mode != Mode::Shallow ) + if( mode == Mode::Shallow ) + { + TU_MATCH_DEF(::HIR::TypeRef::Data, (ty.m_data), (te), + ( + ), + (Pointer, + visit_type(*te.inner, Mode::Shallow); + ), + (Borrow, + visit_type(*te.inner, Mode::Shallow); + ) + ) + } + else { if( active_set.find(&ty) != active_set.end() ) { // TODO: Handle recursion - DEBUG("- Type recursion with " << ty); + BUG(Span(), "- Type recursion with " << ty); return ; } active_set.insert( &ty ); |