summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-11 20:56:58 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-11 20:56:58 +0100
commit3bb2a98e05b21cfd44aeb766eedb97e84408cc63 (patch)
tree3fad79851c0c91fd8d88c6619c6710c6a3287dbf
parent475fab304e55e50b159b26ac4cf68a66cfceb5ff (diff)
downloadgeiser-guile-3bb2a98e05b21cfd44aeb766eedb97e84408cc63.tar.gz
geiser-guile-3bb2a98e05b21cfd44aeb766eedb97e84408cc63.tar.bz2
Don't let (ice-9 history) confuse the evaluator.
-rw-r--r--geiser/introspection.scm31
1 files changed, 20 insertions, 11 deletions
diff --git a/geiser/introspection.scm b/geiser/introspection.scm
index eb5dc6c..6ac3f69 100644
--- a/geiser/introspection.scm
+++ b/geiser/introspection.scm
@@ -30,15 +30,17 @@
#:use-module (ice-9 session)
#:use-module (srfi srfi-1))
-(define (proc-args proc)
- (let ((proc (and (symbol? proc)
- (module-bound? (current-module) proc)
- (eval proc (current-module)))))
- (cond ((not proc) #f)
- ((program? proc) (program-args proc))
- ((procedure? proc) (procedure-args proc))
- ((macro? proc) (macro-args proc))
- (else #f))))
+(define (resolve-symbol sym)
+ (and (symbol? sym)
+ (module-bound? (current-module) sym)
+ (eval sym (current-module))))
+
+(define (obj-args obj)
+ (cond ((not obj) #f)
+ ((program? obj) (program-args obj))
+ ((procedure? obj) (procedure-args obj))
+ ((macro? obj) (macro-args obj))
+ (else #f)))
(define (program-args program)
(let* ((arity (program-arity program))
@@ -61,10 +63,9 @@
(and (not (null? env)) env))))
(define (macro-args macro)
- ;; check if return value is a procedure
(let ((prog (macro-transformer macro)))
(if prog
- (program-args prog)
+ (obj-args prog)
(format-args '(...) #f #f))))
(define (format-args args opt module)
@@ -72,9 +73,17 @@
(cons 'optional (or opt '()))
(cons 'module (if module (module-name module) '()))))
+(define (proc-args proc)
+ (obj-args (resolve-symbol proc)))
+
(define (completions prefix)
(sort! (map symbol->string
(apropos-internal (string-append "^" prefix)))
string<?))
+(define (proc-location proc)
+ (let ((prog (resolve-symbol proc)))
+ (and prog
+ (program-source ))))
+
;;; introspection.scm ends here