LET
authorDavid Vázquez <davazp@gmail.com>
Sat, 29 Jun 2013 17:17:14 +0000 (19:17 +0200)
committerDavid Vázquez <davazp@gmail.com>
Sat, 29 Jun 2013 17:17:14 +0000 (19:17 +0200)
src/compiler.lisp

index af7acb6..2da9fd2 100644 (file)
          (cvalues (mapcar #'ls-compile (mapcar #'second bindings)))
          (*environment* (extend-local-env (remove-if #'special-variable-p variables)))
          (dynamic-bindings))
-    `(code "(function("
-           ,@(interleave
-              (mapcar (lambda (x)
-                        (if (special-variable-p x)
-                            (let ((v (gvarname x)))
-                              (push (cons x v) dynamic-bindings)
-                              v)
-                            (translate-variable x)))
-                      variables)
-              ",")
-           "){"
-           ,(let ((body (ls-compile-block body t t)))
-             `(code ,(let-binding-wrapper dynamic-bindings body)))
-           "})(" ,@(interleave cvalues ",") ")")))
+    `(call (function ,(mapcar (lambda (x)
+                                (if (special-variable-p x)
+                                    (let ((v (gvarname x)))
+                                      (push (cons x v) dynamic-bindings)
+                                      (make-symbol v))
+                                    (make-symbol (translate-variable x))))
+                              variables)
+                     ,(let ((body (ls-compile-block body t t)))
+                           `(code ,(let-binding-wrapper dynamic-bindings body))))
+           ,@cvalues)))
 
 
 ;;; Return the code to initialize BINDING, and push it extending the