diff options
author | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2022-04-29 00:12:25 +0200 |
---|---|---|
committer | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2022-04-29 00:12:25 +0200 |
commit | e93b59fbc5ada40e77d6f2b2a8bbd8e482418d6a (patch) | |
tree | f9436753bba299d648a6721845a9465b34a50062 /src/libexpr/primops/fetchMercurial.cc | |
parent | f6baa4d18845297f3f7fc2434b7ade93a45718e7 (diff) | |
parent | 35393dc2c65765acb6cc99d6a976eab62c28a51d (diff) |
Merge remote-tracking branch 'origin/master' into coerce-string
Diffstat (limited to 'src/libexpr/primops/fetchMercurial.cc')
-rw-r--r-- | src/libexpr/primops/fetchMercurial.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libexpr/primops/fetchMercurial.cc b/src/libexpr/primops/fetchMercurial.cc index 00c7e6b1d..c9c93bdba 100644 --- a/src/libexpr/primops/fetchMercurial.cc +++ b/src/libexpr/primops/fetchMercurial.cc @@ -7,7 +7,7 @@ namespace nix { -static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * args, Value & v) +static void prim_fetchMercurial(EvalState & state, const PosIdx pos, Value * * args, Value & v) { std::string url; std::optional<Hash> rev; @@ -20,31 +20,31 @@ static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * ar if (args[0]->type() == nAttrs) { for (auto & attr : *args[0]->attrs) { - std::string_view n(attr.name); + std::string_view n(state.symbols[attr.name]); if (n == "url") - url = state.coerceToString(*attr.pos, *attr.value, context, false, false, "while evaluating the `url` attribute passed to builtins.fetchMercurial").toOwned(); + url = state.coerceToString(attr.pos, *attr.value, context, false, false, "while evaluating the `url` attribute passed to builtins.fetchMercurial").toOwned(); else if (n == "rev") { // Ugly: unlike fetchGit, here the "rev" attribute can // be both a revision or a branch/tag name. - auto value = state.forceStringNoCtx(*attr.value, *attr.pos, "while evaluating the `rev` attribute passed to builtins.fetchMercurial"); + auto value = state.forceStringNoCtx(*attr.value, attr.pos, "while evaluating the `rev` attribute passed to builtins.fetchMercurial"); if (std::regex_match(value.begin(), value.end(), revRegex)) rev = Hash::parseAny(value, htSHA1); else ref = value; } else if (n == "name") - name = state.forceStringNoCtx(*attr.value, *attr.pos, "while evaluating the `name` attribute passed to builtins.fetchMercurial"); + name = state.forceStringNoCtx(*attr.value, attr.pos, "while evaluating the `name` attribute passed to builtins.fetchMercurial"); else throw EvalError({ - .msg = hintfmt("unsupported argument '%s' to 'fetchMercurial'", attr.name), - .errPos = *attr.pos + .msg = hintfmt("unsupported argument '%s' to 'fetchMercurial'", state.symbols[attr.name]), + .errPos = state.positions[attr.pos] }); } if (url.empty()) throw EvalError({ .msg = hintfmt("'url' argument required"), - .errPos = pos + .errPos = state.positions[pos] }); } else |