commit f0c862793fdf08bab74c306d81c2bd390c73f5a4
parent e0678d72256220d66159a2f43665af510db85d79
Author: Andres Navarro <canavarro82@gmail.com>
Date: Sat, 5 Mar 2011 16:57:22 -0300
Bugfix in kget_binding, added code to evaluate symbols.
Diffstat:
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/kenvironment.c b/src/kenvironment.c
@@ -71,7 +71,7 @@ void kadd_binding(klisp_State *K, TValue env, TValue sym, TValue val)
TValue kget_binding(klisp_State *K, TValue env, TValue sym)
{
while(!ttisnil(env)) {
- TValue oldb = kfind_local_binding(K, kenv_parents(K, env), sym);
+ TValue oldb = kfind_local_binding(K, kenv_bindings(K, env), sym);
if (!ttisnil(oldb))
return kcdr(oldb);
env = kenv_parents(K, env);
diff --git a/src/klisp.c b/src/klisp.c
@@ -41,7 +41,6 @@ void exit_fn(klisp_State *K, TValue *xparams, TValue obj)
void eval_ofn(klisp_State *K, TValue *xparams, TValue obj, TValue env)
{
(void) xparams;
- (void) env;
switch(ttype(obj)) {
case K_TPAIR:
@@ -49,8 +48,8 @@ void eval_ofn(klisp_State *K, TValue *xparams, TValue obj, TValue env)
kapply_cc(K, obj);
break;
case K_TSYMBOL:
- /* TODO */
- kapply_cc(K, obj);
+ /* error handling happens in kget_binding */
+ kapply_cc(K, kget_binding(K, env, obj));
break;
default:
kapply_cc(K, obj);