void functionst::add_function_constraints(const function_infot &info) { // Do Ackermann's function reduction. // This is quadratic, slow, and needs to be modernized. for(std::set<function_application_exprt>::const_iterator it1=info.applications.begin(); it1!=info.applications.end(); it1++) { for(std::set<function_application_exprt>::const_iterator it2=info.applications.begin(); it2!=it1; it2++) { exprt arguments_equal_expr= arguments_equal(it1->arguments(), it2->arguments()); implies_exprt implication(arguments_equal_expr, equal_exprt(*it1, *it2)); prop_conv.set_to_true(implication); } } }
// Methods bool environment_method_exists(TokenContext context, Scope* scope, Method method){ for(size_t i = 0; i < scope->methods.size(); i++){ if( (scope->methods[i].name == method.name or method.name==IGNORE) and (scope->methods[i].parent == method.parent or method.parent==NULL) and (context_class_compare(context, Class(scope->methods[i].return_type), Class(method.return_type)) or method.return_type == IGNORE_CLASS) and (arguments_equal(context, scope->methods[i].arguments, method.arguments))){ return true; } } return false; }
Method environment_method_get(TokenContext context, Scope* scope, Method method){ for(size_t i = 0; i < scope->methods.size(); i++){ if( (scope->methods[i].name == method.name or method.name==IGNORE) and (scope->methods[i].parent == method.parent or method.parent==NULL) and (context_class_compare(context, Class(scope->methods[i].return_type), Class(method.return_type)) or method.return_type == IGNORE_CLASS) and (arguments_equal(context, scope->methods[i].arguments, method.arguments))){ return scope->methods[i]; } } #ifdef DEV_ERRORS fail(DEV_BLANK_TYPE); #endif // DEV_ERRORS return Method{"", NULL, IGNORE_ARGS, IGNORE_CLASS}; }