about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/nixexpr.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T17·01+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T17·01+0100
commit09cbc431cca08be891e5e792ceda2a34956b2fc8 (patch)
tree3653448c7e074bdfd10dfa3bc3b5dfe952299fdf /third_party/nix/src/libexpr/nixexpr.cc
parentb490742a511dd03afc43f5143d6d61edaeeb8091 (diff)
fix(3p/nix): Fix incorrectly braced conditionals and loops r/768
Fixes mistakes introduced by clang-tidy in the previous commit.
Diffstat (limited to 'third_party/nix/src/libexpr/nixexpr.cc')
-rw-r--r--third_party/nix/src/libexpr/nixexpr.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/third_party/nix/src/libexpr/nixexpr.cc b/third_party/nix/src/libexpr/nixexpr.cc
index 85e80361e3ab..9c25530efdba 100644
--- a/third_party/nix/src/libexpr/nixexpr.cc
+++ b/third_party/nix/src/libexpr/nixexpr.cc
@@ -256,16 +256,20 @@ void ExprAttrs::bindVars(const StaticEnv& env) {
     dynamicEnv = &newEnv;
 
     unsigned int displ = 0;
-    for (auto& i : attrs) newEnv.vars[i.first] = i.second.displ = displ++;
+    for (auto& i : attrs) {
+      newEnv.vars[i.first] = i.second.displ = displ++;
+    }
 
-    for (auto& i : attrs)
+    for (auto& i : attrs) {
       i.second.e->bindVars(i.second.inherited ? env : newEnv);
+    }
   }
 
   else {
-    for
+    for (auto& i : attrs) {
+      i.second.e->bindVars(env);
+    }
   }
-  (auto& i : attrs) i.second.e->bindVars(env);
 
   for (auto& i : dynamicAttrs) {
     i.nameExpr->bindVars(*dynamicEnv);
@@ -282,10 +286,14 @@ void ExprLambda::bindVars(const StaticEnv& env) {
 
   unsigned int displ = 0;
 
-  if (!arg.empty()) newEnv.vars[arg] = displ++;
+  if (!arg.empty()) {
+    newEnv.vars[arg] = displ++;
+  }
 
   if (matchAttrs) {
-    for (auto& i : formals->formals) newEnv.vars[i.name] = displ++;
+    for (auto& i : formals->formals) {
+      newEnv.vars[i.name] = displ++;
+    }
 
     for (auto& i : formals->formals)
       if (i.def) i.def->bindVars(newEnv);