diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-05-09 12:34:03 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-05-09 12:34:03 -0700 |
| commit | 745c325d0f498406f229e532753e5d5712e824d4 (patch) | |
| tree | af0bd93ca81361b65c54c9da83a0b7cecc8097bd /src/analyze.cpp | |
| parent | 56908dcb9dd7bbfae7c22b6312752eb576a227c2 (diff) | |
| download | zig-745c325d0f498406f229e532753e5d5712e824d4.tar.gz zig-745c325d0f498406f229e532753e5d5712e824d4.zip | |
support variable declarations in structs
See #22
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 233bc4e7b2..ac26cb3980 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1580,8 +1580,8 @@ static void scan_struct_decl(CodeGen *g, ImportTableEntry *import, BlockContext node->data.struct_decl.type_entry = container_type; // handle the member function definitions independently - for (int i = 0; i < node->data.struct_decl.fns.length; i += 1) { - AstNode *child_node = node->data.struct_decl.fns.at(i); + for (int i = 0; i < node->data.struct_decl.decls.length; i += 1) { + AstNode *child_node = node->data.struct_decl.decls.at(i); get_as_top_level_decl(child_node)->parent_decl = node; BlockContext *child_context = get_container_block_context(container_type); scan_decls(g, import, child_context, child_node); @@ -1669,7 +1669,7 @@ static void resolve_top_level_decl(CodeGen *g, AstNode *node, bool pointer_only) case NodeTypeVariableDeclaration: { AstNodeVariableDeclaration *variable_declaration = &node->data.variable_declaration; - VariableTableEntry *var = analyze_variable_declaration_raw(g, import, import->block_context, + VariableTableEntry *var = analyze_variable_declaration_raw(g, import, node->block_context, node, variable_declaration, false, node, false); g->global_vars.append(var); |
