Commit f2fc9b8a7b

Andrew Kelley <superjoe30@gmail.com>
2016-07-10 00:48:25
fix duplicate type defined when imported from parseh
1 parent 49a4b1b
Changed files (1)
src/analyze.cpp
@@ -1589,6 +1589,11 @@ static void preview_fn_proto(CodeGen *g, ImportTableEntry *import, AstNode *prot
 static void scan_struct_decl(CodeGen *g, ImportTableEntry *import, BlockContext *context, AstNode *node) {
     assert(node->type == NodeTypeStructDecl);
 
+    if (node->data.struct_decl.type_entry) {
+        // already scanned; we can ignore. This can happen from importing from an .h file.
+        return;
+    }
+
     Buf *name = &node->data.struct_decl.name;
     TypeTableEntry *container_type = get_partial_container_type(g, import, context,
             node->data.struct_decl.kind, node, buf_ptr(name));