From b51333624dda1756ce3d5510a03df460d84bdd2d Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 17 Nov 2019 16:35:53 -0800 Subject: [PATCH] Fix bug in parsing of cond-expand. --- src/runtime/mit-macros.scm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/runtime/mit-macros.scm b/src/runtime/mit-macros.scm index 72eed2cb1..0f4c88076 100644 --- a/src/runtime/mit-macros.scm +++ b/src/runtime/mit-macros.scm @@ -708,10 +708,12 @@ USA. (scons-rule `((value id=?) (* (subform (cons ,(feature-requirement-pattern) (* any)))) - (opt (subform (cons (keep-if id=? else) - (* any))))) - (lambda (id=? clauses) - (apply scons-begin (evaluate-cond-expand id=? clauses))))))) + (or (subform (ignore-if id=? else) + (* any)) + (value '()))) + (lambda (id=? clauses else-forms) + (apply scons-begin + (evaluate-cond-expand id=? clauses else-forms))))))) (define (feature-requirement-pattern) (spar-pattern-fixed-point @@ -729,15 +731,14 @@ USA. (define (library-name-pattern) `(subform (* (or symbol ,exact-nonnegative-integer?)))) -(define (evaluate-cond-expand id=? clauses) +(define (evaluate-cond-expand id=? clauses else-forms) (let ((clause (find (lambda (clause) - (or (id=? 'else (car clause)) - (evaluate-feature-requirement id=? (car clause)))) + (evaluate-feature-requirement id=? (car clause))) clauses))) (if clause (cdr clause) - '()))) + else-forms))) (define (evaluate-feature-requirement id=? feature-requirement) -- 2.25.1