define an empty lambda as an empty function

A lifted function with no body was a declaration of one, and nothing
defined it, so the program did not link.
This commit is contained in:
2026-10-18 22:02:55 +03:00
parent 5059f811e0
commit 8dd7a975a0
5 changed files with 45 additions and 10 deletions

View File

@@ -520,7 +520,16 @@ forms, and what remains."
,(atom-to-fmt-c name)
,(walk-arglist args)
.
,(walk-body maybe-body)))))
,(let ((body (walk-body maybe-body)))
;; one that is empty blocks, and where they were, is nothing:
;; what a lifted empty lambda is given to be a definition
(if (every (lambda (s) (equal? s '(%block-begin)))
(remove line-directive? body))
(list)
body))))))
(define (line-directive? form)
(and (pair? form) (eq? (car form) '%line)))
;;; The type of one parameter
(define (arg-type arg)