fix ability to call methods on enums with pointer-to-self

closes #3218
This commit is contained in:
Andrew Kelley
2020-07-14 14:38:40 -07:00
parent 67273cbe76
commit 4696cd3e09
3 changed files with 42 additions and 4 deletions

View File

@@ -20182,7 +20182,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,
}
IrInstGen *first_arg;
if (!first_arg_known_bare && handle_is_ptr(ira->codegen, first_arg_ptr->value->type->data.pointer.child_type)) {
if (!first_arg_known_bare) {
first_arg = first_arg_ptr;
} else {
first_arg = ir_get_deref(ira, &first_arg_ptr->base, first_arg_ptr, nullptr);
@@ -20522,9 +20522,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,
return ira->codegen->invalid_inst_gen;
IrInstGen *first_arg;
if (param_type->id == ZigTypeIdPointer &&
handle_is_ptr(ira->codegen, first_arg_ptr->value->type->data.pointer.child_type))
{
if (param_type->id == ZigTypeIdPointer) {
first_arg = first_arg_ptr;
} else {
first_arg = ir_get_deref(ira, &first_arg_ptr->base, first_arg_ptr, nullptr);