* eval.c (unmemoize_exprs): When dropping internal body markers
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Sat, 21 Aug 2004 07:28:16 +0000 (07:28 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Sat, 21 Aug 2004 07:28:16 +0000 (07:28 +0000)
from the output during unmemoization, also drop those that are not
immediately at the beginning of a body.

libguile/ChangeLog
libguile/eval.c

index e1d8660..58a6e89 100644 (file)
@@ -1,3 +1,9 @@
+2004-08-21  Dirk Herrmann  <dirk@dirk-herrmanns-seiten.de>
+
+       * eval.c (unmemoize_exprs): When dropping internal body markers
+       from the output during unmemoization, also drop those that are not
+       immediately at the beginning of a body.
+
 2004-08-20  Marius Vollmer  <marius.vollmer@uni-dortmund.de>
 
        * eval.c (scm_lookupcar1): Report "Variable used before given a
index 8217c40..0eebbd3 100644 (file)
@@ -586,14 +586,7 @@ unmemoize_exprs (const SCM exprs, const SCM env)
   SCM um_expr;
 
   /* Note that due to the current lazy memoizer we may find partially memoized
-   * code during execution.  In such code, lists of expressions that stem from
-   * a body form may start with an ISYM if the body itself has not yet been
-   * memoized.  This isym is just an internal marker to indicate that the body
-   * still needs to be memoized.  It is dropped during unmemoization.  */
-  if (SCM_CONSP (expr_idx) && SCM_ISYMP (SCM_CAR (expr_idx)))
-    expr_idx = SCM_CDR (expr_idx);
-
-  /* Moreover, in partially memoized code we have to expect improper lists of
+   * code during execution.  In such code we have to expect improper lists of
    * expressions: On the one hand, for such code syntax checks have not yet
    * fully been performed, on the other hand, there may be even legal code
    * like '(a . b) appear as an improper list of expressions as long as the
@@ -603,8 +596,18 @@ unmemoize_exprs (const SCM exprs, const SCM env)
   for (; SCM_CONSP (expr_idx); expr_idx = SCM_CDR (expr_idx))
     {
       const SCM expr = SCM_CAR (expr_idx);
-      um_expr = unmemoize_expression (expr, env);
-      r_result = scm_cons (um_expr, r_result);
+
+      /* In partially memoized code, lists of expressions that stem from a
+       * body form may start with an ISYM if the body itself has not yet been
+       * memoized.  This isym is just an internal marker to indicate that the
+       * body still needs to be memoized.  An isym may occur at the very
+       * beginning of the body or after one or more comment strings.  It is
+       * dropped during unmemoization.  */
+      if (!SCM_ISYMP (expr))
+        {
+          um_expr = unmemoize_expression (expr, env);
+          r_result = scm_cons (um_expr, r_result);
+        }
     }
   um_expr = unmemoize_expression (expr_idx, env);
   if (!SCM_NULLP (r_result))