This commit is contained in:
Justin Ethier 2020-05-18 19:11:11 -04:00
parent cf6ccc25d9
commit d312b0598c
3 changed files with 5 additions and 4 deletions

View file

@ -1001,10 +1001,9 @@ if (acc) {
(not (assoc 'if renamed)))
;; Add a failsafe here in case macro expansion added more
;; incomplete if expressions.
;; FUTURE: append the empty (unprinted) value instead of #f
(let ((new-ast (if (if-else? ast)
`(if ,@(map (lambda (a) (convert a renamed)) (cdr ast)))
(convert (append ast '(#f)) renamed))))
(convert (append ast (list (void))) renamed))))
(cond
;; Optimization - convert (if (not a) b c) into (if a c b)
((and (app? (if->condition new-ast))

View file

@ -172,6 +172,7 @@
(or (integer? exp)
(real? exp)
(complex? exp)
(eq? (void) exp) ;; Poor man's (void?)
(string? exp)
(vector? exp)
(bytevector? exp)

View file

@ -116,6 +116,7 @@
(define (self-evaluating? exp)
(cond ((number? exp) #t)
((boolean? exp) #t)
((eq? (void) exp) #t) ;; Poor man's (void?)
((string? exp) #t)
((vector? exp) #t)
((bytevector? exp) #t)
@ -159,7 +160,7 @@
(define (if-alternative exp)
(if (not (null? (cdddr exp))) ;; TODO: add (not) support
(cadddr exp)
#f))
(void)))
(define (make-if predicate consequent alternative)
(list 'if predicate consequent alternative))
@ -1022,7 +1023,7 @@
;; Insert default value for missing else clause
;; FUTURE: append the empty (unprinted) value
;; instead of #f
#f)))
(void))))
((define-c? exp) exp)
((define-syntax? exp)
;(trace:info `(define-syntax ,exp))