birth: Support for cond-expand else

Birth is pretty much at a feature freeze at this point, but `cond-expand'
really was difficult to work with in certain circumstances when it didn't
even support `else'.

* build-aux/bootstrap/birth.scm (fnmap)[cond-expand]: Always expand `else'
    while dropping all others.
master
Mike Gerwitz 2017-12-11 22:24:19 -05:00
parent f18322fbe5
commit c3dec75fe7
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
1 changed files with 9 additions and 2 deletions

View File

@ -378,9 +378,16 @@
(("js:console")
(string-append "console.log(" (map sexp->es args) ")"))
;; always expands into nothing; this is just to facilitate its use
;; only expands `else' clauses; this is just to facilitate its use
;; moving forward
(("cond-expand") "")
(("cond-expand")
(join "" (map (lambda (clause)
(let ((feature (token-value (car clause)))
(body (cdr clause)))
(if (string=? feature "else")
(body->es body #f)
"")))
args)))
;; yes, there are more important things to do until we get to the
;; point where it's worth implementing proper tail calls