From 87e4ce72d5777c42ce2430d0af933cbbd7ca7489 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Fri, 13 May 2022 16:37:42 +0200 Subject: [PATCH] :art: Improve local error --- src/emit/emit.c | 4 +++- tests/locale/locale_error.gw | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 tests/locale/locale_error.gw diff --git a/src/emit/emit.c b/src/emit/emit.c index 737c63b7..312497ef 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -932,7 +932,9 @@ ANN static m_bool emit_prim_locale(const Emitter emit, const Symbol *id) { vm_run(emit->gwion->vm); emit->gwion->vm->bbq->is_running = true; const m_float ret = *(m_float*)shred->reg; - if(ret == -1.0) return GW_ERROR; + if(ret == -1.0) { + ERR_B(prim_pos(id), "error in locale"); + } const Instr instr = emit_add_instr(emit, RegPushImm2); instr->f = ret; return GW_OK; diff --git a/tests/locale/locale_error.gw b/tests/locale/locale_error.gw new file mode 100644 index 00000000..fc98f1ed --- /dev/null +++ b/tests/locale/locale_error.gw @@ -0,0 +1,2 @@ +#! [contains] invalid value for locale +`foo`; -- 2.43.0