1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 23:12:44 +01:00

Merge remote-tracking branch 'origin/master' into precise-gc

This commit is contained in:
Eelco Dolstra 2020-02-13 17:16:16 +01:00
commit c31b3d6c5c

View file

@ -69,12 +69,12 @@ public:
return end(); return end();
} }
std::optional<Attr *> get(const Symbol & name) Attr * get(const Symbol & name)
{ {
Attr key(name, 0); Attr key(name, 0);
iterator i = std::lower_bound(begin(), end(), key); iterator i = std::lower_bound(begin(), end(), key);
if (i != end() && i->name == name) return &*i; if (i != end() && i->name == name) return &*i;
return {}; return nullptr;
} }
Attr & need(const Symbol & name, const Pos & pos = noPos) Attr & need(const Symbol & name, const Pos & pos = noPos)
@ -82,7 +82,7 @@ public:
auto a = get(name); auto a = get(name);
if (!a) if (!a)
throw Error("attribute '%s' missing, at %s", name, pos); throw Error("attribute '%s' missing, at %s", name, pos);
return **a; return *a;
} }
iterator begin() { return &attrs[0]; } iterator begin() { return &attrs[0]; }