[uim-commit] r1076 - in branches/r5rs/sigscheme: . test

kzk at freedesktop.org kzk at freedesktop.org
Sat Jul 30 15:31:43 EST 2005


Author: kzk
Date: 2005-07-29 22:31:40 -0700 (Fri, 29 Jul 2005)
New Revision: 1076

Modified:
   branches/r5rs/sigscheme/eval.c
   branches/r5rs/sigscheme/test/test-define.scm
Log:
* sigscheme/test/test-define.scm
  - add test cases for null arg
* sigscheme/eval.c
  - (ScmOp_eval, ScmOp_apply): when closure's argnument is NIL,
    no need to extend environment


Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c	2005-07-30 04:57:14 UTC (rev 1075)
+++ branches/r5rs/sigscheme/eval.c	2005-07-30 05:31:40 UTC (rev 1076)
@@ -384,7 +384,7 @@
 							 Scm_NewCons(map_eval(SCM_CDR(obj), env),
 								     SCM_NIL),
 							 SCM_CLOSURE_ENV(tmp));
-			    } else if (SCM_NULLP(arg) || SCM_CONSP(arg)) {
+			    } else if (SCM_CONSP(arg)) {
 				/*
 				 * (2) : (<variable1> <variable2> ...)
 				 * (3) : (<variable1> <variable2> ... <variable n-1> . <variable n>)
@@ -394,6 +394,11 @@
 				env = extend_environment(arg,
 							 map_eval(SCM_CDR(obj), env),
 							 SCM_CLOSURE_ENV(tmp));
+			    } else if (SCM_NULLP(arg)) {
+				/*
+				 * (2') : <variable> is '()
+				 */
+				env = SCM_CLOSURE_ENV(tmp);
 			    } else {
 				SigScm_ErrorObj("lambda : bad syntax with ", arg);
 			    }
@@ -559,7 +564,7 @@
 		    env = extend_environment(Scm_NewCons(args, SCM_NIL),
 					     Scm_NewCons(obj, SCM_NIL),
 					     SCM_CLOSURE_ENV(proc));
-		} else if (SCM_NULLP(args) || SCM_CONSP(args)) {
+		} else if (SCM_CONSP(args)) {
 		    /*
 		     * (2) : (<variable1> <variable2> ...)
 		     * (3) : (<variable1> <variable2> ... <variable n-1> . <variable n>)
@@ -569,6 +574,11 @@
 		    env = extend_environment(args,
 					     obj,
 					     SCM_CLOSURE_ENV(proc));
+		} else if (SCM_NULLP(args)) {
+		    /*
+		     * (2') : <variable> is '()
+		     */
+		    env = SCM_CLOSURE_ENV(proc);
 		} else {
 		    SigScm_ErrorObj("lambda : bad syntax with ", args);
 		}

Modified: branches/r5rs/sigscheme/test/test-define.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-define.scm	2005-07-30 04:57:14 UTC (rev 1075)
+++ branches/r5rs/sigscheme/test/test-define.scm	2005-07-30 05:31:40 UTC (rev 1076)
@@ -19,6 +19,10 @@
     "DEADBEEF" x))
 (assert-eq? "func define" 10 (what2? 10))
 
+(define (nullarg)
+  "nullarg")
+(assert-equal? "nullarg test" "nullarg" (nullarg))
+
 (define (add x y)
   (+ x y))
 (assert-eq? "func define" 10 (add 2 8))



More information about the uim-commit mailing list