| 9768 | } |
| 9769 | |
| 9770 | static void apply_predicate_number_const(xpath_node_set_raw& ns, size_t first, xpath_ast_node* expr, const xpath_stack& stack) |
| 9771 | { |
| 9772 | assert(ns.size() >= first); |
| 9773 | assert(expr->rettype() == xpath_type_number); |
| 9774 | |
| 9775 | size_t size = ns.size() - first; |
| 9776 | |
| 9777 | xpath_node* last = ns.begin() + first; |
| 9778 | |
| 9779 | xpath_context c(xpath_node(), 1, size); |
| 9780 | |
| 9781 | double er = expr->eval_number(c, stack); |
| 9782 | |
| 9783 | if (er >= 1.0 && er <= static_cast<double>(size)) |
| 9784 | { |
| 9785 | size_t eri = static_cast<size_t>(er); |
| 9786 | |
| 9787 | if (er == static_cast<double>(eri)) |
| 9788 | { |
| 9789 | xpath_node r = last[eri - 1]; |
| 9790 | |
| 9791 | *last++ = r; |
| 9792 | } |
| 9793 | } |
| 9794 | |
| 9795 | ns.truncate(last); |
| 9796 | } |
| 9797 | |
| 9798 | void apply_predicate(xpath_node_set_raw& ns, size_t first, const xpath_stack& stack, bool once) |
| 9799 | { |
nothing calls this directly
no test coverage detected