X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/blobdiff_plain/ad303446f43c0029e989a8a3d17c4936965d2c43..7dca21e9e346a9793fa455e55111085e1174c44c:/src/method-aggregate.lisp diff --git a/src/method-aggregate.lisp b/src/method-aggregate.lisp index c8791af..eeea9df 100644 --- a/src/method-aggregate.lisp +++ b/src/method-aggregate.lisp @@ -133,7 +133,7 @@ (defmethod shared-initialize :before ;; Check that we've been given a method combination and make sure it ;; actually exists. (unless comb - (error "The `combination' property is required.")) + (error "The `combination' property is required")) (unless (some (lambda (method) (let* ((specs (method-specializers method)) (message-spec (car specs)) @@ -145,12 +145,12 @@ (defmethod shared-initialize :before comb)))) (generic-function-methods #'compute-aggregating-message-kernel)) - (error "Unknown method combination `~(~A~)'." comb)) + (error "Unknown method combination `~(~A~)'" comb)) (setf combination comb) ;; Make sure the ordering is actually valid. (unless (member most-specific '(:first :last)) - (error "The `most_specific' property must be `first' or `last'.")) + (error "The `most_specific' property must be `first' or `last'")) ;; Set up the function which will compute the kernel. (let ((magic (cons nil nil)) @@ -185,12 +185,8 @@ (defmethod check-method-type (let ((wanted (aggregating-message-method-return-type message (sod-message-combination message))) (msgtype (sod-message-type message))) - (unless (c-type-equal-p (c-type-subtype type) wanted) - (error "Method return type ~A doesn't match message ~A" - (c-type-subtype msgtype) (c-type-subtype type))) - (unless (argument-lists-compatible-p (c-function-arguments msgtype) - (c-function-arguments type)) - (error "Method arguments ~A don't match message ~A" type msgtype)))) + (check-method-return-type type wanted) + (check-method-argument-lists type msgtype))) ;;;-------------------------------------------------------------------------- ;;; Utilities. @@ -287,7 +283,7 @@ (defmacro define-aggregating-method-combination (unless (c-type-equal-p (c-type-subtype ,type) ,want-type) (error "Messages with `~(~A~)' combination ~ - must return `~A'." + must return `~A'" ,combvar ,want-type))) (call-next-method)))) @@ -379,7 +375,7 @@ (define-aggregating-method-combination :min ((acc val) :codegen codegen) :methods (lambda (invoke) (funcall invoke val) (emit-inst codegen (make-if-inst (format nil "~A > ~A" acc val) - (make-set-inst acc val) nil)))) + (make-set-inst acc val))))) (define-aggregating-method-combination :max ((acc val) :codegen codegen) :first-method (lambda (invoke) @@ -388,7 +384,7 @@ (define-aggregating-method-combination :max ((acc val) :codegen codegen) :methods (lambda (invoke) (funcall invoke val) (emit-inst codegen (make-if-inst (format nil "~A < ~A" acc val) - (make-set-inst acc val) nil)))) + (make-set-inst acc val))))) (define-aggregating-method-combination :and ((ret) :codegen codegen) :around (lambda (body) @@ -399,7 +395,7 @@ (define-aggregating-method-combination :and ((ret) :codegen codegen) :methods (lambda (invoke) (funcall invoke ret) (emit-inst codegen (make-if-inst (format nil "!~A" ret) - (make-break-inst) nil)))) + (make-break-inst))))) (define-aggregating-method-combination :or ((ret) :codegen codegen) :around (lambda (body) @@ -409,7 +405,7 @@ (define-aggregating-method-combination :or ((ret) :codegen codegen) (make-do-while-inst (codegen-pop-block codegen) 0))) :methods (lambda (invoke) (funcall invoke ret) - (emit-inst codegen (make-if-inst ret (make-break-inst) nil)))) + (emit-inst codegen (make-if-inst ret (make-break-inst))))) ;;;-------------------------------------------------------------------------- ;;; A customizable aggregating method combination.