aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/attr-path.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-21 20:39:10 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-21 20:39:10 +0000
commit8313f0e939a99b1f715695c0e798cfb368dfc1f2 (patch)
tree11267fbf06412c79395a6d05ec77872bc5e0761f /src/libexpr/attr-path.cc
parent18493fd9c48676ab26854739db67ac5d76ff9347 (diff)
parent984e521392b3f41f7cdab203e5c00f3e00e27a28 (diff)
Merge remote-tracking branch 'upstream/master' into derivation-header-include-order
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)
{