From 08c153abea846f469ba09bc6ffd0c80e7db12030 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Fri, 18 May 2012 16:37:39 -0600 Subject: [PATCH] Clean up some additional exception handling with new stack handler --- .../chaiscript/language/chaiscript_eval.hpp | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index d39eca6..828a041 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -190,28 +190,19 @@ namespace chaiscript } } + Boxed_Value fn = this->children[0]->eval(t_ss); + try { - Boxed_Value fn = this->children[0]->eval(t_ss); - - try { - chaiscript::eval::detail::Stack_Push_Pop spp(t_ss); - const Boxed_Value &retval = (*boxed_cast(fn))(plb); - return retval; - } - catch(const exception::dispatch_error &e){ - throw exception::eval_error(std::string(e.what()) + " with function '" + this->children[0]->text + "'"); - } - catch(detail::Return_Value &rv) { - return rv.retval; - } - catch(...) { - throw; - } + chaiscript::eval::detail::Stack_Push_Pop spp(t_ss); + const Boxed_Value &retval = (*boxed_cast(fn))(plb); + return retval; } - catch(exception::eval_error &) { - throw; + catch(const exception::dispatch_error &e){ + throw exception::eval_error(std::string(e.what()) + " with function '" + this->children[0]->text + "'"); + } + catch(detail::Return_Value &rv) { + return rv.retval; } - } }; @@ -468,9 +459,7 @@ namespace chaiscript catch(detail::Return_Value &rv) { retval = rv.retval; } - catch(...) { - throw; - } + if (this->children[i]->identifier == AST_Node_Type::Array_Call) { for (size_t j = 1; j < this->children[i]->children.size(); ++j) { try {