| 611 | } |
| 612 | |
| 613 | NixInt AttrCursor::getInt() |
| 614 | { |
| 615 | if (root->db) { |
| 616 | fetchCachedValue(); |
| 617 | if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) { |
| 618 | if (auto i = std::get_if<int_t>(&cachedValue->second)) { |
| 619 | debug("using cached integer attribute '%s'", getAttrPathStr()); |
| 620 | return i->x; |
| 621 | } else |
| 622 | root->state.error<TypeError>("'%s' is not an integer", getAttrPathStr()).debugThrow(); |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | auto & v = forceValue(); |
| 627 | |
| 628 | if (v.type() != nInt) |
| 629 | root->state.error<TypeError>("'%s' is not an integer", getAttrPathStr()).debugThrow(); |
| 630 | |
| 631 | return v.integer(); |
| 632 | } |
| 633 | |
| 634 | std::vector<std::string> AttrCursor::getListOfStrings() |
| 635 | { |
no test coverage detected