aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/attr-path.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-06-18 13:44:40 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-06-18 14:03:00 +0200
commit2a61bbf77fd1b4bd518912b4923265b91a8f9d67 (patch)
tree86545bc4a6240b3a2c13711966bd83db0c204e19 /src/libexpr/attr-path.cc
parent7083d33efee2b4782c52dc04d90f7c08e96b79d1 (diff)
Some backports from the flakes branch
Diffstat (limited to 'src/libexpr/attr-path.cc')
-rw-r--r--src/libexpr/attr-path.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc
index 8980bc09d..2e2a17b14 100644
--- a/src/libexpr/attr-path.cc
+++ b/src/libexpr/attr-path.cc
@@ -6,11 +6,11 @@
namespace nix {
-static Strings parseAttrPath(const string & s)
+static Strings parseAttrPath(std::string_view s)
{
Strings res;
string cur;
- string::const_iterator i = s.begin();
+ auto i = s.begin();
while (i != s.end()) {
if (*i == '.') {
res.push_back(cur);
@@ -32,6 +32,15 @@ static Strings parseAttrPath(const string & s)
}
+std::vector<Symbol> parseAttrPath(EvalState & state, std::string_view s)
+{
+ std::vector<Symbol> res;
+ for (auto & a : parseAttrPath(s))
+ res.push_back(state.symbols.create(a));
+ return res;
+}
+
+
std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attrPath,
Bindings & autoArgs, Value & vIn)
{