From: fennecdjay Date: Wed, 14 Dec 2022 12:37:19 +0000 (+0100) Subject: :art: use emit_jump X-Git-Tag: nightly~207^2~40 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=5cd633526411268457c8b056d3e6b3aedd4a1664;p=gwion.git :art: use emit_jump --- diff --git a/src/emit/emit.c b/src/emit/emit.c index c7d0df0f..ceba3b50 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -2039,28 +2039,25 @@ ANN static inline m_bool emit_jump_index(const Emitter emit, const Vector v, return GW_ERROR; } -ANN static inline m_bool emit_stmt_continue(const Emitter emit, - const Stmt_Index stmt) { +ANN static inline m_bool emit_jump(const Emitter emit, const Stmt_Index stmt, + const Vector v) { CHECK_BB(emit_defers2(emit)); if (stmt->idx == -1 || stmt->idx == 1) - vector_add(&emit->code->stack_cont, (vtype)emit_add_instr(emit, Goto)); + vector_add(v, (vtype)emit_add_instr(emit, Goto)); else if (stmt->idx) { - if (emit_jump_index(emit, &emit->code->stack_cont, stmt->idx) < 0) + if (emit_jump_index(emit, v, stmt->idx) < 0) ERR_B(stmt_self(stmt)->pos, _("too many jumps required.")) } return GW_OK; } +ANN static inline m_bool emit_stmt_continue(const Emitter emit, + const Stmt_Index stmt) { + return emit_jump(emit, stmt, &emit->code->stack_cont); +} ANN static inline m_bool emit_stmt_break(const Emitter emit, const Stmt_Index stmt NUSED) { - CHECK_BB(emit_defers2(emit)); - if (stmt->idx == -1 || stmt->idx == 1) - vector_add(&emit->code->stack_break, (vtype)emit_add_instr(emit, Goto)); - else if (stmt->idx) { - if (emit_jump_index(emit, &emit->code->stack_break, stmt->idx) < 0) - ERR_B(stmt_self(stmt)->pos, _("too many jumps required.")) - } - return GW_OK; + return emit_jump(emit, stmt, &emit->code->stack_break); } ANN static inline void emit_push_stack(const Emitter emit) {