Ticket #444: nested-syntax.patch

File nested-syntax.patch, 1.8 KB (added by sjamaan, 13 years ago)

Fix for nested ER macros/syntax-rules as well as IR macros

  • expand.scm

    diff --git a/expand.scm b/expand.scm
    index c7beae6..55b85b6 100644
    a b  
    9494                          (lookup x se)
    9595                          (getp x '##core#macro-alias) ) ) )
    9696              (cond ((getp x '##core#real-name))
     97                    ((getp x '##core#primitive))
    9798                    ((and alias (not (assq x se)))
    9899                     (##sys#alias-global-hook x #f #f))
    99100                    ((not x2) x)
  • tests/compiler-tests.scm

    diff --git a/tests/compiler-tests.scm b/tests/compiler-tests.scm
    index f402f75..43e308e 100644
    a b  
    9999  (strlen-safe-macro* "hello, world")
    100100  (strlen-primitive-macro "hello, world"))
    101101
     102;; Type specifiers and variable names in foreign-lambda in macros
     103;; are incorrectly renamed in modules, too.
     104(foreign-declare "void foo(void *abc) { printf(\"hi\\n\"); }")
     105
     106(module foo ()
     107  (import chicken scheme foreign) ; "chicken" includes an export for "void"
     108 
     109  (let-syntax ((fl
     110                (syntax-rules ()
     111                  ((_)
     112                   (foreign-lambda void foo (c-pointer void)))))
     113               (fl*
     114                (syntax-rules ()
     115                  ((_)
     116                   (foreign-lambda* void (((c-pointer void) a))
     117                                    "C_return(a);"))))
     118               (fp
     119                (syntax-rules ()
     120                  ((_)
     121                   (foreign-primitive void (((c-pointer void) a))
     122                                      "C_return(a);")))))
     123    (fl)
     124    (fl*)
     125    (fp)))
     126
     127
    102128;;; compiler-syntax for map/for-each must be careful when the
    103129;   operator may have side-effects (currently only lambda exprs and symbols
    104130;   are allowed)
     
    142168    (define (baz)
    143169      (bar a: #t))
    144170    baz)
    145   bar)
     171  bar)
     172 No newline at end of file