(define (foo ...) ...) actually gives the lambda a name
* module/language/scheme/translate.scm (primitive-syntax-table): In forms like (define x y) where y is a lambda, and the lambda has no name yet, set the lambda's name in its metadata.
This commit is contained in:
parent
6cdcb824f0
commit
5dcf8f3555
1 changed files with 9 additions and 1 deletions
|
|
@ -147,7 +147,7 @@
|
|||
((,name ,val) (guard (symbol? name)
|
||||
(ghil-toplevel-env? (ghil-env-parent e)))
|
||||
(make-ghil-define e l (ghil-define (ghil-env-parent e) name)
|
||||
(retrans val)))
|
||||
(maybe-name-value! (retrans val) name)))
|
||||
;; (define (NAME FORMALS...) BODY...)
|
||||
(((,name . ,formals) . ,body) (guard (symbol? name))
|
||||
;; -> (define NAME (lambda FORMALS BODY...))
|
||||
|
|
@ -362,6 +362,14 @@
|
|||
(values `((documentation . ,(car body))) (cdr body)))
|
||||
(else (values '() body))))
|
||||
|
||||
(define (maybe-name-value! val name)
|
||||
(cond
|
||||
((ghil-lambda? val)
|
||||
(if (not (assq-ref (ghil-lambda-meta val) 'name))
|
||||
(set! (ghil-lambda-meta val)
|
||||
(acons 'name name (ghil-lambda-meta val))))))
|
||||
val)
|
||||
|
||||
(define (location x)
|
||||
(and (pair? x)
|
||||
(let ((props (source-properties x)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue