mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
resolve-primitives! does not primitivize local definitions
* module/language/tree-il/primitives.scm (resolve-primitives!): Don't resolve toplevels defined in the same compilation unit to primitives, as it could be that the module doesn't have those bindings yet.
This commit is contained in:
parent
58e68be4bb
commit
14b208185c
1 changed files with 15 additions and 2 deletions
|
@ -232,12 +232,25 @@
|
|||
(hashq-ref *singly-valued-primitive-table* prim))
|
||||
|
||||
(define (resolve-primitives! x mod)
|
||||
(define local-definitions
|
||||
(make-hash-table))
|
||||
|
||||
(let collect-local-definitions ((x x))
|
||||
(record-case x
|
||||
((<toplevel-define> name)
|
||||
(hashq-set! local-definitions name #t))
|
||||
((<seq> head tail)
|
||||
(collect-local-definitions head)
|
||||
(collect-local-definitions tail))
|
||||
(else #f)))
|
||||
|
||||
(post-order!
|
||||
(lambda (x)
|
||||
(record-case x
|
||||
((<toplevel-ref> src name)
|
||||
(and=> (hashq-ref *interesting-primitive-vars*
|
||||
(module-variable mod name))
|
||||
(and=> (and (not (hashq-ref local-definitions name))
|
||||
(hashq-ref *interesting-primitive-vars*
|
||||
(module-variable mod name)))
|
||||
(lambda (name) (make-primitive-ref src name))))
|
||||
((<module-ref> src mod name public?)
|
||||
;; for the moment, we're disabling primitive resolution for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue