refactor(3p/nix/libexpr): Use absl::btree_map::iterator type
Instead of using a custom Args* iterator, use the one belonging to the map type directly.
This commit is contained in:
parent
ee4637e3a2
commit
42205f27fc
3 changed files with 11 additions and 5 deletions
2
third_party/nix/src/libexpr/attr-path.cc
vendored
2
third_party/nix/src/libexpr/attr-path.cc
vendored
|
@ -81,7 +81,7 @@ Value* findAlongAttrPath(EvalState& state, const std::string& attrPath,
|
||||||
format("attribute '%1%' in selection path '%2%' not found") % attr %
|
format("attribute '%1%' in selection path '%2%' not found") % attr %
|
||||||
attrPath);
|
attrPath);
|
||||||
}
|
}
|
||||||
v = &*a->value;
|
v = &*(a->second).value;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (apType == apIndex) {
|
else if (apType == apIndex) {
|
||||||
|
|
11
third_party/nix/src/libexpr/attr-set.cc
vendored
11
third_party/nix/src/libexpr/attr-set.cc
vendored
|
@ -31,12 +31,17 @@ std::vector<const Attr*> Bindings::lexicographicOrder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bindings::iterator Bindings::find(const Symbol& name) {
|
Bindings::iterator Bindings::find(const Symbol& name) {
|
||||||
return &attributes_[name];
|
return attributes_.find(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bindings::iterator Bindings::begin() { return &(attributes_.begin()->second); }
|
Bindings::iterator Bindings::begin() {
|
||||||
|
return attributes_.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
Bindings::iterator Bindings::end() {
|
||||||
|
return attributes_.end();
|
||||||
|
}
|
||||||
|
|
||||||
Bindings::iterator Bindings::end() { return &(attributes_.end()->second); }
|
|
||||||
void Bindings::merge(Bindings* other) {
|
void Bindings::merge(Bindings* other) {
|
||||||
// We want the values from the other attribute set to take
|
// We want the values from the other attribute set to take
|
||||||
// precedence, but .merge() works the other way around.
|
// precedence, but .merge() works the other way around.
|
||||||
|
|
3
third_party/nix/src/libexpr/attr-set.hh
vendored
3
third_party/nix/src/libexpr/attr-set.hh
vendored
|
@ -31,7 +31,7 @@ inline bool operator==(const Attr& lhs, const Attr& rhs) {
|
||||||
|
|
||||||
class Bindings {
|
class Bindings {
|
||||||
public:
|
public:
|
||||||
typedef Attr* iterator; // TODO: type, and also 'using'?
|
typedef absl::btree_map<Symbol, Attr>::iterator iterator;
|
||||||
|
|
||||||
// Return the number of contained elements.
|
// Return the number of contained elements.
|
||||||
size_t size();
|
size_t size();
|
||||||
|
@ -71,4 +71,5 @@ class Bindings {
|
||||||
private:
|
private:
|
||||||
absl::btree_map<Symbol, Attr> attributes_;
|
absl::btree_map<Symbol, Attr> attributes_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
Loading…
Reference in a new issue