From 745c325d0f498406f229e532753e5d5712e824d4 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 9 May 2016 12:34:03 -0700 Subject: support variable declarations in structs See #22 --- src/analyze.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/analyze.cpp') 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); -- cgit v1.2.3