From d53e570f5361988e0c0b17d387a599ba73f4dedc Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 11 Jul 2018 06:48:24 -0700 Subject: 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. --- struct.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'struct.c') 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); -- cgit v1.2.3