From 0d3771ac72489c6665f24eebf0d20351648fc5cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 18 May 2020 17:57:17 +0200 Subject: [PATCH] :art: Add null @=> fptr --- opcode.txt | 2 ++ src/lib/func.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/opcode.txt b/opcode.txt index 36ebfc0b..f53ad365 100644 --- a/opcode.txt +++ b/opcode.txt @@ -17,6 +17,8 @@ Reg2Reg Reg2RegAddr Reg2RegDeref StructMember +StructMemberFloat +StructMemberOther StructMemberAddr MemSetImm RegPushMe diff --git a/src/lib/func.c b/src/lib/func.c index b2fc0e1f..5c697aea 100644 --- a/src/lib/func.c +++ b/src/lib/func.c @@ -205,6 +205,13 @@ static OP_CHECK(opck_fptr_at) { return bin->rhs->info->type; } +static OP_CHECK(opck_null_fptr_at) { + Exp_Binary* bin = (Exp_Binary*)data; + CHECK_NN(opck_const_rhs(env, bin, mut)) + exp_setvar(bin->rhs, 1); + return bin->rhs->info->type; +} + static OP_CHECK(opck_fptr_cast) { Exp_Cast* cast = (Exp_Cast*)data; const Type t = exp_self(cast)->info->type; @@ -302,6 +309,10 @@ GWION_IMPORT(func) { GWI_BB(gwi_oper_add(gwi, opck_fptr_at)) GWI_BB(gwi_oper_emi(gwi, opem_func_assign)) GWI_BB(gwi_oper_end(gwi, "@=>", NULL)) + GWI_BB(gwi_oper_ini(gwi, "@null", "@func_ptr", NULL)) + GWI_BB(gwi_oper_add(gwi, opck_null_fptr_at)) + GWI_BB(gwi_oper_emi(gwi, opem_func_assign)) + GWI_BB(gwi_oper_end(gwi, "@=>", NULL)) GWI_BB(gwi_oper_add(gwi, opck_fptr_cast)) GWI_BB(gwi_oper_emi(gwi, opem_fptr_cast)) GWI_BB(gwi_oper_end(gwi, "$", NULL)) -- 2.43.0