| ... | ... | @@ -934,15 +934,13 @@ static IrInstruction *ir_build_ptr_type_child(IrBuilder *irb, Scope *scope, AstN |
| 934 | 934 | return &instruction->base; |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | | static IrInstruction *ir_build_set_fn_test(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *fn_value, |
| 938 | | IrInstruction *is_test) |
| 937 | static IrInstruction *ir_build_set_fn_test(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 938 | IrInstruction *fn_value) |
| 939 | 939 | { |
| 940 | 940 | IrInstructionSetFnTest *instruction = ir_build_instruction<IrInstructionSetFnTest>(irb, scope, source_node); |
| 941 | 941 | instruction->fn_value = fn_value; |
| 942 | | instruction->is_test = is_test; |
| 943 | 942 | |
| 944 | 943 | ir_ref_instruction(fn_value); |
| 945 | | ir_ref_instruction(is_test); |
| 946 | 944 | |
| 947 | 945 | return &instruction->base; |
| 948 | 946 | } |
| ... | ... | @@ -1786,12 +1784,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 1786 | 1784 | if (arg0_value == irb->codegen->invalid_instruction) |
| 1787 | 1785 | return arg0_value; |
| 1788 | 1786 | |
| 1789 | | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 1790 | | IrInstruction *arg1_value = ir_gen_node(irb, arg1_node, scope); |
| 1791 | | if (arg1_value == irb->codegen->invalid_instruction) |
| 1792 | | return arg1_value; |
| 1793 | | |
| 1794 | | return ir_build_set_fn_test(irb, scope, node, arg0_value, arg1_value); |
| 1787 | return ir_build_set_fn_test(irb, scope, node, arg0_value); |
| 1795 | 1788 | } |
| 1796 | 1789 | case BuiltinFnIdSetFnVisible: |
| 1797 | 1790 | { |
| ... | ... | @@ -5680,26 +5673,15 @@ static TypeTableEntry *ir_analyze_instruction_set_fn_test(IrAnalyze *ira, |
| 5680 | 5673 | IrInstructionSetFnTest *set_fn_test_instruction) |
| 5681 | 5674 | { |
| 5682 | 5675 | IrInstruction *fn_value = set_fn_test_instruction->fn_value->other; |
| 5683 | | IrInstruction *is_test_value = set_fn_test_instruction->is_test->other; |
| 5684 | 5676 | |
| 5685 | 5677 | FnTableEntry *fn_entry = ir_resolve_fn(ira, fn_value); |
| 5686 | 5678 | if (!fn_entry) |
| 5687 | 5679 | return ira->codegen->builtin_types.entry_invalid; |
| 5688 | 5680 | |
| 5689 | | if (!ir_resolve_bool(ira, is_test_value, &fn_entry->is_test)) |
| 5690 | | return ira->codegen->builtin_types.entry_invalid; |
| 5691 | | |
| 5692 | | AstNode *source_node = set_fn_test_instruction->base.source_node; |
| 5693 | | if (fn_entry->fn_test_set_node) { |
| 5694 | | ErrorMsg *msg = add_node_error(ira->codegen, source_node, |
| 5695 | | buf_sprintf("function test attribute set twice")); |
| 5696 | | add_error_note(ira->codegen, msg, fn_entry->fn_test_set_node, buf_sprintf("first set here")); |
| 5697 | | return ira->codegen->builtin_types.entry_invalid; |
| 5698 | | } |
| 5699 | | fn_entry->fn_test_set_node = source_node; |
| 5700 | | |
| 5701 | | if (fn_entry->is_test) |
| 5681 | if (!fn_entry->is_test) { |
| 5682 | fn_entry->is_test = true; |
| 5702 | 5683 | ira->codegen->test_fn_count += 1; |
| 5684 | } |
| 5703 | 5685 | |
| 5704 | 5686 | ir_build_const_from(ira, &set_fn_test_instruction->base, false); |
| 5705 | 5687 | return ira->codegen->builtin_types.entry_void; |