Fixed a loss of error location on function calls
This commit is contained in:
parent
0708f32694
commit
2c5b1323dd
@ -127,7 +127,6 @@ namespace chaiscript
|
||||
};
|
||||
|
||||
struct BreakLoop {
|
||||
dispatchkit::Boxed_Value retval;
|
||||
TokenPtr location;
|
||||
|
||||
BreakLoop(const TokenPtr where) : location(where) { }
|
||||
|
@ -90,7 +90,7 @@ namespace chaiscript
|
||||
retval = dispatch(ss.get_function(node->children[i+1]->text), plb);
|
||||
}
|
||||
catch(const dispatchkit::dispatch_error &e){
|
||||
throw EvalError("Can not find appropriate '" + node->children[i+1]->text + "'", node->children[i+1]);
|
||||
throw EvalError("Mismatched types in equation", node->children[i+1]);
|
||||
}
|
||||
}
|
||||
catch(const dispatchkit::dispatch_error &e){
|
||||
@ -297,8 +297,15 @@ namespace chaiscript
|
||||
plb << eval_token(ss, node->children[1]->children[i]);
|
||||
}
|
||||
}
|
||||
dispatchkit::Boxed_Value fn;
|
||||
try {
|
||||
fn = eval_token(ss, node->children[0]);
|
||||
}
|
||||
catch(EvalError &ee) {
|
||||
ss.set_stack(prev_stack);
|
||||
throw EvalError(ee.reason, node->children[0]);
|
||||
}
|
||||
try {
|
||||
dispatchkit::Boxed_Value fn = eval_token(ss, node->children[0]);
|
||||
//fn = ss.get_function(node->children[0]->text);
|
||||
ss.set_stack(new_stack);
|
||||
//retval = dispatch(fn, plb);
|
||||
@ -306,10 +313,6 @@ namespace chaiscript
|
||||
retval = (*dispatchkit::boxed_cast<boost::shared_ptr<dispatchkit::Proxy_Function> >(fn))(plb);
|
||||
ss.set_stack(prev_stack);
|
||||
}
|
||||
catch(EvalError &ee) {
|
||||
ss.set_stack(prev_stack);
|
||||
throw EvalError(ee.reason, node->children[0]);
|
||||
}
|
||||
catch(const dispatchkit::dispatch_error &e){
|
||||
ss.set_stack(prev_stack);
|
||||
throw EvalError("Engine error: " + std::string(e.what()) + " with function '" + node->children[0]->text + "'", node->children[0]);
|
||||
@ -359,10 +362,6 @@ namespace chaiscript
|
||||
retval = dispatch(fn, plb);
|
||||
ss.set_stack(prev_stack);
|
||||
}
|
||||
catch(EvalError &ee) {
|
||||
ss.set_stack(prev_stack);
|
||||
throw EvalError(ee.reason, node);
|
||||
}
|
||||
catch(const dispatchkit::dispatch_error &e){
|
||||
ss.set_stack(prev_stack);
|
||||
throw EvalError("Can not find appropriate '" + fun_name + "'", node);
|
||||
|
Loading…
x
Reference in New Issue
Block a user