| 7411 | xpath_ast_node& operator=(const xpath_ast_node&); |
| 7412 | |
| 7413 | template <class Comp> static bool compare_eq(xpath_ast_node* lhs, xpath_ast_node* rhs, const xpath_context& c, const xpath_stack& stack, const Comp& comp) |
| 7414 | { |
| 7415 | xpath_value_type lt = lhs->rettype(), rt = rhs->rettype(); |
| 7416 | |
| 7417 | if (lt != xpath_type_node_set && rt != xpath_type_node_set) |
| 7418 | { |
| 7419 | if (lt == xpath_type_boolean || rt == xpath_type_boolean) |
| 7420 | return comp(lhs->eval_boolean(c, stack), rhs->eval_boolean(c, stack)); |
| 7421 | else if (lt == xpath_type_number || rt == xpath_type_number) |
| 7422 | return comp(lhs->eval_number(c, stack), rhs->eval_number(c, stack)); |
| 7423 | else if (lt == xpath_type_string || rt == xpath_type_string) |
| 7424 | { |
| 7425 | xpath_allocator_capture cr(stack.result); |
| 7426 | |
| 7427 | xpath_string ls = lhs->eval_string(c, stack); |
| 7428 | xpath_string rs = rhs->eval_string(c, stack); |
| 7429 | |
| 7430 | return comp(ls, rs); |
| 7431 | } |
| 7432 | } |
| 7433 | else if (lt == xpath_type_node_set && rt == xpath_type_node_set) |
| 7434 | { |
| 7435 | xpath_allocator_capture cr(stack.result); |
| 7436 | |
| 7437 | xpath_node_set_raw ls = lhs->eval_node_set(c, stack); |
| 7438 | xpath_node_set_raw rs = rhs->eval_node_set(c, stack); |
| 7439 | |
| 7440 | for (const xpath_node* li = ls.begin(); li != ls.end(); ++li) |
| 7441 | for (const xpath_node* ri = rs.begin(); ri != rs.end(); ++ri) |
| 7442 | { |
| 7443 | xpath_allocator_capture cri(stack.result); |
| 7444 | |
| 7445 | if (comp(string_value(*li, stack.result), string_value(*ri, stack.result))) |
| 7446 | return true; |
| 7447 | } |
| 7448 | |
| 7449 | return false; |
| 7450 | } |
| 7451 | else |
| 7452 | { |
| 7453 | if (lt == xpath_type_node_set) |
| 7454 | { |
| 7455 | swap(lhs, rhs); |
| 7456 | swap(lt, rt); |
| 7457 | } |
| 7458 | |
| 7459 | if (lt == xpath_type_boolean) |
| 7460 | return comp(lhs->eval_boolean(c, stack), rhs->eval_boolean(c, stack)); |
| 7461 | else if (lt == xpath_type_number) |
| 7462 | { |
| 7463 | xpath_allocator_capture cr(stack.result); |
| 7464 | |
| 7465 | double l = lhs->eval_number(c, stack); |
| 7466 | xpath_node_set_raw rs = rhs->eval_node_set(c, stack); |
| 7467 | |
| 7468 | for (const xpath_node* ri = rs.begin(); ri != rs.end(); ++ri) |
| 7469 | { |
| 7470 | xpath_allocator_capture cri(stack.result); |
nothing calls this directly
no test coverage detected