| ... | @@ -537,6 +537,10 @@ static void visit_enum_decl(Context *c, const EnumDecl *enum_decl) { | ... | @@ -537,6 +537,10 @@ static void visit_enum_decl(Context *c, const EnumDecl *enum_decl) { |
| 537 | return; | 537 | return; |
| 538 | } | 538 | } |
| 539 | | 539 | |
| | 540 | // eagerly put the name in the table, but we need to remember to remove it if it fails |
| | 541 | // boy it would be nice to have defer here wouldn't it |
| | 542 | c->enum_type_table.put(bare_name, true); |
| | 543 | |
| 540 | const EnumDecl *enum_def = enum_decl->getDefinition(); | 544 | const EnumDecl *enum_def = enum_decl->getDefinition(); |
| 541 | | 545 | |
| 542 | if (!enum_def) { | 546 | if (!enum_def) { |
| ... | @@ -553,10 +557,6 @@ static void visit_enum_decl(Context *c, const EnumDecl *enum_decl) { | ... | @@ -553,10 +557,6 @@ static void visit_enum_decl(Context *c, const EnumDecl *enum_decl) { |
| 553 | node->data.struct_decl.visib_mod = VisibModExport; | 557 | node->data.struct_decl.visib_mod = VisibModExport; |
| 554 | node->data.struct_decl.directives = create_empty_directives(c); | 558 | node->data.struct_decl.directives = create_empty_directives(c); |
| 555 | | 559 | |
| 556 | // eagerly put the name in the table, but we need to remember to remove it if it fails | | |
| 557 | // boy it would be nice to have defer here wouldn't it | | |
| 558 | c->enum_type_table.put(bare_name, true); | | |
| 559 | | | |
| 560 | | 560 | |
| 561 | ZigList<AstNode *> var_decls = {0}; | 561 | ZigList<AstNode *> var_decls = {0}; |
| 562 | int i = 0; | 562 | int i = 0; |
| ... | @@ -624,6 +624,11 @@ static void visit_record_decl(Context *c, const RecordDecl *record_decl) { | ... | @@ -624,6 +624,11 @@ static void visit_record_decl(Context *c, const RecordDecl *record_decl) { |
| 624 | return; | 624 | return; |
| 625 | } | 625 | } |
| 626 | | 626 | |
| | 627 | // eagerly put the name in the table, but we need to remember to remove it if it fails |
| | 628 | // boy it would be nice to have defer here wouldn't it |
| | 629 | c->struct_type_table.put(bare_name, true); |
| | 630 | |
| | 631 | |
| 627 | RecordDecl *record_def = record_decl->getDefinition(); | 632 | RecordDecl *record_def = record_decl->getDefinition(); |
| 628 | if (!record_def) { | 633 | if (!record_def) { |
| 629 | // this is a type that we can point to but that's it, such as `struct Foo;`. | 634 | // this is a type that we can point to but that's it, such as `struct Foo;`. |
| ... | @@ -639,10 +644,6 @@ static void visit_record_decl(Context *c, const RecordDecl *record_decl) { | ... | @@ -639,10 +644,6 @@ static void visit_record_decl(Context *c, const RecordDecl *record_decl) { |
| 639 | node->data.struct_decl.visib_mod = VisibModExport; | 644 | node->data.struct_decl.visib_mod = VisibModExport; |
| 640 | node->data.struct_decl.directives = create_empty_directives(c); | 645 | node->data.struct_decl.directives = create_empty_directives(c); |
| 641 | | 646 | |
| 642 | // eagerly put the name in the table, but we need to remember to remove it if it fails | | |
| 643 | // boy it would be nice to have defer here wouldn't it | | |
| 644 | c->struct_type_table.put(bare_name, true); | | |
| 645 | | | |
| 646 | for (auto it = record_def->field_begin(), | 647 | for (auto it = record_def->field_begin(), |
| 647 | it_end = record_def->field_end(); | 648 | it_end = record_def->field_end(); |
| 648 | it != it_end; ++it) | 649 | it != it_end; ++it) |