expander: extend "illegal use of syntax" error
Show the compile-time value that is not a procedure. While this runs some risk of exposing details that are meant to be private to a macro/language, a macro/language can use an applicable structure to provide a more specific error message. Meanwhile, showing the value is likely to help for someone who needs to debug a macro problem.
This commit is contained in:
parent
4ed5d7d98b
commit
3c030b143b
|
@ -259,7 +259,11 @@
|
|||
(dispatch-variable t s id ctx binding primitive? protected?)]
|
||||
[else
|
||||
;; Some other compile-time value:
|
||||
(raise-syntax-error #f "illegal use of syntax" s)]))
|
||||
(raise-syntax-error #f "illegal use of syntax" s
|
||||
#f null
|
||||
(format "\n value at phase ~s: ~e"
|
||||
(add1 (expand-context-phase ctx))
|
||||
t))]))
|
||||
|
||||
;; Call a core-form expander (e.g., `lambda`)
|
||||
(define (dispatch-core-form t s ctx)
|
||||
|
|
|
@ -19812,6 +19812,7 @@ static const char *startup_source =
|
|||
" #%app"
|
||||
" #%call-with-values"
|
||||
" make-pthread-parameter"
|
||||
" break-enabled-key"
|
||||
" fasl->s-exp/intern))))"
|
||||
"(define-values(phase-shift-id)(make-built-in-symbol! 'phase))"
|
||||
"(define-values(dest-phase-id)(make-built-in-symbol! 'dest-phase))"
|
||||
|
@ -43044,7 +43045,17 @@ static const char *startup_source =
|
|||
"(if(variable? t_0)"
|
||||
"(let-values()"
|
||||
"(dispatch-variable t_0 s_0 id_0 ctx_0 binding_0 primitive?_0 protected?_0))"
|
||||
" (let-values () (raise-syntax-error$1 #f \"illegal use of syntax\" s_0))))))))))))))))))"
|
||||
"(let-values()"
|
||||
"(raise-syntax-error$1"
|
||||
" #f"
|
||||
" \"illegal use of syntax\""
|
||||
" s_0"
|
||||
" #f"
|
||||
" null"
|
||||
"(format"
|
||||
" \"\\n value at phase ~s: ~e\""
|
||||
"(add1(expand-context-phase ctx_0))"
|
||||
" t_0)))))))))))))))))))"
|
||||
"(define-values"
|
||||
"(dispatch-core-form)"
|
||||
"(lambda(t_0 s_0 ctx_0)"
|
||||
|
|
Loading…
Reference in New Issue
Block a user