mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* libguile/eval.c (scm_m_case): Allow empty lists of case labels.
* test-suite/tests/syntax.test: Fixed and activated test of empty case label support.
This commit is contained in:
parent
2a6f7afe04
commit
58a2510b07
4 changed files with 19 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
|||
2003-10-11 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* eval.c (scm_m_case): Allow empty lists of case labels.
|
||||
|
||||
2003-10-11 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* tags.h (SCM_IM_ELSE, SCM_IM_ARROW): New memoizer codes.
|
||||
|
|
|
@ -741,6 +741,13 @@ scm_m_case (SCM expr, SCM env)
|
|||
s_bad_case_labels, labels, expr);
|
||||
all_labels = scm_append_x (scm_list_2 (labels, all_labels));
|
||||
}
|
||||
else if (SCM_NULLP (labels))
|
||||
{
|
||||
/* The list of labels is empty. According to R5RS this is allowed.
|
||||
* It means that the sequence of expressions will never be executed.
|
||||
* Therefore, as an optimization, we could remove the whole
|
||||
* clause. */
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT_SYNTAX_2 (SCM_EQ_P (labels, scm_sym_else) && else_literal_p,
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-10-11 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* tests/syntax.test: Fixed and activated test of empty case label
|
||||
support.
|
||||
|
||||
2003-10-11 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* tests/syntax.test (exception:bad-expression,
|
||||
|
|
|
@ -509,6 +509,9 @@
|
|||
|
||||
(with-test-prefix "case"
|
||||
|
||||
(pass-if "clause with empty labels list"
|
||||
(case 1 (() #f) (else #t)))
|
||||
|
||||
(with-test-prefix "case is hygienic"
|
||||
|
||||
(pass-if-exception "bound 'else is handled correctly"
|
||||
|
@ -558,11 +561,6 @@
|
|||
(eval '(case 1 ("foo" "bar"))
|
||||
(interaction-environment)))
|
||||
|
||||
;; According to R5RS, the following one is syntactically correct.
|
||||
;; (pass-if-exception "(case 1 (() \"bar\"))"
|
||||
;; exception:bad/missing-clauses
|
||||
;; (case 1 (() "bar")))
|
||||
|
||||
(pass-if-exception "(case 1 ((2) \"bar\") . \"foo\")"
|
||||
exception:bad-expression
|
||||
(eval '(case 1 ((2) "bar") . "foo")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue