diff --git a/semen.scm b/semen.scm index 7d3cfc85..915b2a35 100644 --- a/semen.scm +++ b/semen.scm @@ -425,12 +425,16 @@ (sex-error form "ops needs a type name" form)) (let* ((methods (map (lambda (m) (register-op type m)) (cddr form))) (fns (remove comment-form? methods)) + ;; the signatures too, which a call's receiver is fitted to + (protos (map (lambda (m) (process-fn (sex-fn-prototype m) (list))) fns)) (bodies (map (lambda (m) (if (comment-form? m) (list m) (process-fn m (list)))) methods)) - (early (filter (lambda (m) (called-before? m methods bodies)) fns))) - (append (append-map identity (reverse bodies)) - (fold (lambda (m acc) (process-fn (sex-fn-prototype m) acc)) acc early))))) + (early (filter-map (lambda (m proto) + (and (called-before? m methods bodies) proto)) + fns protos))) + (append (concatenate (reverse bodies)) + (fold append acc early))))) ;;; The method's fn form, renamed to vec2/length, once it is registered ;;; under `length'; a comment is passed along @@ -447,8 +451,6 @@ (let* ((qualified (qualify-op type name)) (renamed (rename-fn form qualified))) (add-method! type name qualified) - ;; its signature too, which a call's receiver is fitted to - (process-fn (sex-fn-prototype renamed) (list)) renamed))))) ;;; Does a body written above METHOD call it?