aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-05-09 12:34:03 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-05-09 12:34:03 -0700
commit745c325d0f498406f229e532753e5d5712e824d4 (patch)
treeaf0bd93ca81361b65c54c9da83a0b7cecc8097bd /src/analyze.cpp
parent56908dcb9dd7bbfae7c22b6312752eb576a227c2 (diff)
downloadzig-745c325d0f498406f229e532753e5d5712e824d4.tar.gz
zig-745c325d0f498406f229e532753e5d5712e824d4.zip
support variable declarations in structs
See #22
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp6
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);