mirror of
https://github.com/NixOS/nix
synced 2024-10-18 00:16:11 -04:00
fromYAML: fix build after merge
This commit is contained in:
parent
1416312e24
commit
12062b6daf
|
@ -127,7 +127,7 @@ static RegisterPrimOp primop_fromYAML({
|
||||||
Custom tags are ignored and a stream with multiple documents is mapped to a list except when the stream contains a single document.
|
Custom tags are ignored and a stream with multiple documents is mapped to a list except when the stream contains a single document.
|
||||||
)",
|
)",
|
||||||
.fun = [] (EvalState & state, const PosIdx pos, Value * * args, Value & val) {
|
.fun = [] (EvalState & state, const PosIdx pos, Value * * args, Value & val) {
|
||||||
auto yaml = state.forceStringNoCtx(*args[0], pos);
|
auto yaml = state.forceStringNoCtx(*args[0], pos, "while evaluating the argument passed to builtins.fromYAML");
|
||||||
|
|
||||||
NixContext context{
|
NixContext context{
|
||||||
.state = state,
|
.state = state,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifdef HAVE_RYML
|
#ifdef HAVE_RYML
|
||||||
|
|
||||||
#include "libexprtests.hh"
|
#include "libexpr.hh"
|
||||||
|
|
||||||
// Ugly, however direct access to the SAX parser is required in order to parse multiple JSON objects from a stream
|
// Ugly, however direct access to the SAX parser is required in order to parse multiple JSON objects from a stream
|
||||||
#include "json-to-value.cc"
|
#include "json-to-value.cc"
|
||||||
|
@ -108,9 +108,9 @@ namespace nix {
|
||||||
if (name == "json") {
|
if (name == "json") {
|
||||||
json = attr->value;
|
json = attr->value;
|
||||||
} else if (name == "yaml") {
|
} else if (name == "yaml") {
|
||||||
yamlRaw = state.forceStringNoCtx(*attr->value);
|
yamlRaw = state.forceStringNoCtx(*attr->value, noPos, "while interpreting the \"yaml\" field as string");
|
||||||
} else if (name == "fail") {
|
} else if (name == "fail") {
|
||||||
fail = state.forceBool(*attr->value, noPos);
|
fail = state.forceBool(*attr->value, noPos, "while interpreting the \"fail\" field as bool");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fail |= !json;
|
fail |= !json;
|
||||||
|
@ -126,7 +126,7 @@ namespace nix {
|
||||||
jsonStr = "null";
|
jsonStr = "null";
|
||||||
jsonVal.mkNull();
|
jsonVal.mkNull();
|
||||||
} else {
|
} else {
|
||||||
jsonStr = state.forceStringNoCtx(*json);
|
jsonStr = state.forceStringNoCtx(*json, noPos, "while interpreting the \"json\" field as string");
|
||||||
}
|
}
|
||||||
if (!(emptyJSON = jsonStr.empty())) {
|
if (!(emptyJSON = jsonStr.empty())) {
|
||||||
if (json->type() != nNull) {
|
if (json->type() != nNull) {
|
||||||
|
|
Loading…
Reference in a new issue