remove ptr field access of arrays

use &array[0] instead
This commit is contained in:
Andrew Kelley
2016-02-07 15:43:19 -07:00
parent 36cf9f0c72
commit 42fe4e3cc8
6 changed files with 34 additions and 60 deletions

View File

@@ -2267,9 +2267,6 @@ static TypeTableEntry *analyze_field_access_expr(CodeGen *g, ImportTableEntry *i
} else if (struct_type->id == TypeTableEntryIdArray) {
if (buf_eql_str(field_name, "len")) {
return g->builtin_types.entry_isize;
} else if (buf_eql_str(field_name, "ptr")) {
// TODO determine whether the pointer should be const
return get_pointer_to_type(g, struct_type->data.array.child_type, false);
} else {
add_node_error(g, node,
buf_sprintf("no member named '%s' in '%s'", buf_ptr(field_name),