chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH] handle aliases generated by macro-expansion in


From: Felix
Subject: [Chicken-hackers] [PATCH] handle aliases generated by macro-expansion in "declare"
Date: Fri, 21 Oct 2011 02:57:41 +0200 (CEST)

The attached patch resolves macro-aliases correctly when resolving
identifier names in "declare" forms. Without this, identifiers that
went through several macro-expansions (and thus aliasing) where not
resolved to their true names, yielding declarations ineffective.

Thanks to Peter for clarifying the handling of aliases in the
expander.


cheers,
felix
>From 9ac54918b77dca9c902fd0243d3e1bbaec34b807 Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Fri, 21 Oct 2011 02:52:53 +0200
Subject: [PATCH] handle macro-aliases when resolving declared identifier

---
 expand.scm |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/expand.scm b/expand.scm
index 87cd8a2..ecfc696 100644
--- a/expand.scm
+++ b/expand.scm
@@ -136,13 +136,15 @@
 ;;; resolve symbol to global name
 
 (define (##sys#globalize sym se)
-  (if (symbol? sym)
-      (let loop ((se se))                      ; ignores syntax bindings
-       (cond ((null? se)
-              (##sys#alias-global-hook sym #f #f)) ;XXX could hint at decl 
(3rd arg)
-             ((and (eq? sym (caar se)) (symbol? (cdar se))) (cdar se))
-             (else (loop (cdr se)))))
-      sym))
+  (cond ((not (symbol? sym)) sym)
+       ((getp sym '##core#macro-alias) => 
+        (lambda (a) (if (symbol? a) a sym)))
+       (else
+        (let loop ((se se))                    ; ignores syntax bindings
+          (cond ((null? se)
+                 (##sys#alias-global-hook sym #f #f)) ;XXX could hint at decl 
(3rd arg)
+                ((and (eq? sym (caar se)) (symbol? (cdar se))) (cdar se))
+                (else (loop (cdr se))))))))
 
 
 ;;; Macro handling
-- 
1.7.0.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]