mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-13 23:20:32 +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))
|
(slot-set! gf 'methods (compute-new-list-of-methods gf m))
|
||||||
(let ((specializers (slot-ref m 'specializers)))
|
(let ((specializers (slot-ref m 'specializers)))
|
||||||
(slot-set! gf 'n-specialized
|
(slot-set! gf 'n-specialized
|
||||||
(let ((n-specialized (slot-ref gf 'n-specialized)))
|
(max (length* specializers)
|
||||||
;; The magnitude indicates # specializers.
|
(slot-ref gf 'n-specialized))))
|
||||||
;; 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)))))
|
|
||||||
)))
|
|
||||||
(%invalidate-method-cache! gf)
|
(%invalidate-method-cache! gf)
|
||||||
(add-method-in-classes! m)
|
(add-method-in-classes! m)
|
||||||
*unspecified*)
|
*unspecified*)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue