summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
Diffstat (limited to 'libguile')
-rw-r--r--libguile/eval.c10
-rw-r--r--libguile/memoize.c3
-rw-r--r--libguile/modules.c12
3 files changed, 15 insertions, 10 deletions
diff --git a/libguile/eval.c b/libguile/eval.c
index f775d31b1..f2cbebe64 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -844,10 +844,12 @@ scm_for_each (SCM proc, SCM arg1, SCM args)
static SCM
scm_c_primitive_eval (SCM exp)
{
- SCM transformer = scm_current_module_transformer ();
- if (scm_is_true (transformer))
- exp = scm_call_1 (transformer, exp);
- exp = scm_memoize_expression (exp);
+ if (!SCM_MEMOIZED_P (exp))
+ exp = scm_call_1 (scm_current_module_transformer (), exp);
+ if (!SCM_MEMOIZED_P (exp))
+ scm_misc_error ("primitive-eval",
+ "expander did not return a memoized expression",
+ scm_list_1 (exp));
return eval (exp, SCM_EOL);
}
diff --git a/libguile/memoize.c b/libguile/memoize.c
index 0427cea76..aeb42a31c 100644
--- a/libguile/memoize.c
+++ b/libguile/memoize.c
@@ -1326,6 +1326,9 @@ scm_init_memoize ()
scm_set_smob_print (scm_tc16_memoized, scm_print_memoized);
#include "libguile/memoize.x"
+
+ scm_c_define ("macroexpand",
+ scm_variable_ref (scm_c_lookup ("memoize-expression")));
}
/*
diff --git a/libguile/modules.c b/libguile/modules.c
index ac15eaaac..a0c47f2db 100644
--- a/libguile/modules.c
+++ b/libguile/modules.c
@@ -564,7 +564,7 @@ scm_current_module_lookup_closure ()
return SCM_BOOL_F;
}
-SCM_SYMBOL (sym_sys_pre_modules_transformer, "%pre-modules-transformer");
+SCM_SYMBOL (sym_macroexpand, "macroexpand");
SCM_DEFINE (scm_module_transformer, "module-transformer", 1, 0, 0,
(SCM module),
@@ -572,13 +572,13 @@ SCM_DEFINE (scm_module_transformer, "module-transformer", 1, 0, 0,
#define FUNC_NAME s_scm_module_transformer
{
if (SCM_UNLIKELY (scm_is_false (module)))
- { SCM v = scm_hashq_ref (scm_pre_modules_obarray,
- sym_sys_pre_modules_transformer,
+ {
+ SCM v = scm_hashq_ref (scm_pre_modules_obarray,
+ sym_macroexpand,
SCM_BOOL_F);
if (scm_is_false (v))
- return SCM_BOOL_F;
- else
- return SCM_VARIABLE_REF (v);
+ SCM_MISC_ERROR ("no module, and `macroexpand' unbound", SCM_EOL);
+ return SCM_VARIABLE_REF (v);
}
else
{