More prelim testing to isolate repl issue
This commit is contained in:
@@ -8,6 +8,7 @@ dispatchkit::Boxed_Value evoke_fn(chaiscript::ChaiScript_Engine &chai, std::stri
|
||||
dispatchkit::Dispatch_Engine::Stack new_stack;
|
||||
new_stack.push_back(dispatchkit::Dispatch_Engine::Scope());
|
||||
ss.set_stack(new_stack);
|
||||
/*
|
||||
try {
|
||||
dispatchkit::Boxed_Value retval = dispatchkit::dispatch(ss.get_function(name), plb);
|
||||
ss.set_stack(prev_stack);
|
||||
@@ -18,6 +19,36 @@ dispatchkit::Boxed_Value evoke_fn(chaiscript::ChaiScript_Engine &chai, std::stri
|
||||
std::cout << "Exception caught" << std::endl;
|
||||
throw;
|
||||
}
|
||||
*/
|
||||
dispatchkit::Boxed_Value retval;
|
||||
try {
|
||||
|
||||
//fn = ss.get_function(node->children[0]->text);
|
||||
ss.set_stack(new_stack);
|
||||
//retval = dispatch(fn, plb);
|
||||
//retval = dispatch
|
||||
//retval = (*dispatchkit::boxed_cast<boost::shared_ptr<dispatchkit::Proxy_Function> >(fn))(plb);
|
||||
retval = dispatchkit::dispatch(ss.get_function(name), plb);
|
||||
ss.set_stack(prev_stack);
|
||||
}
|
||||
catch(chaiscript::EvalError &ee) {
|
||||
ss.set_stack(prev_stack);
|
||||
//throw chaiscript::EvalError(ee.reason, node->children[0]);
|
||||
throw;
|
||||
}
|
||||
catch(const dispatchkit::dispatch_error &e){
|
||||
ss.set_stack(prev_stack);
|
||||
throw;
|
||||
}
|
||||
catch(chaiscript::ReturnValue &rv) {
|
||||
ss.set_stack(prev_stack);
|
||||
retval = rv.retval;
|
||||
}
|
||||
catch(...) {
|
||||
ss.set_stack(prev_stack);
|
||||
throw;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
@@ -36,6 +67,7 @@ int main(int argc, char *argv[]) {
|
||||
val = chai.evaluate_string(input);
|
||||
|
||||
if (val.get_type_info().m_bare_type_info && *(val.get_type_info().m_bare_type_info) != typeid(void)) {
|
||||
|
||||
try {
|
||||
dispatchkit::Boxed_Value printeval = evoke_fn(chai, "to_string", dispatchkit::Param_List_Builder() << val);
|
||||
std::cout << "result: ";
|
||||
@@ -43,6 +75,7 @@ int main(int argc, char *argv[]) {
|
||||
} catch (const std::runtime_error &e) {
|
||||
std::cout << "result: object #" << &val << " Error: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
std::cout << "eval> ";
|
||||
std::getline(std::cin, input);
|
||||
|
||||
Reference in New Issue
Block a user