1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-14 15:40:19 +02:00

fix bug in goops' method cache with rest args

* module/oop/goops/compile.scm (code-table-lookup): Fix a tricky little
  bug!

* test-suite/tests/goops.test ("the method cache"): Add a wee test.
This commit is contained in:
Andy Wingo 2009-06-06 14:07:29 +02:00
parent 12798872ff
commit 4bcc952d45
2 changed files with 19 additions and 5 deletions

View file

@ -34,11 +34,12 @@
(define code-table-lookup
(letrec ((check-entry (lambda (entry types)
(if (null? types)
(and (not (struct? (car entry)))
entry)
(and (eq? (car entry) (car types))
(check-entry (cdr entry) (cdr types)))))))
(cond
((not (pair? entry)) (and (null? types) entry))
((null? types) #f)
(else
(and (eq? (car entry) (car types))
(check-entry (cdr entry) (cdr types))))))))
(lambda (code-table types)
(cond ((null? code-table) #f)
((check-entry (car code-table) types))