aboutsummaryrefslogtreecommitdiff
path: root/src/parseh.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-28 21:53:46 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-28 21:53:46 -0700
commit53c14da2206c74783acb792eab6085cc7d06f068 (patch)
treea555c2ec6bb6e2e05d8a71f3a69765753ac919a6 /src/parseh.cpp
parentc3516b80044732e18eedcd8cd49c424fec497bb3 (diff)
downloadzig-53c14da2206c74783acb792eab6085cc7d06f068.tar.gz
zig-53c14da2206c74783acb792eab6085cc7d06f068.zip
parseh understands bodyless struct used in fn
Diffstat (limited to 'src/parseh.cpp')
-rw-r--r--src/parseh.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/parseh.cpp b/src/parseh.cpp
index 8efef636a5..5a829edc4b 100644
--- a/src/parseh.cpp
+++ b/src/parseh.cpp
@@ -537,6 +537,10 @@ static void visit_enum_decl(Context *c, const EnumDecl *enum_decl) {
return;
}
+ // eagerly put the name in the table, but we need to remember to remove it if it fails
+ // boy it would be nice to have defer here wouldn't it
+ c->enum_type_table.put(bare_name, true);
+
const EnumDecl *enum_def = enum_decl->getDefinition();
if (!enum_def) {
@@ -553,10 +557,6 @@ static void visit_enum_decl(Context *c, const EnumDecl *enum_decl) {
node->data.struct_decl.visib_mod = VisibModExport;
node->data.struct_decl.directives = create_empty_directives(c);
- // eagerly put the name in the table, but we need to remember to remove it if it fails
- // boy it would be nice to have defer here wouldn't it
- c->enum_type_table.put(bare_name, true);
-
ZigList<AstNode *> var_decls = {0};
int i = 0;
@@ -624,6 +624,11 @@ static void visit_record_decl(Context *c, const RecordDecl *record_decl) {
return;
}
+ // eagerly put the name in the table, but we need to remember to remove it if it fails
+ // boy it would be nice to have defer here wouldn't it
+ c->struct_type_table.put(bare_name, true);
+
+
RecordDecl *record_def = record_decl->getDefinition();
if (!record_def) {
// 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) {
node->data.struct_decl.visib_mod = VisibModExport;
node->data.struct_decl.directives = create_empty_directives(c);
- // eagerly put the name in the table, but we need to remember to remove it if it fails
- // boy it would be nice to have defer here wouldn't it
- c->struct_type_table.put(bare_name, true);
-
for (auto it = record_def->field_begin(),
it_end = record_def->field_end();
it != it_end; ++it)