summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-11-08 14:19:41 +0100
committerAndy Wingo <wingo@pobox.com>2013-11-08 14:19:41 +0100
commit873422952847a458f5a236ee8d73e17963f0d58e (patch)
tree5c924d44b2a0191870092dadb5520e110b2f7cd4
parent9f309e2cd9ec78408d2b0df77c46d44f7bddb368 (diff)
downloadguile-wip-rtl-halloween.tar.gz
Fix program-minimum-arity to work better with case-lambda.wip-rtl-halloween
* module/system/vm/debug.scm (program-minimum-arity): Be more precise with case-lambdas.
-rw-r--r--module/system/vm/debug.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/module/system/vm/debug.scm b/module/system/vm/debug.scm
index 09bc16113..af99a54d9 100644
--- a/module/system/vm/debug.scm
+++ b/module/system/vm/debug.scm
@@ -400,7 +400,17 @@ section of the ELF image. Returns an ELF symbol, or @code{#f}."
(let* ((base (elf-section-offset sec))
(first (find-first-arity context base addr)))
(if (arity-is-case-lambda? first)
- (list 0 0 #t) ;; FIXME: be more precise.
+ (let ((arities (read-sub-arities context base
+ (arity-header-offset first))))
+ (and (pair? arities)
+ (list (apply min (map arity-nreq arities))
+ 0
+ (or-map (lambda (arity)
+ (or (positive? (arity-nopt arity))
+ (arity-has-rest? arity)
+ (arity-has-keyword-args? arity)
+ (arity-allow-other-keys? arity)))
+ arities))))
(list (arity-nreq first)
(arity-nopt first)
(arity-has-rest? first)))))))