[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/10] refactor to resolve_variable
From: |
Andy Wingo |
Subject: |
[PATCH 09/10] refactor to resolve_variable |
Date: |
Thu, 23 May 2013 15:31:02 +0200 |
* libguile/vm.c (resolve_variable): Slight refactor.
---
libguile/vm.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/libguile/vm.c b/libguile/vm.c
index f80d607..cbef0d9 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -600,30 +600,27 @@ static SCM boot_continuation;
*/
static SCM
-resolve_variable (SCM what, SCM program_module)
+resolve_variable (SCM what, SCM module)
{
if (SCM_LIKELY (scm_is_symbol (what)))
{
- if (scm_is_true (program_module))
- return scm_module_lookup (program_module, what);
+ if (scm_is_true (module))
+ return scm_module_lookup (module, what);
else
return scm_module_lookup (scm_the_root_module (), what);
}
else
{
- SCM mod;
- /* compilation of @ or @@
- `what' is a three-element list: (MODNAME SYM INTERFACE?)
- INTERFACE? is #t if we compiled @ or #f if we compiled @@
- */
- mod = scm_resolve_module (SCM_CAR (what));
- if (scm_is_true (SCM_CADDR (what)))
- mod = scm_module_public_interface (mod);
- if (scm_is_false (mod))
- scm_misc_error (NULL, "no such module: ~S",
- scm_list_1 (SCM_CAR (what)));
- /* might longjmp */
- return scm_module_lookup (mod, SCM_CADR (what));
+ SCM modname, sym, public;
+
+ modname = SCM_CAR (what);
+ sym = SCM_CADR (what);
+ public = SCM_CADDR (what);
+
+ if (scm_is_true (public))
+ return scm_public_lookup (modname, sym);
+ else
+ return scm_private_lookup (modname, sym);
}
}
--
1.7.10.4
- Re: [PATCH 01/10] inline vm-engine.h into vm-engine.c, (continued)
- [PATCH 03/10] minor vm-engine cleanups, Andy Wingo, 2013/05/23
- [PATCH 02/10] remove CONS macro in VM; use scm_cons instead, Andy Wingo, 2013/05/23
- [PATCH 04/10] remove some configurability in vm-engine, Andy Wingo, 2013/05/23
- [PATCH 05/10] vm-engine: remove register assignments, Andy Wingo, 2013/05/23
- [PATCH 06/10] Allow vm_engine caller to pass arguments on the stack., Andy Wingo, 2013/05/23
- [PATCH 08/10] cpp hygiene in the vm, Andy Wingo, 2013/05/23
- [PATCH 07/10] pop-continuation abort-continuation hooks pass return vals directly, Andy Wingo, 2013/05/23
- [PATCH 09/10] refactor to resolve_variable,
Andy Wingo <=
- [PATCH 10/10] add new rtl vm, Andy Wingo, 2013/05/23