aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval-cache.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-05-25 12:32:22 +0200
committerEelco Dolstra <edolstra@gmail.com>2022-05-25 12:32:22 +0200
commit91b7d5373acdc5d9b3f2c13d16b9850ab5fc9e9d (patch)
treef807d49aefb53b7864109a9a1dc3780840872e53 /src/libexpr/eval-cache.cc
parentba035f7dd03232d093a1265778b9587bab92cf1d (diff)
Style tweaks
Diffstat (limited to 'src/libexpr/eval-cache.cc')
-rw-r--r--src/libexpr/eval-cache.cc40
1 files changed, 8 insertions, 32 deletions
diff --git a/src/libexpr/eval-cache.cc b/src/libexpr/eval-cache.cc
index af213a484..1be98fc95 100644
--- a/src/libexpr/eval-cache.cc
+++ b/src/libexpr/eval-cache.cc
@@ -554,20 +554,14 @@ std::string AttrCursor::getString()
debug("using cached string attribute '%s'", getAttrPathStr());
return s->first;
} else
- {
- auto e = TypeError("'%s' is not a string", getAttrPathStr());
- root->state.debugThrowLastTrace(e);
- }
+ root->state.debugThrowLastTrace(TypeError("'%s' is not a string", getAttrPathStr()));
}
}
auto & v = forceValue();
if (v.type() != nString && v.type() != nPath)
- {
- auto e = TypeError("'%s' is not a string but %s", getAttrPathStr(), showType(v.type()));
- root->state.debugThrowLastTrace(e);
- }
+ root->state.debugThrowLastTrace(TypeError("'%s' is not a string but %s", getAttrPathStr(), showType(v.type())));
return v.type() == nString ? v.string.s : v.path;
}
@@ -591,10 +585,7 @@ string_t AttrCursor::getStringWithContext()
return *s;
}
} else
- {
- auto e = TypeError("'%s' is not a string", getAttrPathStr());
- root->state.debugThrowLastTrace(e);
- }
+ root->state.debugThrowLastTrace(TypeError("'%s' is not a string", getAttrPathStr()));
}
}
@@ -605,10 +596,7 @@ string_t AttrCursor::getStringWithContext()
else if (v.type() == nPath)
return {v.path, {}};
else
- {
- auto e = TypeError("'%s' is not a string but %s", getAttrPathStr(), showType(v.type()));
- root->state.debugThrowLastTrace(e);
- }
+ root->state.debugThrowLastTrace(TypeError("'%s' is not a string but %s", getAttrPathStr(), showType(v.type())));
}
bool AttrCursor::getBool()
@@ -621,20 +609,14 @@ bool AttrCursor::getBool()
debug("using cached Boolean attribute '%s'", getAttrPathStr());
return *b;
} else
- {
- auto e = TypeError("'%s' is not a Boolean", getAttrPathStr());
- root->state.debugThrowLastTrace(e);
- }
+ root->state.debugThrowLastTrace(TypeError("'%s' is not a Boolean", getAttrPathStr()));
}
}
auto & v = forceValue();
if (v.type() != nBool)
- {
- auto e = TypeError("'%s' is not a Boolean", getAttrPathStr());
- root->state.debugThrowLastTrace(e);
- }
+ root->state.debugThrowLastTrace(TypeError("'%s' is not a Boolean", getAttrPathStr()));
return v.boolean;
}
@@ -682,20 +664,14 @@ std::vector<Symbol> AttrCursor::getAttrs()
debug("using cached attrset attribute '%s'", getAttrPathStr());
return *attrs;
} else
- {
- auto e = TypeError("'%s' is not an attribute set", getAttrPathStr());
- root->state.debugThrowLastTrace(e);
- }
+ root->state.debugThrowLastTrace(TypeError("'%s' is not an attribute set", getAttrPathStr()));
}
}
auto & v = forceValue();
if (v.type() != nAttrs)
- {
- auto e = TypeError("'%s' is not an attribute set", getAttrPathStr());
- root->state.debugThrowLastTrace(e);
- }
+ root->state.debugThrowLastTrace(TypeError("'%s' is not an attribute set", getAttrPathStr()));
std::vector<Symbol> attrs;
for (auto & attr : *getValue().attrs)