From: Jérémie Astor Date: Mon, 18 May 2020 15:57:17 +0000 (+0200) Subject: :art: Add null @=> fptr X-Git-Tag: nightly~1539 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=0d3771ac72489c6665f24eebf0d20351648fc5cb;p=gwion.git :art: Add null @=> fptr --- 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))