Simplify redundant bool condition checking

This commit is contained in:
Jason Turner
2015-01-31 07:28:37 -07:00
parent f0ed3a5cf7
commit 76ac7c36fe
3 changed files with 17 additions and 30 deletions

View File

@@ -451,6 +451,15 @@ namespace chaiscript
}
}
static bool get_bool_condition(const Boxed_Value &t_bv) {
try {
return boxed_cast<bool>(t_bv);
}
catch (const exception::bad_boxed_cast &) {
throw exception::eval_error("Condition not boolean");
}
}
void replace_child(const AST_NodePtr &t_child, const AST_NodePtr &t_new_child)
{