From 46cb425c65060a0b4c40b46ddadae30068e35ee3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 1 Dec 2019 00:37:14 +0100 Subject: [PATCH] :art: Range improvment and testing --- src/emit/emit.c | 6 ++++-- tests/range/range_no_match.gw | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/emit/emit.c b/src/emit/emit.c index f5448f18..9fbf6d67 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -396,13 +396,15 @@ ANN static m_bool emit_prim_array(const Emitter emit, const Array_Sub *data) { return GW_OK; } +ANN static inline m_bool emit_exp_pop_next(const Emitter emit, Exp e, const m_bool addref); + ANN static m_bool emit_range(const Emitter emit, Range *range) { if(range->start) - CHECK_OB(emit_exp(emit, range->start, 0)) + CHECK_OB(emit_exp_pop_next(emit, range->start, 0)) else regpushi(emit, 0); if(range->end) - CHECK_OB(emit_exp(emit, range->end, 0)) + CHECK_OB(emit_exp_pop_next(emit, range->end, 0)) else regpushi(emit, -1); return GW_OK; diff --git a/tests/range/range_no_match.gw b/tests/range/range_no_match.gw index 091c0104..e151a033 100644 --- a/tests/range/range_no_match.gw +++ b/tests/range/range_no_match.gw @@ -1,2 +1,2 @@ #! [contains] range types do not match -[1:1,2]; +[1:me]; -- 2.43.0