diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-04-06 06:31:00 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-04-06 06:31:00 -0700 |
commit | 274c4b655b249a637e9a707db71d839c36829689 (patch) | |
tree | c60c9ec6856fd813413beff963c38e26a23702de /share | |
parent | c1f4d79ad5fa862708e1203cd5e78ed595d6ab34 (diff) | |
download | txr-274c4b655b249a637e9a707db71d839c36829689.tar.gz txr-274c4b655b249a637e9a707db71d839c36829689.tar.bz2 txr-274c4b655b249a637e9a707db71d839c36829689.zip |
Diagnose bad supertype in defstruct.
* share/txr/stdlib/struct.tl (defstruct): If super isn't nil,
it must name an existing struct type, or an exception is
thrown. Previously, a nonexistent struct was silently treated
as if nil had been specified.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/struct.tl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/share/txr/stdlib/struct.tl b/share/txr/stdlib/struct.tl index ee4bfd18..2f1692f5 100644 --- a/share/txr/stdlib/struct.tl +++ b/share/txr/stdlib/struct.tl @@ -112,7 +112,12 @@ ^(:instance ,name nil)) (name ^(:instance ,name nil))))) - (super-type (find-struct-type super)) + (super-type (if super + (or (find-struct-type super) + (throwf 'eval-error + "~a: inheritance base ~s \ + \ does not name a struct type" + 'defstruct super)))) (stat-si-forms [keep-if (op member @1 '(:static :function)) slot-init-forms car]) (pruned-si-forms (sys:prune-nil-inits stat-si-forms super-type)) |