diff options
Diffstat (limited to 'src/libexpr/attr-path.cc')
-rw-r--r-- | src/libexpr/attr-path.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc index fdd61a5fd375..55379f94b189 100644 --- a/src/libexpr/attr-path.cc +++ b/src/libexpr/attr-path.cc @@ -42,11 +42,10 @@ Value * findAlongAttrPath(EvalState & state, const string & attrPath, Value * v = &vIn; - foreach (Strings::iterator, i, tokens) { + for (auto & attr : tokens) { - /* Is *i an index (integer) or a normal attribute name? */ + /* Is i an index (integer) or a normal attribute name? */ enum { apAttr, apIndex } apType = apAttr; - string attr = *i; unsigned int attrIndex; if (string2Int(attr, attrIndex)) apType = apIndex; @@ -77,15 +76,15 @@ Value * findAlongAttrPath(EvalState & state, const string & attrPath, else if (apType == apIndex) { - if (v->type != tList) + if (!v->isList()) throw TypeError( format("the expression selected by the selection path ‘%1%’ should be a list but is %2%") % attrPath % showType(*v)); - if (attrIndex >= v->list.length) + if (attrIndex >= v->listSize()) throw Error(format("list index %1% in selection path ‘%2%’ is out of range") % attrIndex % attrPath); - v = v->list.elems[attrIndex]; + v = v->listElems()[attrIndex]; } } |