fix r6rs let[rec]-syntax for expression positions

svn: r8982
This commit is contained in:
Matthew Flatt 2008-03-15 21:57:58 +00:00
parent 7f3c8510de
commit 788adace20
2 changed files with 47 additions and 28 deletions

View File

@ -478,6 +478,14 @@
(define-for-syntax (do-let-syntax stx rec?)
(syntax-case stx ()
[(_ ([id expr] ...) body ...)
(if (eq? 'expression (syntax-local-context))
(with-syntax ([let-stx (if rec?
#'letrec-syntax
#'let-syntax)])
(syntax/loc stx
(let-stx ([id (wrap-as-needed expr)] ...)
(#%expression body)
...)))
(let ([sli (if (list? (syntax-local-context))
syntax-local-introduce
values)])
@ -505,7 +513,7 @@
#'(begin
(define-syntax id (wrap-as-needed expr))
...
body ...)))))]))
body ...))))))]))
(define-syntax (r6rs:let-syntax stx)
(do-let-syntax stx #f))

View File

@ -88,6 +88,17 @@
(dolet a))
7)
;; check that it's ok as an expression:
(test 6
(let-syntax ([foo
(syntax-rules ()
[(_)
(let-syntax ([bar
(syntax-rules ()
[(_) 5])])
(bar))])])
(+ 1 (foo))))
#;
(test/exn (let ([else #f])
(case 0 [else (write "oops")]))