| 6789 | xpath_ast_node& operator=(const xpath_ast_node&); |
| 6790 | |
| 6791 | 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) |
| 6792 | { |
| 6793 | xpath_value_type lt = lhs->rettype(), rt = rhs->rettype(); |
| 6794 | |
| 6795 | if (lt != xpath_type_node_set && rt != xpath_type_node_set) |
| 6796 | { |
| 6797 | if (lt == xpath_type_boolean || rt == xpath_type_boolean) |
| 6798 | return comp(lhs->eval_boolean(c, stack), rhs->eval_boolean(c, stack)); |
| 6799 | else if (lt == xpath_type_number || rt == xpath_type_number) |
| 6800 | return comp(lhs->eval_number(c, stack), rhs->eval_number(c, stack)); |
| 6801 | else if (lt == xpath_type_string || rt == xpath_type_string) |
| 6802 | { |
| 6803 | xpath_allocator_capture cr(stack.result); |
| 6804 | |
| 6805 | xpath_string ls = lhs->eval_string(c, stack); |
| 6806 | xpath_string rs = rhs->eval_string(c, stack); |
| 6807 | |
| 6808 | return comp(ls, rs); |
| 6809 | } |
| 6810 | } |
| 6811 | else if (lt == xpath_type_node_set && rt == xpath_type_node_set) |
| 6812 | { |
| 6813 | xpath_allocator_capture cr(stack.result); |
| 6814 | |
| 6815 | xpath_node_set_raw ls = lhs->eval_node_set(c, stack); |
| 6816 | xpath_node_set_raw rs = rhs->eval_node_set(c, stack); |
| 6817 | |
| 6818 | for (const xpath_node* li = ls.begin(); li != ls.end(); ++li) |
| 6819 | for (const xpath_node* ri = rs.begin(); ri != rs.end(); ++ri) |
| 6820 | { |
| 6821 | xpath_allocator_capture cri(stack.result); |
| 6822 | |
| 6823 | if (comp(string_value(*li, stack.result), string_value(*ri, stack.result))) |
| 6824 | return true; |
| 6825 | } |
| 6826 | |
| 6827 | return false; |
| 6828 | } |
| 6829 | else |
| 6830 | { |
| 6831 | if (lt == xpath_type_node_set) |
| 6832 | { |
| 6833 | swap(lhs, rhs); |
| 6834 | swap(lt, rt); |
| 6835 | } |
| 6836 | |
| 6837 | if (lt == xpath_type_boolean) |
| 6838 | return comp(lhs->eval_boolean(c, stack), rhs->eval_boolean(c, stack)); |
| 6839 | else if (lt == xpath_type_number) |
| 6840 | { |
| 6841 | xpath_allocator_capture cr(stack.result); |
| 6842 | |
| 6843 | double l = lhs->eval_number(c, stack); |
| 6844 | xpath_node_set_raw rs = rhs->eval_node_set(c, stack); |
| 6845 | |
| 6846 | for (const xpath_node* ri = rs.begin(); ri != rs.end(); ++ri) |
| 6847 | { |
| 6848 | xpath_allocator_capture cri(stack.result); |
nothing calls this directly
no test coverage detected