mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
set names of functions defined at the toplevel from `eval'
* module/ice-9/eval.scm (primitive-eval): Set the name of toplevel-defined functions.
This commit is contained in:
parent
f3cf9421cb
commit
ee15aa46e3
2 changed files with 10 additions and 2 deletions
|
@ -425,7 +425,10 @@
|
||||||
(memoize-variable-access! exp #f))))
|
(memoize-variable-access! exp #f))))
|
||||||
|
|
||||||
(('define (name . x))
|
(('define (name . x))
|
||||||
(define! name (eval x env)))
|
(let ((x (eval x env)))
|
||||||
|
(if (and (procedure? x) (not (procedure-property x 'name)))
|
||||||
|
(set-procedure-property! x 'name name))
|
||||||
|
(define! name x)))
|
||||||
|
|
||||||
(('toplevel-set! (var-or-sym . x))
|
(('toplevel-set! (var-or-sym . x))
|
||||||
(variable-set!
|
(variable-set!
|
||||||
|
|
|
@ -26,7 +26,12 @@
|
||||||
(eq? 'display (procedure-name display)))
|
(eq? 'display (procedure-name display)))
|
||||||
|
|
||||||
(pass-if "gsubr"
|
(pass-if "gsubr"
|
||||||
(eq? 'hashq-ref (procedure-name hashq-ref))))
|
(eq? 'hashq-ref (procedure-name hashq-ref)))
|
||||||
|
|
||||||
|
(pass-if "from eval"
|
||||||
|
(eq? 'foobar (procedure-name
|
||||||
|
(eval '(begin (define (foobar) #t) foobar)
|
||||||
|
(current-module))))))
|
||||||
|
|
||||||
|
|
||||||
(with-test-prefix "procedure-arity"
|
(with-test-prefix "procedure-arity"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue