]> Nishi Git Mirror - gwion.git/commitdiff
:art: Add null @=> fptr
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 18 May 2020 15:57:17 +0000 (17:57 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 18 May 2020 15:57:41 +0000 (17:57 +0200)
opcode.txt
src/lib/func.c

index 36ebfc0b59b2854f9db82e2f5a076019a1d86fc5..f53ad365a273c2e9e7c484961da7aa7d157227aa 100644 (file)
@@ -17,6 +17,8 @@ Reg2Reg
 Reg2RegAddr
 Reg2RegDeref
 StructMember
+StructMemberFloat
+StructMemberOther
 StructMemberAddr
 MemSetImm
 RegPushMe
index b2fc0e1f8f2b09bec86a71acd72556e2fa572187..5c697aeadeb76ce8e7184994dab8b16c515dcee9 100644 (file)
@@ -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))