fix r6rs let[rec]-syntax for expression positions
svn: r8982
This commit is contained in:
parent
7f3c8510de
commit
788adace20
|
@ -478,6 +478,14 @@
|
||||||
(define-for-syntax (do-let-syntax stx rec?)
|
(define-for-syntax (do-let-syntax stx rec?)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_ ([id expr] ...) body ...)
|
[(_ ([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))
|
(let ([sli (if (list? (syntax-local-context))
|
||||||
syntax-local-introduce
|
syntax-local-introduce
|
||||||
values)])
|
values)])
|
||||||
|
@ -505,7 +513,7 @@
|
||||||
#'(begin
|
#'(begin
|
||||||
(define-syntax id (wrap-as-needed expr))
|
(define-syntax id (wrap-as-needed expr))
|
||||||
...
|
...
|
||||||
body ...)))))]))
|
body ...))))))]))
|
||||||
|
|
||||||
(define-syntax (r6rs:let-syntax stx)
|
(define-syntax (r6rs:let-syntax stx)
|
||||||
(do-let-syntax stx #f))
|
(do-let-syntax stx #f))
|
||||||
|
|
|
@ -88,6 +88,17 @@
|
||||||
(dolet a))
|
(dolet a))
|
||||||
7)
|
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])
|
(test/exn (let ([else #f])
|
||||||
(case 0 [else (write "oops")]))
|
(case 0 [else (write "oops")]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user