Handle the ReturnVal exception at the eval_function level so that functions passed back to C++ land have their return values handled properly

This commit is contained in:
Jason Turner
2009-06-21 19:45:36 +00:00
parent dc11237af9
commit 786d194689
3 changed files with 10 additions and 3 deletions

View File

@@ -43,7 +43,14 @@ namespace chaiscript
ss.add_object(param_names[i], vals[i]);
}
dispatchkit::Boxed_Value retval = eval_token(ss, node);
dispatchkit::Boxed_Value retval;
try {
retval = eval_token(ss, node);
} catch (const ReturnValue &rv) {
retval = rv.retval;
}
ss.pop_scope();
return retval;
}