mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
Merge pull request #13345 from xokdvium/use-value-getters
libexpr: Use value getters (NFC)
This commit is contained in:
commit
b3c1b70c19
2 changed files with 6 additions and 6 deletions
|
@ -126,9 +126,9 @@ 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.payload.primOp->name));
|
return fmt("the built-in function '%s'", std::string(v.primOp()->name));
|
||||||
case tPrimOpApp:
|
case tPrimOpApp:
|
||||||
return fmt("the partially applied built-in function '%s'", v.primOpAppPrimOp()->name);
|
return fmt("the partially applied built-in function '%s'", v.primOpAppPrimOp()->name);
|
||||||
case tExternal: return v.external()->showType();
|
case tExternal: return v.external()->showType();
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class SymbolValue : protected Value
|
||||||
public:
|
public:
|
||||||
operator std::string_view() const noexcept
|
operator std::string_view() const noexcept
|
||||||
{
|
{
|
||||||
return {payload.string.c_str, size_};
|
return {c_str(), size_};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
[[gnu::always_inline]]
|
[[gnu::always_inline]]
|
||||||
const char * c_str() const noexcept
|
const char * c_str() const noexcept
|
||||||
{
|
{
|
||||||
return s->payload.string.c_str;
|
return s->c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[gnu::always_inline]]
|
[[gnu::always_inline]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue