]> asedeno.scripts.mit.edu Git - cl-protobufs.git/commitdiff
D'oh, forgot to initialize nullable and sequence slots to nil
authorScott McKay <swm@google.com>
Mon, 2 Apr 2012 20:59:44 +0000 (20:59 +0000)
committerScott McKay <swm@google.com>
Mon, 2 Apr 2012 20:59:44 +0000 (20:59 +0000)
git-svn-id: http://svn.internal.itasoftware.com/svn/ita/branches/qres/swm/borgify-1/qres/lisp/quux/protobufs@537223 f8382938-511b-0410-9cdd-bb47b084005c

define-proto.lisp

index a2ad3e19d916ac56ca81e01ec35be567f42029fd..045a8d8bab65eca0b0b78fd0884dc445c12f3863 100644 (file)
                    (collect-slot `(,slot :type ,type
                                          :accessor ,accessor
                                          :initarg ,(kintern (symbol-name slot))
-                                         ,@(and default (list :initform default)))))
+                                         ,@(cond ((and (null default) (eq reqd :repeated))
+                                                  `(:initform ()))
+                                                 ((and (null default) (eq reqd :optional))
+                                                  `(:initform nil))
+                                                 (default
+                                                   `(:initform ,default))))))
                  (collect-field `(make-instance 'protobuf-field
                                    :name  ,(or name (slot-name->proto slot))
                                    :type  ,ptype