MCPcopy Create free account
hub / github.com/NixOS/nix / getInt

Method getInt

src/libexpr/eval-cache.cc:613–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611}
612
613NixInt 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
634std::vector<std::string> AttrCursor::getListOfStrings()
635{

Callers 1

getAttrMethod · 0.45

Calls 3

debugThrowMethod · 0.80
integerMethod · 0.80
typeMethod · 0.45

Tested by

no test coverage detected