From 87731e8edc47736322096a5160d8c398710def45 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Fri, 18 Dec 2020 04:00:22 +0100 Subject: [PATCH] :art: (late) Object operators --- src/lib/object_op.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/object_op.c b/src/lib/object_op.c index 30e3ee49..c5b6e349 100644 --- a/src/lib/object_op.c +++ b/src/lib/object_op.c @@ -294,6 +294,13 @@ ANN void struct_release(const VM_Shred shred, const Type base, const m_bit *ptr) } } +static OP_EMIT(opem_not_object) { + const Instr instr = (Instr)vector_back(&emit->code->instr); + if(instr->opcode == eGWOP_EXCEPT) + vector_pop(&emit->code->instr); + return GW_OK; +} + GWION_IMPORT(object_op) { const Type t_error = gwi_mk_type(gwi, "@error", 0, NULL); gwi->gwion->type[et_error] = t_error; @@ -301,7 +308,7 @@ GWION_IMPORT(object_op) { GWI_BB(gwi_oper_ini(gwi, "Object", "Object", NULL)) GWI_BB(gwi_oper_add(gwi, at_object)) GWI_BB(gwi_oper_end(gwi, "@=>", ObjectAssign)) - GWI_BB(gwi_oper_ini(gwi, "Object", "Object", "int")) + GWI_BB(gwi_oper_ini(gwi, "Object", "Object", "bool")) GWI_BB(gwi_oper_end(gwi, "==", EqObject)) GWI_BB(gwi_oper_end(gwi, "!=", NeqObject)) GWI_BB(gwi_oper_add(gwi, opck_object_cast)) @@ -309,6 +316,9 @@ GWION_IMPORT(object_op) { GWI_BB(gwi_oper_add(gwi, opck_implicit_null2obj)) GWI_BB(gwi_oper_emi(gwi, opem_implicit_null2obj)) GWI_BB(gwi_oper_end(gwi, "@implicit", NULL)) + GWI_BB(gwi_oper_ini(gwi, NULL, "Object", "bool")) + GWI_BB(gwi_oper_emi(gwi, opem_not_object)) + GWI_BB(gwi_oper_end(gwi, "!", IntNot)) GWI_BB(gwi_oper_ini(gwi, "@Compound", NULL, NULL)) GWI_BB(gwi_oper_add(gwi, opck_struct_scan)) GWI_BB(gwi_oper_end(gwi, "@scan", NULL)) -- 2.43.0