mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 12:20:26 +02:00
(apropos-fold, submodules, apropos): Be careful not
to access unbound variables.
This commit is contained in:
parent
094a67bb4c
commit
aef9dd6536
1 changed files with 11 additions and 7 deletions
|
@ -257,12 +257,14 @@ where OPTIONSET is one of debug, read, eval, print
|
||||||
(display name)
|
(display name)
|
||||||
(display ": ")
|
(display ": ")
|
||||||
(display (car x))
|
(display (car x))
|
||||||
(cond ((procedure? (variable-ref (cdr x)))
|
(cond ((variable-bound? (cdr x))
|
||||||
|
(let ((val (variable-ref (cdr x))))
|
||||||
|
(cond ((or (procedure? val) value)
|
||||||
|
(display separator)
|
||||||
|
(display val)))))
|
||||||
|
(else
|
||||||
(display separator)
|
(display separator)
|
||||||
(display (variable-ref (cdr x))))
|
(display "(unbound)")))
|
||||||
(value
|
|
||||||
(display separator)
|
|
||||||
(display (variable-ref (cdr x)))))
|
|
||||||
(if (and shadow
|
(if (and shadow
|
||||||
(not (eq? (module-ref module
|
(not (eq? (module-ref module
|
||||||
(car x))
|
(car x))
|
||||||
|
@ -313,7 +315,9 @@ Fourth arg FOLDER is one of
|
||||||
data)))
|
data)))
|
||||||
(module-filter
|
(module-filter
|
||||||
(lambda (name var data)
|
(lambda (name var data)
|
||||||
(obarray-filter name (variable-ref var) data))))
|
(if (variable-bound? var)
|
||||||
|
(obarray-filter name (variable-ref var) data)
|
||||||
|
data))))
|
||||||
(cond (module (hash-fold module-filter
|
(cond (module (hash-fold module-filter
|
||||||
data
|
data
|
||||||
(module-obarray module)))
|
(module-obarray module)))
|
||||||
|
@ -352,7 +356,7 @@ It is an image under the mapping EXTRACT."
|
||||||
|
|
||||||
(define (submodules m)
|
(define (submodules m)
|
||||||
(hash-fold (lambda (name var data)
|
(hash-fold (lambda (name var data)
|
||||||
(let ((obj (variable-ref var)))
|
(let ((obj (and (variable-bound? var) (variable-ref var))))
|
||||||
(if (and (module? obj)
|
(if (and (module? obj)
|
||||||
(eq? (module-kind obj) 'directory))
|
(eq? (module-kind obj) 'directory))
|
||||||
(cons obj data)
|
(cons obj data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue