diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-07-07 06:14:05 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-07-07 06:14:05 -0700 |
commit | 3c03f12f84e5e3349428393d50f7fbbdcfe75711 (patch) | |
tree | 1967ad29dfc60cee5d25fcb5af217ea035f11c32 /struct.c | |
parent | 73e6b7fcbfdf075dc4dd1843d201aff20e875987 (diff) | |
download | txr-3c03f12f84e5e3349428393d50f7fbbdcfe75711.tar.gz txr-3c03f12f84e5e3349428393d50f7fbbdcfe75711.tar.bz2 txr-3c03f12f84e5e3349428393d50f7fbbdcfe75711.zip |
structs: tighten call-super-fun behavior.
* struct.c (call_super_fun): Do not allow type to be a struct
instance, which is a consequence of the super function being
used. The documentation says that the argument is a type and
mentions no possibility of it being an instance. Allowing a
struct invites mistakes.
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1176,15 +1176,17 @@ static val call_super_method(val inst, val sym, struct args *args) static val call_super_fun(val type, val sym, struct args *args) { - val suptype = super(type); + val self = lit("call-super-fun"); + struct struct_type *st = stype_handle(&type, self); + val suptype = st->super; if (suptype) { val fun = static_slot(suptype, sym); return generic_funcall(fun, args); } - uw_throwf(error_s, lit("call-super-fun: ~s has no supertype"), - type, nao); + uw_throwf(error_s, lit("~a: ~s has no supertype"), + self, type, nao); } val slotp(val type, val sym) |