@@ -1228,13 +1228,13 @@ DerivationOutput DerivationOutput::fromJSON(
12281228 keys.insert (key);
12291229
12301230 auto methodAlgo = [&]() -> std::pair<ContentAddressMethod, HashAlgorithm> {
1231- auto & method_ = getString ( valueAt (json, " method " ));
1232- ContentAddressMethod method = ContentAddressMethod::parse (method_ );
1231+ ContentAddressMethod method = ContentAddressMethod::parse (
1232+ getString ( valueAt (json, " method " )) );
12331233 if (method == ContentAddressMethod::Raw::Text)
12341234 xpSettings.require (Xp::DynamicDerivations);
12351235
1236- auto & hashAlgo_ = getString ( valueAt (json, " hashAlgo " ));
1237- auto hashAlgo = parseHashAlgo (hashAlgo_ );
1236+ auto hashAlgo = parseHashAlgo (
1237+ getString ( valueAt (json, " hashAlgo " )) );
12381238 return { std::move (method), std::move (hashAlgo) };
12391239 };
12401240
@@ -1351,7 +1351,8 @@ Derivation Derivation::fromJSON(
13511351 res.name = getString (valueAt (json, " name" ));
13521352
13531353 try {
1354- for (auto & [outputName, output] : getObject (valueAt (json, " outputs" ))) {
1354+ auto outputs = getObject (valueAt (json, " outputs" ));
1355+ for (auto & [outputName, output] : outputs) {
13551356 res.outputs .insert_or_assign (
13561357 outputName,
13571358 DerivationOutput::fromJSON (store, res.name , outputName, output));
@@ -1362,7 +1363,8 @@ Derivation Derivation::fromJSON(
13621363 }
13631364
13641365 try {
1365- for (auto & input : getArray (valueAt (json, " inputSrcs" )))
1366+ auto inputSrcs = getArray (valueAt (json, " inputSrcs" ));
1367+ for (auto & input : inputSrcs)
13661368 res.inputSrcs .insert (store.parseStorePath (static_cast <const std::string &>(input)));
13671369 } catch (Error & e) {
13681370 e.addTrace ({}, " while reading key 'inputSrcs'" );
@@ -1375,13 +1377,15 @@ Derivation Derivation::fromJSON(
13751377 auto & json = getObject (_json);
13761378 DerivedPathMap<StringSet>::ChildNode node;
13771379 node.value = getStringSet (valueAt (json, " outputs" ));
1378- for (auto & [outputId, childNode] : getObject (valueAt (json, " dynamicOutputs" ))) {
1380+ auto drvs = getObject (valueAt (json, " dynamicOutputs" ));
1381+ for (auto & [outputId, childNode] : drvs) {
13791382 xpSettings.require (Xp::DynamicDerivations);
13801383 node.childMap [outputId] = doInput (childNode);
13811384 }
13821385 return node;
13831386 };
1384- for (auto & [inputDrvPath, inputOutputs] : getObject (valueAt (json, " inputDrvs" )))
1387+ auto drvs = getObject (valueAt (json, " inputDrvs" ));
1388+ for (auto & [inputDrvPath, inputOutputs] : drvs)
13851389 res.inputDrvs .map [store.parseStorePath (inputDrvPath)] =
13861390 doInput (inputOutputs);
13871391 } catch (Error & e) {
0 commit comments