From: fennecdjay Date: Tue, 24 Sep 2019 19:17:40 +0000 (+0200) Subject: :art: Implement '!' as bool X-Git-Tag: nightly~2203 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=1b2a3d9e5c8ddfab084d37495fe1cdd007fa6f2c;p=gwion.git :art: Implement '!' as bool --- diff --git a/src/lib/func.c b/src/lib/func.c index 419e2aa8..80aba0ca 100644 --- a/src/lib/func.c +++ b/src/lib/func.c @@ -301,7 +301,7 @@ GWION_IMPORT(func) { GWI_BB(gwi_oper_ini(gwi, (m_str)OP_ANY_TYPE, "@function", NULL)) GWI_BB(gwi_oper_add(gwi, opck_func_call)) GWI_BB(gwi_oper_end(gwi, "=>", NULL)) - GWI_BB(gwi_oper_ini(gwi, NULL, "@func_ptr", "int")) + GWI_BB(gwi_oper_ini(gwi, NULL, "@func_ptr", "bool")) GWI_BB(gwi_oper_end(gwi, "!", IntNot)) GWI_BB(gwi_oper_ini(gwi, "@function", "@func_ptr", NULL)) GWI_BB(gwi_oper_add(gwi, opck_fptr_at)) diff --git a/src/lib/object.c b/src/lib/object.c index a3c47ddb..ff06d0e1 100644 --- a/src/lib/object.c +++ b/src/lib/object.c @@ -253,7 +253,7 @@ GWION_IMPORT(object) { GWI_BB(gwi_oper_ini(gwi, "Object", "@null", "int")) GWI_BB(gwi_oper_end(gwi, "==", EqObject)) GWI_BB(gwi_oper_end(gwi, "!=", NeqObject)) - GWI_BB(gwi_oper_ini(gwi, NULL, "Object", "int")) + GWI_BB(gwi_oper_ini(gwi, NULL, "Object", "bool")) GWI_BB(gwi_oper_add(gwi, opck_unary_meta2)) GWI_BB(gwi_oper_end(gwi, "!", IntNot)) gwi_item_ini(gwi, "@null", "null"); diff --git a/src/lib/prim.c b/src/lib/prim.c index 3f4fc03a..1992d86a 100644 --- a/src/lib/prim.c +++ b/src/lib/prim.c @@ -62,7 +62,6 @@ static GWION_IMPORT(int_unary) { GWI_BB(gwi_oper_ini(gwi, NULL, "int", "int")) GWI_BB(gwi_oper_add(gwi, opck_unary_meta)) GWI_BB(gwi_oper_end(gwi, "-", int_negate)) - GWI_BB(gwi_oper_end(gwi, "!", IntNot)) CHECK_OP("++", unary, pre_inc) CHECK_OP("--", unary, pre_dec) GWI_BB(gwi_oper_end(gwi, "~", int_cmp)) @@ -78,6 +77,8 @@ static GWION_IMPORT(int_values) { GWI_BB(gwi_enum_add(gwi, "false", 0)) GWI_BB(gwi_enum_add(gwi, "true", 1)) t_bool = gwi_enum_end(gwi); + GWI_BB(gwi_oper_ini(gwi, NULL, "int", "bool")) + GWI_BB(gwi_oper_end(gwi, "!", IntNot)) // GWI_BB(gwi_item_ini(gwi, "bool", "maybe")) // GWI_BB(gwi_item_end(gwi, 0, NULL)) gwi_reserve(gwi, "maybe");