fix duplicate type defined when imported from parseh

master
Andrew Kelley 2016-07-09 15:48:25 -07:00
parent 49a4b1b930
commit f2fc9b8a7b
1 changed files with 5 additions and 0 deletions

View File

@ -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));