summaryrefslogtreecommitdiffstats
path: root/struct.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-07-11 06:48:24 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-07-11 06:48:24 -0700
commitd53e570f5361988e0c0b17d387a599ba73f4dedc (patch)
tree4016e0d4b934da41b22b119c391e8a24c900c10c /struct.c
parentde76e0a57c28cd102994227483cec5ac7eaccd8e (diff)
downloadtxr-d53e570f5361988e0c0b17d387a599ba73f4dedc.tar.gz
txr-d53e570f5361988e0c0b17d387a599ba73f4dedc.tar.bz2
txr-d53e570f5361988e0c0b17d387a599ba73f4dedc.zip
struct: uslot and umethod: improve diagnostics.
* struct.c (uslot_fun, umethod_fun, umethod_args_fun): Use the struct_handle_for_slot function rather than struct_handle. That function includes the slot name in the diagnostic message when the object isn't a struct; the programmer knows which slot was being asked for in the non-struct object.
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/struct.c b/struct.c
index 5e8b1aef..2acc0b65 100644
--- a/struct.c
+++ b/struct.c
@@ -1333,7 +1333,7 @@ val super_method(val strct, val slotsym)
static val uslot_fun(val sym, val strct)
{
val self = lit("uslot");
- struct struct_inst *si = struct_handle(strct, self);
+ struct struct_inst *si = struct_handle_for_slot(strct, self, sym);
if (sym && symbolp(sym)) {
loc ptr = lookup_slot(strct, si, sym);
@@ -1359,7 +1359,7 @@ static val umethod_fun(val sym, struct args *args)
} else {
val strct = args_at(args, 0);
- struct struct_inst *si = struct_handle(strct, self);
+ struct struct_inst *si = struct_handle_for_slot(strct, self, sym);
if (sym && symbolp(sym)) {
loc ptr = lookup_slot(strct, si, sym);
@@ -1389,7 +1389,7 @@ static val umethod_args_fun(val env, struct args *args)
args_normalize_exact(args_call, ca_len + 1);
args_cat_zap_from(args_call, args, index);
- struct struct_inst *si = struct_handle(strct, self);
+ struct struct_inst *si = struct_handle_for_slot(strct, self, sym);
if (sym && symbolp(sym)) {
loc ptr = lookup_slot(strct, si, sym);