diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-06-27 06:37:19 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-06-27 06:37:19 -0700 |
commit | 012e59bb700f7b9046bb9529d8f5fc593490f0b1 (patch) | |
tree | b59130141f16930fa0c93849594d44227fb3955f | |
parent | 77add3afb6db6810254ac1b32a7f2ee89c9f7a02 (diff) | |
download | txr-012e59bb700f7b9046bb9529d8f5fc593490f0b1.tar.gz txr-012e59bb700f7b9046bb9529d8f5fc593490f0b1.tar.bz2 txr-012e59bb700f7b9046bb9529d8f5fc593490f0b1.zip |
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.
-rw-r--r-- | ffi.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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); } |