From b3984dc6f4f6865d01b4f0192899bbd5a8f0602a Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Thu, 10 Oct 2019 00:51:27 +0200 Subject: [PATCH] :shirt: Some clean --- include/match.h | 4 +++- src/emit/emit.c | 2 +- tests/error/variadic_end_no_start.gw | 2 +- tests/error/variadic_start_twice.gw | 2 +- tests/error/variadic_test.gw | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/match.h b/include/match.h index dbdb6a2f..9ab0bee2 100644 --- a/include/match.h +++ b/include/match.h @@ -8,10 +8,12 @@ struct Match_ { ANN static inline void match_map(struct Match_ * const match, Exp e) { const Map map = &match->map; map_init(map); + Exp next; do { + next = e->next; e->next = NULL; map_set(map, (vtype)e, 0); - } while((e = e->next)); + } while((e = next)); } ANN static inline void match_unmap(struct Match_ * const match) { diff --git a/src/emit/emit.c b/src/emit/emit.c index cfaf1524..334d670d 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1341,7 +1341,7 @@ ANN static m_bool emit_stmt_jump(const Emitter emit, const Stmt_Jump stmt) { if(!stmt->is_label) stmt->data.instr = emit_add_instr(emit, Goto); else { - assert(!stmt->data.v.ptr); + assert(stmt->data.v.ptr); const m_uint size = vector_size(&stmt->data.v); if(!size) ERR_B(stmt_self(stmt)->pos, _("label '%s' defined but not used."), s_name(stmt->name)) diff --git a/tests/error/variadic_end_no_start.gw b/tests/error/variadic_end_no_start.gw index 89aed11f..7dc0c9d2 100644 --- a/tests/error/variadic_end_no_start.gw +++ b/tests/error/variadic_end_no_start.gw @@ -1,4 +1,4 @@ -#! [contains] vararg.start not used before vararg.end. this is an error +#! [contains] vararg.start not used before vararg.end fun void test(int i, ...) { vararg.end; #! vararg.start; diff --git a/tests/error/variadic_start_twice.gw b/tests/error/variadic_start_twice.gw index 59e93491..dd192f7a 100644 --- a/tests/error/variadic_start_twice.gw +++ b/tests/error/variadic_start_twice.gw @@ -1,2 +1,2 @@ -#! [contains] vararg.start already used. this is an error +#! [contains] vararg.start already used fun void test(...) { vararg.start; vararg.start;} diff --git a/tests/error/variadic_test.gw b/tests/error/variadic_test.gw index 89aed11f..7dc0c9d2 100644 --- a/tests/error/variadic_test.gw +++ b/tests/error/variadic_test.gw @@ -1,4 +1,4 @@ -#! [contains] vararg.start not used before vararg.end. this is an error +#! [contains] vararg.start not used before vararg.end fun void test(int i, ...) { vararg.end; #! vararg.start; -- 2.43.0