From: Jérémie Astor Date: Sun, 24 May 2020 20:12:37 +0000 (+0200) Subject: :art: Wrap 'fork' exp in a stmt_list X-Git-Tag: nightly~1519 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=154b2a20fb2948e4701f9bcbc462cff0819838d1;p=gwion.git :art: Wrap 'fork' exp in a stmt_list --- diff --git a/src/lib/func.c b/src/lib/func.c index 5c697aea..a1084f3a 100644 --- a/src/lib/func.c +++ b/src/lib/func.c @@ -264,8 +264,17 @@ ANN Type check_exp_unary_spork(const Env env, const Stmt code); static OP_CHECK(opck_spork) { const Exp_Unary* unary = (Exp_Unary*)data; - if(unary->exp && unary->exp->exp_type == ae_exp_call) - return env->gwion->type[unary->op == insert_symbol("spork") ? et_shred : et_fork]; + if(unary->exp && unary->exp->exp_type == ae_exp_call) { + const m_bool is_spork = unary->op == insert_symbol("spork"); + if(!is_spork) { + const Stmt stmt = new_stmt_exp(env->gwion->mp, ae_stmt_exp, unary->exp); + const Stmt_List list = new_stmt_list(env->gwion->mp, stmt, NULL); + const Stmt code = new_stmt_code(env->gwion->mp, list); + ((Exp_Unary*)unary)->exp = NULL; + ((Exp_Unary*)unary)->code = code; + } + return is_spork ? et_shred : et_fork]; + } if(unary->code) { ++env->scope->depth; nspc_push_value(env->gwion->mp, env->curr);