summaryrefslogtreecommitdiff
path: root/libguile/modules.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2008-09-02 00:49:17 -0700
committerAndy Wingo <wingo@pobox.com>2008-09-07 22:27:18 +0200
commit73dea589ca6eb3361cf9583a09f8272f546ee3bf (patch)
treed7fd5c05298ab5ab029c9f74acc48d775dae2ce1 /libguile/modules.c
parent53f84bc8b55efb648e181ded6b973ea87d32d026 (diff)
downloadguile-73dea589ca6eb3361cf9583a09f8272f546ee3bf.tar.gz
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.
Diffstat (limited to 'libguile/modules.c')
-rw-r--r--libguile/modules.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libguile/modules.c b/libguile/modules.c
index 168fbce60..d99d3e472 100644
--- a/libguile/modules.c
+++ b/libguile/modules.c
@@ -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"