ConditionSet FollowSolver::solve_left<StatementAst>(StatementAst *ast) { ConditionSet result; if(ast->prev()) { result.insert(new SimpleStatementCondition(ast->prev())); } return result; }
ConditionSet ParentSolver::solve_left<StatementAst>(StatementAst *ast) { ConditionSet result; if(ast->get_parent()) { result.insert(new SimpleStatementCondition(ast->get_parent())); } return result; }
ConditionSet ParentSolver::solve_right<ConditionalAst>(ConditionalAst *condition) { ConditionSet result; StatementAst *then_branch = condition->get_then_branch(); StatementAst *else_branch = condition->get_else_branch(); while(then_branch != NULL) { result.insert(new SimpleStatementCondition(then_branch)); then_branch = then_branch->next(); } while(else_branch != NULL) { result.insert(new SimpleStatementCondition(else_branch)); else_branch = else_branch->next(); } return result; }
void SimpleQueryMatcher::solve_both_diff_qvar( const ConditionSet& left, const ConditionSet& right, /* output */ ConditionSet& new_left, ConditionSet& new_right, std::vector<ConditionPair>& result_pairs) { for(ConditionSet::iterator left_it = left.begin(); left_it != left.end(); ++left_it) { for(ConditionSet::iterator right_it = right.begin(); right_it != right.end(); ++right_it) { if(_solver->validate(left_it->get(), right_it->get())) { new_left.insert(*left_it); new_right.insert(*right_it); result_pairs.push_back(ConditionPair(*left_it, *right_it)); } } } }
ConditionSet ParentSolver::solve_right<WhileAst>(WhileAst *loop) { ConditionSet result; StatementAst *body = loop->get_body(); while(body != NULL) { result.insert(new SimpleStatementCondition(body)); body = body->next(); } return result; }
void SimpleQueryMatcher::solve_both_same_qvar(const ConditionSet& values, /* output */ ConditionSet& new_values, std::vector<ConditionPair>& result_pairs) { for(ConditionSet::iterator it = values.begin(); it != values.end(); ++it) { if(_solver->validate(it->get(), it->get())) { new_values.insert(*it); result_pairs.push_back(ConditionPair(*it, *it)); } } }