1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 05:50:26 +02:00

module-variable accesses pre-module-obarray if module is #f

* libguile/modules.c (module-variable): If module is #f, access the
  pre-modules-array. This is so that nested-ref can work before the
  module system is booted, I think.

  Of course all of these dependency lines during bootstrap are just to
  make sure the system can be booted properly, either interpreted or
  compiled, so there's no one right way: there are many ways that could
  work.
This commit is contained in:
Andy Wingo 2008-09-02 00:49:17 -07:00
parent 53f84bc8b5
commit 73dea589ca

View file

@ -336,6 +336,8 @@ resolve_duplicate_binding (SCM module, SCM sym,
return result;
}
SCM scm_pre_modules_obarray;
/* Lookup SYM as an imported variable of MODULE. */
static inline SCM
module_imported_variable (SCM module, SCM sym)
@ -462,6 +464,9 @@ SCM_DEFINE (scm_module_variable, "module-variable", 2, 0, 0,
SCM_VALIDATE_SYMBOL (2, sym);
if (scm_is_false (module))
return scm_hashq_ref (scm_pre_modules_obarray, sym, SCM_UNDEFINED);
/* 1. Check module obarray */
var = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym, SCM_UNDEFINED);
if (SCM_BOUND_THING_P (var))
@ -628,8 +633,6 @@ SCM_DEFINE (scm_module_import_interface, "module-import-interface", 2, 0, 0,
* the scm_pre_modules_obarray (a `eq' hash table).
*/
SCM scm_pre_modules_obarray;
SCM
scm_sym2var (SCM sym, SCM proc, SCM definep)
#define FUNC_NAME "scm_sym2var"