summaryrefslogtreecommitdiff
path: root/src/trans/codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/trans/codegen.cpp')
-rw-r--r--src/trans/codegen.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/trans/codegen.cpp b/src/trans/codegen.cpp
index 8b4a1b85..3cb49887 100644
--- a/src/trans/codegen.cpp
+++ b/src/trans/codegen.cpp
@@ -23,22 +23,29 @@ void Trans_Codegen(const ::std::string& outfile, const ::HIR::Crate& crate, cons
// - Emit in the order they're needed.
for(const auto& ty : list.m_types)
{
- TU_IFLET( ::HIR::TypeRef::Data, ty.m_data, Path, te,
- TU_MATCHA( (te.binding), (tpb),
- (Unbound, throw ""; ),
- (Opaque, throw ""; ),
- (Struct,
- codegen->emit_struct(sp, te.path.m_data.as_Generic(), *tpb);
- ),
- (Union,
- codegen->emit_union(sp, te.path.m_data.as_Generic(), *tpb);
- ),
- (Enum,
- codegen->emit_enum(sp, te.path.m_data.as_Generic(), *tpb);
+ if( ty.second )
+ {
+ codegen->emit_type_proto(ty.first);
+ }
+ else
+ {
+ TU_IFLET( ::HIR::TypeRef::Data, ty.first.m_data, Path, te,
+ TU_MATCHA( (te.binding), (tpb),
+ (Unbound, throw ""; ),
+ (Opaque, throw ""; ),
+ (Struct,
+ codegen->emit_struct(sp, te.path.m_data.as_Generic(), *tpb);
+ ),
+ (Union,
+ codegen->emit_union(sp, te.path.m_data.as_Generic(), *tpb);
+ ),
+ (Enum,
+ codegen->emit_enum(sp, te.path.m_data.as_Generic(), *tpb);
+ )
)
)
- )
- codegen->emit_type(ty);
+ codegen->emit_type(ty.first);
+ }
}
// 2. Emit function prototypes