diff options
-rw-r--r-- | eval.c | 9 | ||||
-rw-r--r-- | share/txr/stdlib/compiler.tl | 1 |
2 files changed, 10 insertions, 0 deletions
@@ -2803,6 +2803,14 @@ static val op_switch(val form, val env) return eval_progn(forms, env, forms); } +static val op_upenv(val form, val env) +{ + val args = cdr(form); + val expr = pop(&args); + type_check(env, ENV); + return eval(expr, env->e.up_env, expr); +} + static val me_def_variable(val form, val menv) { val args = rest(form); @@ -5940,6 +5948,7 @@ void eval_init(void) reg_op(with_dyn_rebinds_s, op_with_dyn_rebinds); reg_op(prof_s, op_prof); reg_op(switch_s, op_switch); + reg_op(intern(lit("upenv"), system_package), op_upenv); reg_mac(defvar_s, func_n2(me_def_variable)); reg_mac(defparm_s, func_n2(me_def_variable)); diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 06935a02..05ba8247 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -172,6 +172,7 @@ (prog1 me.(comp-prog1 oreg env form)) (sys:quasi me.(comp-quasi oreg env form)) (dohash me.(compile oreg env (expand-dohash form))) + (sys:upenv me.(compile oreg env.up (cadr form))) (sys:dvbind me.(compile oreg env (caddr form))) (sys:with-dyn-rebinds me.(comp-progn oreg env (cddr form))) ((macrolet symacrolet macro-time) |