New special form: labels
authorDavid Vázquez <davazp@gmail.com>
Thu, 7 Feb 2013 22:58:07 +0000 (23:58 +0100)
committerDavid Vázquez <davazp@gmail.com>
Thu, 7 Feb 2013 22:58:07 +0000 (23:58 +0100)
ecmalisp.lisp

index d6ba178..62fe386 100644 (file)
               (indent body))
             "})(" (join cfuncs ",") ")")))
 
+(define-compilation labels (definitions &rest body)
+  (let* ((fnames (mapcar #'car definitions))
+         (fbody  (mapcar #'cdr definitions))
+        (*environment*
+          (extend-lexenv (mapcar #'make-function-binding fnames)
+                         *environment*
+                         'function))
+         (cfuncs (mapcar #'compile-function-definition fbody)))
+    (concat "(function(){" *newline*
+           (join (mapcar (lambda (func)
+                           ())
+                         definitions))
+            (let ((body (ls-compile-block body t)))
+              (indent body))
+            "})")))
+
 
 
 (defvar *compiling-file* nil)