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 1393976bfc
commit 2e2c2373df
5 changed files with 45 additions and 10 deletions

View File

@@ -511,7 +511,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)