src/: Wrap functionish bodies in an appropriately named `block'.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 21 Oct 2015 23:46:28 +0000 (00:46 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 7 Nov 2015 14:12:22 +0000 (14:12 +0000)
src/c-types-proto.lisp
src/codegen-proto.lisp
src/module-proto.lisp
src/optparse.lisp
src/parser/parser-proto.lisp
src/utilities.lisp

index edadd64..7134962 100644 (file)
           ,@doc
           (destructuring-bind ,bvl ,tail
             ,@decls
-            ,@body))
+            (block ,name ,@body)))
         ',name))))
 
 (export 'c-type-alias)
index a96c6ff..42175a5 100644 (file)
               (print-unreadable-object (,inst-var ,streamvar :type t)
                 (format stream "~@<~@{~S ~@_~S~^ ~_~}~:>"
                         ,@(mappend #'list keys args)))
-              (progn ,@body))))
+              (block ,code ,@body))))
        ,@(and export `((export '(,class-name ,constructor-name
                                 ,@(mapcar (lambda (arg)
                                             (symbolicate 'inst- arg))
index 9c7fcaf..dcf8d7c 100644 (file)
 
    When `clear-the-decks' is called, the BODY will be evaluated as a progn.
    The relative order of `clear-the-decks' operations is unspecified."
-  `(add-clear-the-decks-function ',name (lambda () ,@body)))
+  (multiple-value-bind (docs decls body) (parse-body body)
+    `(add-clear-the-decks-function ',name (lambda ()
+                                           ,@docs ,@decls
+                                           (block ,name ,@body)))))
 
 (export 'clear-the-decks)
 (defun clear-the-decks ()
index a2ac290..9607df7 100644 (file)
           ,@docs ,@decls
           (declare (ignorable ,arg))
           (with-locatives ,var
-            ,@body))
+            (block ,name ,@body)))
         ',name))))
 
 (defun parse-c-integer (string &key radix (start 0) end)
 
    Option macros should produce a list of expressions producing one option
    structure each."
-  `(progn
-     (setf (get ',name 'optmacro) (lambda ,args ,@body))
-     ',name))
+  (multiple-value-bind (docs decls body) (parse-body body)
+    `(progn
+       (setf (get ',name 'optmacro) (lambda ,args
+                                     ,@docs ,@decls
+                                     (block ,name ,@body)))
+       ',name)))
 
 (export 'parse-option-form)
 (eval-when (:compile-toplevel :load-toplevel :execute)
index 4bd1ae4..4c04208 100644 (file)
             ((,context ,ctxclass) (,head (eql ',name)) ,tail)
           ,@doc
           (declare (ignorable ,context))
-          (block ,name
-            (destructuring-bind ,bvl ,tail
-              ,@decls
-              ,@body)))))))
+          (destructuring-bind ,bvl ,tail
+            ,@decls
+            (block ,name ,@body)))))))
 
 (export '(with-parser-context parse))
 (defmacro with-parser-context ((class &rest initargs) &body body)
    If a parser with the given TAG is already attached to SYMBOL then the new
    parser replaces the old one; otherwise it is added to the collection."
 
-  `(pluggable-parser-add ',symbol ',tag (lambda ,bvl ,@body)))
+  (multiple-value-bind (docs decls body) (parse-body body)
+    `(pluggable-parser-add ',symbol ',tag
+                          (lambda ,bvl
+                            ,@docs ,@decls
+                            (block ,symbol ,@body)))))
 
 ;;;--------------------------------------------------------------------------
 ;;; Rewindable parser context protocol.
index 023fc60..dfe2454 100644 (file)
           (,classvar (,instance ,class) (,slotvar (eql ',slot)))
         ,@docs ,@decls
         (declare (ignore ,classvar))
-        (setf (slot-value ,instance ',slot) (progn ,@body))))))
+        (setf (slot-value ,instance ',slot) (block ,slot ,@body))))))
 
 ;;;----- That's all, folks --------------------------------------------------