Appropriately check the context.
svn: r11693
This commit is contained in:
parent
3b44bca1d5
commit
b309ced851
|
@ -79,6 +79,10 @@ improve method arity mismatch contract violation error messages?
|
||||||
;; defines `id' with `contract'; initially binding
|
;; defines `id' with `contract'; initially binding
|
||||||
;; it to the result of `expr'. These variables may not be set!'d.
|
;; it to the result of `expr'. These variables may not be set!'d.
|
||||||
(define-syntax (define/contract define-stx)
|
(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 ()
|
(syntax-case define-stx ()
|
||||||
[(_ name contract-expr)
|
[(_ name contract-expr)
|
||||||
(raise-syntax-error 'define/contract
|
(raise-syntax-error 'define/contract
|
||||||
|
@ -185,6 +189,10 @@ improve method arity mismatch contract violation error messages?
|
||||||
(car args))])))
|
(car args))])))
|
||||||
|
|
||||||
(define-syntax (with-contract stx)
|
(define-syntax (with-contract stx)
|
||||||
|
(when (eq? (syntax-local-context) 'expression)
|
||||||
|
(raise-syntax-error 'with-contract
|
||||||
|
"used in expression context"
|
||||||
|
stx))
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_ blame (arg ...) body0 body ...)
|
[(_ blame (arg ...) body0 body ...)
|
||||||
(identifier? (syntax blame))
|
(identifier? (syntax blame))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user