codegen: fix field access of arrays

also fix error type analyze error
This commit is contained in:
Andrew Kelley
2016-01-23 00:53:43 -07:00
parent a922d5d42a
commit 91d911007b
4 changed files with 11 additions and 4 deletions

View File

@@ -27,6 +27,7 @@ CodeGen *codegen_create(Buf *root_source_dir) {
g->build_type = CodeGenBuildTypeDebug;
g->root_source_dir = root_source_dir;
g->next_error_index = 1;
g->error_value_count = 1;
return g;
}
@@ -684,7 +685,7 @@ static LLVMValueRef gen_field_access_expr(CodeGen *g, AstNode *node, bool is_lva
{
TypeTableEntry *type_entry;
LLVMValueRef ptr = gen_field_ptr(g, node, &type_entry);
if (is_lvalue) {
if (is_lvalue || handle_is_ptr(type_entry)) {
return ptr;
} else {
add_debug_source_node(g, node);