aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-07-09 15:48:25 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-07-09 15:48:25 -0700
commitf2fc9b8a7b50cba4b8b2698a06cfbe7ba8018f4f (patch)
tree8634f376b9bb418cc6f791c33dc49b43f353b827 /src
parent49a4b1b9309de06f7a359836788dfff447003f1b (diff)
downloadzig-f2fc9b8a7b50cba4b8b2698a06cfbe7ba8018f4f.tar.gz
zig-f2fc9b8a7b50cba4b8b2698a06cfbe7ba8018f4f.zip
fix duplicate type defined when imported from parseh
Diffstat (limited to 'src')
-rw-r--r--src/analyze.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 8e3ce507f8..209ee068e6 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));