@@ -1341,21 +1341,21 @@ void ExprVar::eval(EvalState & state, Env & env, Value & v)
13411341 v = *v2;
13421342}
13431343
1344- static std::string showAttrPath (EvalState & state, Env & env, const AttrPath & attrPath)
1344+ static std::string showAttrPath (EvalState & state, Env & env, AttrName * attrPath, size_t nAttrPath )
13451345{
13461346 std::ostringstream out;
13471347 bool first = true ;
1348- for (auto & i : attrPath ) {
1348+ for (size_t i = 0 ; i < nAttrPath; i++ ) {
13491349 if (!first)
13501350 out << ' .' ;
13511351 else
13521352 first = false ;
13531353 try {
1354- out << state.symbols [getName (i , state, env)];
1354+ out << state.symbols [getName (attrPath[i] , state, env)];
13551355 } catch (Error & e) {
1356- assert (!i .symbol );
1356+ assert (!attrPath[i] .symbol );
13571357 out << " \" ${" ;
1358- i .expr ->show (state.symbols , out);
1358+ attrPath[i] .expr ->show (state.symbols , out);
13591359 out << " }\" " ;
13601360 }
13611361 }
@@ -1377,13 +1377,13 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
13771377 env,
13781378 getPos (),
13791379 " while evaluating the attribute '%1%'" ,
1380- showAttrPath (state, env, attrPath))
1380+ showAttrPath (state, env, attrPath, nAttrPath ))
13811381 : nullptr ;
13821382
1383- for (auto & i : attrPath ) {
1383+ for (size_t i = 0 ; i < nAttrPath; i++ ) {
13841384 state.nrLookups ++;
13851385 const Attr * j;
1386- auto name = getName (i , state, env);
1386+ auto name = getName (attrPath[i] , state, env);
13871387 if (def) {
13881388 state.forceValue (*vAttrs, pos);
13891389 if (vAttrs->type () != nAttrs || !(j = vAttrs->attrs ()->get (name))) {
@@ -1418,7 +1418,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
14181418 auto origin = std::get_if<SourcePath>(&pos2r.origin );
14191419 if (!(origin && *origin == state.derivationInternal ))
14201420 state.addErrorTrace (
1421- e, pos2, " while evaluating the attribute '%1%'" , showAttrPath (state, env, attrPath));
1421+ e, pos2, " while evaluating the attribute '%1%'" , showAttrPath (state, env, attrPath, nAttrPath ));
14221422 }
14231423 throw ;
14241424 }
@@ -1429,14 +1429,14 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
14291429Symbol ExprSelect::evalExceptFinalSelect (EvalState & state, Env & env, Value & attrs)
14301430{
14311431 Value vTmp;
1432- Symbol name = getName (attrPath[attrPath. size () - 1 ], state, env);
1432+ Symbol name = getName (attrPath[nAttrPath - 1 ], state, env);
14331433
1434- if (attrPath. size () == 1 ) {
1434+ if (nAttrPath == 1 ) {
14351435 e->eval (state, env, vTmp);
14361436 } else {
1437- ExprSelect init (* this ) ;
1438- init. attrPath . pop_back ( );
1439- init. eval (state, env, vTmp) ;
1437+ nAttrPath-- ;
1438+ eval (state, env, vTmp );
1439+ nAttrPath++ ;
14401440 }
14411441 attrs = vTmp;
14421442 return name;
0 commit comments