chiark / gitweb /
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 edadd64f5ebac16013e967a563218e6872518b79..713496211a154010d3c24c3ecc04d299678c1881 100644 (file)
@@ -181,7 +181,7 @@      (defmethod expand-c-type-form ((,head (eql ',name)) ,tail)
           ,@doc
           (destructuring-bind ,bvl ,tail
             ,@decls
-            ,@body))
+            (block ,name ,@body)))
         ',name))))
 
 (export 'c-type-alias)
index a96c6ffa82e9e3fbf70ca0c650b12429c9ce307d..42175a5e208b06b568221b0d67aecdbe35a6df52 100644 (file)
@@ -154,7 +154,7 @@        (defmethod print-object ((,inst-var ,class-name) ,streamvar)
               (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 9c7fcaf17ddc2350fda8f5a89aeb98868f05ec3a..dcf8d7c57b3992300edcb29beda7e524dcf05c51 100644 (file)
@@ -84,7 +84,10 @@ (defmacro define-clear-the-decks (name &body body)
 
    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 a2ac2906ecd96b2b7379ed8a72b13cf044119121..9607df7fded231fea6d94095e9f2fbf6e728d16a 100644 (file)
@@ -536,7 +536,7 @@      (defun ,func (,var ,arg ,@args)
           ,@docs ,@decls
           (declare (ignorable ,arg))
           (with-locatives ,var
-            ,@body))
+            (block ,name ,@body)))
         ',name))))
 
 (defun parse-c-integer (string &key radix (start 0) end)
@@ -727,9 +727,12 @@ (defmacro defoptmacro (name args &body body)
 
    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 4bd1ae4a9d0e5993b8ddd43a8a131d6af131a7a2..4c04208d5c513575163b3f6a831445f4dba140c8 100644 (file)
@@ -152,10 +152,9 @@ (defmacro defparse (name bvl &body body)
             ((,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)
@@ -573,7 +572,11 @@ (defmacro define-pluggable-parser (symbol tag (&rest bvl) &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 023fc6066304feefeda7a0d88359a66f1671a864..dfe2454e9580255c19f20a4c2fd98ada4a04839e 100644 (file)
@@ -825,6 +825,6 @@ (defmacro define-on-demand-slot (class slot (instance) &body body)
           (,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 --------------------------------------------------