From f2fc9b8a7b50cba4b8b2698a06cfbe7ba8018f4f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 9 Jul 2016 15:48:25 -0700 Subject: [PATCH] fix duplicate type defined when imported from parseh --- src/analyze.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/analyze.cpp b/src/analyze.cpp index 8e3ce507f..209ee068e 100644 --- a/src/analyze.cpp +++ b/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));