From 797897cc014ff1b6b8ac08c66727bb9b41bc5517 Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Fri, 4 Jan 2008 20:53:59 -0500 Subject: [PATCH] Fixes bug 180455: raw symbols in output of macro are not detected --- scheme/last-revision | 2 +- scheme/psyntax.expander.ss | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/scheme/last-revision b/scheme/last-revision index 41f48e5..d378cb0 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1325 +1327 diff --git a/scheme/psyntax.expander.ss b/scheme/psyntax.expander.ss index a6c5ad3..d004a2c 100644 --- a/scheme/psyntax.expander.ss +++ b/scheme/psyntax.expander.ss @@ -2457,25 +2457,33 @@ sealed opaque nongenerative parent-rtd) incorrect-usage-macro) (else - (assertion-violation 'macro-transformer - "BUG: invalid macro" x)))) + (error 'macro-transformer "BUG: invalid macro" x)))) (else - (assertion-violation 'core-macro-transformer - "BUG: invalid macro" x))))) + (error 'core-macro-transformer "BUG: invalid macro" x))))) (define (local-macro-transformer 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 (define chi-macro - (lambda (p e) - (let ((s ((macro-transformer p) (add-mark anti-mark e)))) - (add-mark (gen-mark) s)))) + (lambda (p e) (do-macro-call (macro-transformer p) e))) (define chi-local-macro - (lambda (p e) - (let ((s ((local-macro-transformer p) (add-mark anti-mark e)))) - (add-mark (gen-mark) s)))) + (lambda (p e) (do-macro-call (local-macro-transformer p) e))) (define (chi-global-macro p e) ;;; FIXME: does not handle macro!? @@ -2488,8 +2496,7 @@ ((procedure? x) x) (else (assertion-violation 'chi-global-macro "BUG: not a procedure" x))))) - (let ((s (transformer (add-mark anti-mark e)))) - (add-mark (gen-mark) s)))))) + (do-macro-call transformer e))))) (define chi-expr* (lambda (e* r mr)