From 15aa2f5098df8160c3a9b23765a7ed914c9f7f4e Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Mon, 18 Mar 2019 16:17:56 +0100 Subject: [PATCH] :art: fork just like spork --- ast | 2 +- src/emit/emit.c | 2 +- src/lib/func.c | 5 ++++- src/oo/nspc.c | 3 ++- src/parse/operator.c | 1 + src/parse/scan1.c | 2 +- src/parse/scan2.c | 2 +- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ast b/ast index 4220ad65..d5bb4217 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit 4220ad652772b5784820e8d7c36bb672dbc341f9 +Subproject commit d5bb42177b8cc84c6fa225c93a79b84cb9c75840 diff --git a/src/emit/emit.c b/src/emit/emit.c index 420e2b90..b3f72218 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -928,7 +928,7 @@ ANN m_bool emit_exp_spork(const Emitter emit, const Exp_Unary* unary) { ANN static m_bool emit_exp_unary(const Emitter emit, const Exp_Unary* unary) { GWDEBUG_EXE struct Op_Import opi = { .op=unary->op, .data=(uintptr_t)unary }; - if(unary->op != op_spork && unary->exp) { + if(unary->op != op_spork && unary->op != op_fork && unary->exp) { CHECK_BB(emit_exp(emit, unary->exp, 1)) opi.rhs = unary->exp->type; } diff --git a/src/lib/func.c b/src/lib/func.c index c2961db1..47995999 100644 --- a/src/lib/func.c +++ b/src/lib/func.c @@ -186,5 +186,8 @@ GWION_IMPORT(func) { CHECK_BB(gwi_oper_ini(gwi, NULL, (m_str)OP_ANY_TYPE, NULL)) CHECK_BB(gwi_oper_add(gwi, opck_spork)) CHECK_BB(gwi_oper_emi(gwi, opem_spork)) - return (m_bool)gwi_oper_end(gwi, op_spork, NULL); + CHECK_BB(gwi_oper_end(gwi, op_spork, NULL)) + CHECK_BB(gwi_oper_add(gwi, opck_spork)) + CHECK_BB(gwi_oper_emi(gwi, opem_spork)) + return (m_bool)gwi_oper_end(gwi, op_fork, NULL); } diff --git a/src/oo/nspc.c b/src/oo/nspc.c index 8b39aa1a..bfdc8f56 100644 --- a/src/oo/nspc.c +++ b/src/oo/nspc.c @@ -19,7 +19,8 @@ ANN void nspc_commit(const Nspc nspc) { } ANN static void nspc_release_object(const Nspc a, Value value) { - if(value->d.ptr || (GET_FLAG(value, static) && a->info->class_data) || +// if(value->d.ptr || (GET_FLAG(value, static) && a->info->class_data) || + if((GET_FLAG(value, static) && a->info->class_data) || (value->d.ptr && GET_FLAG(value, builtin))) { const VM_Code code = new_vm_code(NULL, 0, ae_flag_builtin, "in code dtor"); const VM_Shred s = new_vm_shred(code); diff --git a/src/parse/operator.c b/src/parse/operator.c index fbf24e09..9704ee4a 100644 --- a/src/parse/operator.c +++ b/src/parse/operator.c @@ -211,5 +211,6 @@ ANN m_bool op_emit(const Emitter emit, const struct Op_Import* opi) { } } while(r && (r = op_parent(emit->env, r))); } while(l && (l = op_parent(emit->env, l))); +// probably deserves err_msg here return GW_ERROR; } diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 873db3a2..c5b4ed7f 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -141,7 +141,7 @@ ANN static m_bool scan1_exp_if(const Env env, const Exp_If* exp_if) { GWDEBUG_EX } ANN static inline m_bool scan1_exp_unary(const restrict Env env, const Exp_Unary * unary) { - if(unary->op == op_spork && unary->code) + if((unary->op == op_spork || unary->op == op_fork) && unary->code) return scan1_stmt(env, unary->code); return unary->exp ? scan1_exp(env, unary->exp) : GW_OK; } diff --git a/src/parse/scan2.c b/src/parse/scan2.c index d00e7066..67fb1f48 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -210,7 +210,7 @@ ANN static inline m_bool scan2_exp_if(const Env env, const Exp_If* exp_if) { GWD } ANN static m_bool scan2_exp_unary(const Env env, const Exp_Unary * unary) { - if(unary->op == op_spork && unary->code) + if((unary->op == op_spork || unary->op == op_fork) && unary->code) return scan2_stmt(env, unary->code); else if(unary->exp) return scan2_exp(env, unary->exp); -- 2.43.0