mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
codegen: fix member function invocation
This commit is contained in:
parent
66eee5a06b
commit
9c775d2111
@ -9,8 +9,8 @@ const ARRAY_SIZE : u16 = 624;
|
||||
struct Rand {
|
||||
// TODO use ARRAY_SIZE here
|
||||
array: [624]u32,
|
||||
// TODO use ARRAY_SIZE here
|
||||
index: #typeof(624),
|
||||
// TODO use #typeof(ARRAY_SIZE) here
|
||||
index: u16,
|
||||
|
||||
/// Get 32 bits of randomness.
|
||||
pub fn get_u32(r: &Rand) -> u32 {
|
||||
|
||||
@ -150,7 +150,14 @@ static LLVMValueRef gen_fn_call_expr(CodeGen *g, AstNode *node) {
|
||||
Buf *name = &fn_ref_expr->data.field_access_expr.field_name;
|
||||
first_param_expr = fn_ref_expr->data.field_access_expr.struct_expr;
|
||||
struct_type = get_expr_type(first_param_expr);
|
||||
fn_table_entry = struct_type->data.structure.fn_table.get(name);
|
||||
if (struct_type->id == TypeTableEntryIdStruct) {
|
||||
fn_table_entry = struct_type->data.structure.fn_table.get(name);
|
||||
} else if (struct_type->id == TypeTableEntryIdPointer) {
|
||||
assert(struct_type->data.pointer.child_type->id == TypeTableEntryIdStruct);
|
||||
fn_table_entry = struct_type->data.pointer.child_type->data.structure.fn_table.get(name);
|
||||
} else {
|
||||
zig_unreachable();
|
||||
}
|
||||
} else if (fn_ref_expr->type == NodeTypeSymbol) {
|
||||
Buf *name = hack_get_fn_call_name(g, fn_ref_expr);
|
||||
struct_type = nullptr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user