1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

libexpr: Use context getter

This commit is contained in:
Sergei Zimmerman 2025-06-10 13:22:20 +00:00
parent c2aaa68c2c
commit 77f5f50ec2
No known key found for this signature in database
GPG key ID: A9B0B557CA632325

View file

@ -126,7 +126,7 @@ std::string showType(const Value & v)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum" #pragma GCC diagnostic ignored "-Wswitch-enum"
switch (v.internalType) { switch (v.internalType) {
case tString: return v.payload.string.context ? "a string with context" : "a string"; case tString: return v.context() ? "a string with context" : "a string";
case tPrimOp: case tPrimOp:
return fmt("the built-in function '%s'", std::string(v.primOp()->name)); return fmt("the built-in function '%s'", std::string(v.primOp()->name));
case tPrimOpApp: case tPrimOpApp:
@ -2297,8 +2297,8 @@ std::string_view EvalState::forceString(Value & v, const PosIdx pos, std::string
void copyContext(const Value & v, NixStringContext & context, const ExperimentalFeatureSettings & xpSettings) void copyContext(const Value & v, NixStringContext & context, const ExperimentalFeatureSettings & xpSettings)
{ {
if (v.payload.string.context) if (v.context())
for (const char * * p = v.payload.string.context; *p; ++p) for (const char * * p = v.context(); *p; ++p)
context.insert(NixStringContextElem::parse(*p, xpSettings)); context.insert(NixStringContextElem::parse(*p, xpSettings));
} }