src/method-proto.lisp: Fix varargs trampoline method construction.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 30 Aug 2015 09:58:38 +0000 (10:58 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 6 Sep 2015 14:17:47 +0000 (15:17 +0100)
The extra `ap' argument comes at the front, not the end.  Trim the final
ellipsis instead of (wrongly) trying to convert it.

src/method-proto.lisp

index 51bd1a3..17db6e9 100644 (file)
   (let* ((message (codegen-message codegen))
         (message-type (sod-message-type message))
         (return-type (c-type-subtype message-type))
-        (arguments (mapcar (lambda (arg)
-                             (if (eq (argument-name arg) *sod-ap*)
-                                 (make-argument *sod-master-ap*
-                                                (c-type va-list))
-                                 arg))
-                           (sod-message-no-varargs-tail message))))
+        (raw-args (sod-message-argument-tail message))
+        (arguments (if (varargs-message-p message)
+                       (cons (make-argument *sod-master-ap*
+                                            (c-type va-list))
+                             (butlast raw-args))
+                       raw-args)))
     (codegen-push codegen)
     (ensure-ilayout-var codegen super)
     (funcall body (codegen-target codegen))