mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-29 16:30:19 +02:00
* session.scm (make-fold-modules): Detect circular references in
module graph. (Thanks to Matthias Köppe.)
This commit is contained in:
parent
5bc9cbd2d8
commit
9aec475196
1 changed files with 12 additions and 6 deletions
|
@ -264,12 +264,18 @@ The forest traversed is the image of the forest generated by root
|
|||
modules returned by INIT-THUNK and the generator TRAVERSE.
|
||||
It is an image under the mapping EXTRACT."
|
||||
(lambda (fold-module init)
|
||||
(let* ((table (make-hash-table 31))
|
||||
(first? (lambda (obj)
|
||||
(and (not (hash-ref table obj))
|
||||
(hash-create-handle! table obj #t)))))
|
||||
(let rec ((data init)
|
||||
(modules (init-thunk)))
|
||||
(do ((modules modules (cdr modules))
|
||||
(data data (rec (fold-module (extract (car modules)) data)
|
||||
(traverse (car modules)))))
|
||||
((null? modules) data)))))
|
||||
(data data (if (first? (car modules))
|
||||
(rec (fold-module (extract (car modules)) data)
|
||||
(traverse (car modules)))
|
||||
data)))
|
||||
((null? modules) data))))))
|
||||
|
||||
(define-public (apropos-fold-accessible module)
|
||||
(make-fold-modules (lambda () (list module))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue