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

Allow open switch-enum in 5 places

This commit is contained in:
Robert Hensing 2023-04-03 18:15:12 +02:00
parent 3dac4c7874
commit 9470ee877d
4 changed files with 21 additions and 0 deletions

View file

@ -239,6 +239,9 @@ std::string_view showType(ValueType type)
std::string showType(const Value & v)
{
// Allow selecting a subset of enum values
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum"
switch (v.internalType) {
case tString: return v.string.context ? "a string with context" : "a string";
case tPrimOp:
@ -252,16 +255,21 @@ std::string showType(const Value & v)
default:
return std::string(showType(v.type()));
}
#pragma GCC diagnostic pop
}
PosIdx Value::determinePos(const PosIdx pos) const
{
// Allow selecting a subset of enum values
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum"
switch (internalType) {
case tAttrs: return attrs->pos;
case tLambda: return lambda.fun->pos;
case tApp: return app.left->determinePos(pos);
default: return pos;
}
#pragma GCC diagnostic pop
}
bool Value::isTrivial() const