Remove unnecessary type comparison in equation

This commit is contained in:
Jonathan Turner
2009-07-03 14:52:05 +00:00
parent bce2a1ffdb
commit 294d22ac5b
4 changed files with 21 additions and 27 deletions

View File

@@ -78,28 +78,23 @@ namespace chaiscript
for (i = node->children.size()-3; ((int)i) >= 0; i -= 2) {
if (node->children[i+1]->text == "=") {
dispatchkit::Boxed_Value lhs = eval_token(ss, node->children[i]);
if (lhs.is_unknown() || dispatchkit::Bootstrap::type_match(lhs, retval)) {
try {
if (lhs.is_unknown())
{
retval = dispatch(ss.get_function("clone"), dispatchkit::Param_List_Builder() << retval);
}
dispatchkit::Param_List_Builder plb;
plb << lhs;
plb << retval;
try {
if (lhs.is_unknown())
{
retval = dispatch(ss.get_function("clone"), dispatchkit::Param_List_Builder() << retval);
}
dispatchkit::Param_List_Builder plb;
plb << lhs;
plb << retval;
try {
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]);
}
retval = dispatch(ss.get_function(node->children[i+1]->text), plb);
}
catch(const dispatchkit::dispatch_error &e){
throw EvalError("Can not clone right hand side of equation", node->children[i+1]);
throw EvalError("Can not find appropriate '" + node->children[i+1]->text + "'", node->children[i+1]);
}
}
else {
throw EvalError("Mismatched types in equation", node->children[i+1]);
catch(const dispatchkit::dispatch_error &e){
throw EvalError("Can not clone right hand side of equation", node->children[i+1]);
}
}
else if (node->children[i+1]->text == ":=") {