guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, elisp, updated. release_1-9-0-66-g570c


From: Daniel Kraft
Subject: [Guile-commits] GNU Guile branch, elisp, updated. release_1-9-0-66-g570c12a
Date: Sat, 18 Jul 2009 15:58:37 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=570c12aca7dcab2adb60bd56319dcfc3e0d6379b

The branch, elisp has been updated
       via  570c12aca7dcab2adb60bd56319dcfc3e0d6379b (commit)
      from  9b5ff6a6e1da0d2c20b44aa12c92a68a414e8f70 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 570c12aca7dcab2adb60bd56319dcfc3e0d6379b
Author: Daniel Kraft <address@hidden>
Date:   Sat Jul 18 17:58:01 2009 +0200

    Return correct value for setq form.
    
    * module/language/elisp/compile-tree-il.scm: Fix implementation of setq.
    * test-suite/tests/elisp-compiler.test: Check for value of setq form.

-----------------------------------------------------------------------

Summary of changes:
 module/language/elisp/compile-tree-il.scm |   30 +++++++++++++++++-----------
 test-suite/tests/elisp-compiler.test      |    9 ++++---
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/module/language/elisp/compile-tree-il.scm 
b/module/language/elisp/compile-tree-il.scm
index d09bbbc..815f5f6 100644
--- a/module/language/elisp/compile-tree-il.scm
+++ b/module/language/elisp/compile-tree-il.scm
@@ -464,20 +464,26 @@
     ; Build a set form for possibly multiple values.  The code is not 
formulated
     ; tail recursive because it is clearer this way and large lists of symbol
     ; expression pairs are very unlikely.
-    ((setq . ,args)
+    ((setq . ,args) (guard (not (null? args)))
      (make-sequence loc
        (let iterate ((tail args))
-         (if (null? tail)
-           (list (make-void loc))
-           (let ((sym (car tail))
-                 (tailtail (cdr tail)))
-             (if (not (symbol? sym))
-               (report-error loc "expected symbol in setq")
-               (if (null? tailtail)
-                 (report-error loc "missing value for symbol in setq" sym)
-                 (let* ((val (compile-expr (car tailtail)))
-                        (op (set-variable! loc sym value-slot val)))
-                   (cons op (iterate (cdr tailtail)))))))))))
+         (let ((sym (car tail))
+               (tailtail (cdr tail)))
+           (if (not (symbol? sym))
+             (report-error loc "expected symbol in setq")
+             (if (null? tailtail)
+               (report-error loc "missing value for symbol in setq" sym)
+               (let* ((val (compile-expr (car tailtail)))
+                      (op (set-variable! loc sym value-slot val)))
+                 (if (null? (cdr tailtail))
+                   (let* ((temp (gensym))
+                          (ref (make-lexical-ref loc temp temp)))
+                     (list (make-let loc `(,temp) `(,temp) `(,val)
+                             (make-sequence loc
+                               (list (set-variable! loc sym value-slot ref)
+                                     ref)))))
+                   (cons (set-variable! loc sym value-slot val)
+                         (iterate (cdr tailtail)))))))))))
 
     ; Let is done with a single call to with-fluids* binding them locally to 
new
     ; values.
diff --git a/test-suite/tests/elisp-compiler.test 
b/test-suite/tests/elisp-compiler.test
index b77cbd3..1705a97 100644
--- a/test-suite/tests/elisp-compiler.test
+++ b/test-suite/tests/elisp-compiler.test
@@ -112,10 +112,11 @@
   ; TODO: Check for variable-void error
 
   (pass-if-equal "setq and reference" 6
-    (progn (setq a 1
-                 b 2
-                 c 3)
-           (+ a b c))))
+    (progn (setq a 1 b 2 c 3)
+           (+ a b c)))
+
+  (pass-if-equal "setq value" 2
+    (progn (setq a 1 b 2))))
 
 (with-test-prefix/compile "Let and Let*"
 


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]