tell a grouped for header by its shape, not by a var in it
(for ((= s 0) (< s n) (++ s)) ...) passed the check and reached cc as a call of (= s 0).
This commit is contained in:
@@ -95,10 +95,10 @@ forms, and what remains."
|
||||
`(%begin ,@(map walk-expr comments) ,form)))
|
||||
|
||||
;;; (for init test step body ...). C's parens around the header, carried
|
||||
;;; over, leave a call of a `var' in init's slot and the body in test's
|
||||
;;; over, leave all three parts in init's slot and the body in test's
|
||||
(define (check-for-header form slots)
|
||||
(cond ((and (pair? slots) (pair? (car slots)) (pair? (caar slots))
|
||||
(eq? 'var (car (caar slots))))
|
||||
(cond ((and (pair? slots) (list? (car slots)) (= 3 (length (car slots)))
|
||||
(every pair? (car slots)))
|
||||
(sex-error form "a for header is not grouped: write (for init test step body ...)"))
|
||||
((< (length slots) 3)
|
||||
(sex-error form "malformed for: write (for init test step body ...)"))))
|
||||
|
||||
Reference in New Issue
Block a user