Appropriately check the context.

svn: r11693
This commit is contained in:
Stevie Strickland 2008-09-12 18:17:40 +00:00
parent 3b44bca1d5
commit b309ced851

View File

@ -79,6 +79,10 @@ improve method arity mismatch contract violation error messages?
;; defines `id' with `contract'; initially binding
;; it to the result of `expr'. These variables may not be set!'d.
(define-syntax (define/contract define-stx)
(when (eq? (syntax-local-context) 'expression)
(raise-syntax-error 'define/contract
"used in expression context"
define-stx))
(syntax-case define-stx ()
[(_ name contract-expr)
(raise-syntax-error 'define/contract
@ -185,6 +189,10 @@ improve method arity mismatch contract violation error messages?
(car args))])))
(define-syntax (with-contract stx)
(when (eq? (syntax-local-context) 'expression)
(raise-syntax-error 'with-contract
"used in expression context"
stx))
(syntax-case stx ()
[(_ blame (arg ...) body0 body ...)
(identifier? (syntax blame))