| ... | @@ -4166,8 +4166,14 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node, | ... | @@ -4166,8 +4166,14 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node, |
| 4166 | } | 4166 | } |
| 4167 | | 4167 | |
| 4168 | Tld *tld = find_decl(irb->codegen, scope, variable_name); | 4168 | Tld *tld = find_decl(irb->codegen, scope, variable_name); |
| 4169 | if (tld) | 4169 | if (tld) { |
| 4170 | return ir_build_decl_ref(irb, scope, node, tld, lval); | 4170 | IrInstruction *decl_ref = ir_build_decl_ref(irb, scope, node, tld, lval); |
| | 4171 | if (lval == LValPtr) { |
| | 4172 | return decl_ref; |
| | 4173 | } else { |
| | 4174 | return ir_expr_wrap(irb, scope, decl_ref, result_loc); |
| | 4175 | } |
| | 4176 | } |
| 4171 | | 4177 | |
| 4172 | if (get_container_scope(node->owner)->any_imports_failed) { | 4178 | if (get_container_scope(node->owner)->any_imports_failed) { |
| 4173 | // skip the error message since we had a failing import in this file | 4179 | // skip the error message since we had a failing import in this file |
| ... | @@ -16503,7 +16509,7 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh | ... | @@ -16503,7 +16509,7 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh |
| 16503 | IrInstruction *branch_instruction = predecessor->instruction_list.pop(); | 16509 | IrInstruction *branch_instruction = predecessor->instruction_list.pop(); |
| 16504 | ir_set_cursor_at_end(&ira->new_irb, predecessor); | 16510 | ir_set_cursor_at_end(&ira->new_irb, predecessor); |
| 16505 | IrInstruction *casted_value = ir_implicit_cast(ira, new_value, resolved_type); | 16511 | IrInstruction *casted_value = ir_implicit_cast(ira, new_value, resolved_type); |
| 16506 | if (casted_value == ira->codegen->invalid_instruction) { | 16512 | if (type_is_invalid(casted_value->value.type)) { |
| 16507 | return ira->codegen->invalid_instruction; | 16513 | return ira->codegen->invalid_instruction; |
| 16508 | } | 16514 | } |
| 16509 | new_incoming_values.items[i] = casted_value; | 16515 | new_incoming_values.items[i] = casted_value; |