From 73874bab389305e76b8fa3726f4494a613735f5a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 27 Jun 2017 06:37:19 -0700 Subject: ffi: bugfix: diagnostic problems in enum put. * ffi.c (ffi_enum_put, ffi_enum_rput): Fix function name appearing in quotes in error diagnostic. Fix nonexistent member being wrongly reported as nil. --- ffi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'ffi.c') diff --git a/ffi.c b/ffi.c index a555168b..89602f55 100644 --- a/ffi.c +++ b/ffi.c @@ -2619,10 +2619,11 @@ static void ffi_carray_put(struct txr_ffi_type *tft, val carray, mem_t *dst, static void ffi_enum_put(struct txr_ffi_type *tft, val n, mem_t *dst, val self) { if (symbolp(n)) { - n = gethash(tft->num_sym, n); - if (!n) - uw_throwf(error_s, lit("~s: ~s has no member ~s"), self, + val n_num = gethash(tft->num_sym, n); + if (!n_num) + uw_throwf(error_s, lit("~a: ~s has no member ~s"), self, tft->syntax, n, nao); + n = n_num; } ffi_int_put(tft, n, dst, self); } @@ -2639,10 +2640,11 @@ static val ffi_enum_get(struct txr_ffi_type *tft, mem_t *src, val self) static void ffi_enum_rput(struct txr_ffi_type *tft, val n, mem_t *dst, val self) { if (symbolp(n)) { - n = gethash(tft->num_sym, n); - if (!n) - uw_throwf(error_s, lit("~s: ~s has no member ~s"), self, + val n_num = gethash(tft->num_sym, n); + if (!n_num) + uw_throwf(error_s, lit("~a: ~s has no member ~s"), self, tft->syntax, n, nao); + n = n_num; } ffi_int_rput(tft, n, dst, self); } -- cgit v1.2.3