Fixes bug 180455: raw symbols in output of macro are not detected

This commit is contained in:
Abdulaziz Ghuloum 2008-01-04 20:53:59 -05:00
parent e35ed42f6c
commit 797897cc01
2 changed files with 20 additions and 13 deletions

View File

@ -1 +1 @@
1325 1327

View File

@ -2457,25 +2457,33 @@
sealed opaque nongenerative parent-rtd) sealed opaque nongenerative parent-rtd)
incorrect-usage-macro) incorrect-usage-macro)
(else (else
(assertion-violation 'macro-transformer (error 'macro-transformer "BUG: invalid macro" x))))
"BUG: invalid macro" x))))
(else (else
(assertion-violation 'core-macro-transformer (error 'core-macro-transformer "BUG: invalid macro" x)))))
"BUG: invalid macro" x)))))
(define (local-macro-transformer x) (define (local-macro-transformer x)
(car x)) (car x))
(define (do-macro-call transformer expr)
(let ([out (transformer (add-mark anti-mark expr))])
(let f ([x out])
;;; don't feed me cycles.
(unless (stx? x)
(cond
[(pair? x) (f (car x)) (f (cdr x))]
[(vector? x) (vector-for-each f x)]
[(symbol? x)
(syntax-violation #f
"raw symbol encountered in output of macro"
expr x)])))
(add-mark (gen-mark) out)))
;;; chi procedures ;;; chi procedures
(define chi-macro (define chi-macro
(lambda (p e) (lambda (p e) (do-macro-call (macro-transformer p) e)))
(let ((s ((macro-transformer p) (add-mark anti-mark e))))
(add-mark (gen-mark) s))))
(define chi-local-macro (define chi-local-macro
(lambda (p e) (lambda (p e) (do-macro-call (local-macro-transformer p) e)))
(let ((s ((local-macro-transformer p) (add-mark anti-mark e))))
(add-mark (gen-mark) s))))
(define (chi-global-macro p e) (define (chi-global-macro p e)
;;; FIXME: does not handle macro!? ;;; FIXME: does not handle macro!?
@ -2488,8 +2496,7 @@
((procedure? x) x) ((procedure? x) x)
(else (assertion-violation 'chi-global-macro (else (assertion-violation 'chi-global-macro
"BUG: not a procedure" x))))) "BUG: not a procedure" x)))))
(let ((s (transformer (add-mark anti-mark e)))) (do-macro-call transformer e)))))
(add-mark (gen-mark) s))))))
(define chi-expr* (define chi-expr*
(lambda (e* r mr) (lambda (e* r mr)