unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: guile-devel@gnu.org
Subject: [PATCH 2/2] psyntax: fix gen-label for unset module.
Date: Wed,  2 Nov 2016 20:14:50 +0100	[thread overview]
Message-ID: <20161102191450.24080-3-janneke@gnu.org> (raw)
In-Reply-To: <20161102191450.24080-1-janneke@gnu.org>

* module/ice-9/boot-9.scm (generate-unique-id!): New function.
  (module-generate-unique-id!): Use it.
* module/ice-9/psyntax.scm (gen-label): Use it to cater for unset
  module.
* module/ice-9/psyntax-pp.scm: Regenerate.
---
 module/ice-9/boot-9.scm     | 3 ++-
 module/ice-9/psyntax-pp.scm | 2 +-
 module/ice-9/psyntax.scm    | 6 ++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index f1d684d..e18818e 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -374,12 +374,13 @@ a-cont
 (define (module-ref module sym)
   (let ((v (module-variable module sym)))
     (if v (variable-ref v) (error "badness!" (pk module) (pk sym)))))
-(define module-generate-unique-id!
+(define generate-unique-id!
   (let ((next-id 0))
     (lambda (m)
       (let ((i next-id))
         (set! next-id (+ i 1))
         i))))
+(define module-generate-unique-id! generate-unique-id!)
 (define (resolve-module . args)
   #f)
 
diff --git a/module/ice-9/psyntax-pp.scm b/module/ice-9/psyntax-pp.scm
index 207d534..c47df7f 100644
--- a/module/ice-9/psyntax-pp.scm
+++ b/module/ice-9/psyntax-pp.scm
@@ -301,7 +301,7 @@
          (simple-format
            #f
            "l-~s~s"
-           (module-generate-unique-id! mod)
+           (if mod (module-generate-unique-id! mod) (generate-unique-id! #f))
            (module-name mod)))))
    (gen-labels
      (lambda (ls)
diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm
index 8fa0ff3..7e5c863 100644
--- a/module/ice-9/psyntax.scm
+++ b/module/ice-9/psyntax.scm
@@ -634,8 +634,10 @@
     (define (gen-label)
       (let ((mod (current-module)))
         (simple-format #f "l-~s~s"
-                       (module-generate-unique-id! mod)
-                       (module-name mod))))
+                        (if mod
+                            (module-generate-unique-id! mod)
+                            (generate-unique-id! #f))
+                        (module-name mod))))
 
     (define gen-labels
       (lambda (ls)
-- 
2.10.1




      parent reply	other threads:[~2016-11-02 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 19:14 bug#20272: Support reproducible builds Jan Nieuwenhuizen
2016-11-02 19:14 ` [PATCH 1/2] PRELIMINARY: psyntax: Remove uses of syntax-session-id Jan Nieuwenhuizen
2016-11-02 19:14 ` Jan Nieuwenhuizen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161102191450.24080-3-janneke@gnu.org \
    --to=janneke@gnu.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).