1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-06 15:40:29 +02:00

* libguile/eval.c (s_missing_body_expression): New static identifier.

(s_body): Removed.

	(scm_m_expand_body): Fixed core dump when passing a body with
	defines, but without expressions (see additions to syntax.test).
	Use ASSERT_SYNTAX to signal syntax errors.

	* test-suite/tests/syntax.test (exception:missing-body-expr): New.

	Renamed section 'define' to 'top-level define' and added a new
	section 'internal define' with some tests.
This commit is contained in:
Dirk Herrmann 2003-11-08 08:11:14 +00:00
parent a5fda890f5
commit ced8edb0f9
4 changed files with 75 additions and 6 deletions

View file

@ -1,3 +1,13 @@
2003-11-08 Dirk Herrmann <D.Herrmann@tu-bs.de>
* eval.c (s_missing_body_expression): New static identifier.
(s_body): Removed.
(scm_m_expand_body): Fixed core dump when passing a body with
defines, but without expressions (see additions to syntax.test).
Use ASSERT_SYNTAX to signal syntax errors.
2003-11-02 Dirk Herrmann <D.Herrmann@tu-bs.de>
* eval.c (canonicalize_define): New static helper function.

View file

@ -114,6 +114,12 @@ static const char s_expression[] = "Missing or extra expression in";
* context, a 'Missing expression' error is signalled. */
static const char s_missing_expression[] = "Missing expression in";
/* A body may hold an arbitrary number of internal defines, followed by a
* non-empty sequence of expressions. If a body with an empty sequence of
* expressions is detected, a 'Missing body expression' error is signalled.
*/
static const char s_missing_body_expression[] = "Missing body expression in";
/* If a form is detected that holds more expressions than are allowed in that
* context, an 'Extra expression' error is signalled. */
static const char s_extra_expression[] = "Extra expression in";
@ -408,7 +414,6 @@ SCM_REC_MUTEX (source_mutex);
static const char s_test[] = "bad test";
static const char s_body[] = "bad body";
static const char s_bindings[] = "bad bindings";
static const char s_duplicate_bindings[] = "duplicate bindings";
static const char s_variable[] = "bad variable";
@ -1826,7 +1831,6 @@ SCM
scm_m_expand_body (SCM xorig, SCM env)
{
SCM x = SCM_CDR (xorig), defs = SCM_EOL;
char *what = SCM_ISYMCHARS (SCM_CAR (xorig)) + 2;
while (SCM_NIMP (x))
{
@ -1861,6 +1865,10 @@ scm_m_expand_body (SCM xorig, SCM env)
}
}
/* FIXME: xorig is already partially memoized and does not hold information
* about the file location. */
ASSERT_SYNTAX (SCM_CONSP (x), s_missing_body_expression, xorig);
if (!SCM_NULLP (defs))
{
SCM rvars, inits, body, letrec;
@ -1873,7 +1881,6 @@ scm_m_expand_body (SCM xorig, SCM env)
}
else
{
SCM_ASSYNT (SCM_CONSP (x), s_body, what);
SCM_SETCAR (xorig, SCM_CAR (x));
SCM_SETCDR (xorig, SCM_CDR (x));
}