toplevel vars added by syntax expansion are unbound

* module/ice-9/psyntax.scm (chi-top): When adding to the toplevel
  environment at compile-time, default to undefined variables, not
  variables defined to #f.

* module/ice-9/psyntax-pp.scm: Regenerate.

* module/ice-9/boot-9.scm (module-add!): Add a new pre-modules version
  of this function, so we can add variables the environment, not just
  values.
  (module-define!): Use module-add!.
This commit is contained in:
Andy Wingo 2011-01-31 21:02:24 +01:00
commit 05a5e5d6d0
3 changed files with 4176 additions and 4170 deletions

View file

@ -1,6 +1,6 @@
;;;; -*-scheme-*-
;;;;
;;;; Copyright (C) 2001, 2003, 2006, 2009, 2010 Free Software Foundation, Inc.
;;;; Copyright (C) 2001, 2003, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -1143,10 +1143,9 @@
(let ((old (module-variable (current-module) n)))
;; use value of the same-named imported variable, if
;; any
(module-define! (current-module) n
(if (variable? old)
(variable-ref old)
#f))))
(if (and (variable? old) (variable-bound? old))
(module-define! (current-module) n (variable-ref old))
(module-add! (current-module) n (make-undefined-variable)))))
(eval-if-c&e m
(build-global-definition s n (chi e r w mod))
mod))