aboutsummaryrefslogtreecommitdiff
path: root/eval.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'eval.cpp')
-rw-r--r--eval.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/eval.cpp b/eval.cpp
index e536f8f..dd4be00 100644
--- a/eval.cpp
+++ b/eval.cpp
@@ -1,5 +1,7 @@
#include "eval.h"
#include "builtin.h"
+#include "exc.h"
+#include "consts.h"
#include <cstdio>
extern Cons *empty_list;
@@ -87,7 +89,14 @@ EvalObj *Evaluator::run_expr(Cons *prog) {
top_ptr++;
}
else
- pc = dynamic_cast<OptObj*>(args->car)->call(args, envt, cont, top_ptr);
+ {
+ EvalObj *opt = args->car;
+ if (opt->is_opt_obj())
+ pc = static_cast<OptObj*>(opt)->
+ call(args, envt, cont, top_ptr);
+ else
+ throw TokenError(opt->ext_repr(), SYN_ERR_CAN_NOT_APPLY);
+ }
}
}
// static_cast because the previous while condition