chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] handle aliases generated by macro-expansio


From: Felix
Subject: Re: [Chicken-hackers] [PATCH] handle aliases generated by macro-expansion in "declare"
Date: Fri, 21 Oct 2011 03:33:03 +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.

That patch was broken. Please use this one instead.


cheers,
felix
>From e0ab1e510d4fbb17e383d4b8e7a65ed85a11a263 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, making
 sure things are done right inside modules.

---
 expand.scm |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/expand.scm b/expand.scm
index 87cd8a2..67e990b 100644
--- a/expand.scm
+++ b/expand.scm
@@ -136,13 +136,16 @@
 ;;; 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))
+  (let loop1 ((sym sym))
+    (cond ((not (symbol? sym)) sym)
+         ((getp sym '##core#macro-alias) => 
+          (lambda (a) (loop1 (if (symbol? a) a sym))))
+         (else
+          (let loop ((se se))          ; ignores syntax bindings
+            (cond ((null? se)
+                   (##sys#alias-global-hook sym #t #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]