Revert "squash! mescc: Fix switch statements' fallthrough --support mes"
This reverts commit ef4f4bb25a
.
This commit is contained in:
parent
c65ce2798b
commit
6ec2715f74
|
@ -1791,33 +1791,29 @@
|
||||||
(set! i (1+ i)))
|
(set! i (1+ i)))
|
||||||
n))))
|
n))))
|
||||||
|
|
||||||
(define (flatten-cases cases)
|
(define (flatten-cases c)
|
||||||
(define (flatten-case o cases)
|
(define (flatten-case case)
|
||||||
(let ((c (pmatch o
|
(pmatch case
|
||||||
((case ,test (case . ,body))
|
((case ,test (case . ,body))
|
||||||
(append `((case ,test (expr-stmt)))
|
(append `((case ,test (expr-stmt))) (flatten-case `(case ,@body))))
|
||||||
(flatten-case `(case ,@body))))
|
((case ,test ,casebody (case . ,body))
|
||||||
((case ,test ,case-body (case . ,body))
|
(append `((case ,test ,casebody)) (flatten-case `(case ,@body))))
|
||||||
(append `((case ,test ,case-body))
|
((default (case . ,body))
|
||||||
(flatten-case `(case ,@body))))
|
(append `((default (expr-stmt))) (flatten-case `(case ,@body))))
|
||||||
((default (case . ,body))
|
((default ,defbody (case . ,body))
|
||||||
(append `((default (expr-stmt)))
|
(append `((default ,defbody)) (flatten-case `(case ,@body))))
|
||||||
(flatten-case `(case ,@body))))
|
((case ,test (default . ,body))
|
||||||
((default ,default-body (case . ,body))
|
(append `((case ,test (expr-stmt))) (flatten-case `(default ,@body))))
|
||||||
(append `((default ,default-body))
|
((default ,rest)
|
||||||
(flatten-case `(case ,@body))))
|
(list case))
|
||||||
((case ,test (default . ,body))
|
((case ,test)
|
||||||
(append `((case ,test (expr-stmt)))
|
(list case))
|
||||||
(flatten-case `(default ,@body))))
|
((case ,test ,expr)
|
||||||
((default ,rest)
|
(list case))
|
||||||
(list o))
|
(,s (list s))))
|
||||||
((case ,test)
|
(fold (lambda (x acc) (append acc (flatten-case x))) '() c))
|
||||||
(list o))
|
|
||||||
((case ,test ,expr)
|
|
||||||
(list o))
|
|
||||||
(,s (list s)))))
|
|
||||||
(append c cases)))
|
|
||||||
(fold flatten-case '() cases))
|
|
||||||
|
|
||||||
(let* ((info (append-text info (ast->comment `(switch ,expr (compd-stmt (block-item-list (ellipsis)))))))
|
(let* ((info (append-text info (ast->comment `(switch ,expr (compd-stmt (block-item-list (ellipsis)))))))
|
||||||
(statements (flatten-cases statements))
|
(statements (flatten-cases statements))
|
||||||
|
|
Loading…
Reference in New Issue