mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 22:31:12 +02:00
* goops.scm (internal-add-method!): Set n-specialized of a generic
function to the number of specializers regardless if it has rest args or not.
This commit is contained in:
parent
4ea6a43186
commit
81211c73cc
1 changed files with 2 additions and 15 deletions
|
@ -531,21 +531,8 @@
|
|||
(slot-set! gf 'methods (compute-new-list-of-methods gf m))
|
||||
(let ((specializers (slot-ref m 'specializers)))
|
||||
(slot-set! gf 'n-specialized
|
||||
(let ((n-specialized (slot-ref gf 'n-specialized)))
|
||||
;; The magnitude indicates # specializers.
|
||||
;; A negative value indicates that at least one
|
||||
;; method has rest arguments. (Ugly but effective
|
||||
;; space optimization saving one slot in GF objects.)
|
||||
(cond ((negative? n-specialized)
|
||||
(- (max (+ 1 (length* specializers))
|
||||
(abs n-specialized))))
|
||||
((list? specializers)
|
||||
(max (length specializers)
|
||||
n-specialized))
|
||||
(else
|
||||
(- (+ 1 (max (length* specializers)
|
||||
n-specialized)))))
|
||||
)))
|
||||
(max (length* specializers)
|
||||
(slot-ref gf 'n-specialized))))
|
||||
(%invalidate-method-cache! gf)
|
||||
(add-method-in-classes! m)
|
||||
*unspecified*)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue